extcon: arizona: Disable mic detect if running when driver is removed
PATCH 1/1 extcon: arizona: Disable mic detect if running when driver is removed
Microphone detection provides the button detection features on the Arizona CODECs as such it will be running if the jack is currently inserted. If the driver is unbound whilst the jack is still inserted this will cause warnings from the regulator framework as the MICVDD regulator is put but was never disabled.
Correct this by disabling microphone detection on driver removal and if the microphone detection was running disable the regulator and put the runtime reference that was currently held.
--- drivers/extcon/extcon-arizona.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/extcon/extcon-arizona.c +10 -0
@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev)struct arizona_extcon_info *info =platform_get_drvdata (pdev);struct arizona *arizona = info->arizona;int jack_irq_rise, jack_irq_fall; +bool change; + +regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , +ARIZONA_MICD_ENA ,0 , + &change); + +if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + }gpiod_put (info->micd_pol_gpio);
Signature · 1 line
2.11.0
Chanwoo Choi
maintainerHi Charles,
Quoted 26 lines · Charles Keepax
Microphone detection provides the button detection features on the Arizona CODECs as such it will be running if the jack is currently inserted. If the driver is unbound whilst the jack is still inserted this will cause warnings from the regulator framework as the MICVDD regulator is put but was never disabled.
Correct this by disabling microphone detection on driver removal and if the microphone detection was running disable the regulator and put the runtime reference that was currently held.
Signed-off-by Charles Keepax <[email protected]>--- drivers/extcon/extcon-arizona.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/extcon/extcon-arizona.c +3
-0@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev)struct arizona_extcon_info *info =platform_get_drvdata (pdev);struct arizona *arizona = info->arizona;int jack_irq_rise, jack_irq_fall; +bool change; + + regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
drivers/extcon/extcon-arizona.c static int arizona_extcon_remove(struct platform_device *pdev) · line 1741
Quoted 10 lines
drivers/extcon/extcon-arizona.c +7
-0+ARIZONA_MICD_ENA ,0 , + &change); + +if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + }>gpiod_put (info->micd_pol_gpio);
Applied it.
IMO, I think that this driver have to handle the exception handling when regmap_update_bits_check() returns error or 'change' value is not changed. This driver have same issue about exception handling on multiple places. Please take it on separate patche.
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics