aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/si476x.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index 38f3b105c17d..03645ce42063 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -60,48 +60,6 @@ enum si476x_pcm_format {
60 SI476X_PCM_FORMAT_S24_LE = 6, 60 SI476X_PCM_FORMAT_S24_LE = 6,
61}; 61};
62 62
63static unsigned int si476x_codec_read(struct snd_soc_codec *codec,
64 unsigned int reg)
65{
66 int err;
67 unsigned int val;
68 struct si476x_core *core = codec->control_data;
69
70 si476x_core_lock(core);
71 if (!si476x_core_is_powered_up(core))
72 regcache_cache_only(core->regmap, true);
73
74 err = regmap_read(core->regmap, reg, &val);
75
76 if (!si476x_core_is_powered_up(core))
77 regcache_cache_only(core->regmap, false);
78 si476x_core_unlock(core);
79
80 if (err < 0)
81 return err;
82
83 return val;
84}
85
86static int si476x_codec_write(struct snd_soc_codec *codec,
87 unsigned int reg, unsigned int val)
88{
89 int err;
90 struct si476x_core *core = codec->control_data;
91
92 si476x_core_lock(core);
93 if (!si476x_core_is_powered_up(core))
94 regcache_cache_only(core->regmap, true);
95
96 err = regmap_write(core->regmap, reg, val);
97
98 if (!si476x_core_is_powered_up(core))
99 regcache_cache_only(core->regmap, false);
100 si476x_core_unlock(core);
101
102 return err;
103}
104
105static const struct snd_soc_dapm_widget si476x_dapm_widgets[] = { 63static const struct snd_soc_dapm_widget si476x_dapm_widgets[] = {
106SND_SOC_DAPM_OUTPUT("LOUT"), 64SND_SOC_DAPM_OUTPUT("LOUT"),
107SND_SOC_DAPM_OUTPUT("ROUT"), 65SND_SOC_DAPM_OUTPUT("ROUT"),
@@ -239,7 +197,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
239 197
240static int si476x_codec_probe(struct snd_soc_codec *codec) 198static int si476x_codec_probe(struct snd_soc_codec *codec)
241{ 199{
242 codec->control_data = i2c_mfd_cell_to_core(codec->dev); 200 codec->control_data = dev_get_regmap(codec->dev->parent, NULL);
243 return 0; 201 return 0;
244} 202}
245 203
@@ -268,8 +226,6 @@ static struct snd_soc_dai_driver si476x_dai = {
268 226
269static struct snd_soc_codec_driver soc_codec_dev_si476x = { 227static struct snd_soc_codec_driver soc_codec_dev_si476x = {
270 .probe = si476x_codec_probe, 228 .probe = si476x_codec_probe,
271 .read = si476x_codec_read,
272 .write = si476x_codec_write,
273 .dapm_widgets = si476x_dapm_widgets, 229 .dapm_widgets = si476x_dapm_widgets,
274 .num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets), 230 .num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets),
275 .dapm_routes = si476x_dapm_routes, 231 .dapm_routes = si476x_dapm_routes,