From b6145837218cb984245aea5ccd9201aeb5eb0501 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 18 Sep 2017 09:56:38 +0100 Subject: ASoC: zte: spdif: remove duplicate initialization of dma_data dma_data is being initialized twice, remove the unused first initialization and use the latter one instead. Fixed clang warning: "warning: Value stored to 'dma_data' during its initialization is never read" Signed-off-by: Colin Ian King Signed-off-by: Mark Brown --- sound/soc/zte/zx-spdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- cgit v1.2.3 From a10953f5d33b2334c8fb1799084ab49347a59821 Mon Sep 17 00:00:00 2001 From: "Fang, Yang A" Date: Fri, 8 Sep 2017 00:13:07 -0500 Subject: ASoC: ts3a227e: add acpi table This patch adds the acpi match table for the ts3a227e audio accessory detection device. This enables headset features like jack plug/unplug notifications, mic presence, and button pressed events. Signed-off-by: Fang, Yang A Signed-off-by: Thierry Escande Signed-off-by: Pierre-Louis Bossart Acked-By: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/codecs/ts3a227e.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 #include #include +#include #include #include @@ -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, -- cgit v1.2.3 From 9bd400cadae05a26c3a22dd8393081cb96d0e26a Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Wed, 13 Sep 2017 21:37:19 +0200 Subject: ASoC: wm9713: add ac97 new bus support Add support for the new ac97 bus model, where devices are automatically discovered on AC-Links. Signed-off-by: Robert Jarzmik Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 3 ++- sound/soc/codecs/wm9713.c | 39 +++++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index c367d11079bc..807901cac1b3 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -216,7 +216,7 @@ config SND_SOC_ALL_CODECS 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_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 @@ -1136,6 +1136,7 @@ config SND_SOC_WM9712 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/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 #include +#include #include #include #include #include #include #include +#include +#include #include #include #include @@ -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, -- cgit v1.2.3 From 2ed1a8e0ce8db6d36f849526db61ce3c85a9f8d1 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Wed, 13 Sep 2017 21:37:20 +0200 Subject: ASoC: wm9712: add ac97 new bus support Add support for the new ac97 bus model, where devices are automatically discovered on AC-Links. Signed-off-by: Robert Jarzmik Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 3 ++- sound/soc/codecs/wm9712.c | 44 ++++++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 807901cac1b3..655388d456be 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -215,7 +215,7 @@ config SND_SOC_ALL_CODECS 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_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 @@ -1132,6 +1132,7 @@ config SND_SOC_WM9705 config SND_SOC_WM9712 tristate select REGMAP_AC97 + select AC97_BUS_COMPAT if AC97_BUS_NEW config SND_SOC_WM9713 tristate diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 1a3e1797994a..1e228bf9f1ae 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -19,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -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,25 @@ 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)) { + ret = PTR_ERR(regmap); + goto err_free_ac97_codec; +#endif } snd_soc_codec_init_regmap(codec, regmap); @@ -663,10 +674,14 @@ err_free_ac97_codec: 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 +712,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, -- cgit v1.2.3 From c6e46e52b7b3301dda529830226e578cf773151c Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Wed, 13 Sep 2017 21:37:21 +0200 Subject: ASoC: wm9705: add private structure Add a private data structure. This is a preparation for a codec which would need an another data on top of snd_ac97, which will be the case when an MFD wm97xx device will probe wm9705. Signed-off-by: Robert Jarzmik Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm9705.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index f6d5c0f2aea5..08477d040028 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -24,6 +24,10 @@ #define WM9705_VENDOR_ID 0x574d4c05 #define WM9705_VENDOR_ID_MASK 0xffffffff +struct wm9705_priv { + struct snd_ac97 *ac97; +}; + static const struct reg_default wm9705_reg_defaults[] = { { 0x02, 0x8000 }, { 0x04, 0x8000 }, @@ -292,10 +296,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 +315,38 @@ 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)) { + 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(ac97); + return PTR_ERR(wm9705->ac97); } - regmap = regmap_init_ac97(ac97, &wm9705_regmap_config); + regmap = regmap_init_ac97(wm9705->ac97, &wm9705_regmap_config); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); goto err_free_ac97_codec; } - 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); + snd_soc_free_ac97_codec(wm9705->ac97); return ret; } static int wm9705_soc_remove(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); snd_soc_codec_exit_regmap(codec); - snd_soc_free_ac97_codec(ac97); + snd_soc_free_ac97_codec(wm9705->ac97); return 0; } @@ -364,6 +368,14 @@ 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; + + platform_set_drvdata(pdev, wm9705); + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai)); } -- cgit v1.2.3 From aaafcfed9290349555a326fff1147460a54c34f2 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Wed, 13 Sep 2017 21:37:22 +0200 Subject: ASoC: wm9705: add ac97 new bus support Add support for the new ac97 bus model, where devices are automatically discovered on AC-Links. Signed-off-by: Robert Jarzmik Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 3 ++- sound/soc/codecs/wm9705.c | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 655388d456be..0838ae710941 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -214,7 +214,7 @@ 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_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 @@ -1128,6 +1128,7 @@ 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 diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 08477d040028..68c204e3599f 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -26,6 +29,7 @@ struct wm9705_priv { struct snd_ac97 *ac97; + struct wm97xx_platform_data *mfd_pdata; }; static const struct reg_default wm9705_reg_defaults[] = { @@ -319,17 +323,24 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) struct regmap *regmap; int ret; - 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)) { - 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)) { + ret = PTR_ERR(regmap); + goto err_free_ac97_codec; + } +#endif } snd_soc_codec_set_drvdata(codec, wm9705->ac97); @@ -343,10 +354,14 @@ err_free_ac97_codec: static int wm9705_soc_remove(struct snd_soc_codec *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(wm9705->ac97); + if (!wm9705->mfd_pdata) { + snd_soc_codec_exit_regmap(codec); + snd_soc_free_ac97_codec(wm9705->ac97); + } +#endif return 0; } @@ -374,6 +389,7 @@ static int wm9705_probe(struct platform_device *pdev) 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, -- cgit v1.2.3 From 5aa3b03ad0712e3964a0ae2788f61f08da814bfe Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 20 Sep 2017 12:35:37 +0100 Subject: ASoC: wm9712: Add missing brace Signed-off-by: Mark Brown --- sound/soc/codecs/wm9712.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 1e228bf9f1ae..9db5c7783de5 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -658,6 +658,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); goto err_free_ac97_codec; + } #endif } -- cgit v1.2.3 From 3d345b5f7b2f613b6965fc3fc68de9f439752ffe Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 19 Sep 2017 19:59:04 -0300 Subject: ASoC: tfa9879: Add device tree bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though the tfa9879 driver can probe via device tree trough the I2C core code, it is preferable to have explicit device tree bindings instead [1], so add this support. [1] https://www.spinics.net/lists/devicetree/msg195176.html Signed-off-by: Fabio Estevam Reviewed-by: Ɓukasz Majewski Signed-off-by: Mark Brown --- .../devicetree/bindings/sound/tfa9879.txt | 23 ++++++++++++++++++++++ sound/soc/codecs/tfa9879.c | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tfa9879.txt 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 @@ +NXP TFA9879 class-D audio amplifier + +Required properties: + +- compatible : "nxp,tfa9879" + +- reg : the I2C address of the device + +Example: + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + codec: tfa9879@6c { + #sound-dai-cells = <0>; + compatible = "nxp,tfa9879"; + reg = <0x6c>; + }; +}; + 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, -- cgit v1.2.3 From 6bd25aae3a9bc7ed3d24f2b3d4cd711fadc5d32e Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Sat, 14 Oct 2017 22:14:02 +0200 Subject: ASoC: wm97xx: fix compilation corner case When the old AC97 is not used, CONFIG_SND_SOC_AC97_BUS is not defined. As a consequence, in the error path, snd_soc_free_ac97_codec() is not defined and triggers a compilation error. Fix it for wm9705 and wm9712, as wm9713 is correctly written. Signed-off-by: Robert Jarzmik Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm9705.c | 8 ++------ sound/soc/codecs/wm9712.c | 7 ++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 68c204e3599f..2c09f71fe433 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -321,7 +321,6 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) { struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec); struct regmap *regmap; - int ret; if (wm9705->mfd_pdata) { wm9705->ac97 = wm9705->mfd_pdata->ac97; @@ -337,8 +336,8 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) regmap = regmap_init_ac97(wm9705->ac97, &wm9705_regmap_config); if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); - goto err_free_ac97_codec; + snd_soc_free_ac97_codec(wm9705->ac97); + return PTR_ERR(regmap); } #endif } @@ -347,9 +346,6 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) snd_soc_codec_init_regmap(codec, regmap); return 0; -err_free_ac97_codec: - snd_soc_free_ac97_codec(wm9705->ac97); - return ret; } static int wm9705_soc_remove(struct snd_soc_codec *codec) diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 9db5c7783de5..4f6d1a442bc4 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -656,8 +656,8 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); if (IS_ERR(regmap)) { - ret = PTR_ERR(regmap); - goto err_free_ac97_codec; + snd_soc_free_ac97_codec(wm9712->ac97); + return PTR_ERR(regmap); } #endif } @@ -668,9 +668,6 @@ 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) -- cgit v1.2.3 From eaf8abcfb21ecb5f6460d0505b03da4c3b7eee98 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Wed, 1 Nov 2017 11:03:25 +0000 Subject: ASoC: wm8741: Use snd_soc_update_bits rather than hard coding Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8741.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index b8c1940f2243..3c96af057a3e 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; @@ -330,13 +334,13 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_NB_NF: break; case SND_SOC_DAIFMT_IB_IF: - iface |= 0x0010; + iface |= 0x10; break; case SND_SOC_DAIFMT_IB_NF: - iface |= 0x0020; + iface |= 0x20; break; case SND_SOC_DAIFMT_NB_IF: - iface |= 0x0030; + 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; } -- cgit v1.2.3 From 81b3cc55afc3cde54df98f93fbd4704fab7cc0e0 Mon Sep 17 00:00:00 2001 From: Sergej Sawazki Date: Fri, 3 Nov 2017 19:34:28 +0100 Subject: ASoC: wm8741: Fix setting BCLK and LRCLK polarity After checking the code and the datasheet, it seems like we are handling the clock inversion (SND_SOC_DAIFMT_NB_IF and SND_SOC_DAIFMT_IB_IF) not correctly. >From the datasheet (Table 58): R5 Format Control, BITS[5:4], [BCP:LRP]: (0) 00 = normal BCLK, normal LRCLK (1) 01 = normal BCLK, inverted LRCLK <-- Fix this (2) 10 = inverted BCLK, normal LRCLK (3) 11 = inverted BCLK, inverted LRCLK <-- Fix this Signed-off-by: Sergej Sawazki Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8741.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index 3c96af057a3e..a394dbee77aa 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -333,13 +333,13 @@ 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: + case SND_SOC_DAIFMT_NB_IF: iface |= 0x10; break; case SND_SOC_DAIFMT_IB_NF: iface |= 0x20; break; - case SND_SOC_DAIFMT_NB_IF: + case SND_SOC_DAIFMT_IB_IF: iface |= 0x30; break; default: -- cgit v1.2.3