diff options
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index ec9a14e05fdd..3c55ec856e39 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -565,11 +565,10 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) | |||
565 | } | 565 | } |
566 | 566 | ||
567 | ret = arizona_hpdet_read(info); | 567 | ret = arizona_hpdet_read(info); |
568 | if (ret == -EAGAIN) { | 568 | if (ret == -EAGAIN) |
569 | goto out; | 569 | goto out; |
570 | } else if (ret < 0) { | 570 | else if (ret < 0) |
571 | goto done; | 571 | goto done; |
572 | } | ||
573 | reading = ret; | 572 | reading = ret; |
574 | 573 | ||
575 | /* Reset back to starting range */ | 574 | /* Reset back to starting range */ |
@@ -579,11 +578,10 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) | |||
579 | 0); | 578 | 0); |
580 | 579 | ||
581 | ret = arizona_hpdet_do_id(info, &reading, &mic); | 580 | ret = arizona_hpdet_do_id(info, &reading, &mic); |
582 | if (ret == -EAGAIN) { | 581 | if (ret == -EAGAIN) |
583 | goto out; | 582 | goto out; |
584 | } else if (ret < 0) { | 583 | else if (ret < 0) |
585 | goto done; | 584 | goto done; |
586 | } | ||
587 | 585 | ||
588 | /* Report high impedence cables as line outputs */ | 586 | /* Report high impedence cables as line outputs */ |
589 | if (reading >= 5000) | 587 | if (reading >= 5000) |
@@ -739,8 +737,8 @@ err: | |||
739 | static void arizona_micd_timeout_work(struct work_struct *work) | 737 | static void arizona_micd_timeout_work(struct work_struct *work) |
740 | { | 738 | { |
741 | struct arizona_extcon_info *info = container_of(work, | 739 | struct arizona_extcon_info *info = container_of(work, |
742 | struct arizona_extcon_info, | 740 | struct arizona_extcon_info, |
743 | micd_timeout_work.work); | 741 | micd_timeout_work.work); |
744 | 742 | ||
745 | mutex_lock(&info->lock); | 743 | mutex_lock(&info->lock); |
746 | 744 | ||
@@ -757,8 +755,8 @@ static void arizona_micd_timeout_work(struct work_struct *work) | |||
757 | static void arizona_micd_detect(struct work_struct *work) | 755 | static void arizona_micd_detect(struct work_struct *work) |
758 | { | 756 | { |
759 | struct arizona_extcon_info *info = container_of(work, | 757 | struct arizona_extcon_info *info = container_of(work, |
760 | struct arizona_extcon_info, | 758 | struct arizona_extcon_info, |
761 | micd_detect_work.work); | 759 | micd_detect_work.work); |
762 | struct arizona *arizona = info->arizona; | 760 | struct arizona *arizona = info->arizona; |
763 | unsigned int val = 0, lvl; | 761 | unsigned int val = 0, lvl; |
764 | int ret, i, key; | 762 | int ret, i, key; |
@@ -770,7 +768,8 @@ static void arizona_micd_detect(struct work_struct *work) | |||
770 | for (i = 0; i < 10 && !(val & 0x7fc); i++) { | 768 | for (i = 0; i < 10 && !(val & 0x7fc); i++) { |
771 | ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val); | 769 | ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val); |
772 | if (ret != 0) { | 770 | if (ret != 0) { |
773 | dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret); | 771 | dev_err(arizona->dev, |
772 | "Failed to read MICDET: %d\n", ret); | ||
774 | mutex_unlock(&info->lock); | 773 | mutex_unlock(&info->lock); |
775 | return; | 774 | return; |
776 | } | 775 | } |
@@ -778,7 +777,8 @@ static void arizona_micd_detect(struct work_struct *work) | |||
778 | dev_dbg(arizona->dev, "MICDET: %x\n", val); | 777 | dev_dbg(arizona->dev, "MICDET: %x\n", val); |
779 | 778 | ||
780 | if (!(val & ARIZONA_MICD_VALID)) { | 779 | if (!(val & ARIZONA_MICD_VALID)) { |
781 | dev_warn(arizona->dev, "Microphone detection state invalid\n"); | 780 | dev_warn(arizona->dev, |
781 | "Microphone detection state invalid\n"); | ||
782 | mutex_unlock(&info->lock); | 782 | mutex_unlock(&info->lock); |
783 | return; | 783 | return; |
784 | } | 784 | } |
@@ -926,8 +926,8 @@ static irqreturn_t arizona_micdet(int irq, void *data) | |||
926 | static void arizona_hpdet_work(struct work_struct *work) | 926 | static void arizona_hpdet_work(struct work_struct *work) |
927 | { | 927 | { |
928 | struct arizona_extcon_info *info = container_of(work, | 928 | struct arizona_extcon_info *info = container_of(work, |
929 | struct arizona_extcon_info, | 929 | struct arizona_extcon_info, |
930 | hpdet_work.work); | 930 | hpdet_work.work); |
931 | 931 | ||
932 | mutex_lock(&info->lock); | 932 | mutex_lock(&info->lock); |
933 | arizona_start_hpdet_acc_id(info); | 933 | arizona_start_hpdet_acc_id(info); |
@@ -974,10 +974,13 @@ static irqreturn_t arizona_jackdet(int irq, void *data) | |||
974 | &info->hpdet_work, | 974 | &info->hpdet_work, |
975 | msecs_to_jiffies(HPDET_DEBOUNCE)); | 975 | msecs_to_jiffies(HPDET_DEBOUNCE)); |
976 | 976 | ||
977 | if (cancelled_mic) | 977 | if (cancelled_mic) { |
978 | int micd_timeout = info->micd_timeout; | ||
979 | |||
978 | queue_delayed_work(system_power_efficient_wq, | 980 | queue_delayed_work(system_power_efficient_wq, |
979 | &info->micd_timeout_work, | 981 | &info->micd_timeout_work, |
980 | msecs_to_jiffies(info->micd_timeout)); | 982 | msecs_to_jiffies(micd_timeout)); |
983 | } | ||
981 | 984 | ||
982 | goto out; | 985 | goto out; |
983 | } | 986 | } |