Update extcon for 4.4

Detailed description for patchset:
 1. Update the extcon core:
 - Modify the unique identification and name of each external connector
   with the additional prefix to clarify both attribute and meaning of
   external connector as following:
 : EXTCON_CHG_* mean the charger connector.
 : EXTCON_JACK_* mean the jack connector.
 : EXTCON_DISP_* mean the display port connector.
 
 - Keep the standard name of USB charging port by refering to the
   "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use
   the standard name of USB charging port as following:
 : EXTCON_CHG_USB_SDP /* Standard Downstream Port */
 : EXTCON_CHG_USB_DCP /* Dedicated Charging Port */
 : EXTCON_CHG_USB_CDP /* Charging Downstream Port */
 : EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */
 [1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip
 
 2. Update the extcon-arizona.c driver:
 - Support the WM8998 and WM1814 codec for jack detection.
 - Support for the ADC mode microphone detection and the general
   purpose switch for pop suppression.
 - Fix bug include fixing the headphone detection accuracy
   at the top end of the range and some corrections around
   the use of the microphone clamps.
 
 3. Update the extcon-gpio.c driver:
 - Clean-up the extcon-gpio driver and fix minor issue before
   supporting the Device tree binding of it.
 
 4. Clean-up and fix the minor issue for extcon drivers:
 - Export OF module alias information for extcon-rt8973a.c and extcon-sm5502.c.
 - Fix wrong type of variable of for extcon-rt8973a.c and extcon-sm5502.c.
 - Use resource managed API for extcon-axp288.c.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWIDlYAAoJEJzN3yze689T+x8P/2o65hGVdmwuprABG8ZULSXP
 z+TB+q62ll5UAz/nkQgt+QFKkgmCmeMd8yzWtNEKI1/QNE85EIV9qFMIwp0cPllP
 bwLA4rkShCL1ppqxmV0l/wTsp0wXKuTA4VJxKGaj5pD+lgjZBu9VASeci4tgx0YY
 FjIN7Dh0HqlZTN18rfyXzcykxPpQlAbTnRhTWou8J7g9rBnBImCBgYdUJv0ea4hX
 zpas4TxLZMYZu+xjmbk2zHJeVKgrx7tJTu5YsEY4SgCh8NQN864NKxGfsH6AdYF+
 oW6bBiCC5ZsPBXEO6u1OyohDdF0xSUIUBmzwxN/92WKfbZFtv7rPheMzi00XDJNw
 0N2BzHD+l9DJHiP4Cq3axy+jFT9Nrp4DVXex5d8MZwPE4mmq+BV/VVaTG6gtbcDN
 2pET9o7hi/eDmCmbq48fqfQ8RafuyCwy4lJkzRqT5QYmdBJjbydCOk/ncLedtGpq
 W0RiMqiCmkhdPTohu+Uf7g6m0V6oFi54HH25Hfv6c86T7N1QxS67HJZs1aW1wykK
 W2RtEEnKeor7W+gH0uZMRideHQwOBYWWb7PhfUCzpddBw9EqAApuXJT6Gv4tPm1J
 Qu1zJ4mMgGG9uQnfGXoUl1l9coWvPPzLr4iLfjyJXrB8mcAStyrjuUTavCwn3Bd4
 0KPvifcOXrt8PdvEc0an
 =KHGp
 -----END PGP SIGNATURE-----

Merge tag 'extcon-next-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for 4.4

Detailed description for patchset:
1. Update the extcon core:
- Modify the unique identification and name of each external connector
  with the additional prefix to clarify both attribute and meaning of
  external connector as following:
: EXTCON_CHG_* mean the charger connector.
: EXTCON_JACK_* mean the jack connector.
: EXTCON_DISP_* mean the display port connector.

- Keep the standard name of USB charging port by refering to the
  "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use
  the standard name of USB charging port as following:
: EXTCON_CHG_USB_SDP /* Standard Downstream Port */
: EXTCON_CHG_USB_DCP /* Dedicated Charging Port */
: EXTCON_CHG_USB_CDP /* Charging Downstream Port */
: EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */
[1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip

2. Update the extcon-arizona.c driver:
- Support the WM8998 and WM1814 codec for jack detection.
- Support for the ADC mode microphone detection and the general
  purpose switch for pop suppression.
- Fix bug include fixing the headphone detection accuracy
  at the top end of the range and some corrections around
  the use of the microphone clamps.

3. Update the extcon-gpio.c driver:
- Clean-up the extcon-gpio driver and fix minor issue before
  supporting the Device tree binding of it.

4. Clean-up and fix the minor issue for extcon drivers:
- Export OF module alias information for extcon-rt8973a.c and extcon-sm5502.c.
- Fix wrong type of variable of for extcon-rt8973a.c and extcon-sm5502.c.
- Use resource managed API for extcon-axp288.c.
This commit is contained in:
Greg Kroah-Hartman 2015-10-16 21:11:06 -07:00
commit f8d9600425
16 changed files with 357 additions and 244 deletions

View File

@ -1,7 +1,7 @@
/* /*
* extcon-arizona.c - Extcon driver Wolfson Arizona devices * extcon-arizona.c - Extcon driver Wolfson Arizona devices
* *
* Copyright (C) 2012 Wolfson Microelectronics plc * Copyright (C) 2012-2014 Wolfson Microelectronics plc
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -43,11 +43,18 @@
#define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9 #define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9
#define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb #define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb
#define ARIZONA_TST_CAP_DEFAULT 0x3
#define ARIZONA_TST_CAP_CLAMP 0x1
#define ARIZONA_HPDET_MAX 10000 #define ARIZONA_HPDET_MAX 10000
#define HPDET_DEBOUNCE 500 #define HPDET_DEBOUNCE 500
#define DEFAULT_MICD_TIMEOUT 2000 #define DEFAULT_MICD_TIMEOUT 2000
#define QUICK_HEADPHONE_MAX_OHM 3
#define MICROPHONE_MIN_OHM 1257
#define MICROPHONE_MAX_OHM 30000
#define MICD_DBTIME_TWO_READINGS 2 #define MICD_DBTIME_TWO_READINGS 2
#define MICD_DBTIME_FOUR_READINGS 4 #define MICD_DBTIME_FOUR_READINGS 4
@ -117,19 +124,22 @@ static const struct arizona_micd_range micd_default_ranges[] = {
{ .max = 430, .key = BTN_5 }, { .max = 430, .key = BTN_5 },
}; };
/* The number of levels in arizona_micd_levels valid for button thresholds */
#define ARIZONA_NUM_MICD_BUTTON_LEVELS 64
static const int arizona_micd_levels[] = { static const int arizona_micd_levels[] = {
3, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 46, 3, 6, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 34, 36, 39, 41, 44, 46,
49, 52, 54, 57, 60, 62, 65, 67, 70, 73, 75, 78, 81, 83, 89, 94, 100, 49, 52, 54, 57, 60, 62, 65, 67, 70, 73, 75, 78, 81, 83, 89, 94, 100,
105, 111, 116, 122, 127, 139, 150, 161, 173, 186, 196, 209, 220, 245, 105, 111, 116, 122, 127, 139, 150, 161, 173, 186, 196, 209, 220, 245,
270, 295, 321, 348, 375, 402, 430, 489, 550, 614, 681, 752, 903, 1071, 270, 295, 321, 348, 375, 402, 430, 489, 550, 614, 681, 752, 903, 1071,
1257, 1257, 30000,
}; };
static const unsigned int arizona_cable[] = { static const unsigned int arizona_cable[] = {
EXTCON_MECHANICAL, EXTCON_MECHANICAL,
EXTCON_MICROPHONE, EXTCON_JACK_MICROPHONE,
EXTCON_HEADPHONE, EXTCON_JACK_HEADPHONE,
EXTCON_LINE_OUT, EXTCON_JACK_LINE_OUT,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -140,17 +150,33 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
{ {
struct arizona *arizona = info->arizona; struct arizona *arizona = info->arizona;
unsigned int mask = 0, val = 0; unsigned int mask = 0, val = 0;
unsigned int cap_sel = 0;
int ret; int ret;
switch (arizona->type) { switch (arizona->type) {
case WM8998:
case WM1814:
mask = 0;
break;
case WM5110: case WM5110:
case WM8280: case WM8280:
mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR | mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR |
ARIZONA_HP1L_SHRTI; ARIZONA_HP1L_SHRTI;
if (clamp) if (clamp) {
val = ARIZONA_HP1L_SHRTO; val = ARIZONA_HP1L_SHRTO;
else cap_sel = ARIZONA_TST_CAP_CLAMP;
} else {
val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI; val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
cap_sel = ARIZONA_TST_CAP_DEFAULT;
}
ret = regmap_update_bits(arizona->regmap,
ARIZONA_HP_TEST_CTRL_1,
ARIZONA_HP1_TST_CAP_SEL_MASK,
cap_sel);
if (ret != 0)
dev_warn(arizona->dev,
"Failed to set TST_CAP_SEL: %d\n", ret);
break; break;
default: default:
mask = ARIZONA_RMV_SHRT_HP1L; mask = ARIZONA_RMV_SHRT_HP1L;
@ -175,6 +201,7 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
ret); ret);
} }
if (mask) {
ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L, ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L,
mask, val); mask, val);
if (ret != 0) if (ret != 0)
@ -186,6 +213,7 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
if (ret != 0) if (ret != 0)
dev_warn(arizona->dev, "Failed to do clamp: %d\n", dev_warn(arizona->dev, "Failed to do clamp: %d\n",
ret); ret);
}
/* Restore the desired state while not doing the clamp */ /* Restore the desired state while not doing the clamp */
if (!clamp) { if (!clamp) {
@ -270,6 +298,7 @@ static void arizona_start_mic(struct arizona_extcon_info *info)
struct arizona *arizona = info->arizona; struct arizona *arizona = info->arizona;
bool change; bool change;
int ret; int ret;
unsigned int mode;
/* Microphone detection can't use idle mode */ /* Microphone detection can't use idle mode */
pm_runtime_get(info->dev); pm_runtime_get(info->dev);
@ -295,9 +324,14 @@ static void arizona_start_mic(struct arizona_extcon_info *info)
regmap_write(arizona->regmap, 0x80, 0x0); regmap_write(arizona->regmap, 0x80, 0x0);
} }
if (info->detecting && arizona->pdata.micd_software_compare)
mode = ARIZONA_ACCDET_MODE_ADC;
else
mode = ARIZONA_ACCDET_MODE_MIC;
regmap_update_bits(arizona->regmap, regmap_update_bits(arizona->regmap,
ARIZONA_ACCESSORY_DETECT_MODE_1, ARIZONA_ACCESSORY_DETECT_MODE_1,
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); ARIZONA_ACCDET_MODE_MASK, mode);
arizona_extcon_pulse_micbias(info); arizona_extcon_pulse_micbias(info);
@ -443,9 +477,6 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
arizona_hpdet_b_ranges[range].factor_a); arizona_hpdet_b_ranges[range].factor_a);
break; break;
default:
dev_warn(arizona->dev, "Unknown HPDET IP revision %d\n",
info->hpdet_ip_version);
case 2: case 2:
if (!(val & ARIZONA_HP_DONE_B)) { if (!(val & ARIZONA_HP_DONE_B)) {
dev_err(arizona->dev, "HPDET did not complete: %x\n", dev_err(arizona->dev, "HPDET did not complete: %x\n",
@ -482,6 +513,12 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
arizona_hpdet_c_ranges[range].min); arizona_hpdet_c_ranges[range].min);
val = arizona_hpdet_c_ranges[range].min; val = arizona_hpdet_c_ranges[range].min;
} }
break;
default:
dev_warn(arizona->dev, "Unknown HPDET IP revision %d\n",
info->hpdet_ip_version);
return -EINVAL;
} }
dev_dbg(arizona->dev, "HP impedance %d ohms\n", val); dev_dbg(arizona->dev, "HP impedance %d ohms\n", val);
@ -563,7 +600,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
struct arizona_extcon_info *info = data; struct arizona_extcon_info *info = data;
struct arizona *arizona = info->arizona; struct arizona *arizona = info->arizona;
int id_gpio = arizona->pdata.hpdet_id_gpio; int id_gpio = arizona->pdata.hpdet_id_gpio;
unsigned int report = EXTCON_HEADPHONE; unsigned int report = EXTCON_JACK_HEADPHONE;
int ret, reading; int ret, reading;
bool mic = false; bool mic = false;
@ -608,9 +645,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
/* Report high impedence cables as line outputs */ /* Report high impedence cables as line outputs */
if (reading >= 5000) if (reading >= 5000)
report = EXTCON_LINE_OUT; report = EXTCON_JACK_LINE_OUT;
else else
report = EXTCON_HEADPHONE; report = EXTCON_JACK_HEADPHONE;
ret = extcon_set_cable_state_(info->edev, report, true); ret = extcon_set_cable_state_(info->edev, report, true);
if (ret != 0) if (ret != 0)
@ -695,7 +732,7 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
/* Just report headphone */ /* Just report headphone */
ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true); ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret); dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
@ -752,7 +789,7 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
/* Just report headphone */ /* Just report headphone */
ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true); ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret); dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
@ -804,6 +841,37 @@ static void arizona_micd_detect(struct work_struct *work)
return; return;
} }
if (info->detecting && arizona->pdata.micd_software_compare) {
/* Must disable MICD before we read the ADCVAL */
regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_ENA, 0);
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_4, &val);
if (ret != 0) {
dev_err(arizona->dev,
"Failed to read MICDET_ADCVAL: %d\n",
ret);
mutex_unlock(&info->lock);
return;
}
dev_dbg(arizona->dev, "MICDET_ADCVAL: %x\n", val);
val &= ARIZONA_MICDET_ADCVAL_MASK;
if (val < ARRAY_SIZE(arizona_micd_levels))
val = arizona_micd_levels[val];
else
val = INT_MAX;
if (val <= QUICK_HEADPHONE_MAX_OHM)
val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_0;
else if (val <= MICROPHONE_MIN_OHM)
val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_1;
else if (val <= MICROPHONE_MAX_OHM)
val = ARIZONA_MICD_STS | ARIZONA_MICD_LVL_8;
else
val = ARIZONA_MICD_LVL_8;
}
for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) { for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val); ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) { if (ret != 0) {
@ -847,7 +915,7 @@ static void arizona_micd_detect(struct work_struct *work)
arizona_identify_headphone(info); arizona_identify_headphone(info);
ret = extcon_set_cable_state_(info->edev, ret = extcon_set_cable_state_(info->edev,
EXTCON_MICROPHONE, true); EXTCON_JACK_MICROPHONE, true);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Headset report failed: %d\n", dev_err(arizona->dev, "Headset report failed: %d\n",
ret); ret);
@ -932,10 +1000,17 @@ static void arizona_micd_detect(struct work_struct *work)
} }
handled: handled:
if (info->detecting) if (info->detecting) {
if (arizona->pdata.micd_software_compare)
regmap_update_bits(arizona->regmap,
ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_ENA,
ARIZONA_MICD_ENA);
queue_delayed_work(system_power_efficient_wq, queue_delayed_work(system_power_efficient_wq,
&info->micd_timeout_work, &info->micd_timeout_work,
msecs_to_jiffies(info->micd_timeout)); msecs_to_jiffies(info->micd_timeout));
}
pm_runtime_mark_last_busy(info->dev); pm_runtime_mark_last_busy(info->dev);
mutex_unlock(&info->lock); mutex_unlock(&info->lock);
@ -991,11 +1066,8 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
mutex_lock(&info->lock); mutex_lock(&info->lock);
if (arizona->pdata.jd_gpio5) { if (info->micd_clamp) {
mask = ARIZONA_MICD_CLAMP_STS; mask = ARIZONA_MICD_CLAMP_STS;
if (arizona->pdata.jd_invert)
present = ARIZONA_MICD_CLAMP_STS;
else
present = 0; present = 0;
} else { } else {
mask = ARIZONA_JD1_STS; mask = ARIZONA_JD1_STS;
@ -1055,9 +1127,11 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
msecs_to_jiffies(HPDET_DEBOUNCE)); msecs_to_jiffies(HPDET_DEBOUNCE));
} }
if (info->micd_clamp || !arizona->pdata.jd_invert)
regmap_update_bits(arizona->regmap, regmap_update_bits(arizona->regmap,
ARIZONA_JACK_DETECT_DEBOUNCE, ARIZONA_JACK_DETECT_DEBOUNCE,
ARIZONA_MICD_CLAMP_DB | ARIZONA_JD1_DB, 0); ARIZONA_MICD_CLAMP_DB |
ARIZONA_JD1_DB, 0);
} else { } else {
dev_dbg(arizona->dev, "Detected jack removal\n"); dev_dbg(arizona->dev, "Detected jack removal\n");
@ -1224,6 +1298,11 @@ static int arizona_extcon_probe(struct platform_device *pdev)
break; break;
} }
break; break;
case WM8998:
case WM1814:
info->micd_clamp = true;
info->hpdet_ip_version = 2;
break;
default: default:
break; break;
} }
@ -1259,6 +1338,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
info->micd_num_modes = ARRAY_SIZE(micd_default_modes); info->micd_num_modes = ARRAY_SIZE(micd_default_modes);
} }
if (arizona->pdata.gpsw > 0)
regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1,
ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw);
if (arizona->pdata.micd_pol_gpio > 0) { if (arizona->pdata.micd_pol_gpio > 0) {
if (info->micd_modes[0].gpio) if (info->micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH; mode = GPIOF_OUT_INIT_HIGH;
@ -1335,7 +1418,8 @@ static int arizona_extcon_probe(struct platform_device *pdev)
break; break;
} }
BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) != 0x40); BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) <
ARIZONA_NUM_MICD_BUTTON_LEVELS);
if (arizona->pdata.num_micd_ranges) { if (arizona->pdata.num_micd_ranges) {
info->micd_ranges = pdata->micd_ranges; info->micd_ranges = pdata->micd_ranges;
@ -1368,11 +1452,11 @@ static int arizona_extcon_probe(struct platform_device *pdev)
/* Set up all the buttons the user specified */ /* Set up all the buttons the user specified */
for (i = 0; i < info->num_micd_ranges; i++) { for (i = 0; i < info->num_micd_ranges; i++) {
for (j = 0; j < ARRAY_SIZE(arizona_micd_levels); j++) for (j = 0; j < ARIZONA_NUM_MICD_BUTTON_LEVELS; j++)
if (arizona_micd_levels[j] >= info->micd_ranges[i].max) if (arizona_micd_levels[j] >= info->micd_ranges[i].max)
break; break;
if (j == ARRAY_SIZE(arizona_micd_levels)) { if (j == ARIZONA_NUM_MICD_BUTTON_LEVELS) {
dev_err(arizona->dev, "Unsupported MICD level %d\n", dev_err(arizona->dev, "Unsupported MICD level %d\n",
info->micd_ranges[i].max); info->micd_ranges[i].max);
ret = -EINVAL; ret = -EINVAL;
@ -1436,7 +1520,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
pm_runtime_idle(&pdev->dev); pm_runtime_idle(&pdev->dev);
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
if (arizona->pdata.jd_gpio5) { if (info->micd_clamp) {
jack_irq_rise = ARIZONA_IRQ_MICD_CLAMP_RISE; jack_irq_rise = ARIZONA_IRQ_MICD_CLAMP_RISE;
jack_irq_fall = ARIZONA_IRQ_MICD_CLAMP_FALL; jack_irq_fall = ARIZONA_IRQ_MICD_CLAMP_FALL;
} else { } else {
@ -1541,7 +1625,7 @@ static int arizona_extcon_remove(struct platform_device *pdev)
ARIZONA_MICD_CLAMP_CONTROL, ARIZONA_MICD_CLAMP_CONTROL,
ARIZONA_MICD_CLAMP_MODE_MASK, 0); ARIZONA_MICD_CLAMP_MODE_MASK, 0);
if (arizona->pdata.jd_gpio5) { if (info->micd_clamp) {
jack_irq_rise = ARIZONA_IRQ_MICD_CLAMP_RISE; jack_irq_rise = ARIZONA_IRQ_MICD_CLAMP_RISE;
jack_irq_fall = ARIZONA_IRQ_MICD_CLAMP_FALL; jack_irq_fall = ARIZONA_IRQ_MICD_CLAMP_FALL;
} else { } else {

View File

@ -102,9 +102,9 @@ enum axp288_extcon_irq {
}; };
static const unsigned int axp288_extcon_cables[] = { static const unsigned int axp288_extcon_cables[] = {
EXTCON_SLOW_CHARGER, EXTCON_CHG_USB_SDP,
EXTCON_CHARGE_DOWNSTREAM, EXTCON_CHG_USB_CDP,
EXTCON_FAST_CHARGER, EXTCON_CHG_USB_DCP,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -192,18 +192,18 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
dev_dbg(info->dev, "sdp cable is connecetd\n"); dev_dbg(info->dev, "sdp cable is connecetd\n");
notify_otg = true; notify_otg = true;
notify_charger = true; notify_charger = true;
cable = EXTCON_SLOW_CHARGER; cable = EXTCON_CHG_USB_SDP;
break; break;
case DET_STAT_CDP: case DET_STAT_CDP:
dev_dbg(info->dev, "cdp cable is connecetd\n"); dev_dbg(info->dev, "cdp cable is connecetd\n");
notify_otg = true; notify_otg = true;
notify_charger = true; notify_charger = true;
cable = EXTCON_CHARGE_DOWNSTREAM; cable = EXTCON_CHG_USB_CDP;
break; break;
case DET_STAT_DCP: case DET_STAT_DCP:
dev_dbg(info->dev, "dcp cable is connecetd\n"); dev_dbg(info->dev, "dcp cable is connecetd\n");
notify_charger = true; notify_charger = true;
cable = EXTCON_FAST_CHARGER; cable = EXTCON_CHG_USB_DCP;
break; break;
default: default:
dev_warn(info->dev, dev_warn(info->dev,
@ -309,7 +309,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
} }
/* Get otg transceiver phy */ /* Get otg transceiver phy */
info->otg = usb_get_phy(USB_PHY_TYPE_USB2); info->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
if (IS_ERR(info->otg)) { if (IS_ERR(info->otg)) {
dev_err(&pdev->dev, "failed to get otg transceiver\n"); dev_err(&pdev->dev, "failed to get otg transceiver\n");
return PTR_ERR(info->otg); return PTR_ERR(info->otg);
@ -318,11 +318,11 @@ static int axp288_extcon_probe(struct platform_device *pdev)
/* Set up gpio control for USB Mux */ /* Set up gpio control for USB Mux */
if (info->pdata->gpio_mux_cntl) { if (info->pdata->gpio_mux_cntl) {
gpio = desc_to_gpio(info->pdata->gpio_mux_cntl); gpio = desc_to_gpio(info->pdata->gpio_mux_cntl);
ret = gpio_request(gpio, "USB_MUX"); ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX");
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"failed to request the gpio=%d\n", gpio); "failed to request the gpio=%d\n", gpio);
goto gpio_req_failed; return ret;
} }
gpiod_direction_output(info->pdata->gpio_mux_cntl, gpiod_direction_output(info->pdata->gpio_mux_cntl,
EXTCON_GPIO_MUX_SEL_PMIC); EXTCON_GPIO_MUX_SEL_PMIC);
@ -335,7 +335,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
dev_err(&pdev->dev, dev_err(&pdev->dev,
"failed to get virtual interrupt=%d\n", pirq); "failed to get virtual interrupt=%d\n", pirq);
ret = info->irq[i]; ret = info->irq[i];
goto gpio_req_failed; return ret;
} }
ret = devm_request_threaded_irq(&pdev->dev, info->irq[i], ret = devm_request_threaded_irq(&pdev->dev, info->irq[i],
@ -345,7 +345,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to request interrupt=%d\n", dev_err(&pdev->dev, "failed to request interrupt=%d\n",
info->irq[i]); info->irq[i]);
goto gpio_req_failed; return ret;
} }
} }
@ -353,23 +353,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
axp288_extcon_enable_irq(info); axp288_extcon_enable_irq(info);
return 0; return 0;
gpio_req_failed:
usb_put_phy(info->otg);
return ret;
}
static int axp288_extcon_remove(struct platform_device *pdev)
{
struct axp288_extcon_info *info = platform_get_drvdata(pdev);
usb_put_phy(info->otg);
return 0;
} }
static struct platform_driver axp288_extcon_driver = { static struct platform_driver axp288_extcon_driver = {
.probe = axp288_extcon_probe, .probe = axp288_extcon_probe,
.remove = axp288_extcon_remove,
.driver = { .driver = {
.name = "axp288_extcon", .name = "axp288_extcon",
}, },

View File

@ -1,7 +1,5 @@
/* /*
* drivers/extcon/extcon_gpio.c * extcon_gpio.c - Single-state GPIO extcon driver based on extcon class
*
* Single-state GPIO extcon driver based on extcon class
* *
* Copyright (C) 2008 Google, Inc. * Copyright (C) 2008 Google, Inc.
* Author: Mike Lockwood <lockwood@android.com> * Author: Mike Lockwood <lockwood@android.com>
@ -17,12 +15,12 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*
*/ */
#include <linux/extcon.h> #include <linux/extcon.h>
#include <linux/extcon/extcon-gpio.h> #include <linux/extcon/extcon-gpio.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -33,14 +31,12 @@
struct gpio_extcon_data { struct gpio_extcon_data {
struct extcon_dev *edev; struct extcon_dev *edev;
unsigned gpio;
bool gpio_active_low;
const char *state_on;
const char *state_off;
int irq; int irq;
struct delayed_work work; struct delayed_work work;
unsigned long debounce_jiffies; unsigned long debounce_jiffies;
bool check_on_resume;
struct gpio_desc *id_gpiod;
struct gpio_extcon_pdata *pdata;
}; };
static void gpio_extcon_work(struct work_struct *work) static void gpio_extcon_work(struct work_struct *work)
@ -50,93 +46,107 @@ static void gpio_extcon_work(struct work_struct *work)
container_of(to_delayed_work(work), struct gpio_extcon_data, container_of(to_delayed_work(work), struct gpio_extcon_data,
work); work);
state = gpio_get_value(data->gpio); state = gpiod_get_value_cansleep(data->id_gpiod);
if (data->gpio_active_low) if (data->pdata->gpio_active_low)
state = !state; state = !state;
extcon_set_state(data->edev, state); extcon_set_state(data->edev, state);
} }
static irqreturn_t gpio_irq_handler(int irq, void *dev_id) static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
{ {
struct gpio_extcon_data *extcon_data = dev_id; struct gpio_extcon_data *data = dev_id;
queue_delayed_work(system_power_efficient_wq, &extcon_data->work, queue_delayed_work(system_power_efficient_wq, &data->work,
extcon_data->debounce_jiffies); data->debounce_jiffies);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int gpio_extcon_init(struct device *dev, struct gpio_extcon_data *data)
{
struct gpio_extcon_pdata *pdata = data->pdata;
int ret;
ret = devm_gpio_request_one(dev, pdata->gpio, GPIOF_DIR_IN,
dev_name(dev));
if (ret < 0)
return ret;
data->id_gpiod = gpio_to_desc(pdata->gpio);
if (!data->id_gpiod)
return -EINVAL;
if (pdata->debounce) {
ret = gpiod_set_debounce(data->id_gpiod,
pdata->debounce * 1000);
if (ret < 0)
data->debounce_jiffies =
msecs_to_jiffies(pdata->debounce);
}
data->irq = gpiod_to_irq(data->id_gpiod);
if (data->irq < 0)
return data->irq;
return 0;
}
static int gpio_extcon_probe(struct platform_device *pdev) static int gpio_extcon_probe(struct platform_device *pdev)
{ {
struct gpio_extcon_platform_data *pdata = dev_get_platdata(&pdev->dev); struct gpio_extcon_pdata *pdata = dev_get_platdata(&pdev->dev);
struct gpio_extcon_data *extcon_data; struct gpio_extcon_data *data;
int ret; int ret;
if (!pdata) if (!pdata)
return -EBUSY; return -EBUSY;
if (!pdata->irq_flags) { if (!pdata->irq_flags || pdata->extcon_id > EXTCON_NONE)
dev_err(&pdev->dev, "IRQ flag is not specified.\n");
return -EINVAL; return -EINVAL;
}
extcon_data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data), data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data),
GFP_KERNEL); GFP_KERNEL);
if (!extcon_data) if (!data)
return -ENOMEM; return -ENOMEM;
data->pdata = pdata;
extcon_data->edev = devm_extcon_dev_allocate(&pdev->dev, NULL); /* Initialize the gpio */
if (IS_ERR(extcon_data->edev)) { ret = gpio_extcon_init(&pdev->dev, data);
if (ret < 0)
return ret;
/* Allocate the memory of extcon devie and register extcon device */
data->edev = devm_extcon_dev_allocate(&pdev->dev, &pdata->extcon_id);
if (IS_ERR(data->edev)) {
dev_err(&pdev->dev, "failed to allocate extcon device\n"); dev_err(&pdev->dev, "failed to allocate extcon device\n");
return -ENOMEM; return -ENOMEM;
} }
extcon_data->gpio = pdata->gpio; ret = devm_extcon_dev_register(&pdev->dev, data->edev);
extcon_data->gpio_active_low = pdata->gpio_active_low;
extcon_data->state_on = pdata->state_on;
extcon_data->state_off = pdata->state_off;
extcon_data->check_on_resume = pdata->check_on_resume;
ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
pdev->name);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (pdata->debounce) { INIT_DELAYED_WORK(&data->work, gpio_extcon_work);
ret = gpio_set_debounce(extcon_data->gpio,
pdata->debounce * 1000);
if (ret < 0)
extcon_data->debounce_jiffies =
msecs_to_jiffies(pdata->debounce);
}
ret = devm_extcon_dev_register(&pdev->dev, extcon_data->edev); /*
* Request the interrput of gpio to detect whether external connector
* is attached or detached.
*/
ret = devm_request_any_context_irq(&pdev->dev, data->irq,
gpio_irq_handler, pdata->irq_flags,
pdev->name, data);
if (ret < 0) if (ret < 0)
return ret; return ret;
INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); platform_set_drvdata(pdev, data);
extcon_data->irq = gpio_to_irq(extcon_data->gpio);
if (extcon_data->irq < 0)
return extcon_data->irq;
ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler,
pdata->irq_flags, pdev->name,
extcon_data);
if (ret < 0)
return ret;
platform_set_drvdata(pdev, extcon_data);
/* Perform initial detection */ /* Perform initial detection */
gpio_extcon_work(&extcon_data->work.work); gpio_extcon_work(&data->work.work);
return 0; return 0;
} }
static int gpio_extcon_remove(struct platform_device *pdev) static int gpio_extcon_remove(struct platform_device *pdev)
{ {
struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev); struct gpio_extcon_data *data = platform_get_drvdata(pdev);
cancel_delayed_work_sync(&extcon_data->work); cancel_delayed_work_sync(&data->work);
free_irq(extcon_data->irq, extcon_data);
return 0; return 0;
} }
@ -144,12 +154,12 @@ static int gpio_extcon_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int gpio_extcon_resume(struct device *dev) static int gpio_extcon_resume(struct device *dev)
{ {
struct gpio_extcon_data *extcon_data; struct gpio_extcon_data *data;
extcon_data = dev_get_drvdata(dev); data = dev_get_drvdata(dev);
if (extcon_data->check_on_resume) if (data->pdata->check_on_resume)
queue_delayed_work(system_power_efficient_wq, queue_delayed_work(system_power_efficient_wq,
&extcon_data->work, extcon_data->debounce_jiffies); &data->work, data->debounce_jiffies);
return 0; return 0;
} }

