diff options
author | Mark Brown <broonie@linaro.org> | 2013-09-18 14:04:17 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-25 08:54:23 -0400 |
commit | 2d9215c1ecd6f133952bc081a288dbb180816290 (patch) | |
tree | 3ad0c8b6f769ba60cd08575327d426e790e485c6 | |
parent | fd792f8fbcfa95674b6c417429f576ad1d808086 (diff) |
ASoC: mc13783: Use regmap directly from ASoC
As part of a push to remove the register I/O functionality from ASoC (since
it is now duplicated in the regmap API) convert the mc13783 driver to use
regmap directly.
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | sound/soc/codecs/mc13783.c | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 4d3c8fd8c5db..eedbf05b8e96 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -30,16 +30,10 @@ | |||
30 | #include <sound/soc.h> | 30 | #include <sound/soc.h> |
31 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
32 | #include <sound/soc-dapm.h> | 32 | #include <sound/soc-dapm.h> |
33 | #include <linux/regmap.h> | ||
33 | 34 | ||
34 | #include "mc13783.h" | 35 | #include "mc13783.h" |
35 | 36 | ||
36 | #define MC13783_AUDIO_RX0 36 | ||
37 | #define MC13783_AUDIO_RX1 37 | ||
38 | #define MC13783_AUDIO_TX 38 | ||
39 | #define MC13783_SSI_NETWORK 39 | ||
40 | #define MC13783_AUDIO_CODEC 40 | ||
41 | #define MC13783_AUDIO_DAC 41 | ||
42 | |||
43 | #define AUDIO_RX0_ALSPEN (1 << 5) | 37 | #define AUDIO_RX0_ALSPEN (1 << 5) |
44 | #define AUDIO_RX0_ALSPSEL (1 << 7) | 38 | #define AUDIO_RX0_ALSPSEL (1 << 7) |
45 | #define AUDIO_RX0_ADDCDC (1 << 21) | 39 | #define AUDIO_RX0_ADDCDC (1 << 21) |
@@ -95,41 +89,12 @@ | |||
95 | 89 | ||
96 | struct mc13783_priv { | 90 | struct mc13783_priv { |
97 | struct mc13xxx *mc13xxx; | 91 | struct mc13xxx *mc13xxx; |
92 | struct regmap *regmap; | ||
98 | 93 | ||
99 | enum mc13783_ssi_port adc_ssi_port; | 94 | enum mc13783_ssi_port adc_ssi_port; |
100 | enum mc13783_ssi_port dac_ssi_port; | 95 | enum mc13783_ssi_port dac_ssi_port; |
101 | }; | 96 | }; |
102 | 97 | ||
103 | static unsigned int mc13783_read(struct snd_soc_codec *codec, | ||
104 | unsigned int reg) | ||
105 | { | ||
106 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
107 | unsigned int value = 0; | ||
108 | |||
109 | mc13xxx_lock(priv->mc13xxx); | ||
110 | |||
111 | mc13xxx_reg_read(priv->mc13xxx, reg, &value); | ||
112 | |||
113 | mc13xxx_unlock(priv->mc13xxx); | ||
114 | |||
115 | return value; | ||
116 | } | ||
117 | |||
118 | static int mc13783_write(struct snd_soc_codec *codec, | ||
119 | unsigned int reg, unsigned int value) | ||
120 | { | ||
121 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
122 | int ret; | ||
123 | |||
124 | mc13xxx_lock(priv->mc13xxx); | ||
125 | |||
126 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); | ||
127 | |||
128 | mc13xxx_unlock(priv->mc13xxx); | ||
129 | |||
130 | return ret; | ||
131 | } | ||
132 | |||
133 | /* Mapping between sample rates and register value */ | 98 | /* Mapping between sample rates and register value */ |
134 | static unsigned int mc13783_rates[] = { | 99 | static unsigned int mc13783_rates[] = { |
135 | 8000, 11025, 12000, 16000, | 100 | 8000, 11025, 12000, 16000, |
@@ -583,8 +548,14 @@ static struct snd_kcontrol_new mc13783_control_list[] = { | |||
583 | static int mc13783_probe(struct snd_soc_codec *codec) | 548 | static int mc13783_probe(struct snd_soc_codec *codec) |
584 | { | 549 | { |
585 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); | 550 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); |
551 | int ret; | ||
586 | 552 | ||
587 | mc13xxx_lock(priv->mc13xxx); | 553 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); |
554 | ret = snd_soc_codec_set_cache_io(codec, 8, 24, SND_SOC_REGMAP); | ||
555 | if (ret != 0) { | ||
556 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | ||
557 | return ret; | ||
558 | } | ||
588 | 559 | ||
589 | /* these are the reset values */ | 560 | /* these are the reset values */ |
590 | mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); | 561 | mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); |
@@ -608,8 +579,6 @@ static int mc13783_probe(struct snd_soc_codec *codec) | |||
608 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, | 579 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
609 | 0, AUDIO_SSI_SEL); | 580 | 0, AUDIO_SSI_SEL); |
610 | 581 | ||
611 | mc13xxx_unlock(priv->mc13xxx); | ||
612 | |||
613 | return 0; | 582 | return 0; |
614 | } | 583 | } |
615 | 584 | ||
@@ -617,13 +586,9 @@ static int mc13783_remove(struct snd_soc_codec *codec) | |||
617 | { | 586 | { |
618 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); | 587 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); |
619 | 588 | ||
620 | mc13xxx_lock(priv->mc13xxx); | ||
621 | |||
622 | /* Make sure VAUDIOON is off */ | 589 | /* Make sure VAUDIOON is off */ |
623 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0); | 590 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0); |
624 | 591 | ||
625 | mc13xxx_unlock(priv->mc13xxx); | ||
626 | |||
627 | return 0; | 592 | return 0; |
628 | } | 593 | } |
629 | 594 | ||
@@ -713,8 +678,6 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { | |||
713 | static struct snd_soc_codec_driver soc_codec_dev_mc13783 = { | 678 | static struct snd_soc_codec_driver soc_codec_dev_mc13783 = { |
714 | .probe = mc13783_probe, | 679 | .probe = mc13783_probe, |
715 | .remove = mc13783_remove, | 680 | .remove = mc13783_remove, |
716 | .read = mc13783_read, | ||
717 | .write = mc13783_write, | ||
718 | .controls = mc13783_control_list, | 681 | .controls = mc13783_control_list, |
719 | .num_controls = ARRAY_SIZE(mc13783_control_list), | 682 | .num_controls = ARRAY_SIZE(mc13783_control_list), |
720 | .dapm_widgets = mc13783_dapm_widgets, | 683 | .dapm_widgets = mc13783_dapm_widgets, |