diff options
| -rw-r--r-- | Documentation/devicetree/bindings/sound/tfa9879.txt | 23 | ||||
| -rw-r--r-- | sound/soc/codecs/Kconfig | 9 | ||||
| -rw-r--r-- | sound/soc/codecs/tfa9879.c | 6 | ||||
| -rw-r--r-- | sound/soc/codecs/ts3a227e.c | 10 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8741.c | 39 | ||||
| -rw-r--r-- | sound/soc/codecs/wm9705.c | 68 | ||||
| -rw-r--r-- | sound/soc/codecs/wm9712.c | 48 | ||||
| -rw-r--r-- | sound/soc/codecs/wm9713.c | 39 | ||||
| -rw-r--r-- | sound/soc/zte/zx-spdif.c | 4 |
9 files changed, 174 insertions, 72 deletions
diff --git a/Documentation/devicetree/bindings/sound/tfa9879.txt b/Documentation/devicetree/bindings/sound/tfa9879.txt new file mode 100644 index 000000000000..23ba522d9e2b --- /dev/null +++ b/Documentation/devicetree/bindings/sound/tfa9879.txt | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | NXP TFA9879 class-D audio amplifier | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | |||
| 5 | - compatible : "nxp,tfa9879" | ||
| 6 | |||
| 7 | - reg : the I2C address of the device | ||
| 8 | |||
| 9 | Example: | ||
| 10 | |||
| 11 | &i2c1 { | ||
| 12 | clock-frequency = <100000>; | ||
| 13 | pinctrl-names = "default"; | ||
| 14 | pinctrl-0 = <&pinctrl_i2c1>; | ||
| 15 | status = "okay"; | ||
| 16 | |||
| 17 | codec: tfa9879@6c { | ||
| 18 | #sound-dai-cells = <0>; | ||
| 19 | compatible = "nxp,tfa9879"; | ||
| 20 | reg = <0x6c>; | ||
| 21 | }; | ||
| 22 | }; | ||
| 23 | |||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 01f436cc14c6..a42ddbc93f3d 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
| @@ -214,9 +214,9 @@ config SND_SOC_ALL_CODECS | |||
| 214 | select SND_SOC_WM8998 if MFD_WM8998 | 214 | select SND_SOC_WM8998 if MFD_WM8998 |
| 215 | select SND_SOC_WM9081 if I2C | 215 | select SND_SOC_WM9081 if I2C |
| 216 | select SND_SOC_WM9090 if I2C | 216 | select SND_SOC_WM9090 if I2C |
| 217 | select SND_SOC_WM9705 if SND_SOC_AC97_BUS | 217 | select SND_SOC_WM9705 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) |
| 218 | select SND_SOC_WM9712 if SND_SOC_AC97_BUS | 218 | select SND_SOC_WM9712 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) |
| 219 | select SND_SOC_WM9713 if SND_SOC_AC97_BUS | 219 | select SND_SOC_WM9713 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) |
| 220 | help | 220 | help |
| 221 | Normally ASoC codec drivers are only built if a machine driver which | 221 | Normally ASoC codec drivers are only built if a machine driver which |
| 222 | uses them is also built since they are only usable with a machine | 222 | uses them is also built since they are only usable with a machine |
| @@ -1132,14 +1132,17 @@ config SND_SOC_WM9090 | |||
| 1132 | config SND_SOC_WM9705 | 1132 | config SND_SOC_WM9705 |
| 1133 | tristate | 1133 | tristate |
| 1134 | select REGMAP_AC97 | 1134 | select REGMAP_AC97 |
| 1135 | select AC97_BUS_COMPAT if AC97_BUS_NEW | ||
| 1135 | 1136 | ||
| 1136 | config SND_SOC_WM9712 | 1137 | config SND_SOC_WM9712 |
| 1137 | tristate | 1138 | tristate |
| 1138 | select REGMAP_AC97 | 1139 | select REGMAP_AC97 |
| 1140 | select AC97_BUS_COMPAT if AC97_BUS_NEW | ||
| 1139 | 1141 | ||
| 1140 | config SND_SOC_WM9713 | 1142 | config SND_SOC_WM9713 |
| 1141 | tristate | 1143 | tristate |
| 1142 | select REGMAP_AC97 | 1144 | select REGMAP_AC97 |
| 1145 | select AC97_BUS_COMPAT if AC97_BUS_NEW | ||
| 1143 | 1146 | ||
| 1144 | config SND_SOC_ZX_AUD96P22 | 1147 | config SND_SOC_ZX_AUD96P22 |
| 1145 | tristate "ZTE ZX AUD96P22 CODEC" | 1148 | tristate "ZTE ZX AUD96P22 CODEC" |
diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c index 95e0a7abeb7a..f8dd67ca0744 100644 --- a/sound/soc/codecs/tfa9879.c +++ b/sound/soc/codecs/tfa9879.c | |||
| @@ -312,9 +312,15 @@ static const struct i2c_device_id tfa9879_i2c_id[] = { | |||
| 312 | }; | 312 | }; |
| 313 | MODULE_DEVICE_TABLE(i2c, tfa9879_i2c_id); | 313 | MODULE_DEVICE_TABLE(i2c, tfa9879_i2c_id); |
| 314 | 314 | ||
| 315 | static const struct of_device_id tfa9879_of_match[] = { | ||
| 316 | { .compatible = "nxp,tfa9879", }, | ||
| 317 | { } | ||
| 318 | }; | ||
| 319 | |||
| 315 | static struct i2c_driver tfa9879_i2c_driver = { | 320 | static struct i2c_driver tfa9879_i2c_driver = { |
| 316 | .driver = { | 321 | .driver = { |
| 317 | .name = "tfa9879", | 322 | .name = "tfa9879", |
| 323 | .of_match_table = tfa9879_of_match, | ||
| 318 | }, | 324 | }, |
| 319 | .probe = tfa9879_i2c_probe, | 325 | .probe = tfa9879_i2c_probe, |
| 320 | .remove = tfa9879_i2c_remove, | 326 | .remove = tfa9879_i2c_remove, |
diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c index 43568435c208..738e04b09116 100644 --- a/sound/soc/codecs/ts3a227e.c +++ b/sound/soc/codecs/ts3a227e.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/of_gpio.h> | 16 | #include <linux/of_gpio.h> |
| 17 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
| 18 | #include <linux/acpi.h> | ||
| 18 | 19 | ||
| 19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
| 20 | #include <sound/jack.h> | 21 | #include <sound/jack.h> |
| @@ -374,11 +375,20 @@ static const struct of_device_id ts3a227e_of_match[] = { | |||
| 374 | }; | 375 | }; |
| 375 | MODULE_DEVICE_TABLE(of, ts3a227e_of_match); | 376 | MODULE_DEVICE_TABLE(of, ts3a227e_of_match); |
| 376 | 377 | ||
| 378 | #ifdef CONFIG_ACPI | ||
| 379 | static struct acpi_device_id ts3a227e_acpi_match[] = { | ||
| 380 | { "104C227E", 0 }, | ||
| 381 | {}, | ||
| 382 | }; | ||
| 383 | MODULE_DEVICE_TABLE(acpi, ts3a227e_acpi_match); | ||
| 384 | #endif | ||
| 385 | |||
| 377 | static struct i2c_driver ts3a227e_driver = { | 386 | static struct i2c_driver ts3a227e_driver = { |
| 378 | .driver = { | 387 | .driver = { |
| 379 | .name = "ts3a227e", | 388 | .name = "ts3a227e", |
| 380 | .pm = &ts3a227e_pm, | 389 | .pm = &ts3a227e_pm, |
| 381 | .of_match_table = of_match_ptr(ts3a227e_of_match), | 390 | .of_match_table = of_match_ptr(ts3a227e_of_match), |
| 391 | .acpi_match_table = ACPI_PTR(ts3a227e_acpi_match), | ||
| 382 | }, | 392 | }, |
| 383 | .probe = ts3a227e_i2c_probe, | 393 | .probe = ts3a227e_i2c_probe, |
| 384 | .id_table = ts3a227e_i2c_ids, | 394 | .id_table = ts3a227e_i2c_ids, |
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index b8c1940f2243..a394dbee77aa 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c | |||
| @@ -196,7 +196,7 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, | |||
| 196 | { | 196 | { |
| 197 | struct snd_soc_codec *codec = dai->codec; | 197 | struct snd_soc_codec *codec = dai->codec; |
| 198 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); | 198 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); |
| 199 | u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1FC; | 199 | unsigned int iface; |
| 200 | int i; | 200 | int i; |
| 201 | 201 | ||
| 202 | /* The set of sample rates that can be supported depends on the | 202 | /* The set of sample rates that can be supported depends on the |
| @@ -223,15 +223,16 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, | |||
| 223 | /* bit size */ | 223 | /* bit size */ |
| 224 | switch (params_width(params)) { | 224 | switch (params_width(params)) { |
| 225 | case 16: | 225 | case 16: |
| 226 | iface = 0x0; | ||
| 226 | break; | 227 | break; |
| 227 | case 20: | 228 | case 20: |
| 228 | iface |= 0x0001; | 229 | iface = 0x1; |
| 229 | break; | 230 | break; |
| 230 | case 24: | 231 | case 24: |
| 231 | iface |= 0x0002; | 232 | iface = 0x2; |
| 232 | break; | 233 | break; |
| 233 | case 32: | 234 | case 32: |
| 234 | iface |= 0x0003; | 235 | iface = 0x3; |
| 235 | break; | 236 | break; |
| 236 | default: | 237 | default: |
| 237 | dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", | 238 | dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", |
| @@ -242,7 +243,9 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, | |||
| 242 | dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d, rate param = %d", | 243 | dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d, rate param = %d", |
| 243 | params_width(params), params_rate(params)); | 244 | params_width(params), params_rate(params)); |
| 244 | 245 | ||
| 245 | snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); | 246 | snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK, |
| 247 | iface); | ||
| 248 | |||
| 246 | return 0; | 249 | return 0; |
| 247 | } | 250 | } |
| 248 | 251 | ||
| @@ -295,7 +298,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 295 | unsigned int fmt) | 298 | unsigned int fmt) |
| 296 | { | 299 | { |
| 297 | struct snd_soc_codec *codec = codec_dai->codec; | 300 | struct snd_soc_codec *codec = codec_dai->codec; |
| 298 | u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1C3; | 301 | unsigned int iface; |
| 299 | 302 | ||
| 300 | /* check master/slave audio interface */ | 303 | /* check master/slave audio interface */ |
| 301 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 304 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| @@ -308,18 +311,19 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 308 | /* interface format */ | 311 | /* interface format */ |
| 309 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 312 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 310 | case SND_SOC_DAIFMT_I2S: | 313 | case SND_SOC_DAIFMT_I2S: |
| 311 | iface |= 0x0008; | 314 | iface = 0x08; |
| 312 | break; | 315 | break; |
| 313 | case SND_SOC_DAIFMT_RIGHT_J: | 316 | case SND_SOC_DAIFMT_RIGHT_J: |
| 317 | iface = 0x00; | ||
| 314 | break; | 318 | break; |
| 315 | case SND_SOC_DAIFMT_LEFT_J: | 319 | case SND_SOC_DAIFMT_LEFT_J: |
| 316 | iface |= 0x0004; | 320 | iface = 0x04; |
| 317 | break; | 321 | break; |
| 318 | case SND_SOC_DAIFMT_DSP_A: | 322 | case SND_SOC_DAIFMT_DSP_A: |
| 319 | iface |= 0x000C; | 323 | iface = 0x0C; |
| 320 | break; | 324 | break; |
| 321 | case SND_SOC_DAIFMT_DSP_B: | 325 | case SND_SOC_DAIFMT_DSP_B: |
| 322 | iface |= 0x001C; | 326 | iface = 0x1C; |
| 323 | break; | 327 | break; |
| 324 | default: | 328 | default: |
| 325 | return -EINVAL; | 329 | return -EINVAL; |
| @@ -329,14 +333,14 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 329 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 333 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| 330 | case SND_SOC_DAIFMT_NB_NF: | 334 | case SND_SOC_DAIFMT_NB_NF: |
| 331 | break; | 335 | break; |
| 332 | case SND_SOC_DAIFMT_IB_IF: | 336 | case SND_SOC_DAIFMT_NB_IF: |
| 333 | iface |= 0x0010; | 337 | iface |= 0x10; |
| 334 | break; | 338 | break; |
| 335 | case SND_SOC_DAIFMT_IB_NF: | 339 | case SND_SOC_DAIFMT_IB_NF: |
| 336 | iface |= 0x0020; | 340 | iface |= 0x20; |
| 337 | break; | 341 | break; |
| 338 | case SND_SOC_DAIFMT_NB_IF: | 342 | case SND_SOC_DAIFMT_IB_IF: |
| 339 | iface |= 0x0030; | 343 | iface |= 0x30; |
| 340 | break; | 344 | break; |
| 341 | default: | 345 | default: |
| 342 | return -EINVAL; | 346 | return -EINVAL; |
| @@ -347,7 +351,10 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 347 | fmt & SND_SOC_DAIFMT_FORMAT_MASK, | 351 | fmt & SND_SOC_DAIFMT_FORMAT_MASK, |
| 348 | ((fmt & SND_SOC_DAIFMT_INV_MASK))); | 352 | ((fmt & SND_SOC_DAIFMT_INV_MASK))); |
| 349 | 353 | ||
| 350 | snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); | 354 | snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, |
| 355 | WM8741_BCP_MASK | WM8741_LRP_MASK | WM8741_FMT_MASK, | ||
| 356 | iface); | ||
| 357 | |||
| 351 | return 0; | 358 | return 0; |
| 352 | } | 359 | } |
| 353 | 360 | ||
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index f6d5c0f2aea5..2c09f71fe433 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 14 | #include <linux/mfd/wm97xx.h> | ||
| 14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 16 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| @@ -18,12 +19,19 @@ | |||
| 18 | #include <sound/core.h> | 19 | #include <sound/core.h> |
| 19 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
| 20 | #include <sound/ac97_codec.h> | 21 | #include <sound/ac97_codec.h> |
| 22 | #include <sound/ac97/codec.h> | ||
| 23 | #include <sound/ac97/compat.h> | ||
| 21 | #include <sound/initval.h> | 24 | #include <sound/initval.h> |
| 22 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
| 23 | 26 | ||
| 24 | #define WM9705_VENDOR_ID 0x574d4c05 | 27 | #define WM9705_VENDOR_ID 0x574d4c05 |
| 25 | #define WM9705_VENDOR_ID_MASK 0xffffffff | 28 | #define WM9705_VENDOR_ID_MASK 0xffffffff |
| 26 | 29 | ||
| 30 | struct wm9705_priv { | ||
| 31 | struct snd_ac97 *ac97; | ||
| 32 | struct wm97xx_platform_data *mfd_pdata; | ||
| 33 | }; | ||
| 34 | |||
| 27 | static const struct reg_default wm9705_reg_defaults[] = { | 35 | static const struct reg_default wm9705_reg_defaults[] = { |
| 28 | { 0x02, 0x8000 }, | 36 | { 0x02, 0x8000 }, |
| 29 | { 0x04, 0x8000 }, | 37 | { 0x04, 0x8000 }, |
| @@ -292,10 +300,10 @@ static int wm9705_soc_suspend(struct snd_soc_codec *codec) | |||
| 292 | 300 | ||
| 293 | static int wm9705_soc_resume(struct snd_soc_codec *codec) | 301 | static int wm9705_soc_resume(struct snd_soc_codec *codec) |
| 294 | { | 302 | { |
| 295 | struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); | 303 | struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); |
| 296 | int ret; | 304 | int ret; |
| 297 | 305 | ||
| 298 | ret = snd_ac97_reset(ac97, true, WM9705_VENDOR_ID, | 306 | ret = snd_ac97_reset(wm9705->ac97, true, WM9705_VENDOR_ID, |
| 299 | WM9705_VENDOR_ID_MASK); | 307 | WM9705_VENDOR_ID_MASK); |
| 300 | if (ret < 0) | 308 | if (ret < 0) |
| 301 | return ret; | 309 | return ret; |
| @@ -311,38 +319,45 @@ static int wm9705_soc_resume(struct snd_soc_codec *codec) | |||
| 311 | 319 | ||
| 312 | static int wm9705_soc_probe(struct snd_soc_codec *codec) | 320 | static int wm9705_soc_probe(struct snd_soc_codec *codec) |
| 313 | { | 321 | { |
| 314 | struct snd_ac97 *ac97; | 322 | struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); |
| 315 | struct regmap *regmap; | 323 | struct regmap *regmap; |
| 316 | int ret; | ||
| 317 | |||
| 318 | ac97 = snd_soc_new_ac97_codec(codec, WM9705_VENDOR_ID, | ||
| 319 | WM9705_VENDOR_ID_MASK); | ||
| 320 | if (IS_ERR(ac97)) { | ||
| 321 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | ||
| 322 | return PTR_ERR(ac97); | ||
| 323 | } | ||
| 324 | 324 | ||
| 325 | regmap = regmap_init_ac97(ac97, &wm9705_regmap_config); | 325 | if (wm9705->mfd_pdata) { |
| 326 | if (IS_ERR(regmap)) { | 326 | wm9705->ac97 = wm9705->mfd_pdata->ac97; |
| 327 | ret = PTR_ERR(regmap); | 327 | regmap = wm9705->mfd_pdata->regmap; |
| 328 | goto err_free_ac97_codec; | 328 | } else { |
| 329 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
| 330 | wm9705->ac97 = snd_soc_new_ac97_codec(codec, WM9705_VENDOR_ID, | ||
| 331 | WM9705_VENDOR_ID_MASK); | ||
| 332 | if (IS_ERR(wm9705->ac97)) { | ||
| 333 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | ||
| 334 | return PTR_ERR(wm9705->ac97); | ||
| 335 | } | ||
| 336 | |||
| 337 | regmap = regmap_init_ac97(wm9705->ac97, &wm9705_regmap_config); | ||
| 338 | if (IS_ERR(regmap)) { | ||
| 339 | snd_soc_free_ac97_codec(wm9705->ac97); | ||
| 340 | return PTR_ERR(regmap); | ||
| 341 | } | ||
| 342 | #endif | ||
| 329 | } | 343 | } |
| 330 | 344 | ||
| 331 | snd_soc_codec_set_drvdata(codec, ac97); | 345 | snd_soc_codec_set_drvdata(codec, wm9705->ac97); |
| 332 | snd_soc_codec_init_regmap(codec, regmap); | 346 | snd_soc_codec_init_regmap(codec, regmap); |
| 333 | 347 | ||
| 334 | return 0; | 348 | return 0; |
| 335 | err_free_ac97_codec: | ||
| 336 | snd_soc_free_ac97_codec(ac97); | ||
| 337 | return ret; | ||
| 338 | } | 349 | } |
| 339 | 350 | ||
| 340 | static int wm9705_soc_remove(struct snd_soc_codec *codec) | 351 | static int wm9705_soc_remove(struct snd_soc_codec *codec) |
| 341 | { | 352 | { |
| 342 | struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); | 353 | #ifdef CONFIG_SND_SOC_AC97_BUS |
| 354 | struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); | ||
| 343 | 355 | ||
| 344 | snd_soc_codec_exit_regmap(codec); | 356 | if (!wm9705->mfd_pdata) { |
| 345 | snd_soc_free_ac97_codec(ac97); | 357 | snd_soc_codec_exit_regmap(codec); |
| 358 | snd_soc_free_ac97_codec(wm9705->ac97); | ||
| 359 | } | ||
| 360 | #endif | ||
| 346 | return 0; | 361 | return 0; |
| 347 | } | 362 | } |
| 348 | 363 | ||
| @@ -364,6 +379,15 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm9705 = { | |||
| 364 | 379 | ||
| 365 | static int wm9705_probe(struct platform_device *pdev) | 380 | static int wm9705_probe(struct platform_device *pdev) |
| 366 | { | 381 | { |
| 382 | struct wm9705_priv *wm9705; | ||
| 383 | |||
| 384 | wm9705 = devm_kzalloc(&pdev->dev, sizeof(*wm9705), GFP_KERNEL); | ||
| 385 | if (wm9705 == NULL) | ||
| 386 | return -ENOMEM; | ||
| 387 | |||
| 388 | wm9705->mfd_pdata = dev_get_platdata(&pdev->dev); | ||
| 389 | platform_set_drvdata(pdev, wm9705); | ||
| 390 | |||
| 367 | return snd_soc_register_codec(&pdev->dev, | 391 | return snd_soc_register_codec(&pdev->dev, |
| 368 | &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai)); | 392 | &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai)); |
| 369 | } | 393 | } |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 1a3e1797994a..4f6d1a442bc4 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
| 15 | #include <linux/mfd/wm97xx.h> | ||
| 15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 17 | #include <linux/device.h> | 18 | #include <linux/device.h> |
| @@ -19,6 +20,8 @@ | |||
| 19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
| 20 | #include <sound/pcm.h> | 21 | #include <sound/pcm.h> |
| 21 | #include <sound/ac97_codec.h> | 22 | #include <sound/ac97_codec.h> |
| 23 | #include <sound/ac97/codec.h> | ||
| 24 | #include <sound/ac97/compat.h> | ||
| 22 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
| 23 | #include <sound/soc.h> | 26 | #include <sound/soc.h> |
| 24 | #include <sound/tlv.h> | 27 | #include <sound/tlv.h> |
| @@ -30,6 +33,7 @@ struct wm9712_priv { | |||
| 30 | struct snd_ac97 *ac97; | 33 | struct snd_ac97 *ac97; |
| 31 | unsigned int hp_mixer[2]; | 34 | unsigned int hp_mixer[2]; |
| 32 | struct mutex lock; | 35 | struct mutex lock; |
| 36 | struct wm97xx_platform_data *mfd_pdata; | ||
| 33 | }; | 37 | }; |
| 34 | 38 | ||
| 35 | static const struct reg_default wm9712_reg_defaults[] = { | 39 | static const struct reg_default wm9712_reg_defaults[] = { |
| @@ -636,18 +640,26 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
| 636 | struct regmap *regmap; | 640 | struct regmap *regmap; |
| 637 | int ret; | 641 | int ret; |
| 638 | 642 | ||
| 639 | wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, | 643 | if (wm9712->mfd_pdata) { |
| 640 | WM9712_VENDOR_ID_MASK); | 644 | wm9712->ac97 = wm9712->mfd_pdata->ac97; |
| 641 | if (IS_ERR(wm9712->ac97)) { | 645 | regmap = wm9712->mfd_pdata->regmap; |
| 642 | ret = PTR_ERR(wm9712->ac97); | 646 | } else { |
| 643 | dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); | 647 | #ifdef CONFIG_SND_SOC_AC97_BUS |
| 644 | return ret; | 648 | wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, |
| 645 | } | 649 | WM9712_VENDOR_ID_MASK); |
| 646 | 650 | if (IS_ERR(wm9712->ac97)) { | |
| 647 | regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); | 651 | ret = PTR_ERR(wm9712->ac97); |
| 648 | if (IS_ERR(regmap)) { | 652 | dev_err(codec->dev, |
| 649 | ret = PTR_ERR(regmap); | 653 | "Failed to register AC97 codec: %d\n", ret); |
| 650 | goto err_free_ac97_codec; | 654 | return ret; |
| 655 | } | ||
| 656 | |||
| 657 | regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); | ||
| 658 | if (IS_ERR(regmap)) { | ||
| 659 | snd_soc_free_ac97_codec(wm9712->ac97); | ||
| 660 | return PTR_ERR(regmap); | ||
| 661 | } | ||
| 662 | #endif | ||
| 651 | } | 663 | } |
| 652 | 664 | ||
| 653 | snd_soc_codec_init_regmap(codec, regmap); | 665 | snd_soc_codec_init_regmap(codec, regmap); |
| @@ -656,17 +668,18 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
| 656 | snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000); | 668 | snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000); |
| 657 | 669 | ||
| 658 | return 0; | 670 | return 0; |
| 659 | err_free_ac97_codec: | ||
| 660 | snd_soc_free_ac97_codec(wm9712->ac97); | ||
| 661 | return ret; | ||
| 662 | } | 671 | } |
| 663 | 672 | ||
| 664 | static int wm9712_soc_remove(struct snd_soc_codec *codec) | 673 | static int wm9712_soc_remove(struct snd_soc_codec *codec) |
| 665 | { | 674 | { |
| 675 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
| 666 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); | 676 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); |
| 667 | 677 | ||
| 668 | snd_soc_codec_exit_regmap(codec); | 678 | if (!wm9712->mfd_pdata) { |
| 669 | snd_soc_free_ac97_codec(wm9712->ac97); | 679 | snd_soc_codec_exit_regmap(codec); |
| 680 | snd_soc_free_ac97_codec(wm9712->ac97); | ||
| 681 | } | ||
| 682 | #endif | ||
| 670 | return 0; | 683 | return 0; |
| 671 | } | 684 | } |
| 672 | 685 | ||
| @@ -697,6 +710,7 @@ static int wm9712_probe(struct platform_device *pdev) | |||
| 697 | 710 | ||
| 698 | mutex_init(&wm9712->lock); | 711 | mutex_init(&wm9712->lock); |
| 699 | 712 | ||
| 713 | wm9712->mfd_pdata = dev_get_platdata(&pdev->dev); | ||
| 700 | platform_set_drvdata(pdev, wm9712); | 714 | platform_set_drvdata(pdev, wm9712); |
| 701 | 715 | ||
| 702 | return snd_soc_register_codec(&pdev->dev, | 716 | return snd_soc_register_codec(&pdev->dev, |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 7e4822185feb..df7220656d98 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
| @@ -17,12 +17,15 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/mfd/wm97xx.h> | ||
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | #include <linux/device.h> | 22 | #include <linux/device.h> |
| 22 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
| 23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
| 24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
| 25 | #include <sound/ac97_codec.h> | 26 | #include <sound/ac97_codec.h> |
| 27 | #include <sound/ac97/codec.h> | ||
| 28 | #include <sound/ac97/compat.h> | ||
| 26 | #include <sound/initval.h> | 29 | #include <sound/initval.h> |
| 27 | #include <sound/pcm_params.h> | 30 | #include <sound/pcm_params.h> |
| 28 | #include <sound/tlv.h> | 31 | #include <sound/tlv.h> |
| @@ -38,6 +41,7 @@ struct wm9713_priv { | |||
| 38 | u32 pll_in; /* PLL input frequency */ | 41 | u32 pll_in; /* PLL input frequency */ |
| 39 | unsigned int hp_mixer[2]; | 42 | unsigned int hp_mixer[2]; |
| 40 | struct mutex lock; | 43 | struct mutex lock; |
| 44 | struct wm97xx_platform_data *mfd_pdata; | ||
| 41 | }; | 45 | }; |
| 42 | 46 | ||
| 43 | #define HPL_MIXER 0 | 47 | #define HPL_MIXER 0 |
| @@ -1205,17 +1209,23 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec) | |||
| 1205 | static int wm9713_soc_probe(struct snd_soc_codec *codec) | 1209 | static int wm9713_soc_probe(struct snd_soc_codec *codec) |
| 1206 | { | 1210 | { |
| 1207 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); | 1211 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
| 1208 | struct regmap *regmap; | 1212 | struct regmap *regmap = NULL; |
| 1209 | 1213 | ||
| 1210 | wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID, | 1214 | if (wm9713->mfd_pdata) { |
| 1211 | WM9713_VENDOR_ID_MASK); | 1215 | wm9713->ac97 = wm9713->mfd_pdata->ac97; |
| 1212 | if (IS_ERR(wm9713->ac97)) | 1216 | regmap = wm9713->mfd_pdata->regmap; |
| 1213 | return PTR_ERR(wm9713->ac97); | 1217 | } else { |
| 1214 | 1218 | #ifdef CONFIG_SND_SOC_AC97_BUS | |
| 1215 | regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config); | 1219 | wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID, |
| 1216 | if (IS_ERR(regmap)) { | 1220 | WM9713_VENDOR_ID_MASK); |
| 1217 | snd_soc_free_ac97_codec(wm9713->ac97); | 1221 | if (IS_ERR(wm9713->ac97)) |
| 1218 | return PTR_ERR(regmap); | 1222 | return PTR_ERR(wm9713->ac97); |
| 1223 | regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config); | ||
| 1224 | if (IS_ERR(regmap)) { | ||
| 1225 | snd_soc_free_ac97_codec(wm9713->ac97); | ||
| 1226 | return PTR_ERR(regmap); | ||
| 1227 | } | ||
| 1228 | #endif | ||
| 1219 | } | 1229 | } |
| 1220 | 1230 | ||
| 1221 | snd_soc_codec_init_regmap(codec, regmap); | 1231 | snd_soc_codec_init_regmap(codec, regmap); |
| @@ -1228,10 +1238,14 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
| 1228 | 1238 | ||
| 1229 | static int wm9713_soc_remove(struct snd_soc_codec *codec) | 1239 | static int wm9713_soc_remove(struct snd_soc_codec *codec) |
| 1230 | { | 1240 | { |
| 1241 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
| 1231 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); | 1242 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
| 1232 | 1243 | ||
| 1233 | snd_soc_codec_exit_regmap(codec); | 1244 | if (!wm9713->mfd_pdata) { |
| 1234 | snd_soc_free_ac97_codec(wm9713->ac97); | 1245 | snd_soc_codec_exit_regmap(codec); |
| 1246 | snd_soc_free_ac97_codec(wm9713->ac97); | ||
| 1247 | } | ||
| 1248 | #endif | ||
| 1235 | return 0; | 1249 | return 0; |
| 1236 | } | 1250 | } |
| 1237 | 1251 | ||
| @@ -1262,6 +1276,7 @@ static int wm9713_probe(struct platform_device *pdev) | |||
| 1262 | 1276 | ||
| 1263 | mutex_init(&wm9713->lock); | 1277 | mutex_init(&wm9713->lock); |
| 1264 | 1278 | ||
| 1279 | wm9713->mfd_pdata = dev_get_platdata(&pdev->dev); | ||
| 1265 | platform_set_drvdata(pdev, wm9713); | 1280 | platform_set_drvdata(pdev, wm9713); |
| 1266 | 1281 | ||
| 1267 | return snd_soc_register_codec(&pdev->dev, | 1282 | return snd_soc_register_codec(&pdev->dev, |
diff --git a/sound/soc/zte/zx-spdif.c b/sound/soc/zte/zx-spdif.c index b143f9f682d2..17b6ce35037a 100644 --- a/sound/soc/zte/zx-spdif.c +++ b/sound/soc/zte/zx-spdif.c | |||
| @@ -139,11 +139,11 @@ static int zx_spdif_hw_params(struct snd_pcm_substream *substream, | |||
| 139 | { | 139 | { |
| 140 | struct zx_spdif_info *zx_spdif = dev_get_drvdata(socdai->dev); | 140 | struct zx_spdif_info *zx_spdif = dev_get_drvdata(socdai->dev); |
| 141 | struct zx_spdif_info *spdif = snd_soc_dai_get_drvdata(socdai); | 141 | struct zx_spdif_info *spdif = snd_soc_dai_get_drvdata(socdai); |
| 142 | struct snd_dmaengine_dai_dma_data *dma_data = &zx_spdif->dma_data; | 142 | struct snd_dmaengine_dai_dma_data *dma_data = |
| 143 | snd_soc_dai_get_dma_data(socdai, substream); | ||
| 143 | u32 val, ch_num, rate; | 144 | u32 val, ch_num, rate; |
| 144 | int ret; | 145 | int ret; |
| 145 | 146 | ||
| 146 | dma_data = snd_soc_dai_get_dma_data(socdai, substream); | ||
| 147 | dma_data->addr_width = params_width(params) >> 3; | 147 | dma_data->addr_width = params_width(params) >> 3; |
| 148 | 148 | ||
| 149 | val = readl_relaxed(zx_spdif->reg_base + ZX_CTRL); | 149 | val = readl_relaxed(zx_spdif->reg_base + ZX_CTRL); |