View File

@ -150,10 +150,10 @@ enum max14577_muic_acc_type {
static const unsigned int max14577_extcon_cable[] = { static const unsigned int max14577_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_FAST_CHARGER, EXTCON_CHG_USB_FAST,
EXTCON_SLOW_CHARGER, EXTCON_CHG_USB_SLOW,
EXTCON_CHARGE_DOWNSTREAM, EXTCON_CHG_USB_CDP,
EXTCON_JIG, EXTCON_JIG,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -456,18 +456,19 @@ static int max14577_muic_chg_handler(struct max14577_muic_info *info)
extcon_set_cable_state_(info->edev, EXTCON_USB, attached); extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
break; break;
case MAX14577_CHARGER_TYPE_DEDICATED_CHG: case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
extcon_set_cable_state_(info->edev, EXTCON_TA, attached); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
attached);
break; break;
case MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT: case MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT:
extcon_set_cable_state_(info->edev, EXTCON_CHARGE_DOWNSTREAM, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
attached); attached);
break; break;
case MAX14577_CHARGER_TYPE_SPECIAL_500MA: case MAX14577_CHARGER_TYPE_SPECIAL_500MA:
extcon_set_cable_state_(info->edev, EXTCON_SLOW_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
attached); attached);
break; break;
case MAX14577_CHARGER_TYPE_SPECIAL_1A: case MAX14577_CHARGER_TYPE_SPECIAL_1A:
extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
attached); attached);
break; break;
case MAX14577_CHARGER_TYPE_NONE: case MAX14577_CHARGER_TYPE_NONE:

