aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2017-10-30 15:40:25 -0400
committerMark Brown <broonie@kernel.org>2017-10-30 15:40:25 -0400
commit82ab86e82911107ead6fc7cd73568f75bc266a57 (patch)
treeb9b4c72c9b961d0059cf91d29bfd20bad4bcbc9b
parent3fa30ae9ff4a29e677b4800036f755517a27dd9e (diff)
Revert "ASoC: rt5651: Enable jack detection on JD* pins"
This reverts commit 60d5a1a47b9a8381c08d2263b11ac9c757c87746. Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/rt5651.h8
-rw-r--r--sound/soc/codecs/rt5651.c168
-rw-r--r--sound/soc/codecs/rt5651.h4
3 files changed, 2 insertions, 178 deletions
diff --git a/include/sound/rt5651.h b/include/sound/rt5651.h
index 18b79a761f10..d35de758dfb5 100644
--- a/include/sound/rt5651.h
+++ b/include/sound/rt5651.h
@@ -11,19 +11,11 @@
11#ifndef __LINUX_SND_RT5651_H 11#ifndef __LINUX_SND_RT5651_H
12#define __LINUX_SND_RT5651_H 12#define __LINUX_SND_RT5651_H
13 13
14enum rt5651_jd_src {
15 RT5651_JD_NULL,
16 RT5651_JD1_1,
17 RT5651_JD1_2,
18 RT5651_JD2,
19};
20
21struct rt5651_platform_data { 14struct rt5651_platform_data {
22 /* IN2 can optionally be differential */ 15 /* IN2 can optionally be differential */
23 bool in2_diff; 16 bool in2_diff;
24 17
25 bool dmic_en; 18 bool dmic_en;
26 enum rt5651_jd_src jd_src;
27}; 19};
28 20
29#endif 21#endif
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
index 2f0d0055c72f..da60b28ba3df 100644
--- a/sound/soc/codecs/rt5651.c
+++ b/sound/soc/codecs/rt5651.c
@@ -26,7 +26,6 @@
26#include <sound/soc-dapm.h> 26#include <sound/soc-dapm.h>
27#include <sound/initval.h> 27#include <sound/initval.h>
28#include <sound/tlv.h> 28#include <sound/tlv.h>
29#include <sound/jack.h>
30 29
31#include "rl6231.h" 30#include "rl6231.h"
32#include "rt5651.h" 31#include "rt5651.h"
@@ -881,9 +880,6 @@ static const struct snd_soc_dapm_widget rt5651_dapm_widgets[] = {
881 SND_SOC_DAPM_SUPPLY("PLL1", RT5651_PWR_ANLG2, 880 SND_SOC_DAPM_SUPPLY("PLL1", RT5651_PWR_ANLG2,
882 RT5651_PWR_PLL_BIT, 0, NULL, 0), 881 RT5651_PWR_PLL_BIT, 0, NULL, 0),
883 /* Input Side */ 882 /* Input Side */
884 SND_SOC_DAPM_SUPPLY("JD Power", RT5651_PWR_ANLG2,
885 RT5651_PWM_JD_M_BIT, 0, NULL, 0),
886
887 /* micbias */ 883 /* micbias */
888 SND_SOC_DAPM_SUPPLY("LDO", RT5651_PWR_ANLG1, 884 SND_SOC_DAPM_SUPPLY("LDO", RT5651_PWR_ANLG1,
889 RT5651_PWR_LDO_BIT, 0, NULL, 0), 885 RT5651_PWR_LDO_BIT, 0, NULL, 0),
@@ -1532,8 +1528,6 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
1532static int rt5651_set_bias_level(struct snd_soc_codec *codec, 1528static int rt5651_set_bias_level(struct snd_soc_codec *codec,
1533 enum snd_soc_bias_level level) 1529 enum snd_soc_bias_level level)
1534{ 1530{
1535 struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
1536
1537 switch (level) { 1531 switch (level) {
1538 case SND_SOC_BIAS_PREPARE: 1532 case SND_SOC_BIAS_PREPARE:
1539 if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { 1533 if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) {
@@ -1562,13 +1556,8 @@ static int rt5651_set_bias_level(struct snd_soc_codec *codec,
1562 snd_soc_write(codec, RT5651_PWR_DIG2, 0x0000); 1556 snd_soc_write(codec, RT5651_PWR_DIG2, 0x0000);
1563 snd_soc_write(codec, RT5651_PWR_VOL, 0x0000); 1557 snd_soc_write(codec, RT5651_PWR_VOL, 0x0000);
1564 snd_soc_write(codec, RT5651_PWR_MIXER, 0x0000); 1558 snd_soc_write(codec, RT5651_PWR_MIXER, 0x0000);
1565 if (rt5651->pdata.jd_src) { 1559 snd_soc_write(codec, RT5651_PWR_ANLG1, 0x0000);
1566 snd_soc_write(codec, RT5651_PWR_ANLG2, 0x0204); 1560 snd_soc_write(codec, RT5651_PWR_ANLG2, 0x0000);
1567 snd_soc_write(codec, RT5651_PWR_ANLG1, 0x0002);
1568 } else {
1569 snd_soc_write(codec, RT5651_PWR_ANLG1, 0x0000);
1570 snd_soc_write(codec, RT5651_PWR_ANLG2, 0x0000);
1571 }
1572 break; 1561 break;
1573 1562
1574 default: 1563 default:
@@ -1581,7 +1570,6 @@ static int rt5651_set_bias_level(struct snd_soc_codec *codec,
1581static int rt5651_probe(struct snd_soc_codec *codec) 1570static int rt5651_probe(struct snd_soc_codec *codec)
1582{ 1571{
1583 struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); 1572 struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
1584 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
1585 1573
1586 rt5651->codec = codec; 1574 rt5651->codec = codec;
1587 1575
@@ -1597,15 +1585,6 @@ static int rt5651_probe(struct snd_soc_codec *codec)
1597 1585
1598 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); 1586 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);
1599 1587
1600 if (rt5651->pdata.jd_src) {
1601 snd_soc_dapm_force_enable_pin(dapm, "JD Power");
1602 snd_soc_dapm_force_enable_pin(dapm, "LDO");
1603 snd_soc_dapm_sync(dapm);
1604
1605 regmap_update_bits(rt5651->regmap, RT5651_MICBIAS,
1606 0x38, 0x38);
1607 }
1608
1609 return 0; 1588 return 0;
1610} 1589}
1611 1590
@@ -1749,93 +1728,6 @@ static int rt5651_parse_dt(struct rt5651_priv *rt5651, struct device_node *np)
1749 return 0; 1728 return 0;
1750} 1729}
1751 1730
1752static irqreturn_t rt5651_irq(int irq, void *data)
1753{
1754 struct rt5651_priv *rt5651 = data;
1755
1756 queue_delayed_work(system_power_efficient_wq,
1757 &rt5651->jack_detect_work, msecs_to_jiffies(250));
1758
1759 return IRQ_HANDLED;
1760}
1761
1762static int rt5651_jack_detect(struct snd_soc_codec *codec, int jack_insert)
1763{
1764 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
1765 int jack_type;
1766
1767 if (jack_insert) {
1768 snd_soc_dapm_force_enable_pin(dapm, "LDO");
1769 snd_soc_dapm_sync(dapm);
1770
1771 snd_soc_update_bits(codec, RT5651_MICBIAS,
1772 RT5651_MIC1_OVCD_MASK |
1773 RT5651_MIC1_OVTH_MASK |
1774 RT5651_PWR_CLK12M_MASK |
1775 RT5651_PWR_MB_MASK,
1776 RT5651_MIC1_OVCD_EN |
1777 RT5651_MIC1_OVTH_600UA |
1778 RT5651_PWR_MB_PU |
1779 RT5651_PWR_CLK12M_PU);
1780 msleep(100);
1781 if (snd_soc_read(codec, RT5651_IRQ_CTRL2) & RT5651_MB1_OC_CLR)
1782 jack_type = SND_JACK_HEADPHONE;
1783 else
1784 jack_type = SND_JACK_HEADSET;
1785 snd_soc_update_bits(codec, RT5651_IRQ_CTRL2,
1786 RT5651_MB1_OC_CLR, 0);
1787 } else { /* jack out */
1788 jack_type = 0;
1789
1790 snd_soc_update_bits(codec, RT5651_MICBIAS,
1791 RT5651_MIC1_OVCD_MASK,
1792 RT5651_MIC1_OVCD_DIS);
1793 }
1794
1795 return jack_type;
1796}
1797
1798static void rt5651_jack_detect_work(struct work_struct *work)
1799{
1800 struct rt5651_priv *rt5651 =
1801 container_of(work, struct rt5651_priv, jack_detect_work.work);
1802
1803 int report, val = 0;
1804
1805 if (!rt5651->codec)
1806 return;
1807
1808 switch (rt5651->pdata.jd_src) {
1809 case RT5651_JD1_1:
1810 val = snd_soc_read(rt5651->codec, RT5651_INT_IRQ_ST) & 0x1000;
1811 break;
1812 case RT5651_JD1_2:
1813 val = snd_soc_read(rt5651->codec, RT5651_INT_IRQ_ST) & 0x2000;
1814 break;
1815 case RT5651_JD2:
1816 val = snd_soc_read(rt5651->codec, RT5651_INT_IRQ_ST) & 0x4000;
1817 break;
1818 default:
1819 break;
1820 }
1821
1822 report = rt5651_jack_detect(rt5651->codec, !val);
1823
1824 snd_soc_jack_report(rt5651->hp_jack, report, SND_JACK_HEADSET);
1825}
1826
1827int rt5651_set_jack_detect(struct snd_soc_codec *codec,
1828 struct snd_soc_jack *hp_jack)
1829{
1830 struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
1831
1832 rt5651->hp_jack = hp_jack;
1833 rt5651_irq(0, rt5651);
1834
1835 return 0;
1836}
1837EXPORT_SYMBOL_GPL(rt5651_set_jack_detect);
1838
1839static int rt5651_i2c_probe(struct i2c_client *i2c, 1731static int rt5651_i2c_probe(struct i2c_client *i2c,
1840 const struct i2c_device_id *id) 1732 const struct i2c_device_id *id)
1841{ 1733{
@@ -1887,59 +1779,6 @@ static int rt5651_i2c_probe(struct i2c_client *i2c,
1887 1779