usb: phy: Introduce one extcon device into usb phy

Usually usb phy need register one extcon device to get the connection
notifications. It will remove some duplicate code if the extcon device
is registered using common code instead of each phy driver having its
own related extcon APIs. So we add one pointer of extcon device into
usb phy structure, and some other helper functions to register extcon.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
Baolin Wang
2017-05-05 14:12:24 +08:00
committed by Felipe Balbi
parent 05853ad68e
commit 7d21114dc6
3 changed files with 67 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
#ifndef __LINUX_USB_PHY_H
#define __LINUX_USB_PHY_H
#include <linux/extcon.h>
#include <linux/notifier.h>
#include <linux/usb.h>
@@ -85,6 +86,12 @@ struct usb_phy {
struct usb_phy_io_ops *io_ops;
void __iomem *io_priv;
/* to support extcon device */
struct extcon_dev *edev;
struct extcon_dev *id_edev;
struct notifier_block vbus_nb;
struct notifier_block id_nb;
/* for notification of usb_phy_events */
struct atomic_notifier_head notifier;