Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: adp5585: Enable oscillator during probe

Make sure to enable the oscillator in the top device. This will allow to
not control this in the child PWM device as that would not work with
future support for keyboard matrix where the oscillator needs to be
always enabled (and so cannot be disabled by disabling PWM).

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Uwe Kleine-König <ukleinek@kernel.org>
Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-3-b1fcfe9e9826@analog.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Nuno Sá and committed by
Lee Jones
e5517601 175f1990

+19 -5
+19
drivers/mfd/adp5585.c
··· 137 137 return 0; 138 138 } 139 139 140 + static void adp5585_osc_disable(void *data) 141 + { 142 + const struct adp5585_dev *adp5585 = data; 143 + 144 + regmap_write(adp5585->regmap, ADP5585_GENERAL_CFG, 0); 145 + } 146 + 140 147 static int adp5585_i2c_probe(struct i2c_client *i2c) 141 148 { 142 149 const struct regmap_config *regmap_config; ··· 171 164 if ((id & ADP5585_MAN_ID_MASK) != ADP5585_MAN_ID_VALUE) 172 165 return dev_err_probe(&i2c->dev, -ENODEV, 173 166 "Invalid device ID 0x%02x\n", id); 167 + 168 + /* 169 + * Enable the internal oscillator, as it's shared between multiple 170 + * functions. 171 + */ 172 + ret = regmap_set_bits(adp5585->regmap, ADP5585_GENERAL_CFG, ADP5585_OSC_EN); 173 + if (ret) 174 + return ret; 175 + 176 + ret = devm_add_action_or_reset(&i2c->dev, adp5585_osc_disable, adp5585); 177 + if (ret) 178 + return ret; 174 179 175 180 return adp5585_add_devices(&i2c->dev); 176 181 }
-5
drivers/pwm/pwm-adp5585.c
··· 63 63 int ret; 64 64 65 65 if (!state->enabled) { 66 - regmap_clear_bits(regmap, ADP5585_GENERAL_CFG, ADP5585_OSC_EN); 67 66 regmap_clear_bits(regmap, ADP5585_PWM_CFG, ADP5585_PWM_EN); 68 67 return 0; 69 68 } ··· 97 98 ret = regmap_update_bits(regmap, ADP5585_PWM_CFG, 98 99 ADP5585_PWM_IN_AND | ADP5585_PWM_MODE | 99 100 ADP5585_PWM_EN, ADP5585_PWM_EN); 100 - if (ret) 101 - return ret; 102 - 103 - ret = regmap_set_bits(regmap, ADP5585_GENERAL_CFG, ADP5585_OSC_EN); 104 101 if (ret) 105 102 return ret; 106 103