linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Yauhen Kharuzhy <jekhor@gmail.com>,
	linux-kernel@vger.kernel.org,
	Chanwoo Choi <cw00.choi@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v2] extcon-intel-cht-wc: Don't reset USB data connection at probe
Date: Tue, 17 Sep 2019 08:22:10 +0200	[thread overview]
Message-ID: <6579a7ed-f35d-7459-e1bd-c2d01d432407@redhat.com> (raw)
In-Reply-To: <20190916211536.29646-2-jekhor@gmail.com>

Hi,

On 16-09-2019 23:15, Yauhen Kharuzhy wrote:
> Intel Cherry Trail Whiskey Cove extcon driver connect USB data lines to
> PMIC at driver probing for further charger detection. This causes reset of
> USB data sessions and removing all devices from bus. If system was
> booted from Live CD or USB dongle, this makes system unusable.
> 
> Check if USB ID pin is floating and re-route data lines in this case
> only, don't touch otherwise.
> 
> Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
> ---

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



>   drivers/extcon/extcon-intel-cht-wc.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
> index 9d32150e68db..da1886a92f75 100644
> --- a/drivers/extcon/extcon-intel-cht-wc.c
> +++ b/drivers/extcon/extcon-intel-cht-wc.c
> @@ -338,6 +338,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>   	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
>   	struct cht_wc_extcon_data *ext;
>   	unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK);
> +	int pwrsrc_sts, id;
>   	int irq, ret;
>   
>   	irq = platform_get_irq(pdev, 0);
> @@ -387,8 +388,19 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>   		goto disable_sw_control;
>   	}
>   
> -	/* Route D+ and D- to PMIC for initial charger detection */
> -	cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);
> +	ret = regmap_read(ext->regmap, CHT_WC_PWRSRC_STS, &pwrsrc_sts);
> +	if (ret) {
> +		dev_err(ext->dev, "Error reading pwrsrc status: %d\n", ret);
> +		goto disable_sw_control;
> +	}
> +
> +	id = cht_wc_extcon_get_id(ext, pwrsrc_sts);
> +
> +	/* If no USB host or device connected, route D+ and D- to PMIC for
> +	 * initial charger detection
> +	 */
> +	if (id != INTEL_USB_ID_GND)
> +		cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);
>   
>   	/* Get initial state */
>   	cht_wc_extcon_pwrsrc_event(ext);
> 


  reply	other threads:[~2019-09-17  6:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 21:15 extcon-intel-cht-wc: Don't reset USB data connection at probe Yauhen Kharuzhy
2019-09-16 21:15 ` [PATCH v2] " Yauhen Kharuzhy
2019-09-17  6:22   ` Hans de Goede [this message]
2019-09-17 11:13   ` Andy Shevchenko
2019-09-17 13:25     ` Yauhen Kharuzhy
2019-09-18  7:17       ` Andy Shevchenko
2019-09-20  7:42         ` Chanwoo Choi
2019-09-20  8:25   ` Andy Shevchenko
2019-09-20  8:43   ` Chanwoo Choi

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=6579a7ed-f35d-7459-e1bd-c2d01d432407@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=cw00.choi@samsung.com \
    --cc=jekhor@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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;
as well as URLs for NNTP newsgroup(s).