[PATCH v1 7/9] extcon: extcon-ptn5150: Add USB debug accessory support

Ramuthevar,Vadivel MuruganX
2020-08-18T06:58:03Z

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>

Add USB debug accessory support.

Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>
---
drivers/extcon/extcon-ptn5150.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
index 5612dc0ef2af..b985a5e5c9bc 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -33,6 +33,7 @@ enum ptn5150_reg {

#define PTN5150_DFP_ATTACHED 0x1
#define PTN5150_UFP_ATTACHED 0x2
+#define PTN5150_DEBUG_ATTACHED 0x3

/* Define PTN5150 MASK/SHIFT constant */
#define PTN5150_REG_DEVICE_ID_VERSION GENMASK(7, 3)
@@ -61,6 +62,7 @@ struct ptn5150_info {
static const unsigned int ptn5150_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
+ EXTCON_JIG,
EXTCON_NONE,
};

@@ -86,6 +88,7 @@ static void ptn5150_irq_work(struct work_struct *work)
union extcon_property_value vbus_detected;
union extcon_property_value flipped;
bool host_vbus = false;
+ bool debug = false;
bool host = false;
bool dev = false;

@@ -152,6 +155,9 @@ static void ptn5150_irq_work(struct work_struct *work)
extcon_set_state_sync(info->edev,
EXTCON_USB_HOST, true);
break;
+ case PTN5150_DEBUG_ATTACHED:
+ debug = true;
+ break;
default:
dev_err(info->dev,
"Unknown Port status : %x\n",
@@ -182,6 +188,7 @@ static void ptn5150_irq_work(struct work_struct *work)
extcon_set_property(info->edev, host ? EXTCON_USB_HOST : EXTCON_USB,
EXTCON_PROP_USB_VBUS, vbus_detected);
extcon_set_state_sync(info->edev, EXTCON_USB_HOST, host);
+ extcon_set_state_sync(info->edev, EXTCON_JIG, debug);
extcon_set_state_sync(info->edev, EXTCON_USB, dev);

mutex_unlock(&info->mutex);
--
2.11.0