mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chanwoo Choi <cwchoi00@gmail.com>
To: Peter Rosin <peda@axentia.se>, linux-kernel@vger.kernel.org
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Michael Auchter <michael.auchter@ni.com>
Subject: Re: [PATCH] extcon: usbc-tusb320: make sure the state is initialized on probe
Date: Thu, 30 Jun 2022 04:54:33 +0900	[thread overview]
Message-ID: <c6d43dab-57bf-7041-9a5a-345fa35ca0c7@gmail.com> (raw)
In-Reply-To: <ab1ad93b-4d39-8863-9704-da779fc4c426@axentia.se>

On 22. 6. 23. 20:21, Peter Rosin wrote:
> When the port is connected at boot, there is not necessarily
> an interrupt flagged in the interrupt status register, causing
> the IRQ handler to bail out early without reading the state when
> it is invoked directly from probe.
> 
> Add a flag that overrides the interrupt status register and reads
> the state regardless during probe.
> 
> Fixes: 06bc4ca115cd ("extcon: Add driver for TI TUSB320")
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  drivers/extcon/extcon-usbc-tusb320.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
> index 6ba3d89b106d..bd3645ae0d52 100644
> --- a/drivers/extcon/extcon-usbc-tusb320.c
> +++ b/drivers/extcon/extcon-usbc-tusb320.c
> @@ -55,6 +55,7 @@ struct tusb320_priv {
>  	struct extcon_dev *edev;
>  	struct tusb320_ops *ops;
>  	enum tusb320_attached_state state;
> +	bool initialized;
>  };
>  
>  static const char * const tusb_attached_states[] = {
> @@ -195,7 +196,7 @@ static irqreturn_t tusb320_irq_handler(int irq, void *dev_id)
>  		return IRQ_NONE;
>  	}
>  
> -	if (!(reg & TUSB320_REG9_INTERRUPT_STATUS))
> +	if (priv->initialized && !(reg & TUSB320_REG9_INTERRUPT_STATUS))
>  		return IRQ_NONE;
>  
>  	state = (reg >> TUSB320_REG9_ATTACHED_STATE_SHIFT) &
> @@ -297,6 +298,8 @@ static int tusb320_extcon_probe(struct i2c_client *client,
>  		 */
>  		tusb320_irq_handler(client->irq, priv);
>  
> +	priv->initialized = true;
> +

After initializing as 'priv->initialized = true', 
tusb320_irq_handler() is not anymore detecting the external connector changes.

If external connector is detached after finished kernel boot,
how to change the state of external connector by using extcon_set_state()?

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi

  reply	other threads:[~2022-06-29 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 11:21 Peter Rosin
2022-06-29 19:54 ` Chanwoo Choi [this message]
2022-06-30  6:03   ` Peter Rosin
2022-08-23  9:51     ` Peter Rosin

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=c6d43dab-57bf-7041-9a5a-345fa35ca0c7@gmail.com \
    --to=cwchoi00@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.auchter@ni.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=peda@axentia.se \
    /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®