lkml.org 
[lkml]   [2020]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 42/58] usb: chipidea: core: add wakeup support for extcon
    Date
    From: Peter Chen <peter.chen@nxp.com>

    commit 876d4e1e8298ad1f94d9e9392fc90486755437b4 upstream.

    If wakeup event occurred by extcon event, it needs to call
    ci_irq again since the first ci_irq calling at extcon notifier
    only wakes up controller, but do noop for event handling,
    it causes the extcon use case can't work well from low power mode.

    Cc: <stable@vger.kernel.org>
    Fixes: 3ecb3e09b042 ("usb: chipidea: Use extcon framework for VBUS and ID detect")
    Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
    Tested-by: Philippe Schenker <philippe.schenker@toradex.com>
    Signed-off-by: Peter Chen <peter.chen@nxp.com>
    Link: https://lore.kernel.org/r/20200707060601.31907-2-peter.chen@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/usb/chipidea/core.c | 24 ++++++++++++++++++++++++
    1 file changed, 24 insertions(+)

    --- a/drivers/usb/chipidea/core.c
    +++ b/drivers/usb/chipidea/core.c
    @@ -1122,6 +1122,29 @@ static void ci_controller_suspend(struct
    enable_irq(ci->irq);
    }

    +/*
    + * Handle the wakeup interrupt triggered by extcon connector
    + * We need to call ci_irq again for extcon since the first
    + * interrupt (wakeup int) only let the controller be out of
    + * low power mode, but not handle any interrupts.
    + */
    +static void ci_extcon_wakeup_int(struct ci_hdrc *ci)
    +{
    + struct ci_hdrc_cable *cable_id, *cable_vbus;
    + u32 otgsc = hw_read_otgsc(ci, ~0);
    +
    + cable_id = &ci->platdata->id_extcon;
    + cable_vbus = &ci->platdata->vbus_extcon;
    +
    + if (!IS_ERR(cable_id->edev) && ci->is_otg &&
    + (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS))
    + ci_irq(ci->irq, ci);
    +
    + if (!IS_ERR(cable_vbus->edev) && ci->is_otg &&
    + (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS))
    + ci_irq(ci->irq, ci);
    +}
    +
    static int ci_controller_resume(struct device *dev)
    {
    struct ci_hdrc *ci = dev_get_drvdata(dev);
    @@ -1148,6 +1171,7 @@ static int ci_controller_resume(struct d
    enable_irq(ci->irq);
    if (ci_otg_is_fsm_mode(ci))
    ci_otg_fsm_wakeup_by_srp(ci);
    + ci_extcon_wakeup_int(ci);
    }

    return 0;

    \
     
     \ /
      Last update: 2020-07-20 17:40    [W:4.239 / U:0.728 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site