mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>, myungjoo.ham@samsung.com
Cc: linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH] extcon: arizona: Disable mic detect if running when driver is removed
Date: Fri, 12 Apr 2019 09:38:12 +0900	[thread overview]
Message-ID: <22018fcb-ac96-8cc4-c432-770962b37ef4@samsung.com> (raw)
In-Reply-To: <20190404163356.17773-1-ckeepax@opensource.cirrus.com>

Hi Charles,

On 19. 4. 5. 오전 1:33, Charles Keepax wrote:
> 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 <ckeepax@opensource.cirrus.com>
> ---
>  drivers/extcon/extcon-arizona.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index da0e9bc4262fa..9327479c719c2 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -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);
>  
> 

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.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

      reply	other threads:[~2019-04-12  0:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190404163407epcas1p2a59f81b2486e552d35b8a900dffa53b5@epcas1p2.samsung.com>
2019-04-04 16:33 ` Charles Keepax
2019-04-12  0:38   ` Chanwoo Choi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22018fcb-ac96-8cc4-c432-770962b37ef4@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®