This patch adds HNP polling operation function for OTG fsm.

Signed-off-by: Li Jun <b47...@freescale.com>
---
 drivers/usb/phy/phy-fsm-usb.c |    2 ++
 include/linux/usb/otg-fsm.h   |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c
index c47e5a6..ef91961 100644
--- a/drivers/usb/phy/phy-fsm-usb.c
+++ b/drivers/usb/phy/phy-fsm-usb.c
@@ -169,6 +169,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum 
usb_otg_state new_state)
                otg_set_protocol(fsm, PROTO_HOST);
                usb_bus_start_enum(fsm->otg->host,
                                fsm->otg->host->otg_port);
+               otg_start_hnp_polling(fsm);
                break;
        case OTG_STATE_A_IDLE:
                otg_drv_vbus(fsm, 0);
@@ -203,6 +204,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum 
usb_otg_state new_state)
                 */
                if (!fsm->a_bus_req || fsm->a_suspend_req_inf)
                        otg_add_timer(fsm, A_WAIT_ENUM);
+               otg_start_hnp_polling(fsm);
                break;
        case OTG_STATE_A_SUSPEND:
                otg_drv_vbus(fsm, 1);
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index b6ba1bf..79c6ee8 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -127,6 +127,7 @@ struct otg_fsm_ops {
        void    (*start_pulse)(struct otg_fsm *fsm);
        void    (*start_adp_prb)(struct otg_fsm *fsm);
        void    (*start_adp_sns)(struct otg_fsm *fsm);
+       void    (*start_hnp_polling)(struct otg_fsm *fsm);
        void    (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
        void    (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
        int     (*start_host)(struct otg_fsm *fsm, int on);
@@ -209,6 +210,14 @@ static inline int otg_start_adp_sns(struct otg_fsm *fsm)
        return 0;
 }
 
+static inline int otg_start_hnp_polling(struct otg_fsm *fsm)
+{
+       if (!fsm->ops->start_hnp_polling)
+               return -EOPNOTSUPP;
+       fsm->ops->start_hnp_polling(fsm);
+       return 0;
+}
+
 static inline int otg_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
 {
        if (!fsm->ops->add_timer)
-- 
1.7.8


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to