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

extcon: intel-mrfld: Sync hardware and software state on init

extcon driver for Basin Cove PMIC shadows the switch status used for dwc3
DRD to detect a change in the switch position. This change initializes the
status at probe time.

Cc: stable@vger.kernel.org
Fixes: 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Ferry Toth and committed by
Chanwoo Choi
ecb5bdff 009c9aa5

+9
+9
drivers/extcon/extcon-intel-mrfld.c
··· 197 197 struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent); 198 198 struct regmap *regmap = pmic->regmap; 199 199 struct mrfld_extcon_data *data; 200 + unsigned int status; 200 201 unsigned int id; 201 202 int irq, ret; 202 203 ··· 244 243 245 244 /* Get initial state */ 246 245 mrfld_extcon_role_detect(data); 246 + 247 + /* 248 + * Cached status value is used for cable detection, see comments 249 + * in mrfld_extcon_cable_detect(), we need to sync cached value 250 + * with a real state of the hardware. 251 + */ 252 + regmap_read(regmap, BCOVE_SCHGRIRQ1, &status); 253 + data->status = status; 247 254 248 255 mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR); 249 256 mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);