View File

@ -204,11 +204,11 @@ enum max77693_muic_acc_type {
static const unsigned int max77693_extcon_cable[] = { static const unsigned int max77693_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_USB_HOST, EXTCON_USB_HOST,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_FAST_CHARGER, EXTCON_CHG_USB_FAST,
EXTCON_SLOW_CHARGER, EXTCON_CHG_USB_SLOW,
EXTCON_CHARGE_DOWNSTREAM, EXTCON_CHG_USB_CDP,
EXTCON_MHL, EXTCON_DISP_MHL,
EXTCON_JIG, EXTCON_JIG,
EXTCON_DOCK, EXTCON_DOCK,
EXTCON_NONE, EXTCON_NONE,
@ -505,7 +505,7 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_DOCK, attached); extcon_set_cable_state_(info->edev, EXTCON_DOCK, attached);
extcon_set_cable_state_(info->edev, EXTCON_MHL, attached); extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
goto out; goto out;
case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE: /* Dock-Desk */ case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE: /* Dock-Desk */
dock_id = EXTCON_DOCK; dock_id = EXTCON_DOCK;
@ -605,7 +605,7 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
case MAX77693_MUIC_GND_MHL: case MAX77693_MUIC_GND_MHL:
case MAX77693_MUIC_GND_MHL_VB: case MAX77693_MUIC_GND_MHL_VB:
/* MHL or MHL with USB/TA cable */ /* MHL or MHL with USB/TA cable */
extcon_set_cable_state_(info->edev, EXTCON_MHL, attached); extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
break; break;
default: default:
dev_err(info->dev, "failed to detect %s cable of gnd type\n", dev_err(info->dev, "failed to detect %s cable of gnd type\n",
@ -801,10 +801,11 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
* - Support charging through micro-usb port without * - Support charging through micro-usb port without
* data connection * data connection
*/ */
extcon_set_cable_state_(info->edev, EXTCON_TA, attached); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
attached);
if (!cable_attached) if (!cable_attached)
extcon_set_cable_state_(info->edev, EXTCON_MHL, extcon_set_cable_state_(info->edev,
cable_attached); EXTCON_DISP_MHL, cable_attached);
break; break;
} }
@ -862,7 +863,7 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
extcon_set_cable_state_(info->edev, EXTCON_DOCK, extcon_set_cable_state_(info->edev, EXTCON_DOCK,
attached); attached);
extcon_set_cable_state_(info->edev, EXTCON_MHL, extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
attached); attached);
break; break;
} }
@ -901,20 +902,21 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
break; break;
case MAX77693_CHARGER_TYPE_DEDICATED_CHG: case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
/* Only TA cable */ /* Only TA cable */
extcon_set_cable_state_(info->edev, EXTCON_TA, attached); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
attached);
break; break;
} }
break; break;
case MAX77693_CHARGER_TYPE_DOWNSTREAM_PORT: case MAX77693_CHARGER_TYPE_DOWNSTREAM_PORT:
extcon_set_cable_state_(info->edev, EXTCON_CHARGE_DOWNSTREAM, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
attached); attached);
break; break;
case MAX77693_CHARGER_TYPE_APPLE_500MA: case MAX77693_CHARGER_TYPE_APPLE_500MA:
extcon_set_cable_state_(info->edev, EXTCON_SLOW_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
attached); attached);
break; break;
case MAX77693_CHARGER_TYPE_APPLE_1A_2A: case MAX77693_CHARGER_TYPE_APPLE_1A_2A:
extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
attached); attached);
break; break;
case MAX77693_CHARGER_TYPE_DEAD_BATTERY: case MAX77693_CHARGER_TYPE_DEAD_BATTERY:

