diff options
Diffstat (limited to 'sound')
-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 |
8 files changed, 151 insertions, 72 deletions
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 select SND_SOC_WM8998 if MFD_WM8998 select SND_SOC_WM9081 if I2C select SND_SOC_WM9090 if I2C - select SND_SOC_WM9705 if SND_SOC_AC97_BUS - select SND_SOC_WM9712 if SND_SOC_AC97_BUS - select SND_SOC_WM9713 if SND_SOC_AC97_BUS + select SND_SOC_WM9705 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) + select SND_SOC_WM9712 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) + select SND_SOC_WM9713 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) help Normally ASoC codec drivers are only built if a machine driver which uses them is also built since they are only usable with a machine @@ -1132,14 +1132,17 @@ config SND_SOC_WM9090 config SND_SOC_WM9705 tristate select REGMAP_AC97 + select AC97_BUS_COMPAT if AC97_BUS_NEW config SND_SOC_WM9712 tristate select REGMAP_AC97 + select AC97_BUS_COMPAT if AC97_BUS_NEW config SND_SOC_WM9713 tristate select REGMAP_AC97 + select AC97_BUS_COMPAT if AC97_BUS_NEW config SND_SOC_ZX_AUD96P22 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[] = { }; MODULE_DEVICE_TABLE(i2c, tfa9879_i2c_id); +static const struct of_device_id tfa9879_of_match[] = { + { .compatible = "nxp,tfa9879", }, + { } +}; + static struct i2c_driver tfa9879_i2c_driver = { .driver = { .name = "tfa9879", + .of_match_table = tfa9879_of_match, }, .probe = tfa9879_i2c_probe, .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 @@ #include <linux/module.h> #include <linux/of_gpio.h> #include <linux/regmap.h> +#include <linux/acpi.h> #include <sound/core.h> #include <sound/jack.h> @@ -374,11 +375,20 @@ static const struct of_device_id ts3a227e_of_match[] = { }; MODULE_DEVICE_TABLE(of, ts3a227e_of_match); +#ifdef CONFIG_ACPI +static struct acpi_device_id ts3a227e_acpi_match[] = { + { "104C227E", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(acpi, ts3a227e_acpi_match); +#endif + static struct i2c_driver ts3a227e_driver = { .driver = { .name = "ts3a227e", .pm = &ts3a227e_pm, .of_match_table = of_match_ptr(ts3a227e_of_match), + .acpi_match_table = ACPI_PTR(ts3a227e_acpi_match), }, .probe = ts3a227e_i2c_probe, .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, { struct snd_soc_codec *codec = dai->codec; struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); - u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1FC; + unsigned int iface; int i; /* 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, /* bit size */ switch (params_width(params)) { case 16: + iface = 0x0; break; case 20: - iface |= 0x0001; + iface = 0x1; break; case 24: - iface |= 0x0002; + iface = 0x2; break; case 32: - iface |= 0x0003; + iface = 0x3; break; default: 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, dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d, rate param = %d", params_width(params), params_rate(params)); - snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); + snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK, + iface); + return 0; } @@ -295,7 +298,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1C3; + unsigned int iface; /* check master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -308,18 +311,19 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - iface |= 0x0008; + iface = 0x08; break; case SND_SOC_DAIFMT_RIGHT_J: + iface = 0x00; break; case SND_SOC_DAIFMT_LEFT_J: - iface |= 0x0004; + iface = 0x04; break; case SND_SOC_DAIFMT_DSP_A: - iface |= 0x000C; + iface = 0x0C; break; case SND_SOC_DAIFMT_DSP_B: - iface |= 0x001C; + iface = 0x1C; break; default: return -EINVAL; @@ -329,14 +333,14 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_NB_NF: break; - case SND_SOC_DAIFMT_IB_IF: - iface |= 0x0010; + case SND_SOC_DAIFMT_NB_IF: + iface |= 0x10; break; case SND_SOC_DAIFMT_IB_NF: - iface |= 0x0020; + iface |= 0x20; break; - case SND_SOC_DAIFMT_NB_IF: - iface |= 0x0030; + case SND_SOC_DAIFMT_IB_IF: + iface |= 0x30; break; default: return -EINVAL; @@ -347,7 +351,10 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, fmt & SND_SOC_DAIFMT_FORMAT_MASK, ((fmt & SND_SOC_DAIFMT_INV_MASK))); - snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); + snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, + WM8741_BCP_MASK | WM8741_LRP_MASK | WM8741_FMT_MASK, + iface); + return 0; } 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 @@ #include <linux/init.h> #include <linux/slab.h> +#include <linux/mfd/wm97xx.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/device.h> @@ -18,12 +19,19 @@ #include <sound/core.h> #include <sound/pcm.h> #include <sound/ac97_codec.h> +#include <sound/ac97/codec.h> +#include <sound/ac97/compat.h> #include <sound/initval.h> #include <sound/soc.h> #define WM9705_VENDOR_ID 0x574d4c05 #define WM9705_VENDOR_ID_MASK 0xffffffff +struct wm9705_priv { + struct snd_ac97 *ac97; + struct wm97xx_platform_data *mfd_pdata; +}; + static const struct reg_default wm9705_reg_defaults[] = { { 0x02, 0x8000 }, { 0x04, 0x8000 }, @@ -292,10 +300,10 @@ static int wm9705_soc_suspend(struct snd_soc_codec *codec) static int wm9705_soc_resume(struct snd_soc_codec *codec) { - struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); + struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); int ret; - ret = snd_ac97_reset(ac97, true, WM9705_VENDOR_ID, + ret = snd_ac97_reset(wm9705->ac97, true, WM9705_VENDOR_ID, WM9705_VENDOR_ID_MASK); if (ret < 0) return ret; @@ -311,38 +319,45 @@ static int wm9705_soc_resume(struct snd_soc_codec *codec) static int wm9705_soc_probe(struct snd_soc_codec *codec) { - struct snd_ac97 *ac97; + struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); struct regmap *regmap; - int ret; - - ac97 = snd_soc_new_ac97_codec(codec, WM9705_VENDOR_ID, - WM9705_VENDOR_ID_MASK); - if (IS_ERR(ac97)) { - dev_err(codec->dev, "Failed to register AC97 codec\n"); - return PTR_ERR(ac97); - } - regmap = regmap_init_ac97(ac97, &wm9705_regmap_config); - if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); - goto err_free_ac97_codec; + if (wm9705->mfd_pdata) { + wm9705->ac97 = wm9705->mfd_pdata->ac97; + regmap = wm9705->mfd_pdata->regmap; + } else { +#ifdef CONFIG_SND_SOC_AC97_BUS + wm9705->ac97 = snd_soc_new_ac97_codec(codec, WM9705_VENDOR_ID, + WM9705_VENDOR_ID_MASK); + if (IS_ERR(wm9705->ac97)) { + dev_err(codec->dev, "Failed to register AC97 codec\n"); + return PTR_ERR(wm9705->ac97); + } + + regmap = regmap_init_ac97(wm9705->ac97, &wm9705_regmap_config); + if (IS_ERR(regmap)) { + snd_soc_free_ac97_codec(wm9705->ac97); + return PTR_ERR(regmap); + } +#endif } - snd_soc_codec_set_drvdata(codec, ac97); + snd_soc_codec_set_drvdata(codec, wm9705->ac97); snd_soc_codec_init_regmap(codec, regmap); return 0; -err_free_ac97_codec: - snd_soc_free_ac97_codec(ac97); - return ret; } static int wm9705_soc_remove(struct snd_soc_codec *codec) { - struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); +#ifdef CONFIG_SND_SOC_AC97_BUS + struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); - snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(ac97); + if (!wm9705->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); + snd_soc_free_ac97_codec(wm9705->ac97); + } +#endif return 0; } @@ -364,6 +379,15 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm9705 = { static int wm9705_probe(struct platform_device *pdev) { + struct wm9705_priv *wm9705; + + wm9705 = devm_kzalloc(&pdev->dev, sizeof(*wm9705), GFP_KERNEL); + if (wm9705 == NULL) + return -ENOMEM; + + wm9705->mfd_pdata = dev_get_platdata(&pdev->dev); + platform_set_drvdata(pdev, wm9705); + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai)); } 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 @@ #include <linux/init.h> #include <linux/slab.h> +#include <linux/mfd/wm97xx.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/device.h> @@ -19,6 +20,8 @@ #include <sound/core.h> #include <sound/pcm.h> #include <sound/ac97_codec.h> +#include <sound/ac97/codec.h> +#include <sound/ac97/compat.h> #include <sound/initval.h> #include <sound/soc.h> #include <sound/tlv.h> @@ -30,6 +33,7 @@ struct wm9712_priv { struct snd_ac97 *ac97; unsigned int hp_mixer[2]; struct mutex lock; + struct wm97xx_platform_data *mfd_pdata; }; static const struct reg_default wm9712_reg_defaults[] = { @@ -636,18 +640,26 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) struct regmap *regmap; int ret; - wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, - WM9712_VENDOR_ID_MASK); - if (IS_ERR(wm9712->ac97)) { - ret = PTR_ERR(wm9712->ac97); - dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); - return ret; - } - - regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); - if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); - goto err_free_ac97_codec; + if (wm9712->mfd_pdata) { + wm9712->ac97 = wm9712->mfd_pdata->ac97; + regmap = wm9712->mfd_pdata->regmap; + } else { +#ifdef CONFIG_SND_SOC_AC97_BUS + wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, + WM9712_VENDOR_ID_MASK); + if (IS_ERR(wm9712->ac97)) { + ret = PTR_ERR(wm9712->ac97); + dev_err(codec->dev, + "Failed to register AC97 codec: %d\n", ret); + return ret; + } + + regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); + if (IS_ERR(regmap)) { + snd_soc_free_ac97_codec(wm9712->ac97); + return PTR_ERR(regmap); + } +#endif } snd_soc_codec_init_regmap(codec, regmap); @@ -656,17 +668,18 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000); return 0; -err_free_ac97_codec: - snd_soc_free_ac97_codec(wm9712->ac97); - return ret; } static int wm9712_soc_remove(struct snd_soc_codec *codec) { +#ifdef CONFIG_SND_SOC_AC97_BUS struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); - snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(wm9712->ac97); + if (!wm9712->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); + snd_soc_free_ac97_codec(wm9712->ac97); + } +#endif return 0; } @@ -697,6 +710,7 @@ static int wm9712_probe(struct platform_device *pdev) mutex_init(&wm9712->lock); + wm9712->mfd_pdata = dev_get_platdata(&pdev->dev); platform_set_drvdata(pdev, wm9712); 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 @@ #include <linux/init.h> #include <linux/slab.h> +#include <linux/mfd/wm97xx.h> #include <linux/module.h> #include <linux/device.h> #include <linux/regmap.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/ac97_codec.h> +#include <sound/ac97/codec.h> +#include <sound/ac97/compat.h> #include <sound/initval.h> #include <sound/pcm_params.h> #include <sound/tlv.h> @@ -38,6 +41,7 @@ struct wm9713_priv { u32 pll_in; /* PLL input frequency */ unsigned int hp_mixer[2]; struct mutex lock; + struct wm97xx_platform_data *mfd_pdata; }; #define HPL_MIXER 0 @@ -1205,17 +1209,23 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec) static int wm9713_soc_probe(struct snd_soc_codec *codec) { struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); - struct regmap *regmap; + struct regmap *regmap = NULL; - wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID, - WM9713_VENDOR_ID_MASK); - if (IS_ERR(wm9713->ac97)) - return PTR_ERR(wm9713->ac97); - - regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config); - if (IS_ERR(regmap)) { - snd_soc_free_ac97_codec(wm9713->ac97); - return PTR_ERR(regmap); + if (wm9713->mfd_pdata) { + wm9713->ac97 = wm9713->mfd_pdata->ac97; + regmap = wm9713->mfd_pdata->regmap; + } else { +#ifdef CONFIG_SND_SOC_AC97_BUS + wm9713->ac97 = snd_soc_new_ac97_codec(codec, WM9713_VENDOR_ID, + WM9713_VENDOR_ID_MASK); + if (IS_ERR(wm9713->ac97)) + return PTR_ERR(wm9713->ac97); + regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config); + if (IS_ERR(regmap)) { + snd_soc_free_ac97_codec(wm9713->ac97); + return PTR_ERR(regmap); + } +#endif } snd_soc_codec_init_regmap(codec, regmap); @@ -1228,10 +1238,14 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) static int wm9713_soc_remove(struct snd_soc_codec *codec) { +#ifdef CONFIG_SND_SOC_AC97_BUS struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); - snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(wm9713->ac97); + if (!wm9713->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); + snd_soc_free_ac97_codec(wm9713->ac97); + } +#endif return 0; } @@ -1262,6 +1276,7 @@ static int wm9713_probe(struct platform_device *pdev) mutex_init(&wm9713->lock); + wm9713->mfd_pdata = dev_get_platdata(&pdev->dev); platform_set_drvdata(pdev, wm9713); 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, { struct zx_spdif_info *zx_spdif = dev_get_drvdata(socdai->dev); struct zx_spdif_info *spdif = snd_soc_dai_get_drvdata(socdai); - struct snd_dmaengine_dai_dma_data *dma_data = &zx_spdif->dma_data; + struct snd_dmaengine_dai_dma_data *dma_data = + snd_soc_dai_get_dma_data(socdai, substream); u32 val, ch_num, rate; int ret; - dma_data = snd_soc_dai_get_dma_data(socdai, substream); dma_data->addr_width = params_width(params) >> 3; val = readl_relaxed(zx_spdif->reg_base + ZX_CTRL); |