diff options
| -rw-r--r-- | sound/soc/codecs/sn95031.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index dba26e63844e..13045f2af4d3 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
| @@ -164,30 +164,28 @@ static unsigned int sn95031_get_mic_bias(struct snd_soc_codec *codec) | |||
| 164 | } | 164 | } |
| 165 | /*end - adc helper functions */ | 165 | /*end - adc helper functions */ |
| 166 | 166 | ||
| 167 | static inline unsigned int sn95031_read(struct snd_soc_codec *codec, | 167 | static int sn95031_read(void *ctx, unsigned int reg, unsigned int *val) |
| 168 | unsigned int reg) | ||
| 169 | { | 168 | { |
| 170 | u8 value = 0; | 169 | u8 value = 0; |
| 171 | int ret; | 170 | int ret; |
| 172 | 171 | ||
| 173 | ret = intel_scu_ipc_ioread8(reg, &value); | 172 | ret = intel_scu_ipc_ioread8(reg, &value); |
| 174 | if (ret) | 173 | if (ret == 0) |
| 175 | pr_err("read of %x failed, err %d\n", reg, ret); | 174 | *val = value; |
| 176 | return value; | ||
| 177 | 175 | ||
| 176 | return ret; | ||
| 178 | } | 177 | } |
| 179 | 178 | ||
| 180 | static inline int sn95031_write(struct snd_soc_codec *codec, | 179 | static int sn95031_write(void *ctx, unsigned int reg, unsigned int value) |
| 181 | unsigned int reg, unsigned int value) | ||
| 182 | { | 180 | { |
| 183 | int ret; | 181 | return intel_scu_ipc_iowrite8(reg, value); |
| 184 | |||
| 185 | ret = intel_scu_ipc_iowrite8(reg, value); | ||
| 186 | if (ret) | ||
| 187 | pr_err("write of %x failed, err %d\n", reg, ret); | ||
| 188 | return ret; | ||
| 189 | } | 182 | } |
| 190 | 183 | ||
| 184 | static const struct regmap_config sn95031_regmap = { | ||
| 185 | .reg_read = sn95031_read, | ||
| 186 | .reg_write = sn95031_write, | ||
| 187 | }; | ||
| 188 | |||
| 191 | static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, | 189 | static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, |
| 192 | enum snd_soc_bias_level level) | 190 | enum snd_soc_bias_level level) |
| 193 | { | 191 | { |
| @@ -827,6 +825,8 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec) | |||
| 827 | { | 825 | { |
| 828 | pr_debug("codec_probe called\n"); | 826 | pr_debug("codec_probe called\n"); |
| 829 | 827 | ||
| 828 | snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | ||
| 829 | |||
| 830 | /* PCM interface config | 830 | /* PCM interface config |
| 831 | * This sets the pcm rx slot conguration to max 6 slots | 831 | * This sets the pcm rx slot conguration to max 6 slots |
| 832 | * for max 4 dais (2 stereo and 2 mono) | 832 | * for max 4 dais (2 stereo and 2 mono) |
| @@ -886,8 +886,6 @@ static int sn95031_codec_remove(struct snd_soc_codec *codec) | |||
| 886 | static struct snd_soc_codec_driver sn95031_codec = { | 886 | static struct snd_soc_codec_driver sn95031_codec = { |
| 887 | .probe = sn95031_codec_probe, | 887 | .probe = sn95031_codec_probe, |
| 888 | .remove = sn95031_codec_remove, | 888 | .remove = sn95031_codec_remove, |
| 889 | .read = sn95031_read, | ||
| 890 | .write = sn95031_write, | ||
| 891 | .set_bias_level = sn95031_set_vaud_bias, | 889 | .set_bias_level = sn95031_set_vaud_bias, |
| 892 | .idle_bias_off = true, | 890 | .idle_bias_off = true, |
| 893 | .dapm_widgets = sn95031_dapm_widgets, | 891 | .dapm_widgets = sn95031_dapm_widgets, |
| @@ -898,7 +896,14 @@ static struct snd_soc_codec_driver sn95031_codec = { | |||
| 898 | 896 | ||
| 899 | static int sn95031_device_probe(struct platform_device *pdev) | 897 | static int sn95031_device_probe(struct platform_device *pdev) |
| 900 | { | 898 | { |
| 899 | struct regmap *regmap; | ||
| 900 | |||
| 901 | pr_debug("codec device probe called for %s\n", dev_name(&pdev->dev)); | 901 | pr_debug("codec device probe called for %s\n", dev_name(&pdev->dev)); |
| 902 | |||
| 903 | regmap = devm_regmap_init(&pdev->dev, NULL, NULL, &sn95031_regmap); | ||
| 904 | if (IS_ERR(regmap)) | ||
| 905 | return PTR_ERR(regmap); | ||
| 906 | |||
| 902 | return snd_soc_register_codec(&pdev->dev, &sn95031_codec, | 907 | return snd_soc_register_codec(&pdev->dev, &sn95031_codec, |
| 903 | sn95031_dais, ARRAY_SIZE(sn95031_dais)); | 908 | sn95031_dais, ARRAY_SIZE(sn95031_dais)); |
| 904 | } | 909 | } |