View File

@ -122,11 +122,11 @@ enum max77843_muic_charger_type {
static const unsigned int max77843_extcon_cable[] = { static const unsigned int max77843_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_USB_HOST, EXTCON_USB_HOST,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_CHARGE_DOWNSTREAM, EXTCON_CHG_USB_CDP,
EXTCON_FAST_CHARGER, EXTCON_CHG_USB_FAST,
EXTCON_SLOW_CHARGER, EXTCON_CHG_USB_SLOW,
EXTCON_MHL, EXTCON_DISP_MHL,
EXTCON_JIG, EXTCON_JIG,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -355,7 +355,7 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_MHL, attached); extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
break; break;
default: default:
dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n", dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n",
@ -494,7 +494,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_CHARGE_DOWNSTREAM, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
attached); attached);
break; break;
case MAX77843_MUIC_CHG_DEDICATED: case MAX77843_MUIC_CHG_DEDICATED:
@ -504,7 +504,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_TA, attached); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
attached);
break; break;
case MAX77843_MUIC_CHG_SPECIAL_500MA: case MAX77843_MUIC_CHG_SPECIAL_500MA:
ret = max77843_muic_set_path(info, ret = max77843_muic_set_path(info,
@ -513,7 +514,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_SLOW_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
attached); attached);
break; break;
case MAX77843_MUIC_CHG_SPECIAL_1A: case MAX77843_MUIC_CHG_SPECIAL_1A:
@ -523,7 +524,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0) if (ret < 0)
return ret; return ret;
extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
attached); attached);
break; break;
case MAX77843_MUIC_CHG_GND: case MAX77843_MUIC_CHG_GND:
@ -532,9 +533,11 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
/* Charger cable on MHL accessory is attach or detach */ /* Charger cable on MHL accessory is attach or detach */
if (gnd_type == MAX77843_MUIC_GND_MHL_VB) if (gnd_type == MAX77843_MUIC_GND_MHL_VB)
extcon_set_cable_state_(info->edev, EXTCON_TA, true); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
true);
else if (gnd_type == MAX77843_MUIC_GND_MHL) else if (gnd_type == MAX77843_MUIC_GND_MHL)
extcon_set_cable_state_(info->edev, EXTCON_TA, false); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
false);
break; break;
case MAX77843_MUIC_CHG_NONE: case MAX77843_MUIC_CHG_NONE:
break; break;

