regulator: mt6358: Fail probe on unknown chip ID
authorChen-Yu Tsai <wenst@chromium.org>
Wed, 13 Sep 2023 08:29:16 +0000 (16:29 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 25 Sep 2023 12:19:48 +0000 (14:19 +0200)
commit7442edec72bc657e6ce38ae01de9f10e55decfaa
tree3dc9e8a3f0a3a93ef6c4c080f4c6cfd30b161f1e
parent6465e260f48790807eef06b583b38ca9789b6072
regulator: mt6358: Fail probe on unknown chip ID

The MT6358 and MT6366 PMICs, and likely many others from MediaTek, have
a chip ID register, making the chip semi-discoverable.

The driver currently supports two PMICs and expects to be probed on one
or the other. It does not account for incorrect mfd driver entries or
device trees. While these should not happen, if they do, it could be
catastrophic for the device. The driver should be sure the hardware is
what it expects.

Make the driver fail to probe if the chip ID presented is not a known
one.

Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Fixes: f0e3c6261af1 ("regulator: mt6366: Add support for MT6366 regulator")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230913082919.1631287-2-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/mt6358-regulator.c