diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 22:49:31 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 06:18:44 -0500 |
commit | 79223bf190919199652441d9f455cb0deabc75f5 (patch) | |
tree | e3aa0601f1534b0b5eb1a451a179d5777bf55df1 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: rt5645/rt5677: replace codec to component
Now we can replace Codec to Component. Let's do it.
Because Intel/Mediatek platforms are using rt5645/rt5677,
we need to update these all related drivers in same time.
Otherwise compile error/warning happen
rt5645:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
rt5677:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/amd/acp-rt5645.c | 4 | ||||
-rw-r--r-- | sound/soc/codecs/rt5645.c | 370 | ||||
-rw-r--r-- | sound/soc/codecs/rt5645.h | 4 | ||||
-rw-r--r-- | sound/soc/codecs/rt5677.c | 205 | ||||
-rw-r--r-- | sound/soc/codecs/rt5677.h | 4 | ||||
-rw-r--r-- | sound/soc/intel/boards/bdw-rt5677.c | 38 | ||||
-rw-r--r-- | sound/soc/intel/boards/cht_bsw_rt5645.c | 8 | ||||
-rw-r--r-- | sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 6 | ||||
-rw-r--r-- | sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 12 | ||||
-rw-r--r-- | sound/soc/mediatek/mt8173/mt8173-rt5650.c | 12 | ||||
-rw-r--r-- | sound/soc/rockchip/rockchip_rt5645.c | 8 |
11 files changed, 331 insertions, 340 deletions
diff --git a/sound/soc/amd/acp-rt5645.c b/sound/soc/amd/acp-rt5645.c index 941aed6bb364..b79b922b08a0 100644 --- a/sound/soc/amd/acp-rt5645.c +++ b/sound/soc/amd/acp-rt5645.c | |||
@@ -71,9 +71,9 @@ static int cz_init(struct snd_soc_pcm_runtime *rtd) | |||
71 | { | 71 | { |
72 | int ret; | 72 | int ret; |
73 | struct snd_soc_card *card; | 73 | struct snd_soc_card *card; |
74 | struct snd_soc_codec *codec; | 74 | struct snd_soc_component *codec; |
75 | 75 | ||
76 | codec = rtd->codec; | 76 | codec = rtd->codec_dai->component; |
77 | card = rtd->card; | 77 | card = rtd->card; |
78 | 78 | ||
79 | ret = snd_soc_card_jack_new(card, "Headset Jack", | 79 | ret = snd_soc_card_jack_new(card, "Headset Jack", |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 8f140c8b93ac..bc8d829ce45b 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -407,7 +407,7 @@ static const char *const rt5645_supply_names[] = { | |||
407 | }; | 407 | }; |
408 | 408 | ||
409 | struct rt5645_priv { | 409 | struct rt5645_priv { |
410 | struct snd_soc_codec *codec; | 410 | struct snd_soc_component *component; |
411 | struct rt5645_platform_data pdata; | 411 | struct rt5645_platform_data pdata; |
412 | struct regmap *regmap; | 412 | struct regmap *regmap; |
413 | struct i2c_client *i2c; | 413 | struct i2c_client *i2c; |
@@ -437,9 +437,9 @@ struct rt5645_priv { | |||
437 | int v_id; | 437 | int v_id; |
438 | }; | 438 | }; |
439 | 439 | ||
440 | static int rt5645_reset(struct snd_soc_codec *codec) | 440 | static int rt5645_reset(struct snd_soc_component *component) |
441 | { | 441 | { |
442 | return snd_soc_write(codec, RT5645_RESET, 0); | 442 | return snd_soc_component_write(component, RT5645_RESET, 0); |
443 | } | 443 | } |
444 | 444 | ||
445 | static bool rt5645_volatile_register(struct device *dev, unsigned int reg) | 445 | static bool rt5645_volatile_register(struct device *dev, unsigned int reg) |
@@ -846,17 +846,17 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = { | |||
846 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 846 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
847 | struct snd_kcontrol *kcontrol, int event) | 847 | struct snd_kcontrol *kcontrol, int event) |
848 | { | 848 | { |
849 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 849 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
850 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 850 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
851 | int idx, rate; | 851 | int idx, rate; |
852 | 852 | ||
853 | rate = rt5645->sysclk / rl6231_get_pre_div(rt5645->regmap, | 853 | rate = rt5645->sysclk / rl6231_get_pre_div(rt5645->regmap, |
854 | RT5645_ADDA_CLK1, RT5645_I2S_PD1_SFT); | 854 | RT5645_ADDA_CLK1, RT5645_I2S_PD1_SFT); |
855 | idx = rl6231_calc_dmic_clk(rate); | 855 | idx = rl6231_calc_dmic_clk(rate); |
856 | if (idx < 0) | 856 | if (idx < 0) |
857 | dev_err(codec->dev, "Failed to set DMIC clock\n"); | 857 | dev_err(component->dev, "Failed to set DMIC clock\n"); |
858 | else | 858 | else |
859 | snd_soc_update_bits(codec, RT5645_DMIC_CTRL1, | 859 | snd_soc_component_update_bits(component, RT5645_DMIC_CTRL1, |
860 | RT5645_DMIC_CLK_MASK, idx << RT5645_DMIC_CLK_SFT); | 860 | RT5645_DMIC_CLK_MASK, idx << RT5645_DMIC_CLK_SFT); |
861 | return idx; | 861 | return idx; |
862 | } | 862 | } |
@@ -864,10 +864,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
864 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 864 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
865 | struct snd_soc_dapm_widget *sink) | 865 | struct snd_soc_dapm_widget *sink) |
866 | { | 866 | { |
867 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 867 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
868 | unsigned int val; | 868 | unsigned int val; |
869 | 869 | ||
870 | val = snd_soc_read(codec, RT5645_GLB_CLK); | 870 | val = snd_soc_component_read32(component, RT5645_GLB_CLK); |
871 | val &= RT5645_SCLK_SRC_MASK; | 871 | val &= RT5645_SCLK_SRC_MASK; |
872 | if (val == RT5645_SCLK_SRC_PLL1) | 872 | if (val == RT5645_SCLK_SRC_PLL1) |
873 | return 1; | 873 | return 1; |
@@ -878,7 +878,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
878 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | 878 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
879 | struct snd_soc_dapm_widget *sink) | 879 | struct snd_soc_dapm_widget *sink) |
880 | { | 880 | { |
881 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 881 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
882 | unsigned int reg, shift, val; | 882 | unsigned int reg, shift, val; |
883 | 883 | ||
884 | switch (source->shift) { | 884 | switch (source->shift) { |
@@ -910,7 +910,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
910 | return 0; | 910 | return 0; |
911 | } | 911 | } |
912 | 912 | ||
913 | val = (snd_soc_read(codec, reg) >> shift) & 0xf; | 913 | val = (snd_soc_component_read32(component, reg) >> shift) & 0xf; |
914 | switch (val) { | 914 | switch (val) { |
915 | case 1: | 915 | case 1: |
916 | case 2: | 916 | case 2: |
@@ -923,9 +923,9 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
923 | 923 | ||
924 | } | 924 | } |
925 | 925 | ||
926 | static int rt5645_enable_hweq(struct snd_soc_codec *codec) | 926 | static int rt5645_enable_hweq(struct snd_soc_component *component) |
927 | { | 927 | { |
928 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 928 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
929 | int i; | 929 | int i; |
930 | 930 | ||
931 | for (i = 0; i < RT5645_HWEQ_NUM; i++) { | 931 | for (i = 0; i < RT5645_HWEQ_NUM; i++) { |
@@ -941,7 +941,7 @@ static int rt5645_enable_hweq(struct snd_soc_codec *codec) | |||
941 | 941 | ||
942 | /** | 942 | /** |
943 | * rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters | 943 | * rt5645_sel_asrc_clk_src - select ASRC clock source for a set of filters |
944 | * @codec: SoC audio codec device. | 944 | * @component: SoC audio component device. |
945 | * @filter_mask: mask of filters. | 945 | * @filter_mask: mask of filters. |
946 | * @clk_src: clock source | 946 | * @clk_src: clock source |
947 | * | 947 | * |
@@ -953,7 +953,7 @@ static int rt5645_enable_hweq(struct snd_soc_codec *codec) | |||
953 | * set of filters specified by the mask. And the codec driver will turn on ASRC | 953 | * set of filters specified by the mask. And the codec driver will turn on ASRC |
954 | * for these filters if ASRC is selected as their clock source. | 954 | * for these filters if ASRC is selected as their clock source. |
955 | */ | 955 | */ |
956 | int rt5645_sel_asrc_clk_src(struct snd_soc_codec *codec, | 956 | int rt5645_sel_asrc_clk_src(struct snd_soc_component *component, |
957 | unsigned int filter_mask, unsigned int clk_src) | 957 | unsigned int filter_mask, unsigned int clk_src) |
958 | { | 958 | { |
959 | unsigned int asrc2_mask = 0; | 959 | unsigned int asrc2_mask = 0; |
@@ -1009,11 +1009,11 @@ int rt5645_sel_asrc_clk_src(struct snd_soc_codec *codec, | |||
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | if (asrc2_mask) | 1011 | if (asrc2_mask) |
1012 | snd_soc_update_bits(codec, RT5645_ASRC_2, | 1012 | snd_soc_component_update_bits(component, RT5645_ASRC_2, |
1013 | asrc2_mask, asrc2_value); | 1013 | asrc2_mask, asrc2_value); |
1014 | 1014 | ||
1015 | if (asrc3_mask) | 1015 | if (asrc3_mask) |
1016 | snd_soc_update_bits(codec, RT5645_ASRC_3, | 1016 | snd_soc_component_update_bits(component, RT5645_ASRC_3, |
1017 | asrc3_mask, asrc3_value); | 1017 | asrc3_mask, asrc3_value); |
1018 | 1018 | ||
1019 | return 0; | 1019 | return 0; |
@@ -1678,56 +1678,56 @@ static const struct snd_kcontrol_new pdm1_r_vol_control = | |||
1678 | SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5645_PDM_OUT_CTRL, | 1678 | SOC_DAPM_SINGLE_AUTODISABLE("Switch", RT5645_PDM_OUT_CTRL, |
1679 | RT5645_M_PDM1_R, 1, 1); | 1679 | RT5645_M_PDM1_R, 1, 1); |
1680 | 1680 | ||
1681 | static void hp_amp_power(struct snd_soc_codec *codec, int on) | 1681 | static void hp_amp_power(struct snd_soc_component *component, int on) |
1682 | { | 1682 | { |
1683 | static int hp_amp_power_count; | 1683 | static int hp_amp_power_count; |
1684 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 1684 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
1685 | 1685 | ||
1686 | if (on) { | 1686 | if (on) { |
1687 | if (hp_amp_power_count <= 0) { | 1687 | if (hp_amp_power_count <= 0) { |
1688 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { | 1688 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { |
1689 | snd_soc_write(codec, RT5645_DEPOP_M2, 0x3100); | 1689 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x3100); |
1690 | snd_soc_write(codec, RT5645_CHARGE_PUMP, | 1690 | snd_soc_component_write(component, RT5645_CHARGE_PUMP, |
1691 | 0x0e06); | 1691 | 0x0e06); |
1692 | snd_soc_write(codec, RT5645_DEPOP_M1, 0x000d); | 1692 | snd_soc_component_write(component, RT5645_DEPOP_M1, 0x000d); |
1693 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1693 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1694 | RT5645_HP_DCC_INT1, 0x9f01); | 1694 | RT5645_HP_DCC_INT1, 0x9f01); |
1695 | msleep(20); | 1695 | msleep(20); |
1696 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1696 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1697 | RT5645_HP_CO_MASK, RT5645_HP_CO_EN); | 1697 | RT5645_HP_CO_MASK, RT5645_HP_CO_EN); |
1698 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1698 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1699 | 0x3e, 0x7400); | 1699 | 0x3e, 0x7400); |
1700 | snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); | 1700 | snd_soc_component_write(component, RT5645_DEPOP_M3, 0x0737); |
1701 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1701 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1702 | RT5645_MAMP_INT_REG2, 0xfc00); | 1702 | RT5645_MAMP_INT_REG2, 0xfc00); |
1703 | snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); | 1703 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); |
1704 | msleep(90); | 1704 | msleep(90); |
1705 | rt5645->hp_on = true; | 1705 | rt5645->hp_on = true; |
1706 | } else { | 1706 | } else { |
1707 | /* depop parameters */ | 1707 | /* depop parameters */ |
1708 | snd_soc_update_bits(codec, RT5645_DEPOP_M2, | 1708 | snd_soc_component_update_bits(component, RT5645_DEPOP_M2, |
1709 | RT5645_DEPOP_MASK, RT5645_DEPOP_MAN); | 1709 | RT5645_DEPOP_MASK, RT5645_DEPOP_MAN); |
1710 | snd_soc_write(codec, RT5645_DEPOP_M1, 0x000d); | 1710 | snd_soc_component_write(component, RT5645_DEPOP_M1, 0x000d); |
1711 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1711 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1712 | RT5645_HP_DCC_INT1, 0x9f01); | 1712 | RT5645_HP_DCC_INT1, 0x9f01); |
1713 | mdelay(150); | 1713 | mdelay(150); |
1714 | /* headphone amp power on */ | 1714 | /* headphone amp power on */ |
1715 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1715 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1716 | RT5645_PWR_FV1 | RT5645_PWR_FV2, 0); | 1716 | RT5645_PWR_FV1 | RT5645_PWR_FV2, 0); |
1717 | snd_soc_update_bits(codec, RT5645_PWR_VOL, | 1717 | snd_soc_component_update_bits(component, RT5645_PWR_VOL, |
1718 | RT5645_PWR_HV_L | RT5645_PWR_HV_R, | 1718 | RT5645_PWR_HV_L | RT5645_PWR_HV_R, |
1719 | RT5645_PWR_HV_L | RT5645_PWR_HV_R); | 1719 | RT5645_PWR_HV_L | RT5645_PWR_HV_R); |
1720 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1720 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1721 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | | 1721 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | |
1722 | RT5645_PWR_HA, | 1722 | RT5645_PWR_HA, |
1723 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | | 1723 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | |
1724 | RT5645_PWR_HA); | 1724 | RT5645_PWR_HA); |
1725 | mdelay(5); | 1725 | mdelay(5); |
1726 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1726 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1727 | RT5645_PWR_FV1 | RT5645_PWR_FV2, | 1727 | RT5645_PWR_FV1 | RT5645_PWR_FV2, |
1728 | RT5645_PWR_FV1 | RT5645_PWR_FV2); | 1728 | RT5645_PWR_FV1 | RT5645_PWR_FV2); |
1729 | 1729 | ||
1730 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1730 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1731 | RT5645_HP_CO_MASK | RT5645_HP_SG_MASK, | 1731 | RT5645_HP_CO_MASK | RT5645_HP_SG_MASK, |
1732 | RT5645_HP_CO_EN | RT5645_HP_SG_EN); | 1732 | RT5645_HP_CO_EN | RT5645_HP_SG_EN); |
1733 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1733 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
@@ -1743,15 +1743,15 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) | |||
1743 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { | 1743 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { |
1744 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1744 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1745 | 0x3e, 0x7400); | 1745 | 0x3e, 0x7400); |
1746 | snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); | 1746 | snd_soc_component_write(component, RT5645_DEPOP_M3, 0x0737); |
1747 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1747 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1748 | RT5645_MAMP_INT_REG2, 0xfc00); | 1748 | RT5645_MAMP_INT_REG2, 0xfc00); |
1749 | snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); | 1749 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); |
1750 | msleep(100); | 1750 | msleep(100); |
1751 | snd_soc_write(codec, RT5645_DEPOP_M1, 0x0001); | 1751 | snd_soc_component_write(component, RT5645_DEPOP_M1, 0x0001); |
1752 | 1752 | ||
1753 | } else { | 1753 | } else { |
1754 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1754 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1755 | RT5645_HP_SG_MASK | | 1755 | RT5645_HP_SG_MASK | |
1756 | RT5645_HP_L_SMT_MASK | | 1756 | RT5645_HP_L_SMT_MASK | |
1757 | RT5645_HP_R_SMT_MASK, | 1757 | RT5645_HP_R_SMT_MASK, |
@@ -1759,11 +1759,11 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) | |||
1759 | RT5645_HP_L_SMT_DIS | | 1759 | RT5645_HP_L_SMT_DIS | |
1760 | RT5645_HP_R_SMT_DIS); | 1760 | RT5645_HP_R_SMT_DIS); |
1761 | /* headphone amp power down */ | 1761 | /* headphone amp power down */ |
1762 | snd_soc_write(codec, RT5645_DEPOP_M1, 0x0000); | 1762 | snd_soc_component_write(component, RT5645_DEPOP_M1, 0x0000); |
1763 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1763 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1764 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | | 1764 | RT5645_PWR_HP_L | RT5645_PWR_HP_R | |
1765 | RT5645_PWR_HA, 0); | 1765 | RT5645_PWR_HA, 0); |
1766 | snd_soc_update_bits(codec, RT5645_DEPOP_M2, | 1766 | snd_soc_component_update_bits(component, RT5645_DEPOP_M2, |
1767 | RT5645_DEPOP_MASK, 0); | 1767 | RT5645_DEPOP_MASK, 0); |
1768 | } | 1768 | } |
1769 | } | 1769 | } |
@@ -1773,15 +1773,15 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) | |||
1773 | static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | 1773 | static int rt5645_hp_event(struct snd_soc_dapm_widget *w, |
1774 | struct snd_kcontrol *kcontrol, int event) | 1774 | struct snd_kcontrol *kcontrol, int event) |
1775 | { | 1775 | { |
1776 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1776 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1777 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 1777 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
1778 | 1778 | ||
1779 | switch (event) { | 1779 | switch (event) { |
1780 | case SND_SOC_DAPM_POST_PMU: | 1780 | case SND_SOC_DAPM_POST_PMU: |
1781 | hp_amp_power(codec, 1); | 1781 | hp_amp_power(component, 1); |
1782 | /* headphone unmute sequence */ | 1782 | /* headphone unmute sequence */ |
1783 | if (rt5645->codec_type == CODEC_TYPE_RT5645) { | 1783 | if (rt5645->codec_type == CODEC_TYPE_RT5645) { |
1784 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, | 1784 | snd_soc_component_update_bits(component, RT5645_DEPOP_M3, |
1785 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | | 1785 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | |
1786 | RT5645_CP_FQ3_MASK, | 1786 | RT5645_CP_FQ3_MASK, |
1787 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ1_SFT) | | 1787 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ1_SFT) | |
@@ -1789,16 +1789,16 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1789 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ3_SFT)); | 1789 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ3_SFT)); |
1790 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1790 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1791 | RT5645_MAMP_INT_REG2, 0xfc00); | 1791 | RT5645_MAMP_INT_REG2, 0xfc00); |
1792 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1792 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1793 | RT5645_SMT_TRIG_MASK, RT5645_SMT_TRIG_EN); | 1793 | RT5645_SMT_TRIG_MASK, RT5645_SMT_TRIG_EN); |
1794 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1794 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1795 | RT5645_RSTN_MASK, RT5645_RSTN_EN); | 1795 | RT5645_RSTN_MASK, RT5645_RSTN_EN); |
1796 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1796 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1797 | RT5645_RSTN_MASK | RT5645_HP_L_SMT_MASK | | 1797 | RT5645_RSTN_MASK | RT5645_HP_L_SMT_MASK | |
1798 | RT5645_HP_R_SMT_MASK, RT5645_RSTN_DIS | | 1798 | RT5645_HP_R_SMT_MASK, RT5645_RSTN_DIS | |
1799 | RT5645_HP_L_SMT_EN | RT5645_HP_R_SMT_EN); | 1799 | RT5645_HP_L_SMT_EN | RT5645_HP_R_SMT_EN); |
1800 | msleep(40); | 1800 | msleep(40); |
1801 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1801 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1802 | RT5645_HP_SG_MASK | RT5645_HP_L_SMT_MASK | | 1802 | RT5645_HP_SG_MASK | RT5645_HP_L_SMT_MASK | |
1803 | RT5645_HP_R_SMT_MASK, RT5645_HP_SG_DIS | | 1803 | RT5645_HP_R_SMT_MASK, RT5645_HP_SG_DIS | |
1804 | RT5645_HP_L_SMT_DIS | RT5645_HP_R_SMT_DIS); | 1804 | RT5645_HP_L_SMT_DIS | RT5645_HP_R_SMT_DIS); |
@@ -1808,7 +1808,7 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1808 | case SND_SOC_DAPM_PRE_PMD: | 1808 | case SND_SOC_DAPM_PRE_PMD: |
1809 | /* headphone mute sequence */ | 1809 | /* headphone mute sequence */ |
1810 | if (rt5645->codec_type == CODEC_TYPE_RT5645) { | 1810 | if (rt5645->codec_type == CODEC_TYPE_RT5645) { |
1811 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, | 1811 | snd_soc_component_update_bits(component, RT5645_DEPOP_M3, |
1812 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | | 1812 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | |
1813 | RT5645_CP_FQ3_MASK, | 1813 | RT5645_CP_FQ3_MASK, |
1814 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ1_SFT) | | 1814 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ1_SFT) | |
@@ -1816,17 +1816,17 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1816 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ3_SFT)); | 1816 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ3_SFT)); |
1817 | regmap_write(rt5645->regmap, RT5645_PR_BASE + | 1817 | regmap_write(rt5645->regmap, RT5645_PR_BASE + |
1818 | RT5645_MAMP_INT_REG2, 0xfc00); | 1818 | RT5645_MAMP_INT_REG2, 0xfc00); |
1819 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1819 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1820 | RT5645_HP_SG_MASK, RT5645_HP_SG_EN); | 1820 | RT5645_HP_SG_MASK, RT5645_HP_SG_EN); |
1821 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1821 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1822 | RT5645_RSTP_MASK, RT5645_RSTP_EN); | 1822 | RT5645_RSTP_MASK, RT5645_RSTP_EN); |
1823 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1823 | snd_soc_component_update_bits(component, RT5645_DEPOP_M1, |
1824 | RT5645_RSTP_MASK | RT5645_HP_L_SMT_MASK | | 1824 | RT5645_RSTP_MASK | RT5645_HP_L_SMT_MASK | |
1825 | RT5645_HP_R_SMT_MASK, RT5645_RSTP_DIS | | 1825 | RT5645_HP_R_SMT_MASK, RT5645_RSTP_DIS | |
1826 | RT5645_HP_L_SMT_EN | RT5645_HP_R_SMT_EN); | 1826 | RT5645_HP_L_SMT_EN | RT5645_HP_R_SMT_EN); |
1827 | msleep(30); | 1827 | msleep(30); |
1828 | } | 1828 | } |
1829 | hp_amp_power(codec, 0); | 1829 | hp_amp_power(component, 0); |
1830 | break; | 1830 | break; |
1831 | 1831 | ||
1832 | default: | 1832 | default: |
@@ -1839,25 +1839,25 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1839 | static int rt5645_spk_event(struct snd_soc_dapm_widget *w, | 1839 | static int rt5645_spk_event(struct snd_soc_dapm_widget *w, |
1840 | struct snd_kcontrol *kcontrol, int event) | 1840 | struct snd_kcontrol *kcontrol, int event) |
1841 | { | 1841 | { |
1842 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1842 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1843 | 1843 | ||
1844 | switch (event) { | 1844 | switch (event) { |
1845 | case SND_SOC_DAPM_POST_PMU: | 1845 | case SND_SOC_DAPM_POST_PMU: |
1846 | rt5645_enable_hweq(codec); | 1846 | rt5645_enable_hweq(component); |
1847 | snd_soc_update_bits(codec, RT5645_PWR_DIG1, | 1847 | snd_soc_component_update_bits(component, RT5645_PWR_DIG1, |
1848 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | | 1848 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | |
1849 | RT5645_PWR_CLS_D_L, | 1849 | RT5645_PWR_CLS_D_L, |
1850 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | | 1850 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | |
1851 | RT5645_PWR_CLS_D_L); | 1851 | RT5645_PWR_CLS_D_L); |
1852 | snd_soc_update_bits(codec, RT5645_GEN_CTRL3, | 1852 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL3, |
1853 | RT5645_DET_CLK_MASK, RT5645_DET_CLK_MODE1); | 1853 | RT5645_DET_CLK_MASK, RT5645_DET_CLK_MODE1); |
1854 | break; | 1854 | break; |
1855 | 1855 | ||
1856 | case SND_SOC_DAPM_PRE_PMD: | 1856 | case SND_SOC_DAPM_PRE_PMD: |
1857 | snd_soc_update_bits(codec, RT5645_GEN_CTRL3, | 1857 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL3, |
1858 | RT5645_DET_CLK_MASK, RT5645_DET_CLK_DIS); | 1858 | RT5645_DET_CLK_MASK, RT5645_DET_CLK_DIS); |
1859 | snd_soc_write(codec, RT5645_EQ_CTRL2, 0); | 1859 | snd_soc_component_write(component, RT5645_EQ_CTRL2, 0); |
1860 | snd_soc_update_bits(codec, RT5645_PWR_DIG1, | 1860 | snd_soc_component_update_bits(component, RT5645_PWR_DIG1, |
1861 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | | 1861 | RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | |
1862 | RT5645_PWR_CLS_D_L, 0); | 1862 | RT5645_PWR_CLS_D_L, 0); |
1863 | break; | 1863 | break; |
@@ -1872,24 +1872,24 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w, | |||
1872 | static int rt5645_lout_event(struct snd_soc_dapm_widget *w, | 1872 | static int rt5645_lout_event(struct snd_soc_dapm_widget *w, |
1873 | struct snd_kcontrol *kcontrol, int event) | 1873 | struct snd_kcontrol *kcontrol, int event) |
1874 | { | 1874 | { |
1875 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1875 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1876 | 1876 | ||
1877 | switch (event) { | 1877 | switch (event) { |
1878 | case SND_SOC_DAPM_POST_PMU: | 1878 | case SND_SOC_DAPM_POST_PMU: |
1879 | hp_amp_power(codec, 1); | 1879 | hp_amp_power(component, 1); |
1880 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1880 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1881 | RT5645_PWR_LM, RT5645_PWR_LM); | 1881 | RT5645_PWR_LM, RT5645_PWR_LM); |
1882 | snd_soc_update_bits(codec, RT5645_LOUT1, | 1882 | snd_soc_component_update_bits(component, RT5645_LOUT1, |
1883 | RT5645_L_MUTE | RT5645_R_MUTE, 0); | 1883 | RT5645_L_MUTE | RT5645_R_MUTE, 0); |
1884 | break; | 1884 | break; |
1885 | 1885 | ||
1886 | case SND_SOC_DAPM_PRE_PMD: | 1886 | case SND_SOC_DAPM_PRE_PMD: |
1887 | snd_soc_update_bits(codec, RT5645_LOUT1, | 1887 | snd_soc_component_update_bits(component, RT5645_LOUT1, |
1888 | RT5645_L_MUTE | RT5645_R_MUTE, | 1888 | RT5645_L_MUTE | RT5645_R_MUTE, |
1889 | RT5645_L_MUTE | RT5645_R_MUTE); | 1889 | RT5645_L_MUTE | RT5645_R_MUTE); |
1890 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 1890 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
1891 | RT5645_PWR_LM, 0); | 1891 | RT5645_PWR_LM, 0); |
1892 | hp_amp_power(codec, 0); | 1892 | hp_amp_power(component, 0); |
1893 | break; | 1893 | break; |
1894 | 1894 | ||
1895 | default: | 1895 | default: |
@@ -1902,16 +1902,16 @@ static int rt5645_lout_event(struct snd_soc_dapm_widget *w, | |||
1902 | static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, | 1902 | static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, |
1903 | struct snd_kcontrol *kcontrol, int event) | 1903 | struct snd_kcontrol *kcontrol, int event) |
1904 | { | 1904 | { |
1905 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1905 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1906 | 1906 | ||
1907 | switch (event) { | 1907 | switch (event) { |
1908 | case SND_SOC_DAPM_POST_PMU: | 1908 | case SND_SOC_DAPM_POST_PMU: |
1909 | snd_soc_update_bits(codec, RT5645_PWR_ANLG2, | 1909 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG2, |
1910 | RT5645_PWR_BST2_P, RT5645_PWR_BST2_P); | 1910 | RT5645_PWR_BST2_P, RT5645_PWR_BST2_P); |
1911 | break; | 1911 | break; |
1912 | 1912 | ||
1913 | case SND_SOC_DAPM_PRE_PMD: | 1913 | case SND_SOC_DAPM_PRE_PMD: |
1914 | snd_soc_update_bits(codec, RT5645_PWR_ANLG2, | 1914 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG2, |
1915 | RT5645_PWR_BST2_P, 0); | 1915 | RT5645_PWR_BST2_P, 0); |
1916 | break; | 1916 | break; |
1917 | 1917 | ||
@@ -1925,8 +1925,8 @@ static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, | |||
1925 | static int rt5650_hp_event(struct snd_soc_dapm_widget *w, | 1925 | static int rt5650_hp_event(struct snd_soc_dapm_widget *w, |
1926 | struct snd_kcontrol *k, int event) | 1926 | struct snd_kcontrol *k, int event) |
1927 | { | 1927 | { |
1928 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1928 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1929 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 1929 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
1930 | 1930 | ||
1931 | switch (event) { | 1931 | switch (event) { |
1932 | case SND_SOC_DAPM_POST_PMU: | 1932 | case SND_SOC_DAPM_POST_PMU: |
@@ -1946,17 +1946,17 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w, | |||
1946 | static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w, | 1946 | static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w, |
1947 | struct snd_kcontrol *k, int event) | 1947 | struct snd_kcontrol *k, int event) |
1948 | { | 1948 | { |
1949 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1949 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1950 | 1950 | ||
1951 | switch (event) { | 1951 | switch (event) { |
1952 | case SND_SOC_DAPM_PRE_PMU: | 1952 | case SND_SOC_DAPM_PRE_PMU: |
1953 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | 1953 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL2, |
1954 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, | 1954 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, |
1955 | RT5645_MICBIAS1_POW_CTRL_SEL_M); | 1955 | RT5645_MICBIAS1_POW_CTRL_SEL_M); |
1956 | break; | 1956 | break; |
1957 | 1957 | ||
1958 | case SND_SOC_DAPM_POST_PMD: | 1958 | case SND_SOC_DAPM_POST_PMD: |
1959 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | 1959 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL2, |
1960 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, | 1960 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, |
1961 | RT5645_MICBIAS1_POW_CTRL_SEL_A); | 1961 | RT5645_MICBIAS1_POW_CTRL_SEL_A); |
1962 | break; | 1962 | break; |
@@ -1971,17 +1971,17 @@ static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w, | |||
1971 | static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w, | 1971 | static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w, |
1972 | struct snd_kcontrol *k, int event) | 1972 | struct snd_kcontrol *k, int event) |
1973 | { | 1973 | { |
1974 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 1974 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
1975 | 1975 | ||
1976 | switch (event) { | 1976 | switch (event) { |
1977 | case SND_SOC_DAPM_PRE_PMU: | 1977 | case SND_SOC_DAPM_PRE_PMU: |
1978 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | 1978 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL2, |
1979 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, | 1979 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, |
1980 | RT5645_MICBIAS2_POW_CTRL_SEL_M); | 1980 | RT5645_MICBIAS2_POW_CTRL_SEL_M); |
1981 | break; | 1981 | break; |
1982 | 1982 | ||
1983 | case SND_SOC_DAPM_POST_PMD: | 1983 | case SND_SOC_DAPM_POST_PMD: |
1984 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | 1984 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL2, |
1985 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, | 1985 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, |
1986 | RT5645_MICBIAS2_POW_CTRL_SEL_A); | 1986 | RT5645_MICBIAS2_POW_CTRL_SEL_A); |
1987 | break; | 1987 | break; |
@@ -2768,20 +2768,20 @@ static const struct snd_soc_dapm_route rt5645_old_dapm_routes[] = { | |||
2768 | static int rt5645_hw_params(struct snd_pcm_substream *substream, | 2768 | static int rt5645_hw_params(struct snd_pcm_substream *substream, |
2769 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 2769 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
2770 | { | 2770 | { |
2771 | struct snd_soc_codec *codec = dai->codec; | 2771 | struct snd_soc_component *component = dai->component; |
2772 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2772 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
2773 | unsigned int val_len = 0, val_clk, mask_clk, dl_sft; | 2773 | unsigned int val_len = 0, val_clk, mask_clk, dl_sft; |
2774 | int pre_div, bclk_ms, frame_size; | 2774 | int pre_div, bclk_ms, frame_size; |
2775 | 2775 | ||
2776 | rt5645->lrck[dai->id] = params_rate(params); | 2776 | rt5645->lrck[dai->id] = params_rate(params); |
2777 | pre_div = rl6231_get_clk_info(rt5645->sysclk, rt5645->lrck[dai->id]); | 2777 | pre_div = rl6231_get_clk_info(rt5645->sysclk, rt5645->lrck[dai->id]); |
2778 | if (pre_div < 0) { | 2778 | if (pre_div < 0) { |
2779 | dev_err(codec->dev, "Unsupported clock setting\n"); | 2779 | dev_err(component->dev, "Unsupported clock setting\n"); |
2780 | return -EINVAL; | 2780 | return -EINVAL; |
2781 | } | 2781 | } |
2782 | frame_size = snd_soc_params_to_frame_size(params); | 2782 | frame_size = snd_soc_params_to_frame_size(params); |
2783 | if (frame_size < 0) { | 2783 | if (frame_size < 0) { |
2784 | dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); | 2784 | dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); |
2785 | return -EINVAL; | 2785 | return -EINVAL; |
2786 | } | 2786 | } |
2787 | 2787 | ||
@@ -2822,20 +2822,20 @@ static int rt5645_hw_params(struct snd_pcm_substream *substream, | |||
2822 | case RT5645_AIF1: | 2822 | case RT5645_AIF1: |
2823 | mask_clk = RT5645_I2S_PD1_MASK; | 2823 | mask_clk = RT5645_I2S_PD1_MASK; |
2824 | val_clk = pre_div << RT5645_I2S_PD1_SFT; | 2824 | val_clk = pre_div << RT5645_I2S_PD1_SFT; |
2825 | snd_soc_update_bits(codec, RT5645_I2S1_SDP, | 2825 | snd_soc_component_update_bits(component, RT5645_I2S1_SDP, |
2826 | (0x3 << dl_sft), (val_len << dl_sft)); | 2826 | (0x3 << dl_sft), (val_len << dl_sft)); |
2827 | snd_soc_update_bits(codec, RT5645_ADDA_CLK1, mask_clk, val_clk); | 2827 | snd_soc_component_update_bits(component, RT5645_ADDA_CLK1, mask_clk, val_clk); |
2828 | break; | 2828 | break; |
2829 | case RT5645_AIF2: | 2829 | case RT5645_AIF2: |
2830 | mask_clk = RT5645_I2S_BCLK_MS2_MASK | RT5645_I2S_PD2_MASK; | 2830 | mask_clk = RT5645_I2S_BCLK_MS2_MASK | RT5645_I2S_PD2_MASK; |
2831 | val_clk = bclk_ms << RT5645_I2S_BCLK_MS2_SFT | | 2831 | val_clk = bclk_ms << RT5645_I2S_BCLK_MS2_SFT | |
2832 | pre_div << RT5645_I2S_PD2_SFT; | 2832 | pre_div << RT5645_I2S_PD2_SFT; |
2833 | snd_soc_update_bits(codec, RT5645_I2S2_SDP, | 2833 | snd_soc_component_update_bits(component, RT5645_I2S2_SDP, |
2834 | (0x3 << dl_sft), (val_len << dl_sft)); | 2834 | (0x3 << dl_sft), (val_len << dl_sft)); |
2835 | snd_soc_update_bits(codec, RT5645_ADDA_CLK1, mask_clk, val_clk); | 2835 | snd_soc_component_update_bits(component, RT5645_ADDA_CLK1, mask_clk, val_clk); |
2836 | break; | 2836 | break; |
2837 | default: | 2837 | default: |
2838 | dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); | 2838 | dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); |
2839 | return -EINVAL; | 2839 | return -EINVAL; |
2840 | } | 2840 | } |
2841 | 2841 | ||
@@ -2844,8 +2844,8 @@ static int rt5645_hw_params(struct snd_pcm_substream *substream, | |||
2844 | 2844 | ||
2845 | static int rt5645_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 2845 | static int rt5645_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
2846 | { | 2846 | { |
2847 | struct snd_soc_codec *codec = dai->codec; | 2847 | struct snd_soc_component *component = dai->component; |
2848 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2848 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
2849 | unsigned int reg_val = 0, pol_sft; | 2849 | unsigned int reg_val = 0, pol_sft; |
2850 | 2850 | ||
2851 | switch (rt5645->codec_type) { | 2851 | switch (rt5645->codec_type) { |
@@ -2896,17 +2896,17 @@ static int rt5645_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
2896 | } | 2896 | } |
2897 | switch (dai->id) { | 2897 | switch (dai->id) { |
2898 | case RT5645_AIF1: | 2898 | case RT5645_AIF1: |
2899 | snd_soc_update_bits(codec, RT5645_I2S1_SDP, | 2899 | snd_soc_component_update_bits(component, RT5645_I2S1_SDP, |
2900 | RT5645_I2S_MS_MASK | (1 << pol_sft) | | 2900 | RT5645_I2S_MS_MASK | (1 << pol_sft) | |
2901 | RT5645_I2S_DF_MASK, reg_val); | 2901 | RT5645_I2S_DF_MASK, reg_val); |
2902 | break; | 2902 | break; |
2903 | case RT5645_AIF2: | 2903 | case RT5645_AIF2: |
2904 | snd_soc_update_bits(codec, RT5645_I2S2_SDP, | 2904 | snd_soc_component_update_bits(component, RT5645_I2S2_SDP, |
2905 | RT5645_I2S_MS_MASK | (1 << pol_sft) | | 2905 | RT5645_I2S_MS_MASK | (1 << pol_sft) | |
2906 | RT5645_I2S_DF_MASK, reg_val); | 2906 | RT5645_I2S_DF_MASK, reg_val); |
2907 | break; | 2907 | break; |
2908 | default: | 2908 | default: |
2909 | dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); | 2909 | dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); |
2910 | return -EINVAL; | 2910 | return -EINVAL; |
2911 | } | 2911 | } |
2912 | return 0; | 2912 | return 0; |
@@ -2915,8 +2915,8 @@ static int rt5645_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
2915 | static int rt5645_set_dai_sysclk(struct snd_soc_dai *dai, | 2915 | static int rt5645_set_dai_sysclk(struct snd_soc_dai *dai, |
2916 | int clk_id, unsigned int freq, int dir) | 2916 | int clk_id, unsigned int freq, int dir) |
2917 | { | 2917 | { |
2918 | struct snd_soc_codec *codec = dai->codec; | 2918 | struct snd_soc_component *component = dai->component; |
2919 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2919 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
2920 | unsigned int reg_val = 0; | 2920 | unsigned int reg_val = 0; |
2921 | 2921 | ||
2922 | if (freq == rt5645->sysclk && clk_id == rt5645->sysclk_src) | 2922 | if (freq == rt5645->sysclk && clk_id == rt5645->sysclk_src) |
@@ -2933,10 +2933,10 @@ static int rt5645_set_dai_sysclk(struct snd_soc_dai *dai, | |||
2933 | reg_val |= RT5645_SCLK_SRC_RCCLK; | 2933 | reg_val |= RT5645_SCLK_SRC_RCCLK; |
2934 | break; | 2934 | break; |
2935 | default: | 2935 | default: |
2936 | dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); | 2936 | dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); |
2937 | return -EINVAL; | 2937 | return -EINVAL; |
2938 | } | 2938 | } |
2939 | snd_soc_update_bits(codec, RT5645_GLB_CLK, | 2939 | snd_soc_component_update_bits(component, RT5645_GLB_CLK, |
2940 | RT5645_SCLK_SRC_MASK, reg_val); | 2940 | RT5645_SCLK_SRC_MASK, reg_val); |
2941 | rt5645->sysclk = freq; | 2941 | rt5645->sysclk = freq; |
2942 | rt5645->sysclk_src = clk_id; | 2942 | rt5645->sysclk_src = clk_id; |
@@ -2949,8 +2949,8 @@ static int rt5645_set_dai_sysclk(struct snd_soc_dai *dai, | |||
2949 | static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | 2949 | static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, |
2950 | unsigned int freq_in, unsigned int freq_out) | 2950 | unsigned int freq_in, unsigned int freq_out) |
2951 | { | 2951 | { |
2952 | struct snd_soc_codec *codec = dai->codec; | 2952 | struct snd_soc_component *component = dai->component; |
2953 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2953 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
2954 | struct rl6231_pll_code pll_code; | 2954 | struct rl6231_pll_code pll_code; |
2955 | int ret; | 2955 | int ret; |
2956 | 2956 | ||
@@ -2959,54 +2959,54 @@ static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | |||
2959 | return 0; | 2959 | return 0; |
2960 | 2960 | ||
2961 | if (!freq_in || !freq_out) { | 2961 | if (!freq_in || !freq_out) { |
2962 | dev_dbg(codec->dev, "PLL disabled\n"); | 2962 | dev_dbg(component->dev, "PLL disabled\n"); |
2963 | 2963 | ||
2964 | rt5645->pll_in = 0; | 2964 | rt5645->pll_in = 0; |
2965 | rt5645->pll_out = 0; | 2965 | rt5645->pll_out = 0; |
2966 | snd_soc_update_bits(codec, RT5645_GLB_CLK, | 2966 | snd_soc_component_update_bits(component, RT5645_GLB_CLK, |
2967 | RT5645_SCLK_SRC_MASK, RT5645_SCLK_SRC_MCLK); | 2967 | RT5645_SCLK_SRC_MASK, RT5645_SCLK_SRC_MCLK); |
2968 | return 0; | 2968 | return 0; |
2969 | } | 2969 | } |
2970 | 2970 | ||
2971 | switch (source) { | 2971 | switch (source) { |
2972 | case RT5645_PLL1_S_MCLK: | 2972 | case RT5645_PLL1_S_MCLK: |
2973 | snd_soc_update_bits(codec, RT5645_GLB_CLK, | 2973 | snd_soc_component_update_bits(component, RT5645_GLB_CLK, |
2974 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_MCLK); | 2974 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_MCLK); |
2975 | break; | 2975 | break; |
2976 | case RT5645_PLL1_S_BCLK1: | 2976 | case RT5645_PLL1_S_BCLK1: |
2977 | case RT5645_PLL1_S_BCLK2: | 2977 | case RT5645_PLL1_S_BCLK2: |
2978 | switch (dai->id) { | 2978 | switch (dai->id) { |
2979 | case RT5645_AIF1: | 2979 | case RT5645_AIF1: |
2980 | snd_soc_update_bits(codec, RT5645_GLB_CLK, | 2980 | snd_soc_component_update_bits(component, RT5645_GLB_CLK, |
2981 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_BCLK1); | 2981 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_BCLK1); |
2982 | break; | 2982 | break; |
2983 | case RT5645_AIF2: | 2983 | case RT5645_AIF2: |
2984 | snd_soc_update_bits(codec, RT5645_GLB_CLK, | 2984 | snd_soc_component_update_bits(component, RT5645_GLB_CLK, |
2985 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_BCLK2); | 2985 | RT5645_PLL1_SRC_MASK, RT5645_PLL1_SRC_BCLK2); |
2986 | break; | 2986 | break; |
2987 | default: | 2987 | default: |
2988 | dev_err(codec->dev, "Invalid dai->id: %d\n", dai->id); | 2988 | dev_err(component->dev, "Invalid dai->id: %d\n", dai->id); |
2989 | return -EINVAL; | 2989 | return -EINVAL; |
2990 | } | 2990 | } |
2991 | break; | 2991 | break; |
2992 | default: | 2992 | default: |
2993 | dev_err(codec->dev, "Unknown PLL source %d\n", source); | 2993 | dev_err(component->dev, "Unknown PLL source %d\n", source); |
2994 | return -EINVAL; | 2994 | return -EINVAL; |
2995 | } | 2995 | } |
2996 | 2996 | ||
2997 | ret = rl6231_pll_calc(freq_in, freq_out, &pll_code); | 2997 | ret = rl6231_pll_calc(freq_in, freq_out, &pll_code); |
2998 | if (ret < 0) { | 2998 | if (ret < 0) { |
2999 | dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); | 2999 | dev_err(component->dev, "Unsupport input clock %d\n", freq_in); |
3000 | return ret; | 3000 | return ret; |
3001 | } | 3001 | } |
3002 | 3002 | ||
3003 | dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=%d\n", | 3003 | dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n", |
3004 | pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), | 3004 | pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), |
3005 | pll_code.n_code, pll_code.k_code); | 3005 | pll_code.n_code, pll_code.k_code); |
3006 | 3006 | ||
3007 | snd_soc_write(codec, RT5645_PLL_CTRL1, | 3007 | snd_soc_component_write(component, RT5645_PLL_CTRL1, |
3008 | pll_code.n_code << RT5645_PLL_N_SFT | pll_code.k_code); | 3008 | pll_code.n_code << RT5645_PLL_N_SFT | pll_code.k_code); |
3009 | snd_soc_write(codec, RT5645_PLL_CTRL2, | 3009 | snd_soc_component_write(component, RT5645_PLL_CTRL2, |
3010 | (pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT | | 3010 | (pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT | |
3011 | pll_code.m_bp << RT5645_PLL_M_BP_SFT); | 3011 | pll_code.m_bp << RT5645_PLL_M_BP_SFT); |
3012 | 3012 | ||
@@ -3020,8 +3020,8 @@ static int rt5645_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | |||
3020 | static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 3020 | static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
3021 | unsigned int rx_mask, int slots, int slot_width) | 3021 | unsigned int rx_mask, int slots, int slot_width) |
3022 | { | 3022 | { |
3023 | struct snd_soc_codec *codec = dai->codec; | 3023 | struct snd_soc_component *component = dai->component; |
3024 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3024 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3025 | unsigned int i_slot_sft, o_slot_sft, i_width_sht, o_width_sht, en_sft; | 3025 | unsigned int i_slot_sft, o_slot_sft, i_width_sht, o_width_sht, en_sft; |
3026 | unsigned int mask, val = 0; | 3026 | unsigned int mask, val = 0; |
3027 | 3027 | ||
@@ -3044,7 +3044,7 @@ static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
3044 | if (rx_mask || tx_mask) { | 3044 | if (rx_mask || tx_mask) { |
3045 | val |= (1 << en_sft); | 3045 | val |= (1 << en_sft); |
3046 | if (rt5645->codec_type == CODEC_TYPE_RT5645) | 3046 | if (rt5645->codec_type == CODEC_TYPE_RT5645) |
3047 | snd_soc_update_bits(codec, RT5645_BASS_BACK, | 3047 | snd_soc_component_update_bits(component, RT5645_BASS_BACK, |
3048 | RT5645_G_BB_BST_MASK, RT5645_G_BB_BST_25DB); | 3048 | RT5645_G_BB_BST_MASK, RT5645_G_BB_BST_25DB); |
3049 | } | 3049 | } |
3050 | 3050 | ||
@@ -3078,45 +3078,45 @@ static int rt5645_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
3078 | break; | 3078 | break; |
3079 | } | 3079 | } |
3080 | 3080 | ||
3081 | snd_soc_update_bits(codec, RT5645_TDM_CTRL_1, mask, val); | 3081 | snd_soc_component_update_bits(component, RT5645_TDM_CTRL_1, mask, val); |
3082 | 3082 | ||
3083 | return 0; | 3083 | return 0; |
3084 | } | 3084 | } |
3085 | 3085 | ||
3086 | static int rt5645_set_bias_level(struct snd_soc_codec *codec, | 3086 | static int rt5645_set_bias_level(struct snd_soc_component *component, |
3087 | enum snd_soc_bias_level level) | 3087 | enum snd_soc_bias_level level) |
3088 | { | 3088 | { |
3089 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3089 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3090 | 3090 | ||
3091 | switch (level) { | 3091 | switch (level) { |
3092 | case SND_SOC_BIAS_PREPARE: | 3092 | case SND_SOC_BIAS_PREPARE: |
3093 | if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { | 3093 | if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { |
3094 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 3094 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
3095 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3095 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
3096 | RT5645_PWR_BG | RT5645_PWR_VREF2, | 3096 | RT5645_PWR_BG | RT5645_PWR_VREF2, |
3097 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3097 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
3098 | RT5645_PWR_BG | RT5645_PWR_VREF2); | 3098 | RT5645_PWR_BG | RT5645_PWR_VREF2); |
3099 | mdelay(10); | 3099 | mdelay(10); |
3100 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 3100 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
3101 | RT5645_PWR_FV1 | RT5645_PWR_FV2, | 3101 | RT5645_PWR_FV1 | RT5645_PWR_FV2, |
3102 | RT5645_PWR_FV1 | RT5645_PWR_FV2); | 3102 | RT5645_PWR_FV1 | RT5645_PWR_FV2); |
3103 | snd_soc_update_bits(codec, RT5645_GEN_CTRL1, | 3103 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL1, |
3104 | RT5645_DIG_GATE_CTRL, RT5645_DIG_GATE_CTRL); | 3104 | RT5645_DIG_GATE_CTRL, RT5645_DIG_GATE_CTRL); |
3105 | } | 3105 | } |
3106 | break; | 3106 | break; |
3107 | 3107 | ||
3108 | case SND_SOC_BIAS_STANDBY: | 3108 | case SND_SOC_BIAS_STANDBY: |
3109 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 3109 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
3110 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3110 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
3111 | RT5645_PWR_BG | RT5645_PWR_VREF2, | 3111 | RT5645_PWR_BG | RT5645_PWR_VREF2, |
3112 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3112 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
3113 | RT5645_PWR_BG | RT5645_PWR_VREF2); | 3113 | RT5645_PWR_BG | RT5645_PWR_VREF2); |
3114 | mdelay(10); | 3114 | mdelay(10); |
3115 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 3115 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
3116 | RT5645_PWR_FV1 | RT5645_PWR_FV2, | 3116 | RT5645_PWR_FV1 | RT5645_PWR_FV2, |
3117 | RT5645_PWR_FV1 | RT5645_PWR_FV2); | 3117 | RT5645_PWR_FV1 | RT5645_PWR_FV2); |
3118 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { | 3118 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { |
3119 | snd_soc_write(codec, RT5645_DEPOP_M2, 0x1140); | 3119 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); |
3120 | msleep(40); | 3120 | msleep(40); |
3121 | if (rt5645->en_button_func) | 3121 | if (rt5645->en_button_func) |
3122 | queue_delayed_work(system_power_efficient_wq, | 3122 | queue_delayed_work(system_power_efficient_wq, |
@@ -3126,11 +3126,11 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, | |||
3126 | break; | 3126 | break; |
3127 | 3127 | ||
3128 | case SND_SOC_BIAS_OFF: | 3128 | case SND_SOC_BIAS_OFF: |
3129 | snd_soc_write(codec, RT5645_DEPOP_M2, 0x1100); | 3129 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1100); |
3130 | if (!rt5645->en_button_func) | 3130 | if (!rt5645->en_button_func) |
3131 | snd_soc_update_bits(codec, RT5645_GEN_CTRL1, | 3131 | snd_soc_component_update_bits(component, RT5645_GEN_CTRL1, |
3132 | RT5645_DIG_GATE_CTRL, 0); | 3132 | RT5645_DIG_GATE_CTRL, 0); |
3133 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 3133 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
3134 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3134 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
3135 | RT5645_PWR_BG | RT5645_PWR_VREF2 | | 3135 | RT5645_PWR_BG | RT5645_PWR_VREF2 | |
3136 | RT5645_PWR_FV1 | RT5645_PWR_FV2, 0x0); | 3136 | RT5645_PWR_FV1 | RT5645_PWR_FV2, 0x0); |
@@ -3143,27 +3143,27 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, | |||
3143 | return 0; | 3143 | return 0; |
3144 | } | 3144 | } |
3145 | 3145 | ||
3146 | static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | 3146 | static void rt5645_enable_push_button_irq(struct snd_soc_component *component, |
3147 | bool enable) | 3147 | bool enable) |
3148 | { | 3148 | { |
3149 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 3149 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
3150 | 3150 | ||
3151 | if (enable) { | 3151 | if (enable) { |
3152 | snd_soc_dapm_force_enable_pin(dapm, "ADC L power"); | 3152 | snd_soc_dapm_force_enable_pin(dapm, "ADC L power"); |
3153 | snd_soc_dapm_force_enable_pin(dapm, "ADC R power"); | 3153 | snd_soc_dapm_force_enable_pin(dapm, "ADC R power"); |
3154 | snd_soc_dapm_sync(dapm); | 3154 | snd_soc_dapm_sync(dapm); |
3155 | 3155 | ||
3156 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD1, 0x3, 0x3); | 3156 | snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD1, 0x3, 0x3); |
3157 | snd_soc_update_bits(codec, | 3157 | snd_soc_component_update_bits(component, |
3158 | RT5645_INT_IRQ_ST, 0x8, 0x8); | 3158 | RT5645_INT_IRQ_ST, 0x8, 0x8); |
3159 | snd_soc_update_bits(codec, | 3159 | snd_soc_component_update_bits(component, |
3160 | RT5650_4BTN_IL_CMD2, 0x8000, 0x8000); | 3160 | RT5650_4BTN_IL_CMD2, 0x8000, 0x8000); |
3161 | snd_soc_read(codec, RT5650_4BTN_IL_CMD1); | 3161 | snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1); |
3162 | pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1, | 3162 | pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1, |
3163 | snd_soc_read(codec, RT5650_4BTN_IL_CMD1)); | 3163 | snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1)); |
3164 | } else { | 3164 | } else { |
3165 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); | 3165 | snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); |
3166 | snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); | 3166 | snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0); |
3167 | 3167 | ||
3168 | snd_soc_dapm_disable_pin(dapm, "ADC L power"); | 3168 | snd_soc_dapm_disable_pin(dapm, "ADC L power"); |
3169 | snd_soc_dapm_disable_pin(dapm, "ADC R power"); | 3169 | snd_soc_dapm_disable_pin(dapm, "ADC R power"); |
@@ -3171,10 +3171,10 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | |||
3171 | } | 3171 | } |
3172 | } | 3172 | } |
3173 | 3173 | ||
3174 | static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | 3174 | static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insert) |
3175 | { | 3175 | { |
3176 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 3176 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
3177 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3177 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3178 | unsigned int val; | 3178 | unsigned int val; |
3179 | 3179 | ||
3180 | if (jack_insert) { | 3180 | if (jack_insert) { |
@@ -3208,12 +3208,12 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
3208 | msleep(600); | 3208 | msleep(600); |
3209 | regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); | 3209 | regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); |
3210 | val &= 0x7; | 3210 | val &= 0x7; |
3211 | dev_dbg(codec->dev, "val = %d\n", val); | 3211 | dev_dbg(component->dev, "val = %d\n", val); |
3212 | 3212 | ||
3213 | if (val == 1 || val == 2) { | 3213 | if (val == 1 || val == 2) { |
3214 | rt5645->jack_type = SND_JACK_HEADSET; | 3214 | rt5645->jack_type = SND_JACK_HEADSET; |
3215 | if (rt5645->en_button_func) { | 3215 | if (rt5645->en_button_func) { |
3216 | rt5645_enable_push_button_irq(codec, true); | 3216 | rt5645_enable_push_button_irq(component, true); |
3217 | } | 3217 | } |
3218 | } else { | 3218 | } else { |
3219 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); | 3219 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
@@ -3235,7 +3235,7 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
3235 | RT5645_CBJ_BST1_EN, 0); | 3235 | RT5645_CBJ_BST1_EN, 0); |
3236 | 3236 | ||
3237 | if (rt5645->en_button_func) | 3237 | if (rt5645->en_button_func) |
3238 | rt5645_enable_push_button_irq(codec, false); | 3238 | rt5645_enable_push_button_irq(component, false); |
3239 | 3239 | ||
3240 | if (rt5645->pdata.jd_mode == 0) | 3240 | if (rt5645->pdata.jd_mode == 0) |
3241 | snd_soc_dapm_disable_pin(dapm, "LDO2"); | 3241 | snd_soc_dapm_disable_pin(dapm, "LDO2"); |
@@ -3249,25 +3249,25 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
3249 | return rt5645->jack_type; | 3249 | return rt5645->jack_type; |
3250 | } | 3250 | } |
3251 | 3251 | ||
3252 | static int rt5645_button_detect(struct snd_soc_codec *codec) | 3252 | static int rt5645_button_detect(struct snd_soc_component *component) |
3253 | { | 3253 | { |
3254 | int btn_type, val; | 3254 | int btn_type, val; |
3255 | 3255 | ||
3256 | val = snd_soc_read(codec, RT5650_4BTN_IL_CMD1); | 3256 | val = snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1); |
3257 | pr_debug("val=0x%x\n", val); | 3257 | pr_debug("val=0x%x\n", val); |
3258 | btn_type = val & 0xfff0; | 3258 | btn_type = val & 0xfff0; |
3259 | snd_soc_write(codec, RT5650_4BTN_IL_CMD1, val); | 3259 | snd_soc_component_write(component, RT5650_4BTN_IL_CMD1, val); |
3260 | 3260 | ||
3261 | return btn_type; | 3261 | return btn_type; |
3262 | } | 3262 | } |
3263 | 3263 | ||
3264 | static irqreturn_t rt5645_irq(int irq, void *data); | 3264 | static irqreturn_t rt5645_irq(int irq, void *data); |
3265 | 3265 | ||
3266 | int rt5645_set_jack_detect(struct snd_soc_codec *codec, | 3266 | int rt5645_set_jack_detect(struct snd_soc_component *component, |
3267 | struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, | 3267 | struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, |
3268 | struct snd_soc_jack *btn_jack) | 3268 | struct snd_soc_jack *btn_jack) |
3269 | { | 3269 | { |
3270 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3270 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3271 | 3271 | ||
3272 | rt5645->hp_jack = hp_jack; | 3272 | rt5645->hp_jack = hp_jack; |
3273 | rt5645->mic_jack = mic_jack; | 3273 | rt5645->mic_jack = mic_jack; |
@@ -3291,16 +3291,16 @@ static void rt5645_jack_detect_work(struct work_struct *work) | |||
3291 | container_of(work, struct rt5645_priv, jack_detect_work.work); | 3291 | container_of(work, struct rt5645_priv, jack_detect_work.work); |
3292 | int val, btn_type, gpio_state = 0, report = 0; | 3292 | int val, btn_type, gpio_state = 0, report = 0; |
3293 | 3293 | ||
3294 | if (!rt5645->codec) | 3294 | if (!rt5645->component) |
3295 | return; | 3295 | return; |
3296 | 3296 | ||
3297 | switch (rt5645->pdata.jd_mode) { | 3297 | switch (rt5645->pdata.jd_mode) { |
3298 | case 0: /* Not using rt5645 JD */ | 3298 | case 0: /* Not using rt5645 JD */ |
3299 | if (rt5645->gpiod_hp_det) { | 3299 | if (rt5645->gpiod_hp_det) { |
3300 | gpio_state = gpiod_get_value(rt5645->gpiod_hp_det); | 3300 | gpio_state = gpiod_get_value(rt5645->gpiod_hp_det); |
3301 | dev_dbg(rt5645->codec->dev, "gpio_state = %d\n", | 3301 | dev_dbg(rt5645->component->dev, "gpio_state = %d\n", |
3302 | gpio_state); | 3302 | gpio_state); |
3303 | report = rt5645_jack_detect(rt5645->codec, gpio_state); | 3303 | report = rt5645_jack_detect(rt5645->component, gpio_state); |
3304 | } | 3304 | } |
3305 | snd_soc_jack_report(rt5645->hp_jack, | 3305 | snd_soc_jack_report(rt5645->hp_jack, |
3306 | report, SND_JACK_HEADPHONE); | 3306 | report, SND_JACK_HEADPHONE); |
@@ -3308,20 +3308,20 @@ static void rt5645_jack_detect_work(struct work_struct *work) | |||
3308 | report, SND_JACK_MICROPHONE); | 3308 | report, SND_JACK_MICROPHONE); |
3309 | return; | 3309 | return; |
3310 | default: /* read rt5645 jd1_1 status */ | 3310 | default: /* read rt5645 jd1_1 status */ |
3311 | val = snd_soc_read(rt5645->codec, RT5645_INT_IRQ_ST) & 0x1000; | 3311 | val = snd_soc_component_read32(rt5645->component, RT5645_INT_IRQ_ST) & 0x1000; |
3312 | break; | 3312 | break; |
3313 | 3313 | ||
3314 | } | 3314 | } |
3315 | 3315 | ||
3316 | if (!val && (rt5645->jack_type == 0)) { /* jack in */ | 3316 | if (!val && (rt5645->jack_type == 0)) { /* jack in */ |
3317 | report = rt5645_jack_detect(rt5645->codec, 1); | 3317 | report = rt5645_jack_detect(rt5645->component, 1); |
3318 | } else if (!val && rt5645->jack_type != 0) { | 3318 | } else if (!val && rt5645->jack_type != 0) { |
3319 | /* for push button and jack out */ | 3319 | /* for push button and jack out */ |
3320 | btn_type = 0; | 3320 | btn_type = 0; |
3321 | if (snd_soc_read(rt5645->codec, RT5645_INT_IRQ_ST) & 0x4) { | 3321 | if (snd_soc_component_read32(rt5645->component, RT5645_INT_IRQ_ST) & 0x4) { |
3322 | /* button pressed */ | 3322 | /* button pressed */ |
3323 | report = SND_JACK_HEADSET; | 3323 | report = SND_JACK_HEADSET; |
3324 | btn_type = rt5645_button_detect(rt5645->codec); | 3324 | btn_type = rt5645_button_detect(rt5645->component); |
3325 | /* rt5650 can report three kinds of button behavior, | 3325 | /* rt5650 can report three kinds of button behavior, |
3326 | one click, double click and hold. However, | 3326 | one click, double click and hold. However, |
3327 | currently we will report button pressed/released | 3327 | currently we will report button pressed/released |
@@ -3351,7 +3351,7 @@ static void rt5645_jack_detect_work(struct work_struct *work) | |||
3351 | case 0x0000: /* unpressed */ | 3351 | case 0x0000: /* unpressed */ |
3352 | break; | 3352 | break; |
3353 | default: | 3353 | default: |
3354 | dev_err(rt5645->codec->dev, | 3354 | dev_err(rt5645->component->dev, |
3355 | "Unexpected button code 0x%04x\n", | 3355 | "Unexpected button code 0x%04x\n", |
3356 | btn_type); | 3356 | btn_type); |
3357 | break; | 3357 | break; |
@@ -3366,9 +3366,9 @@ static void rt5645_jack_detect_work(struct work_struct *work) | |||
3366 | } else { | 3366 | } else { |
3367 | /* jack out */ | 3367 | /* jack out */ |
3368 | report = 0; | 3368 | report = 0; |
3369 | snd_soc_update_bits(rt5645->codec, | 3369 | snd_soc_component_update_bits(rt5645->component, |
3370 | RT5645_INT_IRQ_ST, 0x1, 0x0); | 3370 | RT5645_INT_IRQ_ST, 0x1, 0x0); |
3371 | rt5645_jack_detect(rt5645->codec, 0); | 3371 | rt5645_jack_detect(rt5645->component, 0); |
3372 | } | 3372 | } |
3373 | 3373 | ||
3374 | snd_soc_jack_report(rt5645->hp_jack, report, SND_JACK_HEADPHONE); | 3374 | snd_soc_jack_report(rt5645->hp_jack, report, SND_JACK_HEADPHONE); |
@@ -3406,12 +3406,12 @@ static void rt5645_btn_check_callback(struct timer_list *t) | |||
3406 | &rt5645->jack_detect_work, msecs_to_jiffies(5)); | 3406 | &rt5645->jack_detect_work, msecs_to_jiffies(5)); |
3407 | } | 3407 | } |
3408 | 3408 | ||
3409 | static int rt5645_probe(struct snd_soc_codec *codec) | 3409 | static int rt5645_probe(struct snd_soc_component *component) |
3410 | { | 3410 | { |
3411 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 3411 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
3412 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3412 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3413 | 3413 | ||
3414 | rt5645->codec = codec; | 3414 | rt5645->component = component; |
3415 | 3415 | ||
3416 | switch (rt5645->codec_type) { | 3416 | switch (rt5645->codec_type) { |
3417 | case CODEC_TYPE_RT5645: | 3417 | case CODEC_TYPE_RT5645: |
@@ -3437,7 +3437,7 @@ static int rt5645_probe(struct snd_soc_codec *codec) | |||
3437 | break; | 3437 | break; |
3438 | } | 3438 | } |
3439 | 3439 | ||
3440 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); | 3440 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); |
3441 | 3441 | ||
3442 | /* for JD function */ | 3442 | /* for JD function */ |
3443 | if (rt5645->pdata.jd_mode) { | 3443 | if (rt5645->pdata.jd_mode) { |
@@ -3447,24 +3447,23 @@ static int rt5645_probe(struct snd_soc_codec *codec) | |||
3447 | } | 3447 | } |
3448 | 3448 | ||
3449 | if (rt5645->pdata.long_name) | 3449 | if (rt5645->pdata.long_name) |
3450 | codec->component.card->long_name = rt5645->pdata.long_name; | 3450 | component->card->long_name = rt5645->pdata.long_name; |
3451 | 3451 | ||
3452 | rt5645->eq_param = devm_kzalloc(codec->dev, | 3452 | rt5645->eq_param = devm_kzalloc(component->dev, |
3453 | RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL); | 3453 | RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL); |
3454 | 3454 | ||
3455 | return 0; | 3455 | return 0; |
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | static int rt5645_remove(struct snd_soc_codec *codec) | 3458 | static void rt5645_remove(struct snd_soc_component *component) |
3459 | { | 3459 | { |
3460 | rt5645_reset(codec); | 3460 | rt5645_reset(component); |
3461 | return 0; | ||
3462 | } | 3461 | } |
3463 | 3462 | ||
3464 | #ifdef CONFIG_PM | 3463 | #ifdef CONFIG_PM |
3465 | static int rt5645_suspend(struct snd_soc_codec *codec) | 3464 | static int rt5645_suspend(struct snd_soc_component *component) |
3466 | { | 3465 | { |
3467 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3466 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3468 | 3467 | ||
3469 | regcache_cache_only(rt5645->regmap, true); | 3468 | regcache_cache_only(rt5645->regmap, true); |
3470 | regcache_mark_dirty(rt5645->regmap); | 3469 | regcache_mark_dirty(rt5645->regmap); |
@@ -3472,9 +3471,9 @@ static int rt5645_suspend(struct snd_soc_codec *codec) | |||
3472 | return 0; | 3471 | return 0; |
3473 | } | 3472 | } |
3474 | 3473 | ||
3475 | static int rt5645_resume(struct snd_soc_codec *codec) | 3474 | static int rt5645_resume(struct snd_soc_component *component) |
3476 | { | 3475 | { |
3477 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3476 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
3478 | 3477 | ||
3479 | regcache_cache_only(rt5645->regmap, false); | 3478 | regcache_cache_only(rt5645->regmap, false); |
3480 | regcache_sync(rt5645->regmap); | 3479 | regcache_sync(rt5645->regmap); |
@@ -3539,21 +3538,21 @@ static struct snd_soc_dai_driver rt5645_dai[] = { | |||
3539 | }, | 3538 | }, |
3540 | }; | 3539 | }; |
3541 | 3540 | ||
3542 | static const struct snd_soc_codec_driver soc_codec_dev_rt5645 = { | 3541 | static const struct snd_soc_component_driver soc_component_dev_rt5645 = { |
3543 | .probe = rt5645_probe, | 3542 | .probe = rt5645_probe, |
3544 | .remove = rt5645_remove, | 3543 | .remove = rt5645_remove, |
3545 | .suspend = rt5645_suspend, | 3544 | .suspend = rt5645_suspend, |
3546 | .resume = rt5645_resume, | 3545 | .resume = rt5645_resume, |
3547 | .set_bias_level = rt5645_set_bias_level, | 3546 | .set_bias_level = rt5645_set_bias_level, |
3548 | .idle_bias_off = true, | 3547 | .controls = rt5645_snd_controls, |
3549 | .component_driver = { | 3548 | .num_controls = ARRAY_SIZE(rt5645_snd_controls), |
3550 | .controls = rt5645_snd_controls, | 3549 | .dapm_widgets = rt5645_dapm_widgets, |
3551 | .num_controls = ARRAY_SIZE(rt5645_snd_controls), | 3550 | .num_dapm_widgets = ARRAY_SIZE(rt5645_dapm_widgets), |
3552 | .dapm_widgets = rt5645_dapm_widgets, | 3551 | .dapm_routes = rt5645_dapm_routes, |
3553 | .num_dapm_widgets = ARRAY_SIZE(rt5645_dapm_widgets), | 3552 | .num_dapm_routes = ARRAY_SIZE(rt5645_dapm_routes), |
3554 | .dapm_routes = rt5645_dapm_routes, | 3553 | .use_pmdown_time = 1, |
3555 | .num_dapm_routes = ARRAY_SIZE(rt5645_dapm_routes), | 3554 | .endianness = 1, |
3556 | }, | 3555 | .non_legacy_dai_naming = 1, |
3557 | }; | 3556 | }; |
3558 | 3557 | ||
3559 | static const struct regmap_config rt5645_regmap = { | 3558 | static const struct regmap_config rt5645_regmap = { |
@@ -4028,7 +4027,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
4028 | } | 4027 | } |
4029 | } | 4028 | } |
4030 | 4029 | ||
4031 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645, | 4030 | ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_rt5645, |
4032 | rt5645_dai, ARRAY_SIZE(rt5645_dai)); | 4031 | rt5645_dai, ARRAY_SIZE(rt5645_dai)); |
4033 | if (ret) | 4032 | if (ret) |
4034 | goto err_irq; | 4033 | goto err_irq; |
@@ -4054,7 +4053,6 @@ static int rt5645_i2c_remove(struct i2c_client *i2c) | |||
4054 | cancel_delayed_work_sync(&rt5645->rcclock_work); | 4053 | cancel_delayed_work_sync(&rt5645->rcclock_work); |
4055 | del_timer_sync(&rt5645->btn_check_timer); | 4054 | del_timer_sync(&rt5645->btn_check_timer); |
4056 | 4055 | ||
4057 | snd_soc_unregister_codec(&i2c->dev); | ||
4058 | regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); | 4056 | regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); |
4059 | 4057 | ||
4060 | return 0; | 4058 | return 0; |
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h index 940325b28c29..cc2455768368 100644 --- a/sound/soc/codecs/rt5645.h +++ b/sound/soc/codecs/rt5645.h | |||
@@ -2200,10 +2200,10 @@ enum { | |||
2200 | RT5645_AD_MONO_R_FILTER = (0x1 << 5), | 2200 | RT5645_AD_MONO_R_FILTER = (0x1 << 5), |
2201 | }; | 2201 | }; |
2202 | 2202 | ||
2203 | int rt5645_sel_asrc_clk_src(struct snd_soc_codec *codec, | 2203 | int rt5645_sel_asrc_clk_src(struct snd_soc_component *component, |
2204 | unsigned int filter_mask, unsigned int clk_src); | 2204 | unsigned int filter_mask, unsigned int clk_src); |
2205 | 2205 | ||
2206 | int rt5645_set_jack_detect(struct snd_soc_codec *codec, | 2206 | int rt5645_set_jack_detect(struct snd_soc_component *component, |
2207 | struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, | 2207 | struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, |
2208 | struct snd_soc_jack *btn_jack); | 2208 | struct snd_soc_jack *btn_jack); |
2209 | #endif /* __RT5645_H__ */ | 2209 | #endif /* __RT5645_H__ */ |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 0791fec398fb..bc1a23dd7c2d 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -554,7 +554,7 @@ static bool rt5677_readable_register(struct device *dev, unsigned int reg) | |||
554 | static int rt5677_dsp_mode_i2c_write_addr(struct rt5677_priv *rt5677, | 554 | static int rt5677_dsp_mode_i2c_write_addr(struct rt5677_priv *rt5677, |
555 | unsigned int addr, unsigned int value, unsigned int opcode) | 555 | unsigned int addr, unsigned int value, unsigned int opcode) |
556 | { | 556 | { |
557 | struct snd_soc_codec *codec = rt5677->codec; | 557 | struct snd_soc_component *component = rt5677->component; |
558 | int ret; | 558 | int ret; |
559 | 559 | ||
560 | mutex_lock(&rt5677->dsp_cmd_lock); | 560 | mutex_lock(&rt5677->dsp_cmd_lock); |
@@ -562,35 +562,35 @@ static int rt5677_dsp_mode_i2c_write_addr(struct rt5677_priv *rt5677, | |||
562 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, | 562 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, |
563 | addr >> 16); | 563 | addr >> 16); |
564 | if (ret < 0) { | 564 | if (ret < 0) { |
565 | dev_err(codec->dev, "Failed to set addr msb value: %d\n", ret); | 565 | dev_err(component->dev, "Failed to set addr msb value: %d\n", ret); |
566 | goto err; | 566 | goto err; |
567 | } | 567 | } |
568 | 568 | ||
569 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, | 569 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, |
570 | addr & 0xffff); | 570 | addr & 0xffff); |
571 | if (ret < 0) { | 571 | if (ret < 0) { |
572 | dev_err(codec->dev, "Failed to set addr lsb value: %d\n", ret); | 572 | dev_err(component->dev, "Failed to set addr lsb value: %d\n", ret); |
573 | goto err; | 573 | goto err; |
574 | } | 574 | } |
575 | 575 | ||
576 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_MSB, | 576 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_MSB, |
577 | value >> 16); | 577 | value >> 16); |
578 | if (ret < 0) { | 578 | if (ret < 0) { |
579 | dev_err(codec->dev, "Failed to set data msb value: %d\n", ret); | 579 | dev_err(component->dev, "Failed to set data msb value: %d\n", ret); |
580 | goto err; | 580 | goto err; |
581 | } | 581 | } |
582 | 582 | ||
583 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_LSB, | 583 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_LSB, |
584 | value & 0xffff); | 584 | value & 0xffff); |
585 | if (ret < 0) { | 585 | if (ret < 0) { |
586 | dev_err(codec->dev, "Failed to set data lsb value: %d\n", ret); | 586 | dev_err(component->dev, "Failed to set data lsb value: %d\n", ret); |
587 | goto err; | 587 | goto err; |
588 | } | 588 | } |
589 | 589 | ||
590 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, | 590 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, |
591 | opcode); | 591 | opcode); |
592 | if (ret < 0) { | 592 | if (ret < 0) { |
593 | dev_err(codec->dev, "Failed to set op code value: %d\n", ret); | 593 | dev_err(component->dev, "Failed to set op code value: %d\n", ret); |
594 | goto err; | 594 | goto err; |
595 | } | 595 | } |
596 | 596 | ||
@@ -612,7 +612,7 @@ err: | |||
612 | static int rt5677_dsp_mode_i2c_read_addr( | 612 | static int rt5677_dsp_mode_i2c_read_addr( |
613 | struct rt5677_priv *rt5677, unsigned int addr, unsigned int *value) | 613 | struct rt5677_priv *rt5677, unsigned int addr, unsigned int *value) |
614 | { | 614 | { |
615 | struct snd_soc_codec *codec = rt5677->codec; | 615 | struct snd_soc_component *component = rt5677->component; |
616 | int ret; | 616 | int ret; |
617 | unsigned int msb, lsb; | 617 | unsigned int msb, lsb; |
618 | 618 | ||
@@ -621,21 +621,21 @@ static int rt5677_dsp_mode_i2c_read_addr( | |||
621 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, | 621 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, |
622 | addr >> 16); | 622 | addr >> 16); |
623 | if (ret < 0) { | 623 | if (ret < 0) { |
624 | dev_err(codec->dev, "Failed to set addr msb value: %d\n", ret); | 624 | dev_err(component->dev, "Failed to set addr msb value: %d\n", ret); |
625 | goto err; | 625 | goto err; |
626 | } | 626 | } |
627 | 627 | ||
628 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, | 628 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, |
629 | addr & 0xffff); | 629 | addr & 0xffff); |
630 | if (ret < 0) { | 630 | if (ret < 0) { |
631 | dev_err(codec->dev, "Failed to set addr lsb value: %d\n", ret); | 631 | dev_err(component->dev, "Failed to set addr lsb value: %d\n", ret); |
632 | goto err; | 632 | goto err; |
633 | } | 633 | } |
634 | 634 | ||
635 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, | 635 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, |
636 | 0x0002); | 636 | 0x0002); |
637 | if (ret < 0) { | 637 | if (ret < 0) { |
638 | dev_err(codec->dev, "Failed to set op code value: %d\n", ret); | 638 | dev_err(component->dev, "Failed to set op code value: %d\n", ret); |
639 | goto err; | 639 | goto err; |
640 | } | 640 | } |
641 | 641 | ||
@@ -685,9 +685,9 @@ static int rt5677_dsp_mode_i2c_read( | |||
685 | return ret; | 685 | return ret; |
686 | } | 686 | } |
687 | 687 | ||
688 | static void rt5677_set_dsp_mode(struct snd_soc_codec *codec, bool on) | 688 | static void rt5677_set_dsp_mode(struct snd_soc_component *component, bool on) |
689 | { | 689 | { |
690 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 690 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
691 | 691 | ||
692 | if (on) { | 692 | if (on) { |
693 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x2, 0x2); | 693 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x2, 0x2); |
@@ -698,9 +698,9 @@ static void rt5677_set_dsp_mode(struct snd_soc_codec *codec, bool on) | |||
698 | } | 698 | } |
699 | } | 699 | } |
700 | 700 | ||
701 | static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on) | 701 | static int rt5677_set_dsp_vad(struct snd_soc_component *component, bool on) |
702 | { | 702 | { |
703 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 703 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
704 | static bool activity; | 704 | static bool activity; |
705 | int ret; | 705 | int ret; |
706 | 706 | ||
@@ -740,17 +740,17 @@ static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on) | |||
740 | } | 740 | } |
741 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x07ff); | 741 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x07ff); |
742 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x07fd); | 742 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x07fd); |
743 | rt5677_set_dsp_mode(codec, true); | 743 | rt5677_set_dsp_mode(component, true); |
744 | 744 | ||
745 | ret = request_firmware(&rt5677->fw1, RT5677_FIRMWARE1, | 745 | ret = request_firmware(&rt5677->fw1, RT5677_FIRMWARE1, |
746 | codec->dev); | 746 | component->dev); |
747 | if (ret == 0) { | 747 | if (ret == 0) { |
748 | rt5677_spi_write_firmware(0x50000000, rt5677->fw1); | 748 | rt5677_spi_write_firmware(0x50000000, rt5677->fw1); |
749 | release_firmware(rt5677->fw1); | 749 | release_firmware(rt5677->fw1); |
750 | } | 750 | } |
751 | 751 | ||
752 | ret = request_firmware(&rt5677->fw2, RT5677_FIRMWARE2, | 752 | ret = request_firmware(&rt5677->fw2, RT5677_FIRMWARE2, |
753 | codec->dev); | 753 | component->dev); |
754 | if (ret == 0) { | 754 | if (ret == 0) { |
755 | rt5677_spi_write_firmware(0x60000000, rt5677->fw2); | 755 | rt5677_spi_write_firmware(0x60000000, rt5677->fw2); |
756 | release_firmware(rt5677->fw2); | 756 | release_firmware(rt5677->fw2); |
@@ -767,7 +767,7 @@ static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on) | |||
767 | regcache_cache_bypass(rt5677->regmap, true); | 767 | regcache_cache_bypass(rt5677->regmap, true); |
768 | 768 | ||
769 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x1, 0x1); | 769 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x1, 0x1); |
770 | rt5677_set_dsp_mode(codec, false); | 770 | rt5677_set_dsp_mode(component, false); |
771 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x0001); | 771 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x0001); |
772 | 772 | ||
773 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); | 773 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); |
@@ -812,12 +812,11 @@ static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, | |||
812 | { | 812 | { |
813 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 813 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
814 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); | 814 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
815 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); | ||
816 | 815 | ||
817 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; | 816 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; |
818 | 817 | ||
819 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) | 818 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) |
820 | rt5677_set_dsp_vad(codec, rt5677->dsp_vad_en); | 819 | rt5677_set_dsp_vad(component, rt5677->dsp_vad_en); |
821 | 820 | ||
822 | return 0; | 821 | return 0; |
823 | } | 822 | } |
@@ -911,15 +910,15 @@ static const struct snd_kcontrol_new rt5677_snd_controls[] = { | |||
911 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 910 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
912 | struct snd_kcontrol *kcontrol, int event) | 911 | struct snd_kcontrol *kcontrol, int event) |
913 | { | 912 | { |
914 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 913 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
915 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 914 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
916 | int idx, rate; | 915 | int idx, rate; |
917 | 916 | ||
918 | rate = rt5677->sysclk / rl6231_get_pre_div(rt5677->regmap, | 917 | rate = rt5677->sysclk / rl6231_get_pre_div(rt5677->regmap, |
919 | RT5677_CLK_TREE_CTRL1, RT5677_I2S_PD1_SFT); | 918 | RT5677_CLK_TREE_CTRL1, RT5677_I2S_PD1_SFT); |
920 | idx = rl6231_calc_dmic_clk(rate); | 919 | idx = rl6231_calc_dmic_clk(rate); |
921 | if (idx < 0) | 920 | if (idx < 0) |
922 | dev_err(codec->dev, "Failed to set DMIC clock\n"); | 921 | dev_err(component->dev, "Failed to set DMIC clock\n"); |
923 | else | 922 | else |
924 | regmap_update_bits(rt5677->regmap, RT5677_DMIC_CTRL1, | 923 | regmap_update_bits(rt5677->regmap, RT5677_DMIC_CTRL1, |
925 | RT5677_DMIC_CLK_MASK, idx << RT5677_DMIC_CLK_SFT); | 924 | RT5677_DMIC_CLK_MASK, idx << RT5677_DMIC_CLK_SFT); |
@@ -929,8 +928,8 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
929 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 928 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
930 | struct snd_soc_dapm_widget *sink) | 929 | struct snd_soc_dapm_widget *sink) |
931 | { | 930 | { |
932 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 931 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
933 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 932 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
934 | unsigned int val; | 933 | unsigned int val; |
935 | 934 | ||
936 | regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); | 935 | regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); |
@@ -944,8 +943,8 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
944 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | 943 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
945 | struct snd_soc_dapm_widget *sink) | 944 | struct snd_soc_dapm_widget *sink) |
946 | { | 945 | { |
947 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 946 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
948 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 947 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
949 | unsigned int reg, shift, val; | 948 | unsigned int reg, shift, val; |
950 | 949 | ||
951 | if (source->reg == RT5677_ASRC_1) { | 950 | if (source->reg == RT5677_ASRC_1) { |
@@ -1027,8 +1026,8 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
1027 | static int can_use_asrc(struct snd_soc_dapm_widget *source, | 1026 | static int can_use_asrc(struct snd_soc_dapm_widget *source, |
1028 | struct snd_soc_dapm_widget *sink) | 1027 | struct snd_soc_dapm_widget *sink) |
1029 | { | 1028 | { |
1030 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 1029 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
1031 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 1030 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
1032 | 1031 | ||
1033 | if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384) | 1032 | if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384) |
1034 | return 1; | 1033 | return 1; |
@@ -1038,7 +1037,7 @@ static int can_use_asrc(struct snd_soc_dapm_widget *source, | |||
1038 | 1037 | ||
1039 | /** | 1038 | /** |
1040 | * rt5677_sel_asrc_clk_src - select ASRC clock source for a set of filters | 1039 | * rt5677_sel_asrc_clk_src - select ASRC clock source for a set of filters |
1041 | * @codec: SoC audio codec device. | 1040 | * @component: SoC audio component device. |
1042 | * @filter_mask: mask of filters. | 1041 | * @filter_mask: mask of filters. |
1043 | * @clk_src: clock source | 1042 | * @clk_src: clock source |
1044 | * | 1043 | * |
@@ -1050,10 +1049,10 @@ static int can_use_asrc(struct snd_soc_dapm_widget *source, | |||
1050 | * set of filters specified by the mask. And the codec driver will turn on ASRC | 1049 | * set of filters specified by the mask. And the codec driver will turn on ASRC |
1051 | * for these filters if ASRC is selected as their clock source. | 1050 | * for these filters if ASRC is selected as their clock source. |
1052 | */ | 1051 | */ |
1053 | int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec, | 1052 | int rt5677_sel_asrc_clk_src(struct snd_soc_component *component, |
1054 | unsigned int filter_mask, unsigned int clk_src) | 1053 | unsigned int filter_mask, unsigned int clk_src) |
1055 | { | 1054 | { |
1056 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 1055 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
1057 | unsigned int asrc3_mask = 0, asrc3_value = 0; | 1056 | unsigned int asrc3_mask = 0, asrc3_value = 0; |
1058 | unsigned int asrc4_mask = 0, asrc4_value = 0; | 1057 | unsigned int asrc4_mask = 0, asrc4_value = 0; |
1059 | unsigned int asrc5_mask = 0, asrc5_value = 0; | 1058 | unsigned int asrc5_mask = 0, asrc5_value = 0; |
@@ -1232,8 +1231,8 @@ EXPORT_SYMBOL_GPL(rt5677_sel_asrc_clk_src); | |||
1232 | static int rt5677_dmic_use_asrc(struct snd_soc_dapm_widget *source, | 1231 | static int rt5677_dmic_use_asrc(struct snd_soc_dapm_widget *source, |
1233 | struct snd_soc_dapm_widget *sink) | 1232 | struct snd_soc_dapm_widget *sink) |
1234 | { | 1233 | { |
1235 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | 1234 | struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); |
1236 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 1235 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
1237 | unsigned int asrc_setting; | 1236 | unsigned int asrc_setting; |
1238 | 1237 | ||
1239 | switch (source->shift) { | 1238 | switch (source->shift) { |
@@ -2393,8 +2392,8 @@ static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux = | |||
2393 | static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, | 2392 | static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, |
2394 | struct snd_kcontrol *kcontrol, int event) | 2393 | struct snd_kcontrol *kcontrol, int event) |
2395 | { | 2394 | { |
2396 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2395 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2397 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2396 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2398 | 2397 | ||
2399 | switch (event) { | 2398 | switch (event) { |
2400 | case SND_SOC_DAPM_POST_PMU: | 2399 | case SND_SOC_DAPM_POST_PMU: |
@@ -2417,8 +2416,8 @@ static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, | |||
2417 | static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, | 2416 | static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, |
2418 | struct snd_kcontrol *kcontrol, int event) | 2417 | struct snd_kcontrol *kcontrol, int event) |
2419 | { | 2418 | { |
2420 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2419 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2421 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2420 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2422 | 2421 | ||
2423 | switch (event) { | 2422 | switch (event) { |
2424 | case SND_SOC_DAPM_POST_PMU: | 2423 | case SND_SOC_DAPM_POST_PMU: |
@@ -2441,8 +2440,8 @@ static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, | |||
2441 | static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, | 2440 | static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, |
2442 | struct snd_kcontrol *kcontrol, int event) | 2441 | struct snd_kcontrol *kcontrol, int event) |
2443 | { | 2442 | { |
2444 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2443 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2445 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2444 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2446 | 2445 | ||
2447 | switch (event) { | 2446 | switch (event) { |
2448 | case SND_SOC_DAPM_PRE_PMU: | 2447 | case SND_SOC_DAPM_PRE_PMU: |
@@ -2463,8 +2462,8 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, | |||
2463 | static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, | 2462 | static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, |
2464 | struct snd_kcontrol *kcontrol, int event) | 2463 | struct snd_kcontrol *kcontrol, int event) |
2465 | { | 2464 | { |
2466 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2465 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2467 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2466 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2468 | 2467 | ||
2469 | switch (event) { | 2468 | switch (event) { |
2470 | case SND_SOC_DAPM_PRE_PMU: | 2469 | case SND_SOC_DAPM_PRE_PMU: |
@@ -2485,8 +2484,8 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, | |||
2485 | static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, | 2484 | static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, |
2486 | struct snd_kcontrol *kcontrol, int event) | 2485 | struct snd_kcontrol *kcontrol, int event) |
2487 | { | 2486 | { |
2488 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2487 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2489 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2488 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2490 | 2489 | ||
2491 | switch (event) { | 2490 | switch (event) { |
2492 | case SND_SOC_DAPM_POST_PMU: | 2491 | case SND_SOC_DAPM_POST_PMU: |
@@ -2512,8 +2511,8 @@ static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, | |||
2512 | static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, | 2511 | static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, |
2513 | struct snd_kcontrol *kcontrol, int event) | 2512 | struct snd_kcontrol *kcontrol, int event) |
2514 | { | 2513 | { |
2515 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2514 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2516 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2515 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2517 | unsigned int value; | 2516 | unsigned int value; |
2518 | 2517 | ||
2519 | switch (event) { | 2518 | switch (event) { |
@@ -2535,8 +2534,8 @@ static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, | |||
2535 | static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, | 2534 | static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, |
2536 | struct snd_kcontrol *kcontrol, int event) | 2535 | struct snd_kcontrol *kcontrol, int event) |
2537 | { | 2536 | { |
2538 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2537 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2539 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2538 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2540 | unsigned int value; | 2539 | unsigned int value; |
2541 | 2540 | ||
2542 | switch (event) { | 2541 | switch (event) { |
@@ -2558,12 +2557,12 @@ static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, | |||
2558 | static int rt5677_vref_event(struct snd_soc_dapm_widget *w, | 2557 | static int rt5677_vref_event(struct snd_soc_dapm_widget *w, |
2559 | struct snd_kcontrol *kcontrol, int event) | 2558 | struct snd_kcontrol *kcontrol, int event) |
2560 | { | 2559 | { |
2561 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 2560 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
2562 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2561 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
2563 | 2562 | ||
2564 | switch (event) { | 2563 | switch (event) { |
2565 | case SND_SOC_DAPM_POST_PMU: | 2564 | case SND_SOC_DAPM_POST_PMU: |
2566 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON && | 2565 | if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON && |
2567 | !rt5677->is_vref_slow) { | 2566 | !rt5677->is_vref_slow) { |
2568 | mdelay(20); | 2567 | mdelay(20); |
2569 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, | 2568 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
@@ -4098,21 +4097,21 @@ static const struct snd_soc_dapm_route rt5677_dmic2_clk_2[] = { | |||
4098 | static int rt5677_hw_params(struct snd_pcm_substream *substream, | 4097 | static int rt5677_hw_params(struct snd_pcm_substream *substream, |
4099 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 4098 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
4100 | { | 4099 | { |
4101 | struct snd_soc_codec *codec = dai->codec; | 4100 | struct snd_soc_component *component = dai->component; |
4102 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4101 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4103 | unsigned int val_len = 0, val_clk, mask_clk; | 4102 | unsigned int val_len = 0, val_clk, mask_clk; |
4104 | int pre_div, bclk_ms, frame_size; | 4103 | int pre_div, bclk_ms, frame_size; |
4105 | 4104 | ||
4106 | rt5677->lrck[dai->id] = params_rate(params); | 4105 | rt5677->lrck[dai->id] = params_rate(params); |
4107 | pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); | 4106 | pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); |
4108 | if (pre_div < 0) { | 4107 | if (pre_div < 0) { |
4109 | dev_err(codec->dev, "Unsupported clock setting: sysclk=%dHz lrck=%dHz\n", | 4108 | dev_err(component->dev, "Unsupported clock setting: sysclk=%dHz lrck=%dHz\n", |
4110 | rt5677->sysclk, rt5677->lrck[dai->id]); | 4109 | rt5677->sysclk, rt5677->lrck[dai->id]); |
4111 | return -EINVAL; | 4110 | return -EINVAL; |
4112 | } | 4111 | } |
4113 | frame_size = snd_soc_params_to_frame_size(params); | 4112 | frame_size = snd_soc_params_to_frame_size(params); |
4114 | if (frame_size < 0) { | 4113 | if (frame_size < 0) { |
4115 | dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); | 4114 | dev_err(component->dev, "Unsupported frame size: %d\n", frame_size); |
4116 | return -EINVAL; | 4115 | return -EINVAL; |
4117 | } | 4116 | } |
4118 | bclk_ms = frame_size > 32; | 4117 | bclk_ms = frame_size > 32; |
@@ -4183,8 +4182,8 @@ static int rt5677_hw_params(struct snd_pcm_substream *substream, | |||
4183 | 4182 | ||
4184 | static int rt5677_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 4183 | static int rt5677_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
4185 | { | 4184 | { |
4186 | struct snd_soc_codec *codec = dai->codec; | 4185 | struct snd_soc_component *component = dai->component; |
4187 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4186 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4188 | unsigned int reg_val = 0; | 4187 | unsigned int reg_val = 0; |
4189 | 4188 | ||
4190 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 4189 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -4257,8 +4256,8 @@ static int rt5677_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
4257 | static int rt5677_set_dai_sysclk(struct snd_soc_dai *dai, | 4256 | static int rt5677_set_dai_sysclk(struct snd_soc_dai *dai, |
4258 | int clk_id, unsigned int freq, int dir) | 4257 | int clk_id, unsigned int freq, int dir) |
4259 | { | 4258 | { |
4260 | struct snd_soc_codec *codec = dai->codec; | 4259 | struct snd_soc_component *component = dai->component; |
4261 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4260 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4262 | unsigned int reg_val = 0; | 4261 | unsigned int reg_val = 0; |
4263 | 4262 | ||
4264 | if (freq == rt5677->sysclk && clk_id == rt5677->sysclk_src) | 4263 | if (freq == rt5677->sysclk && clk_id == rt5677->sysclk_src) |
@@ -4275,7 +4274,7 @@ static int rt5677_set_dai_sysclk(struct snd_soc_dai *dai, | |||
4275 | reg_val |= RT5677_SCLK_SRC_RCCLK; | 4274 | reg_val |= RT5677_SCLK_SRC_RCCLK; |
4276 | break; | 4275 | break; |
4277 | default: | 4276 | default: |
4278 | dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); | 4277 | dev_err(component->dev, "Invalid clock id (%d)\n", clk_id); |
4279 | return -EINVAL; | 4278 | return -EINVAL; |
4280 | } | 4279 | } |
4281 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, | 4280 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
@@ -4310,8 +4309,8 @@ static int rt5677_pll_calc(const unsigned int freq_in, | |||
4310 | static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | 4309 | static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, |
4311 | unsigned int freq_in, unsigned int freq_out) | 4310 | unsigned int freq_in, unsigned int freq_out) |
4312 | { | 4311 | { |
4313 | struct snd_soc_codec *codec = dai->codec; | 4312 | struct snd_soc_component *component = dai->component; |
4314 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4313 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4315 | struct rl6231_pll_code pll_code; | 4314 | struct rl6231_pll_code pll_code; |
4316 | int ret; | 4315 | int ret; |
4317 | 4316 | ||
@@ -4320,7 +4319,7 @@ static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | |||
4320 | return 0; | 4319 | return 0; |
4321 | 4320 | ||
4322 | if (!freq_in || !freq_out) { | 4321 | if (!freq_in || !freq_out) { |
4323 | dev_dbg(codec->dev, "PLL disabled\n"); | 4322 | dev_dbg(component->dev, "PLL disabled\n"); |
4324 | 4323 | ||
4325 | rt5677->pll_in = 0; | 4324 | rt5677->pll_in = 0; |
4326 | rt5677->pll_out = 0; | 4325 | rt5677->pll_out = 0; |
@@ -4360,17 +4359,17 @@ static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | |||
4360 | } | 4359 | } |
4361 | break; | 4360 | break; |
4362 | default: | 4361 | default: |
4363 | dev_err(codec->dev, "Unknown PLL source %d\n", source); | 4362 | dev_err(component->dev, "Unknown PLL source %d\n", source); |
4364 | return -EINVAL; | 4363 | return -EINVAL; |
4365 | } | 4364 | } |
4366 | 4365 | ||
4367 | ret = rt5677_pll_calc(freq_in, freq_out, &pll_code); | 4366 | ret = rt5677_pll_calc(freq_in, freq_out, &pll_code); |
4368 | if (ret < 0) { | 4367 | if (ret < 0) { |
4369 | dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); | 4368 | dev_err(component->dev, "Unsupport input clock %d\n", freq_in); |
4370 | return ret; | 4369 | return ret; |
4371 | } | 4370 | } |
4372 | 4371 | ||
4373 | dev_dbg(codec->dev, "m_bypass=%d m=%d n=%d k=%d\n", | 4372 | dev_dbg(component->dev, "m_bypass=%d m=%d n=%d k=%d\n", |
4374 | pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), | 4373 | pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), |
4375 | pll_code.n_code, pll_code.k_code); | 4374 | pll_code.n_code, pll_code.k_code); |
4376 | 4375 | ||
@@ -4390,8 +4389,8 @@ static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, | |||
4390 | static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 4389 | static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
4391 | unsigned int rx_mask, int slots, int slot_width) | 4390 | unsigned int rx_mask, int slots, int slot_width) |
4392 | { | 4391 | { |
4393 | struct snd_soc_codec *codec = dai->codec; | 4392 | struct snd_soc_component *component = dai->component; |
4394 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4393 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4395 | unsigned int val = 0, slot_width_25 = 0; | 4394 | unsigned int val = 0, slot_width_25 = 0; |
4396 | 4395 | ||
4397 | if (rx_mask || tx_mask) | 4396 | if (rx_mask || tx_mask) |
@@ -4449,18 +4448,18 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
4449 | return 0; | 4448 | return 0; |
4450 | } | 4449 | } |
4451 | 4450 | ||
4452 | static int rt5677_set_bias_level(struct snd_soc_codec *codec, | 4451 | static int rt5677_set_bias_level(struct snd_soc_component *component, |
4453 | enum snd_soc_bias_level level) | 4452 | enum snd_soc_bias_level level) |
4454 | { | 4453 | { |
4455 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4454 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4456 | 4455 | ||
4457 | switch (level) { | 4456 | switch (level) { |
4458 | case SND_SOC_BIAS_ON: | 4457 | case SND_SOC_BIAS_ON: |
4459 | break; | 4458 | break; |
4460 | 4459 | ||
4461 | case SND_SOC_BIAS_PREPARE: | 4460 | case SND_SOC_BIAS_PREPARE: |
4462 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { | 4461 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { |
4463 | rt5677_set_dsp_vad(codec, false); | 4462 | rt5677_set_dsp_vad(component, false); |
4464 | 4463 | ||
4465 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, | 4464 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
4466 | RT5677_LDO1_SEL_MASK | RT5677_LDO2_SEL_MASK, | 4465 | RT5677_LDO1_SEL_MASK | RT5677_LDO2_SEL_MASK, |
@@ -4495,7 +4494,7 @@ static int rt5677_set_bias_level(struct snd_soc_codec *codec, | |||
4495 | RT5677_PR_BASE + RT5677_BIAS_CUR4, 0x0f00, 0x0000); | 4494 | RT5677_PR_BASE + RT5677_BIAS_CUR4, 0x0f00, 0x0000); |
4496 | 4495 | ||
4497 | if (rt5677->dsp_vad_en) | 4496 | if (rt5677->dsp_vad_en) |
4498 | rt5677_set_dsp_vad(codec, true); | 4497 | rt5677_set_dsp_vad(component, true); |
4499 | break; | 4498 | break; |
4500 | 4499 | ||
4501 | default: | 4500 | default: |
@@ -4696,13 +4695,13 @@ static void rt5677_free_gpio(struct i2c_client *i2c) | |||
4696 | } | 4695 | } |
4697 | #endif | 4696 | #endif |
4698 | 4697 | ||
4699 | static int rt5677_probe(struct snd_soc_codec *codec) | 4698 | static int rt5677_probe(struct snd_soc_component *component) |
4700 | { | 4699 | { |
4701 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 4700 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
4702 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4701 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4703 | int i; | 4702 | int i; |
4704 | 4703 | ||
4705 | rt5677->codec = codec; | 4704 | rt5677->component = component; |
4706 | 4705 | ||
4707 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { | 4706 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { |
4708 | snd_soc_dapm_add_routes(dapm, | 4707 | snd_soc_dapm_add_routes(dapm, |
@@ -4714,7 +4713,7 @@ static int rt5677_probe(struct snd_soc_codec *codec) | |||
4714 | ARRAY_SIZE(rt5677_dmic2_clk_1)); | 4713 | ARRAY_SIZE(rt5677_dmic2_clk_1)); |
4715 | } | 4714 | } |
4716 | 4715 | ||
4717 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); | 4716 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); |
4718 | 4717 | ||
4719 | regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020); | 4718 | regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020); |
4720 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00); | 4719 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00); |
@@ -4753,21 +4752,19 @@ static int rt5677_probe(struct snd_soc_codec *codec) | |||
4753 | return 0; | 4752 | return 0; |
4754 | } | 4753 | } |
4755 | 4754 | ||
4756 | static int rt5677_remove(struct snd_soc_codec *codec) | 4755 | static void rt5677_remove(struct snd_soc_component *component) |
4757 | { | 4756 | { |
4758 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4757 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4759 | 4758 | ||
4760 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); | 4759 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); |
4761 | gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); | 4760 | gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); |
4762 | gpiod_set_value_cansleep(rt5677->reset_pin, 1); | 4761 | gpiod_set_value_cansleep(rt5677->reset_pin, 1); |
4763 | |||
4764 | return 0; | ||
4765 | } | 4762 | } |
4766 | 4763 | ||
4767 | #ifdef CONFIG_PM | 4764 | #ifdef CONFIG_PM |
4768 | static int rt5677_suspend(struct snd_soc_codec *codec) | 4765 | static int rt5677_suspend(struct snd_soc_component *component) |
4769 | { | 4766 | { |
4770 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4767 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4771 | 4768 | ||
4772 | if (!rt5677->dsp_vad_en) { | 4769 | if (!rt5677->dsp_vad_en) { |
4773 | regcache_cache_only(rt5677->regmap, true); | 4770 | regcache_cache_only(rt5677->regmap, true); |
@@ -4780,9 +4777,9 @@ static int rt5677_suspend(struct snd_soc_codec *codec) | |||
4780 | return 0; | 4777 | return 0; |
4781 | } | 4778 | } |
4782 | 4779 | ||
4783 | static int rt5677_resume(struct snd_soc_codec *codec) | 4780 | static int rt5677_resume(struct snd_soc_component *component) |
4784 | { | 4781 | { |
4785 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4782 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
4786 | 4783 | ||
4787 | if (!rt5677->dsp_vad_en) { | 4784 | if (!rt5677->dsp_vad_en) { |
4788 | rt5677->pll_src = 0; | 4785 | rt5677->pll_src = 0; |
@@ -4959,21 +4956,21 @@ static struct snd_soc_dai_driver rt5677_dai[] = { | |||
4959 | }, | 4956 | }, |
4960 | }; | 4957 | }; |
4961 | 4958 | ||
4962 | static const struct snd_soc_codec_driver soc_codec_dev_rt5677 = { | 4959 | static const struct snd_soc_component_driver soc_component_dev_rt5677 = { |
4963 | .probe = rt5677_probe, | 4960 | .probe = rt5677_probe, |
4964 | .remove = rt5677_remove, | 4961 | .remove = rt5677_remove, |
4965 | .suspend = rt5677_suspend, | 4962 | .suspend = rt5677_suspend, |
4966 | .resume = rt5677_resume, | 4963 | .resume = rt5677_resume, |
4967 | .set_bias_level = rt5677_set_bias_level, | 4964 | .set_bias_level = rt5677_set_bias_level, |
4968 | .idle_bias_off = true, | 4965 | .controls = rt5677_snd_controls, |
4969 | .component_driver = { | 4966 | .num_controls = ARRAY_SIZE(rt5677_snd_controls), |
4970 | .controls = rt5677_snd_controls, | 4967 | .dapm_widgets = rt5677_dapm_widgets, |
4971 | .num_controls = ARRAY_SIZE(rt5677_snd_controls), | 4968 | .num_dapm_widgets = ARRAY_SIZE(rt5677_dapm_widgets), |
4972 | .dapm_widgets = rt5677_dapm_widgets, | 4969 | .dapm_routes = rt5677_dapm_routes, |
4973 | .num_dapm_widgets = ARRAY_SIZE(rt5677_dapm_widgets), | 4970 | .num_dapm_routes = ARRAY_SIZE(rt5677_dapm_routes), |
4974 | .dapm_routes = rt5677_dapm_routes, | 4971 | .use_pmdown_time = 1, |
4975 | .num_dapm_routes = ARRAY_SIZE(rt5677_dapm_routes), | 4972 | .endianness = 1, |
4976 | }, | 4973 | .non_legacy_dai_naming = 1, |
4977 | }; | 4974 | }; |
4978 | 4975 | ||
4979 | static const struct regmap_config rt5677_regmap_physical = { | 4976 | static const struct regmap_config rt5677_regmap_physical = { |
@@ -5262,13 +5259,13 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, | |||
5262 | rt5677_init_gpio(i2c); | 5259 | rt5677_init_gpio(i2c); |
5263 | rt5677_init_irq(i2c); | 5260 | rt5677_init_irq(i2c); |
5264 | 5261 | ||
5265 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5677, | 5262 | return devm_snd_soc_register_component(&i2c->dev, |
5263 | &soc_component_dev_rt5677, | ||
5266 | rt5677_dai, ARRAY_SIZE(rt5677_dai)); | 5264 | rt5677_dai, ARRAY_SIZE(rt5677_dai)); |
5267 | } | 5265 | } |
5268 | 5266 | ||
5269 | static int rt5677_i2c_remove(struct i2c_client *i2c) | 5267 | static int rt5677_i2c_remove(struct i2c_client *i2c) |
5270 | { | 5268 | { |
5271 | snd_soc_unregister_codec(&i2c->dev); | ||
5272 | rt5677_free_irq(i2c); | 5269 | rt5677_free_irq(i2c); |
5273 | rt5677_free_gpio(i2c); | 5270 | rt5677_free_gpio(i2c); |
5274 | 5271 | ||
diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h index 97239973edc4..183d92b03045 100644 --- a/sound/soc/codecs/rt5677.h +++ b/sound/soc/codecs/rt5677.h | |||
@@ -1790,7 +1790,7 @@ struct rt5677_platform_data { | |||
1790 | }; | 1790 | }; |
1791 | 1791 | ||
1792 | struct rt5677_priv { | 1792 | struct rt5677_priv { |
1793 | struct snd_soc_codec *codec; | 1793 | struct snd_soc_component *component; |
1794 | struct rt5677_platform_data pdata; | 1794 | struct rt5677_platform_data pdata; |
1795 | struct regmap *regmap, *regmap_physical; | 1795 | struct regmap *regmap, *regmap_physical; |
1796 | const struct firmware *fw1, *fw2; | 1796 | const struct firmware *fw1, *fw2; |
@@ -1816,7 +1816,7 @@ struct rt5677_priv { | |||
1816 | bool is_vref_slow; | 1816 | bool is_vref_slow; |
1817 | }; | 1817 | }; |
1818 | 1818 | ||
1819 | int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec, | 1819 | int rt5677_sel_asrc_clk_src(struct snd_soc_component *component, |
1820 | unsigned int filter_mask, unsigned int clk_src); | 1820 | unsigned int filter_mask, unsigned int clk_src); |
1821 | 1821 | ||
1822 | #endif /* __RT5677_H__ */ | 1822 | #endif /* __RT5677_H__ */ |
diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c index 058b8ccedf02..b19d2d977a41 100644 --- a/sound/soc/intel/boards/bdw-rt5677.c +++ b/sound/soc/intel/boards/bdw-rt5677.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | struct bdw_rt5677_priv { | 35 | struct bdw_rt5677_priv { |
36 | struct gpio_desc *gpio_hp_en; | 36 | struct gpio_desc *gpio_hp_en; |
37 | struct snd_soc_codec *codec; | 37 | struct snd_soc_component *component; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static int bdw_rt5677_event_hp(struct snd_soc_dapm_widget *w, | 40 | static int bdw_rt5677_event_hp(struct snd_soc_dapm_widget *w, |
@@ -203,26 +203,26 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd) | |||
203 | { | 203 | { |
204 | struct bdw_rt5677_priv *bdw_rt5677 = | 204 | struct bdw_rt5677_priv *bdw_rt5677 = |
205 | snd_soc_card_get_drvdata(rtd->card); | 205 | snd_soc_card_get_drvdata(rtd->card); |
206 | struct snd_soc_codec *codec = rtd->codec; | 206 | struct snd_soc_component *component = rtd->codec_dai->component; |
207 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 207 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
208 | int ret; | 208 | int ret; |
209 | 209 | ||
210 | ret = devm_acpi_dev_add_driver_gpios(codec->dev, bdw_rt5677_gpios); | 210 | ret = devm_acpi_dev_add_driver_gpios(component->dev, bdw_rt5677_gpios); |
211 | if (ret) | 211 | if (ret) |
212 | dev_warn(codec->dev, "Failed to add driver gpios\n"); | 212 | dev_warn(component->dev, "Failed to add driver gpios\n"); |
213 | 213 | ||
214 | /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1. | 214 | /* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1. |
215 | * The ASRC clock source is clk_i2s1_asrc. | 215 | * The ASRC clock source is clk_i2s1_asrc. |
216 | */ | 216 | */ |
217 | rt5677_sel_asrc_clk_src(codec, RT5677_DA_STEREO_FILTER | | 217 | rt5677_sel_asrc_clk_src(component, RT5677_DA_STEREO_FILTER | |
218 | RT5677_AD_STEREO1_FILTER | RT5677_I2S1_SOURCE, | 218 | RT5677_AD_STEREO1_FILTER | RT5677_I2S1_SOURCE, |
219 | RT5677_CLK_SEL_I2S1_ASRC); | 219 | RT5677_CLK_SEL_I2S1_ASRC); |
220 | 220 | ||
221 | /* Request rt5677 GPIO for headphone amp control */ | 221 | /* Request rt5677 GPIO for headphone amp control */ |
222 | bdw_rt5677->gpio_hp_en = devm_gpiod_get(codec->dev, "headphone-enable", | 222 | bdw_rt5677->gpio_hp_en = devm_gpiod_get(component->dev, "headphone-enable", |
223 | GPIOD_OUT_LOW); | 223 | GPIOD_OUT_LOW); |
224 | if (IS_ERR(bdw_rt5677->gpio_hp_en)) { | 224 | if (IS_ERR(bdw_rt5677->gpio_hp_en)) { |
225 | dev_err(codec->dev, "Can't find HP_AMP_SHDN_L gpio\n"); | 225 | dev_err(component->dev, "Can't find HP_AMP_SHDN_L gpio\n"); |
226 | return PTR_ERR(bdw_rt5677->gpio_hp_en); | 226 | return PTR_ERR(bdw_rt5677->gpio_hp_en); |
227 | } | 227 | } |
228 | 228 | ||
@@ -230,25 +230,25 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd) | |||
230 | if (!snd_soc_card_jack_new(rtd->card, "Headphone Jack", | 230 | if (!snd_soc_card_jack_new(rtd->card, "Headphone Jack", |
231 | SND_JACK_HEADPHONE, &headphone_jack, | 231 | SND_JACK_HEADPHONE, &headphone_jack, |
232 | &headphone_jack_pin, 1)) { | 232 | &headphone_jack_pin, 1)) { |
233 | headphone_jack_gpio.gpiod_dev = codec->dev; | 233 | headphone_jack_gpio.gpiod_dev = component->dev; |
234 | if (snd_soc_jack_add_gpios(&headphone_jack, 1, | 234 | if (snd_soc_jack_add_gpios(&headphone_jack, 1, |
235 | &headphone_jack_gpio)) | 235 | &headphone_jack_gpio)) |
236 | dev_err(codec->dev, "Can't add headphone jack gpio\n"); | 236 | dev_err(component->dev, "Can't add headphone jack gpio\n"); |
237 | } else { | 237 | } else { |
238 | dev_err(codec->dev, "Can't create headphone jack\n"); | 238 | dev_err(component->dev, "Can't create headphone jack\n"); |
239 | } | 239 | } |
240 | 240 | ||
241 | /* Create and initialize mic jack */ | 241 | /* Create and initialize mic jack */ |
242 | if (!snd_soc_card_jack_new(rtd->card, "Mic Jack", | 242 | if (!snd_soc_card_jack_new(rtd->card, "Mic Jack", |
243 | SND_JACK_MICROPHONE, &mic_jack, | 243 | SND_JACK_MICROPHONE, &mic_jack, |
244 | &mic_jack_pin, 1)) { | 244 | &mic_jack_pin, 1)) { |
245 | mic_jack_gpio.gpiod_dev = codec->dev; | 245 | mic_jack_gpio.gpiod_dev = component->dev; |
246 | if (snd_soc_jack_add_gpios(&mic_jack, 1, &mic_jack_gpio)) | 246 | if (snd_soc_jack_add_gpios(&mic_jack, 1, &mic_jack_gpio)) |
247 | dev_err(codec->dev, "Can't add mic jack gpio\n"); | 247 | dev_err(component->dev, "Can't add mic jack gpio\n"); |
248 | } else { | 248 | } else { |
249 | dev_err(codec->dev, "Can't create mic jack\n"); | 249 | dev_err(component->dev, "Can't create mic jack\n"); |
250 | } | 250 | } |
251 | bdw_rt5677->codec = codec; | 251 | bdw_rt5677->component = component; |
252 | 252 | ||
253 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); | 253 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
254 | return 0; | 254 | return 0; |
@@ -301,8 +301,8 @@ static int bdw_rt5677_suspend_pre(struct snd_soc_card *card) | |||
301 | struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card); | 301 | struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card); |
302 | struct snd_soc_dapm_context *dapm; | 302 | struct snd_soc_dapm_context *dapm; |
303 | 303 | ||
304 | if (bdw_rt5677->codec) { | 304 | if (bdw_rt5677->component) { |
305 | dapm = snd_soc_codec_get_dapm(bdw_rt5677->codec); | 305 | dapm = snd_soc_component_get_dapm(bdw_rt5677->component); |
306 | snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); | 306 | snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); |
307 | } | 307 | } |
308 | return 0; | 308 | return 0; |
@@ -313,8 +313,8 @@ static int bdw_rt5677_resume_post(struct snd_soc_card *card) | |||
313 | struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card); | 313 | struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card); |
314 | struct snd_soc_dapm_context *dapm; | 314 | struct snd_soc_dapm_context *dapm; |
315 | 315 | ||
316 | if (bdw_rt5677->codec) { | 316 | if (bdw_rt5677->component) { |
317 | dapm = snd_soc_codec_get_dapm(bdw_rt5677->codec); | 317 | dapm = snd_soc_component_get_dapm(bdw_rt5677->component); |
318 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); | 318 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
319 | } | 319 | } |
320 | return 0; | 320 | return 0; |
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index 31641aab62cd..49ba1a956a06 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c | |||
@@ -252,14 +252,14 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | |||
252 | { | 252 | { |
253 | struct snd_soc_card *card = runtime->card; | 253 | struct snd_soc_card *card = runtime->card; |
254 | struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); | 254 | struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); |
255 | struct snd_soc_codec *codec = runtime->codec; | 255 | struct snd_soc_component *component = runtime->codec_dai->component; |
256 | int jack_type; | 256 | int jack_type; |
257 | int ret; | 257 | int ret; |
258 | 258 | ||
259 | if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) || | 259 | if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) || |
260 | (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) { | 260 | (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) { |
261 | /* Select clk_i2s2_asrc as ASRC clock source */ | 261 | /* Select clk_i2s2_asrc as ASRC clock source */ |
262 | rt5645_sel_asrc_clk_src(codec, | 262 | rt5645_sel_asrc_clk_src(component, |
263 | RT5645_DA_STEREO_FILTER | | 263 | RT5645_DA_STEREO_FILTER | |
264 | RT5645_DA_MONO_L_FILTER | | 264 | RT5645_DA_MONO_L_FILTER | |
265 | RT5645_DA_MONO_R_FILTER | | 265 | RT5645_DA_MONO_R_FILTER | |
@@ -267,7 +267,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | |||
267 | RT5645_CLK_SEL_I2S2_ASRC); | 267 | RT5645_CLK_SEL_I2S2_ASRC); |
268 | } else { | 268 | } else { |
269 | /* Select clk_i2s1_asrc as ASRC clock source */ | 269 | /* Select clk_i2s1_asrc as ASRC clock source */ |
270 | rt5645_sel_asrc_clk_src(codec, | 270 | rt5645_sel_asrc_clk_src(component, |
271 | RT5645_DA_STEREO_FILTER | | 271 | RT5645_DA_STEREO_FILTER | |
272 | RT5645_DA_MONO_L_FILTER | | 272 | RT5645_DA_MONO_L_FILTER | |
273 | RT5645_DA_MONO_R_FILTER | | 273 | RT5645_DA_MONO_R_FILTER | |
@@ -310,7 +310,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | |||
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
313 | rt5645_set_jack_detect(codec, &ctx->jack, &ctx->jack, &ctx->jack); | 313 | rt5645_set_jack_detect(component, &ctx->jack, &ctx->jack, &ctx->jack); |
314 | 314 | ||
315 | 315 | ||
316 | /* | 316 | /* |
diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c index 5a9a5482976e..904f3ee6b0eb 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | |||
@@ -82,10 +82,10 @@ static struct snd_soc_jack mt8173_rt5650_rt5514_jack; | |||
82 | static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime) | 82 | static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime) |
83 | { | 83 | { |
84 | struct snd_soc_card *card = runtime->card; | 84 | struct snd_soc_card *card = runtime->card; |
85 | struct snd_soc_codec *codec = runtime->codec_dais[0]->codec; | 85 | struct snd_soc_component *component = runtime->codec_dais[0]->component; |
86 | int ret; | 86 | int ret; |
87 | 87 | ||
88 | rt5645_sel_asrc_clk_src(codec, | 88 | rt5645_sel_asrc_clk_src(component, |
89 | RT5645_DA_STEREO_FILTER | | 89 | RT5645_DA_STEREO_FILTER | |
90 | RT5645_AD_STEREO_FILTER, | 90 | RT5645_AD_STEREO_FILTER, |
91 | RT5645_CLK_SEL_I2S1_ASRC); | 91 | RT5645_CLK_SEL_I2S1_ASRC); |
@@ -101,7 +101,7 @@ static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime) | |||
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | return rt5645_set_jack_detect(codec, | 104 | return rt5645_set_jack_detect(component, |
105 | &mt8173_rt5650_rt5514_jack, | 105 | &mt8173_rt5650_rt5514_jack, |
106 | &mt8173_rt5650_rt5514_jack, | 106 | &mt8173_rt5650_rt5514_jack, |
107 | &mt8173_rt5650_rt5514_jack); | 107 | &mt8173_rt5650_rt5514_jack); |
diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index b7248085ca04..9c61b8c099c5 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | |||
@@ -86,19 +86,19 @@ static struct snd_soc_jack mt8173_rt5650_rt5676_jack; | |||
86 | static int mt8173_rt5650_rt5676_init(struct snd_soc_pcm_runtime *runtime) | 86 | static int mt8173_rt5650_rt5676_init(struct snd_soc_pcm_runtime *runtime) |
87 | { | 87 | { |
88 | struct snd_soc_card *card = runtime->card; | 88 | struct snd_soc_card *card = runtime->card; |
89 | struct snd_soc_codec *codec = runtime->codec_dais[0]->codec; | 89 | struct snd_soc_component *component = runtime->codec_dais[0]->component; |
90 | struct snd_soc_codec *codec_sub = runtime->codec_dais[1]->codec; | 90 | struct snd_soc_component *component_sub = runtime->codec_dais[1]->component; |
91 | int ret; | 91 | int ret; |
92 | 92 | ||
93 | rt5645_sel_asrc_clk_src(codec, | 93 | rt5645_sel_asrc_clk_src(component, |
94 | RT5645_DA_STEREO_FILTER | | 94 | RT5645_DA_STEREO_FILTER | |
95 | RT5645_AD_STEREO_FILTER, | 95 | RT5645_AD_STEREO_FILTER, |
96 | RT5645_CLK_SEL_I2S1_ASRC); | 96 | RT5645_CLK_SEL_I2S1_ASRC); |
97 | rt5677_sel_asrc_clk_src(codec_sub, | 97 | rt5677_sel_asrc_clk_src(component_sub, |
98 | RT5677_DA_STEREO_FILTER | | 98 | RT5677_DA_STEREO_FILTER | |
99 | RT5677_AD_STEREO1_FILTER, | 99 | RT5677_AD_STEREO1_FILTER, |
100 | RT5677_CLK_SEL_I2S1_ASRC); | 100 | RT5677_CLK_SEL_I2S1_ASRC); |
101 | rt5677_sel_asrc_clk_src(codec_sub, | 101 | rt5677_sel_asrc_clk_src(component_sub, |
102 | RT5677_AD_STEREO2_FILTER | | 102 | RT5677_AD_STEREO2_FILTER | |
103 | RT5677_I2S2_SOURCE, | 103 | RT5677_I2S2_SOURCE, |
104 | RT5677_CLK_SEL_I2S2_ASRC); | 104 | RT5677_CLK_SEL_I2S2_ASRC); |
@@ -114,7 +114,7 @@ static int mt8173_rt5650_rt5676_init(struct snd_soc_pcm_runtime *runtime) | |||
114 | return ret; | 114 | return ret; |
115 | } | 115 | } |
116 | 116 | ||
117 | return rt5645_set_jack_detect(codec, | 117 | return rt5645_set_jack_detect(component, |
118 | &mt8173_rt5650_rt5676_jack, | 118 | &mt8173_rt5650_rt5676_jack, |
119 | &mt8173_rt5650_rt5676_jack, | 119 | &mt8173_rt5650_rt5676_jack, |
120 | &mt8173_rt5650_rt5676_jack); | 120 | &mt8173_rt5650_rt5676_jack); |
diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index 679fc8bea0a3..84aa09d3dd98 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c | |||
@@ -112,26 +112,26 @@ static struct snd_soc_jack mt8173_rt5650_jack; | |||
112 | static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) | 112 | static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) |
113 | { | 113 | { |
114 | struct snd_soc_card *card = runtime->card; | 114 | struct snd_soc_card *card = runtime->card; |
115 | struct snd_soc_codec *codec = runtime->codec_dais[0]->codec; | 115 | struct snd_soc_component *component = runtime->codec_dais[0]->component; |
116 | const char *codec_capture_dai = runtime->codec_dais[1]->name; | 116 | const char *codec_capture_dai = runtime->codec_dais[1]->name; |
117 | int ret; | 117 | int ret; |
118 | 118 | ||
119 | rt5645_sel_asrc_clk_src(codec, | 119 | rt5645_sel_asrc_clk_src(component, |
120 | RT5645_DA_STEREO_FILTER, | 120 | RT5645_DA_STEREO_FILTER, |
121 | RT5645_CLK_SEL_I2S1_ASRC); | 121 | RT5645_CLK_SEL_I2S1_ASRC); |
122 | 122 | ||
123 | if (!strcmp(codec_capture_dai, "rt5645-aif1")) { | 123 | if (!strcmp(codec_capture_dai, "rt5645-aif1")) { |
124 | rt5645_sel_asrc_clk_src(codec, | 124 | rt5645_sel_asrc_clk_src(component, |
125 | RT5645_AD_STEREO_FILTER, | 125 | RT5645_AD_STEREO_FILTER, |
126 | RT5645_CLK_SEL_I2S1_ASRC); | 126 | RT5645_CLK_SEL_I2S1_ASRC); |
127 | } else if (!strcmp(codec_capture_dai, "rt5645-aif2")) { | 127 | } else if (!strcmp(codec_capture_dai, "rt5645-aif2")) { |
128 | rt5645_sel_asrc_clk_src(codec, | 128 | rt5645_sel_asrc_clk_src(component, |
129 | RT5645_AD_STEREO_FILTER, | 129 | RT5645_AD_STEREO_FILTER, |
130 | RT5645_CLK_SEL_I2S2_ASRC); | 130 | RT5645_CLK_SEL_I2S2_ASRC); |
131 | } else { | 131 | } else { |
132 | dev_warn(card->dev, | 132 | dev_warn(card->dev, |
133 | "Only one dai codec found in DTS, enabled rt5645 AD filter\n"); | 133 | "Only one dai codec found in DTS, enabled rt5645 AD filter\n"); |
134 | rt5645_sel_asrc_clk_src(codec, | 134 | rt5645_sel_asrc_clk_src(component, |
135 | RT5645_AD_STEREO_FILTER, | 135 | RT5645_AD_STEREO_FILTER, |
136 | RT5645_CLK_SEL_I2S1_ASRC); | 136 | RT5645_CLK_SEL_I2S1_ASRC); |
137 | } | 137 | } |
@@ -147,7 +147,7 @@ static int mt8173_rt5650_init(struct snd_soc_pcm_runtime *runtime) | |||
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | 149 | ||
150 | return rt5645_set_jack_detect(codec, | 150 | return rt5645_set_jack_detect(component, |
151 | &mt8173_rt5650_jack, | 151 | &mt8173_rt5650_jack, |
152 | &mt8173_rt5650_jack, | 152 | &mt8173_rt5650_jack, |
153 | &mt8173_rt5650_jack); | 153 | &mt8173_rt5650_jack); |
diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index 9e0c17805807..4db4fd56db35 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c | |||
@@ -29,16 +29,12 @@ | |||
29 | #include <sound/pcm_params.h> | 29 | #include <sound/pcm_params.h> |
30 | #include <sound/soc.h> | 30 | #include <sound/soc.h> |
31 | #include "rockchip_i2s.h" | 31 | #include "rockchip_i2s.h" |
32 | #include "../codecs/rt5645.h" | ||
32 | 33 | ||
33 | #define DRV_NAME "rockchip-snd-rt5645" | 34 | #define DRV_NAME "rockchip-snd-rt5645" |
34 | 35 | ||
35 | static struct snd_soc_jack headset_jack; | 36 | static struct snd_soc_jack headset_jack; |
36 | 37 | ||
37 | /* Jack detect via rt5645 driver. */ | ||
38 | extern int rt5645_set_jack_detect(struct snd_soc_codec *codec, | ||
39 | struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack, | ||
40 | struct snd_soc_jack *btn_jack); | ||
41 | |||
42 | static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { | 38 | static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { |
43 | SND_SOC_DAPM_HP("Headphones", NULL), | 39 | SND_SOC_DAPM_HP("Headphones", NULL), |
44 | SND_SOC_DAPM_SPK("Speakers", NULL), | 40 | SND_SOC_DAPM_SPK("Speakers", NULL), |
@@ -129,7 +125,7 @@ static int rk_init(struct snd_soc_pcm_runtime *runtime) | |||
129 | return ret; | 125 | return ret; |
130 | } | 126 | } |
131 | 127 | ||
132 | return rt5645_set_jack_detect(runtime->codec, | 128 | return rt5645_set_jack_detect(runtime->codec_dai->component, |
133 | &headset_jack, | 129 | &headset_jack, |
134 | &headset_jack, | 130 | &headset_jack, |
135 | &headset_jack); | 131 | &headset_jack); |