aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 23:47:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 23:47:25 -0400
commit2424a7339bdc5468b8a6b3bddd750647e45b314d (patch)
treeec1e5df7df1a3d54d6cb4952914955b301eaab82 /drivers/extcon/extcon-arizona.c
parent33b06938cf81939135448ed448ee5aa95fa86d04 (diff)
parent42d7d7539a7bcf1d493b989465283c464f4a0525 (diff)
Merge tag 'extcon-next-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next
Chanwoo writes: Update extcon for 3.13 This patchset modify extcon core to remove unnecessary allocation sequence for 'dev' instance and change extcon_dev_register() interface. extcon-gpio use gpiolib API to get debounce time and include small fix of extcon core/device driver. Detailed description for patchset: 1. Modify extcon core driver - The extcon-gpio driver use gpio_set_debounce() API provided from gpiolib if gpio driver for SoC support gpio_set_debounce() function and support 'gpio_ activ_low' filed to check whether gpio active state is 1(high) or 0(low). - Change field type of 'dev' in structure extcon_dev and remove the sequence of allocating memory of 'struct dev' on extcon_dev_register() function because extcon device must need 'struct device. - Change extcon_dev_register() prototype to simplify it and remove unnecessary parameter as below: 2. Fix coding style and typo - extcon core : Fix indentation coding style and remove unnecessary casting - extcon-max8997 : Fix checkpatch warning - extcon-max77693 : Fix checkpatch warning - extcon-arizona : Fix typo of comment and modify minor issue - extcon-palmas : Use dev_get_platdata() 3. Modify extcon-arizona driver - Modify minor issue about micbias and comparision statement
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r--drivers/extcon/extcon-arizona.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 91a702beccc5..3c55ec856e39 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -86,8 +86,8 @@ struct arizona_extcon_info {
86}; 86};
87 87
88static const struct arizona_micd_config micd_default_modes[] = { 88static const struct arizona_micd_config micd_default_modes[] = {
89 { ARIZONA_ACCDET_SRC, 1 << ARIZONA_MICD_BIAS_SRC_SHIFT, 0 }, 89 { ARIZONA_ACCDET_SRC, 1, 0 },
90 { 0, 2 << ARIZONA_MICD_BIAS_SRC_SHIFT, 1 }, 90 { 0, 2, 1 },
91}; 91};
92 92
93static const struct arizona_micd_range micd_default_ranges[] = { 93static const struct arizona_micd_range micd_default_ranges[] = {
@@ -182,7 +182,8 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
182 info->micd_modes[mode].gpio); 182 info->micd_modes[mode].gpio);
183 regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1, 183 regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
184 ARIZONA_MICD_BIAS_SRC_MASK, 184 ARIZONA_MICD_BIAS_SRC_MASK,
185 info->micd_modes[mode].bias); 185 info->micd_modes[mode].bias <<
186 ARIZONA_MICD_BIAS_SRC_SHIFT);
186 regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1, 187 regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1,
187 ARIZONA_ACCDET_SRC, info->micd_modes[mode].src); 188 ARIZONA_ACCDET_SRC, info->micd_modes[mode].src);
188 189
@@ -193,7 +194,7 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
193 194
194static const char *arizona_extcon_get_micbias(struct arizona_extcon_info *info) 195static const char *arizona_extcon_get_micbias(struct arizona_extcon_info *info)
195{ 196{
196 switch (info->micd_modes[0].bias >> ARIZONA_MICD_BIAS_SRC_SHIFT) { 197 switch (info->micd_modes[0].bias) {
197 case 1: 198 case 1:
198 return "MICBIAS1"; 199 return "MICBIAS1";
199 case 2: 200 case 2:
@@ -388,7 +389,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
388 >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT; 389 >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT;
389 390
390 if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 && 391 if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 &&
391 (val < 100 || val > 0x3fb)) { 392 (val < 100 || val >= 0x3fb)) {
392 range++; 393 range++;
393 dev_dbg(arizona->dev, "Moving to HPDET range %d\n", 394 dev_dbg(arizona->dev, "Moving to HPDET range %d\n",
394 range); 395 range);
@@ -401,7 +402,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
401 } 402 }
402 403
403 /* If we go out of range report top of range */ 404 /* If we go out of range report top of range */
404 if (val < 100 || val > 0x3fb) { 405 if (val < 100 || val >= 0x3fb) {
405 dev_dbg(arizona->dev, "Measurement out of range\n"); 406 dev_dbg(arizona->dev, "Measurement out of range\n");
406 return ARIZONA_HPDET_MAX; 407 return ARIZONA_HPDET_MAX;
407 } 408 }
@@ -514,7 +515,7 @@ static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading,
514 } 515 }
515 516
516 /* 517 /*
517 * If we measure the mic as 518 * If we measure the mic as high impedance
518 */ 519 */
519 if (!id_gpio || info->hpdet_res[1] > 50) { 520 if (!id_gpio || info->hpdet_res[1] > 50) {
520 dev_dbg(arizona->dev, "Detected mic\n"); 521 dev_dbg(arizona->dev, "Detected mic\n");
@@ -1042,6 +1043,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
1042 else 1043 else
1043 info->micd_timeout = DEFAULT_MICD_TIMEOUT; 1044 info->micd_timeout = DEFAULT_MICD_TIMEOUT;
1044 1045
1046out:
1045 /* Clear trig_sts to make sure DCVDD is not forced up */ 1047 /* Clear trig_sts to make sure DCVDD is not forced up */
1046 regmap_write(arizona->regmap, ARIZONA_AOD_WKUP_AND_TRIG, 1048 regmap_write(arizona->regmap, ARIZONA_AOD_WKUP_AND_TRIG,
1047 ARIZONA_MICD_CLAMP_FALL_TRIG_STS | 1049 ARIZONA_MICD_CLAMP_FALL_TRIG_STS |
@@ -1049,7 +1051,6 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
1049 ARIZONA_JD1_FALL_TRIG_STS | 1051 ARIZONA_JD1_FALL_TRIG_STS |
1050 ARIZONA_JD1_RISE_TRIG_STS); 1052 ARIZONA_JD1_RISE_TRIG_STS);
1051 1053
1052out:
1053 mutex_unlock(&info->lock); 1054 mutex_unlock(&info->lock);
1054 1055
1055 pm_runtime_mark_last_busy(info->dev); 1056 pm_runtime_mark_last_busy(info->dev);
@@ -1132,9 +1133,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
1132 } 1133 }
1133 1134
1134 info->edev.name = "Headset Jack"; 1135 info->edev.name = "Headset Jack";
1136 info->edev.dev.parent = arizona->dev;
1135 info->edev.supported_cable = arizona_cable; 1137 info->edev.supported_cable = arizona_cable;
1136 1138
1137 ret = extcon_dev_register(&info->edev, arizona->dev); 1139 ret = extcon_dev_register(&info->edev);
1138 if (ret < 0) { 1140 if (ret < 0) {
1139 dev_err(arizona->dev, "extcon_dev_register() failed: %d\n", 1141 dev_err(arizona->dev, "extcon_dev_register() failed: %d\n",
1140 ret); 1142 ret);