aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-11-08 20:04:37 -0500
committerMark Brown <broonie@kernel.org>2017-11-27 13:47:46 -0500
commit3bd333677d6091d989068b0f7ff7aba975e62dc5 (patch)
tree5026b8ee2a2e953a53f1c856d8be77a4cdd8135f
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323 (diff)
ASoC: don't use codec hw_write on twl6040
twl6040 driver is using codec hw_write/control_data, but it is redundant code. This patch cleanup these Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/twl6040.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 1773ff84ee3b..a8e6941a1868 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -106,10 +106,12 @@ static const struct snd_pcm_hw_constraint_list sysclk_constraints[] = {
106 { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, 106 { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, },
107}; 107};
108 108
109#define to_twl6040(codec) dev_get_drvdata((codec)->dev->parent)
110
109static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) 111static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg)
110{ 112{
111 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 113 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
112 struct twl6040 *twl6040 = codec->control_data; 114 struct twl6040 *twl6040 = to_twl6040(codec);
113 u8 value; 115 u8 value;
114 116
115 if (reg >= TWL6040_CACHEREGNUM) 117 if (reg >= TWL6040_CACHEREGNUM)
@@ -171,7 +173,7 @@ static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec,
171static int twl6040_write(struct snd_soc_codec *codec, 173static int twl6040_write(struct snd_soc_codec *codec,
172 unsigned int reg, unsigned int value) 174 unsigned int reg, unsigned int value)
173{ 175{
174 struct twl6040 *twl6040 = codec->control_data; 176 struct twl6040 *twl6040 = to_twl6040(codec);
175 177
176 if (reg >= TWL6040_CACHEREGNUM) 178 if (reg >= TWL6040_CACHEREGNUM)
177 return -EIO; 179 return -EIO;
@@ -572,7 +574,7 @@ EXPORT_SYMBOL_GPL(twl6040_get_trim_value);
572 574
573int twl6040_get_hs_step_size(struct snd_soc_codec *codec) 575int twl6040_get_hs_step_size(struct snd_soc_codec *codec)
574{ 576{
575 struct twl6040 *twl6040 = codec->control_data; 577 struct twl6040 *twl6040 = to_twl6040(codec);
576 578
577 if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3) 579 if (twl6040_get_revid(twl6040) < TWL6040_REV_ES1_3)
578 /* For ES under ES_1.3 HS step is 2 mV */ 580 /* For ES under ES_1.3 HS step is 2 mV */
@@ -830,7 +832,7 @@ static const struct snd_soc_dapm_route intercon[] = {
830static int twl6040_set_bias_level(struct snd_soc_codec *codec, 832static int twl6040_set_bias_level(struct snd_soc_codec *codec,
831 enum snd_soc_bias_level level) 833 enum snd_soc_bias_level level)
832{ 834{
833 struct twl6040 *twl6040 = codec->control_data; 835 struct twl6040 *twl6040 = to_twl6040(codec);
834 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 836 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
835 int ret = 0; 837 int ret = 0;
836 838
@@ -922,7 +924,7 @@ static int twl6040_prepare(struct snd_pcm_substream *substream,
922 struct snd_soc_dai *dai) 924 struct snd_soc_dai *dai)
923{ 925{
924 struct snd_soc_codec *codec = dai->codec; 926 struct snd_soc_codec *codec = dai->codec;
925 struct twl6040 *twl6040 = codec->control_data; 927 struct twl6040 *twl6040 = to_twl6040(codec);
926 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 928 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
927 int ret; 929 int ret;
928 930
@@ -964,7 +966,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,
964static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id, 966static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id,
965 int mute) 967 int mute)
966{ 968{
967 struct twl6040 *twl6040 = codec->control_data; 969 struct twl6040 *twl6040 = to_twl6040(codec);
968 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 970 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
969 int hslctl, hsrctl, earctl; 971 int hslctl, hsrctl, earctl;
970 int hflctl, hfrctl; 972 int hflctl, hfrctl;
@@ -1108,7 +1110,6 @@ static struct snd_soc_dai_driver twl6040_dai[] = {
1108static int twl6040_probe(struct snd_soc_codec *codec) 1110static int twl6040_probe(struct snd_soc_codec *codec)
1109{ 1111{
1110 struct twl6040_data *priv; 1112 struct twl6040_data *priv;
1111 struct twl6040 *twl6040 = dev_get_drvdata(codec->dev->parent);
1112 struct platform_device *pdev = to_platform_device(codec->dev); 1113 struct platform_device *pdev = to_platform_device(codec->dev);
1113 int ret = 0; 1114 int ret = 0;
1114 1115
@@ -1119,7 +1120,6 @@ static int twl6040_probe(struct snd_soc_codec *codec)
1119 snd_soc_codec_set_drvdata(codec, priv); 1120 snd_soc_codec_set_drvdata(codec, priv);
1120 1121
1121 priv->codec = codec; 1122 priv->codec = codec;
1122 codec->control_data = twl6040;
1123 1123
1124 priv->plug_irq = platform_get_irq(pdev, 0); 1124 priv->plug_irq = platform_get_irq(pdev, 0);
1125 if (priv->plug_irq < 0) { 1125 if (priv->plug_irq < 0) {