Unverified Commit f9028dcd authored by Peter Geis's avatar Peter Geis Committed by Mark Brown
Browse files

regulator: fan53555: only bind tcs4525 to correct chip id



The tcs4525 regulator has a chip id of <12>.
Only allow the driver to bind to the correct chip id for safety, in
accordance with the other supported devices.

Signed-off-by: default avatarPeter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20210511211335.2935163-3-pgwipeout@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d4db69eb
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ enum {
	FAN53555_CHIP_ID_08 = 8,
};

enum {
	TCS4525_CHIP_ID_12 = 12,
};

/* IC mask revision */
enum {
	FAN53555_CHIP_REV_00 = 0x3,
@@ -368,6 +372,8 @@ static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di)

static int fan53555_voltages_setup_tcs(struct fan53555_device_info *di)
{
	switch (di->chip_id) {
	case TCS4525_CHIP_ID_12:
		di->slew_reg = TCS4525_TIME;
		di->slew_mask = TCS_SLEW_MASK;
		di->slew_shift = TCS_SLEW_MASK;
@@ -376,6 +382,11 @@ static int fan53555_voltages_setup_tcs(struct fan53555_device_info *di)
		di->vsel_min = 600000;
		di->vsel_step = 6250;
		di->vsel_count = FAN53526_NVOLTAGES;
		break;
	default:
		dev_err(di->dev, "Chip ID %d not supported!\n", di->chip_id);
		return -EINVAL;
	}

	return 0;
}