lkml.org 
[lkml]   [2020]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.4 01/33] extcon-intel-cht-wc: Don't reset USB data connection at probe
    Date
    From: Yauhen Kharuzhy <jekhor@gmail.com>

    [ Upstream commit e81b88932985c9134d410f4eaaaa9b81a3b4bd0c ]

    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.

    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
    [cw00.choi: Clean-up the minor coding style]
    Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 9d32150e68db5..771f6f4cf92e6 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;
    + }
    +
    + /*
    + * If no USB host or device connected, route D+ and D- to PMIC for
    + * initial charger detection
    + */
    + id = cht_wc_extcon_get_id(ext, pwrsrc_sts);
    + if (id != INTEL_USB_ID_GND)
    + cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);

    /* Get initial state */
    cht_wc_extcon_pwrsrc_event(ext);
    --
    2.20.1
    \
     
     \ /
      Last update: 2020-01-24 02:18    [W:6.306 / U:0.180 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site