View File

@ -148,11 +148,11 @@ struct max8997_muic_info {
static const unsigned int max8997_extcon_cable[] = { static const unsigned int max8997_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_USB_HOST, EXTCON_USB_HOST,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_FAST_CHARGER, EXTCON_CHG_USB_FAST,
EXTCON_SLOW_CHARGER, EXTCON_CHG_USB_SLOW,
EXTCON_CHARGE_DOWNSTREAM, EXTCON_CHG_USB_CDP,
EXTCON_MHL, EXTCON_DISP_MHL,
EXTCON_DOCK, EXTCON_DOCK,
EXTCON_JIG, EXTCON_JIG,
EXTCON_NONE, EXTCON_NONE,
@ -403,7 +403,7 @@ static int max8997_muic_adc_handler(struct max8997_muic_info *info)
return ret; return ret;
break; break;
case MAX8997_MUIC_ADC_MHL: case MAX8997_MUIC_ADC_MHL:
extcon_set_cable_state_(info->edev, EXTCON_MHL, attached); extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
break; break;
case MAX8997_MUIC_ADC_FACTORY_MODE_USB_OFF: case MAX8997_MUIC_ADC_FACTORY_MODE_USB_OFF:
case MAX8997_MUIC_ADC_FACTORY_MODE_USB_ON: case MAX8997_MUIC_ADC_FACTORY_MODE_USB_ON:
@ -486,18 +486,19 @@ static int max8997_muic_chg_handler(struct max8997_muic_info *info)
} }
break; break;
case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT: case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT:
extcon_set_cable_state_(info->edev, EXTCON_CHARGE_DOWNSTREAM, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
attached); attached);
break; break;
case MAX8997_CHARGER_TYPE_DEDICATED_CHG: case MAX8997_CHARGER_TYPE_DEDICATED_CHG:
extcon_set_cable_state_(info->edev, EXTCON_TA, attached); extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
attached);
break; break;
case MAX8997_CHARGER_TYPE_500MA: case MAX8997_CHARGER_TYPE_500MA:
extcon_set_cable_state_(info->edev, EXTCON_SLOW_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
attached); attached);
break; break;
case MAX8997_CHARGER_TYPE_1A: case MAX8997_CHARGER_TYPE_1A:
extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER, extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
attached); attached);
break; break;
default: default:

