[PATCH v1 8/9] extcon: extcon-ptn5150: Add USB analog audio accessory support

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

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

Add USB analog audio accessory attached and detection 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 b985a5e5c9bc..140994ac43ed 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -34,6 +34,7 @@ enum ptn5150_reg {
#define PTN5150_DFP_ATTACHED 0x1
#define PTN5150_UFP_ATTACHED 0x2
#define PTN5150_DEBUG_ATTACHED 0x3
+#define PTN5150_AUDIO_ATTACHED 0x4

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

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

@@ -158,6 +161,9 @@ static void ptn5150_irq_work(struct work_struct *work)
case PTN5150_DEBUG_ATTACHED:
debug = true;
break;
+ case PTN5150_AUDIO_ATTACHED:
+ audio = true;
+ break;
default:
dev_err(info->dev,
"Unknown Port status : %x\n",
@@ -189,6 +195,7 @@ static void ptn5150_irq_work(struct work_struct *work)
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_JACK_HEADPHONE, audio);
extcon_set_state_sync(info->edev, EXTCON_USB, dev);

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