View File

@ -93,7 +93,7 @@ static struct reg_data rt8973a_reg_data[] = {
static const unsigned int rt8973a_extcon_cable[] = { static const unsigned int rt8973a_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_USB_HOST, EXTCON_USB_HOST,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_JIG, EXTCON_JIG,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -333,7 +333,7 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info,
con_sw = DM_DP_SWITCH_USB; con_sw = DM_DP_SWITCH_USB;
break; break;
case RT8973A_MUIC_ADC_TA: case RT8973A_MUIC_ADC_TA:
id = EXTCON_TA; id = EXTCON_CHG_USB_DCP;
con_sw = DM_DP_SWITCH_OPEN; con_sw = DM_DP_SWITCH_OPEN;
break; break;
case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB: case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB:
@ -594,7 +594,7 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c,
for (i = 0; i < info->num_muic_irqs; i++) { for (i = 0; i < info->num_muic_irqs; i++) {
struct muic_irq *muic_irq = &info->muic_irqs[i]; struct muic_irq *muic_irq = &info->muic_irqs[i];
unsigned int virq = 0; int virq = 0;
virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq); virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq);
if (virq <= 0) if (virq <= 0)
@ -658,6 +658,7 @@ static const struct of_device_id rt8973a_dt_match[] = {
{ .compatible = "richtek,rt8973a-muic" }, { .compatible = "richtek,rt8973a-muic" },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, rt8973a_dt_match);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int rt8973a_muic_suspend(struct device *dev) static int rt8973a_muic_suspend(struct device *dev)

View File

@ -95,7 +95,7 @@ static struct reg_data sm5502_reg_data[] = {
static const unsigned int sm5502_extcon_cable[] = { static const unsigned int sm5502_extcon_cable[] = {
EXTCON_USB, EXTCON_USB,
EXTCON_USB_HOST, EXTCON_USB_HOST,
EXTCON_TA, EXTCON_CHG_USB_DCP,
EXTCON_NONE, EXTCON_NONE,
}; };
@ -389,7 +389,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
vbus_sw = VBUSIN_SWITCH_VBUSOUT_WITH_USB; vbus_sw = VBUSIN_SWITCH_VBUSOUT_WITH_USB;
break; break;
case SM5502_MUIC_ADC_OPEN_TA: case SM5502_MUIC_ADC_OPEN_TA:
id = EXTCON_TA; id = EXTCON_CHG_USB_DCP;
con_sw = DM_DP_SWITCH_OPEN; con_sw = DM_DP_SWITCH_OPEN;
vbus_sw = VBUSIN_SWITCH_VBUSOUT; vbus_sw = VBUSIN_SWITCH_VBUSOUT;
break; break;
@ -586,7 +586,7 @@ static int sm5022_muic_i2c_probe(struct i2c_client *i2c,
for (i = 0; i < info->num_muic_irqs; i++) { for (i = 0; i < info->num_muic_irqs; i++) {
struct muic_irq *muic_irq = &info->muic_irqs[i]; struct muic_irq *muic_irq = &info->muic_irqs[i];
unsigned int virq = 0; int virq = 0;
virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq); virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq);
if (virq <= 0) if (virq <= 0)
@ -650,6 +650,7 @@ static const struct of_device_id sm5502_dt_match[] = {
{ .compatible = "siliconmitus,sm5502-muic" }, { .compatible = "siliconmitus,sm5502-muic" },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, sm5502_dt_match);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int sm5502_muic_suspend(struct device *dev) static int sm5502_muic_suspend(struct device *dev)

View File

@ -45,28 +45,31 @@ static const char *extcon_name[] = {
[EXTCON_USB] = "USB", [EXTCON_USB] = "USB",
[EXTCON_USB_HOST] = "USB-HOST", [EXTCON_USB_HOST] = "USB-HOST",
/* Charger external connector */ /* Charging external connector */
[EXTCON_TA] = "TA", [EXTCON_CHG_USB_SDP] = "SDP",
[EXTCON_FAST_CHARGER] = "FAST-CHARGER", [EXTCON_CHG_USB_DCP] = "DCP",
[EXTCON_SLOW_CHARGER] = "SLOW-CHARGER", [EXTCON_CHG_USB_CDP] = "CDP",
[EXTCON_CHARGE_DOWNSTREAM] = "CHARGE-DOWNSTREAM", [EXTCON_CHG_USB_ACA] = "ACA",
[EXTCON_CHG_USB_FAST] = "FAST-CHARGER",
[EXTCON_CHG_USB_SLOW] = "SLOW-CHARGER",
/* Audio/Video external connector */ /* Jack external connector */
[EXTCON_LINE_IN] = "LINE-IN", [EXTCON_JACK_MICROPHONE] = "MICROPHONE",
[EXTCON_LINE_OUT] = "LINE-OUT", [EXTCON_JACK_HEADPHONE] = "HEADPHONE",
[EXTCON_MICROPHONE] = "MICROPHONE", [EXTCON_JACK_LINE_IN] = "LINE-IN",
[EXTCON_HEADPHONE] = "HEADPHONE", [EXTCON_JACK_LINE_OUT] = "LINE-OUT",
[EXTCON_JACK_VIDEO_IN] = "VIDEO-IN",
[EXTCON_JACK_VIDEO_OUT] = "VIDEO-OUT",
[EXTCON_JACK_SPDIF_IN] = "SPDIF-IN",
[EXTCON_JACK_SPDIF_OUT] = "SPDIF-OUT",
[EXTCON_HDMI] = "HDMI", /* Display external connector */
[EXTCON_MHL] = "MHL", [EXTCON_DISP_HDMI] = "HDMI",
[EXTCON_DVI] = "DVI", [EXTCON_DISP_MHL] = "MHL",
[EXTCON_VGA] = "VGA", [EXTCON_DISP_DVI] = "DVI",
[EXTCON_SPDIF_IN] = "SPDIF-IN", [EXTCON_DISP_VGA] = "VGA",
[EXTCON_SPDIF_OUT] = "SPDIF-OUT",
[EXTCON_VIDEO_IN] = "VIDEO-IN",
[EXTCON_VIDEO_OUT] = "VIDEO-OUT",
/* Etc external connector */ /* Miscellaneous external connector */
[EXTCON_DOCK] = "DOCK", [EXTCON_DOCK] = "DOCK",
[EXTCON_JIG] = "JIG", [EXTCON_JIG] = "JIG",
[EXTCON_MECHANICAL] = "MECHANICAL", [EXTCON_MECHANICAL] = "MECHANICAL",

View File

@ -1481,6 +1481,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x00000C04, 0xA101 }, /* R3076 - GPIO5 CTRL */ { 0x00000C04, 0xA101 }, /* R3076 - GPIO5 CTRL */
{ 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */ { 0x00000C0F, 0x0400 }, /* R3087 - IRQ CTRL 1 */
{ 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */ { 0x00000C10, 0x1000 }, /* R3088 - GPIO Debounce Config */
{ 0x00000C18, 0x0000 }, /* R3096 - GP Switch 1 */
{ 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */ { 0x00000C20, 0x8002 }, /* R3104 - Misc Pad Ctrl 1 */
{ 0x00000C21, 0x8001 }, /* R3105 - Misc Pad Ctrl 2 */ { 0x00000C21, 0x8001 }, /* R3105 - Misc Pad Ctrl 2 */
{ 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */ { 0x00000C22, 0x0000 }, /* R3106 - Misc Pad Ctrl 3 */
@ -1811,6 +1812,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_MIC_DETECT_1: case ARIZONA_MIC_DETECT_1:
case ARIZONA_MIC_DETECT_2: case ARIZONA_MIC_DETECT_2:
case ARIZONA_MIC_DETECT_3: case ARIZONA_MIC_DETECT_3:
case ARIZONA_MIC_DETECT_4:
case ARIZONA_MIC_DETECT_LEVEL_1: case ARIZONA_MIC_DETECT_LEVEL_1:
case ARIZONA_MIC_DETECT_LEVEL_2: case ARIZONA_MIC_DETECT_LEVEL_2:
case ARIZONA_MIC_DETECT_LEVEL_3: case ARIZONA_MIC_DETECT_LEVEL_3:
@ -1910,6 +1912,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_HP1_SHORT_CIRCUIT_CTRL: case ARIZONA_HP1_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP2_SHORT_CIRCUIT_CTRL: case ARIZONA_HP2_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP3_SHORT_CIRCUIT_CTRL: case ARIZONA_HP3_SHORT_CIRCUIT_CTRL:
case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_AIF1_BCLK_CTRL: case ARIZONA_AIF1_BCLK_CTRL:
case ARIZONA_AIF1_TX_PIN_CTRL: case ARIZONA_AIF1_TX_PIN_CTRL:
case ARIZONA_AIF1_RX_PIN_CTRL: case ARIZONA_AIF1_RX_PIN_CTRL:
@ -2527,6 +2530,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_GPIO5_CTRL: case ARIZONA_GPIO5_CTRL:
case ARIZONA_IRQ_CTRL_1: case ARIZONA_IRQ_CTRL_1:
case ARIZONA_GPIO_DEBOUNCE_CONFIG: case ARIZONA_GPIO_DEBOUNCE_CONFIG:
case ARIZONA_GP_SWITCH_1:
case ARIZONA_MISC_PAD_CTRL_1: case ARIZONA_MISC_PAD_CTRL_1:
case ARIZONA_MISC_PAD_CTRL_2: case ARIZONA_MISC_PAD_CTRL_2:
case ARIZONA_MISC_PAD_CTRL_3: case ARIZONA_MISC_PAD_CTRL_3:
@ -2847,12 +2851,14 @@ static bool wm5110_volatile_register(struct device *dev, unsigned int reg)
case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS: case ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS:
case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS: case ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS:
case ARIZONA_MIC_DETECT_3: case ARIZONA_MIC_DETECT_3:
case ARIZONA_MIC_DETECT_4:
case ARIZONA_HP_CTRL_1L: case ARIZONA_HP_CTRL_1L:
case ARIZONA_HP_CTRL_1R: case ARIZONA_HP_CTRL_1R:
case ARIZONA_HEADPHONE_DETECT_2: case ARIZONA_HEADPHONE_DETECT_2:
case ARIZONA_INPUT_ENABLES_STATUS: case ARIZONA_INPUT_ENABLES_STATUS:
case ARIZONA_OUTPUT_STATUS_1: case ARIZONA_OUTPUT_STATUS_1:
case ARIZONA_RAW_OUTPUT_STATUS_1: case ARIZONA_RAW_OUTPUT_STATUS_1:
case ARIZONA_HP_TEST_CTRL_1:
case ARIZONA_SLIMBUS_RX_PORT_STATUS: case ARIZONA_SLIMBUS_RX_PORT_STATUS:
case ARIZONA_SLIMBUS_TX_PORT_STATUS: case ARIZONA_SLIMBUS_TX_PORT_STATUS:
case ARIZONA_INTERRUPT_STATUS_1: case ARIZONA_INTERRUPT_STATUS_1:

View File

@ -107,5 +107,7 @@
#define ARIZONA_ACCDET_MODE_MIC 0 #define ARIZONA_ACCDET_MODE_MIC 0
#define ARIZONA_ACCDET_MODE_HPL 1 #define ARIZONA_ACCDET_MODE_HPL 1
#define ARIZONA_ACCDET_MODE_HPR 2 #define ARIZONA_ACCDET_MODE_HPR 2
#define ARIZONA_ACCDET_MODE_HPM 4
#define ARIZONA_ACCDET_MODE_ADC 7
#endif #endif

View File

@ -33,30 +33,40 @@
*/ */
#define EXTCON_NONE 0 #define EXTCON_NONE 0
#define EXTCON_USB 1 /* USB connector */ /* USB external connector */
#define EXTCON_USB 1
#define EXTCON_USB_HOST 2 #define EXTCON_USB_HOST 2
#define EXTCON_TA 3 /* Charger connector */ /* Charging external connector */
#define EXTCON_FAST_CHARGER 4 #define EXTCON_CHG_USB_SDP 5 /* Standard Downstream Port */
#define EXTCON_SLOW_CHARGER 5 #define EXTCON_CHG_USB_DCP 6 /* Dedicated Charging Port */
#define EXTCON_CHARGE_DOWNSTREAM 6 #define EXTCON_CHG_USB_CDP 7 /* Charging Downstream Port */
#define EXTCON_CHG_USB_ACA 8 /* Accessory Charger Adapter */
#define EXTCON_CHG_USB_FAST 9
#define EXTCON_CHG_USB_SLOW 10
#define EXTCON_LINE_IN 7 /* Audio/Video connector */ /* Jack external connector */
#define EXTCON_LINE_OUT 8 #define EXTCON_JACK_MICROPHONE 20
#define EXTCON_MICROPHONE 9 #define EXTCON_JACK_HEADPHONE 21
#define EXTCON_HEADPHONE 10 #define EXTCON_JACK_LINE_IN 22
#define EXTCON_HDMI 11 #define EXTCON_JACK_LINE_OUT 23
#define EXTCON_MHL 12 #define EXTCON_JACK_VIDEO_IN 24
#define EXTCON_DVI 13 #define EXTCON_JACK_VIDEO_OUT 25
#define EXTCON_VGA 14 #define EXTCON_JACK_SPDIF_IN 26 /* Sony Philips Digital InterFace */
#define EXTCON_SPDIF_IN 15 #define EXTCON_JACK_SPDIF_OUT 27
#define EXTCON_SPDIF_OUT 16
#define EXTCON_VIDEO_IN 17
#define EXTCON_VIDEO_OUT 18
#define EXTCON_DOCK 19 /* Misc connector */ /* Display external connector */
#define EXTCON_JIG 20 #define EXTCON_DISP_HDMI 40 /* High-Definition Multimedia Interface */
#define EXTCON_MECHANICAL 21 #define EXTCON_DISP_MHL 41 /* Mobile High-Definition Link */
#define EXTCON_DISP_DVI 42 /* Digital Visual Interface */
#define EXTCON_DISP_VGA 43 /* Video Graphics Array */
/* Miscellaneous external connector */
#define EXTCON_DOCK 60
#define EXTCON_JIG 61
#define EXTCON_MECHANICAL 62
#define EXTCON_NUM 63
struct extcon_cable; struct extcon_cable;

View File

@ -1,5 +1,5 @@
/* /*
* External connector (extcon) class generic GPIO driver * Single-state GPIO extcon driver based on extcon class
* *
* Copyright (C) 2012 Samsung Electronics * Copyright (C) 2012 Samsung Electronics
* Author: MyungJoo Ham <myungjoo.ham@samsung.com> * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
@ -16,7 +16,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*
*/ */
#ifndef __EXTCON_GPIO_H__ #ifndef __EXTCON_GPIO_H__
#define __EXTCON_GPIO_H__ __FILE__ #define __EXTCON_GPIO_H__ __FILE__
@ -24,35 +23,24 @@
#include <linux/extcon.h> #include <linux/extcon.h>
/** /**
* struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. * struct gpio_extcon_pdata - A simple GPIO-controlled extcon device.
* @name: The name of this GPIO extcon device. * @extcon_id: The unique id of specific external connector.
* @gpio: Corresponding GPIO. * @gpio: Corresponding GPIO.
* @gpio_active_low: Boolean describing whether gpio active state is 1 or 0 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
* If true, low state of gpio means active. * If true, low state of gpio means active.
* If false, high state of gpio means active. * If false, high state of gpio means active.
* @debounce: Debounce time for GPIO IRQ in ms. * @debounce: Debounce time for GPIO IRQ in ms.
* @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW). * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
* @state_on: print_state is overriden with state_on if attached.
* If NULL, default method of extcon class is used.
* @state_off: print_state is overriden with state_off if detached.
* If NUll, default method of extcon class is used.
* @check_on_resume: Boolean describing whether to check the state of gpio * @check_on_resume: Boolean describing whether to check the state of gpio
* while resuming from sleep. * while resuming from sleep.
*
* Note that in order for state_on or state_off to be valid, both state_on
* and state_off should be not NULL. If at least one of them is NULL,
* the print_state is not overriden.
*/ */
struct gpio_extcon_platform_data { struct gpio_extcon_pdata {
const char *name; unsigned int extcon_id;
unsigned gpio; unsigned gpio;
bool gpio_active_low; bool gpio_active_low;
unsigned long debounce; unsigned long debounce;
unsigned long irq_flags; unsigned long irq_flags;
/* if NULL, "0" or "1" will be printed */
const char *state_on;
const char *state_off;
bool check_on_resume; bool check_on_resume;
}; };

View File

@ -124,6 +124,9 @@ struct arizona_pdata {
/** Channel to use for headphone detection */ /** Channel to use for headphone detection */
unsigned int hpdet_channel; unsigned int hpdet_channel;
/** Use software comparison to determine mic presence */
bool micd_software_compare;
/** Extra debounce timeout used during initial mic detection (ms) */ /** Extra debounce timeout used during initial mic detection (ms) */
unsigned int micd_detect_debounce; unsigned int micd_detect_debounce;
@ -181,6 +184,9 @@ struct arizona_pdata {
/** GPIO for primary IRQ (used for edge triggered emulation) */ /** GPIO for primary IRQ (used for edge triggered emulation) */
int irq_gpio; int irq_gpio;
/** General purpose switch control */
unsigned int gpsw;
}; };
#endif #endif

View File

@ -242,6 +242,7 @@
#define ARIZONA_HP1_SHORT_CIRCUIT_CTRL 0x4A0 #define ARIZONA_HP1_SHORT_CIRCUIT_CTRL 0x4A0
#define ARIZONA_HP2_SHORT_CIRCUIT_CTRL 0x4A1 #define ARIZONA_HP2_SHORT_CIRCUIT_CTRL 0x4A1
#define ARIZONA_HP3_SHORT_CIRCUIT_CTRL 0x4A2 #define ARIZONA_HP3_SHORT_CIRCUIT_CTRL 0x4A2
#define ARIZONA_HP_TEST_CTRL_1 0x4A4
#define ARIZONA_SPK_CTRL_2 0x4B5 #define ARIZONA_SPK_CTRL_2 0x4B5
#define ARIZONA_SPK_CTRL_3 0x4B6 #define ARIZONA_SPK_CTRL_3 0x4B6
#define ARIZONA_DAC_COMP_1 0x4DC #define ARIZONA_DAC_COMP_1 0x4DC
@ -2359,9 +2360,9 @@
#define ARIZONA_ACCDET_SRC_MASK 0x2000 /* ACCDET_SRC */ #define ARIZONA_ACCDET_SRC_MASK 0x2000 /* ACCDET_SRC */
#define ARIZONA_ACCDET_SRC_SHIFT 13 /* ACCDET_SRC */ #define ARIZONA_ACCDET_SRC_SHIFT 13 /* ACCDET_SRC */
#define ARIZONA_ACCDET_SRC_WIDTH 1 /* ACCDET_SRC */ #define ARIZONA_ACCDET_SRC_WIDTH 1 /* ACCDET_SRC */
#define ARIZONA_ACCDET_MODE_MASK 0x0003 /* ACCDET_MODE - [1:0] */ #define ARIZONA_ACCDET_MODE_MASK 0x0007 /* ACCDET_MODE - [2:0] */
#define ARIZONA_ACCDET_MODE_SHIFT 0 /* ACCDET_MODE - [1:0] */ #define ARIZONA_ACCDET_MODE_SHIFT 0 /* ACCDET_MODE - [2:0] */
#define ARIZONA_ACCDET_MODE_WIDTH 2 /* ACCDET_MODE - [1:0] */ #define ARIZONA_ACCDET_MODE_WIDTH 3 /* ACCDET_MODE - [2:0] */
/* /*
* R667 (0x29B) - Headphone Detect 1 * R667 (0x29B) - Headphone Detect 1
@ -3701,6 +3702,13 @@
#define ARIZONA_HP3_SC_ENA_SHIFT 12 /* HP3_SC_ENA */ #define ARIZONA_HP3_SC_ENA_SHIFT 12 /* HP3_SC_ENA */
#define ARIZONA_HP3_SC_ENA_WIDTH 1 /* HP3_SC_ENA */ #define ARIZONA_HP3_SC_ENA_WIDTH 1 /* HP3_SC_ENA */
/*
* R1188 (0x4A4) HP Test Ctrl 1
*/
#define ARIZONA_HP1_TST_CAP_SEL_MASK 0x0003 /* HP1_TST_CAP_SEL - [1:0] */
#define ARIZONA_HP1_TST_CAP_SEL_SHIFT 0 /* HP1_TST_CAP_SEL - [1:0] */
#define ARIZONA_HP1_TST_CAP_SEL_WIDTH 2 /* HP1_TST_CAP_SEL - [1:0] */
/* /*
* R1244 (0x4DC) - DAC comp 1 * R1244 (0x4DC) - DAC comp 1
*/ */