From efc4720dfbf737903ca4c1366bc45ca780d13412 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Sat, 20 Jun 2015 22:47:01 +0200 Subject: ASoC: Add gtm601 codec driver This driver add PCM interface to a GTM601 UMTS modem chip. There is no configuration interface. Signed-off-by: Marek Belisko Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index efaafce..1b7c492 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -62,6 +62,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_BT_SCO select SND_SOC_ES8328_SPI if SPI_MASTER select SND_SOC_ES8328_I2C if I2C + select SND_SOC_GTM601 select SND_SOC_ISABELLE if I2C select SND_SOC_JZ4740_CODEC select SND_SOC_LM4857 if I2C @@ -446,6 +447,9 @@ config SND_SOC_ES8328_SPI tristate select SND_SOC_ES8328 +config SND_SOC_GTM601 + tristate 'GTM601 UMTS modem audio codec' + config SND_SOC_ISABELLE tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index cf160d9..365529d 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -55,6 +55,7 @@ snd-soc-dmic-objs := dmic.o snd-soc-es8328-objs := es8328.o snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-spi-objs := es8328-spi.o +snd-soc-gtm601-objs := gtm601.o snd-soc-isabelle-objs := isabelle.o snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o @@ -242,6 +243,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o +obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c new file mode 100644 index 0000000..1b77ff2 --- /dev/null +++ b/sound/soc/codecs/gtm601.c @@ -0,0 +1,98 @@ +/* + * This is a simple driver for the GTM601 Voice PCM interface + * + * Copyright (C) 2015 Goldelico GmbH + * + * Author: Marek Belisko + * + * Based on wm8727.c driver + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct snd_soc_dapm_widget gtm601_dapm_widgets[] = { + SND_SOC_DAPM_OUTPUT("AOUT"), + SND_SOC_DAPM_INPUT("AIN"), +}; + +static const struct snd_soc_dapm_route gtm601_dapm_routes[] = { + { "AOUT", NULL, "Playback" }, + { "Capture", NULL, "AIN" }, +}; + +struct snd_soc_dai_driver gtm601_dai = { + .name = "gtm601", + .playback = { + .stream_name = "Playback", + .channels_min = 1, + .channels_max = 1, + .rates = SNDRV_PCM_RATE_8000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .stream_name = "Capture", + .channels_min = 1, + .channels_max = 1, + .rates = SNDRV_PCM_RATE_8000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, +}; + +static struct snd_soc_codec_driver soc_codec_dev_gtm601 = { + .dapm_widgets = gtm601_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets), + .dapm_routes = gtm601_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(gtm601_dapm_routes), +}; + +static int gtm601_platform_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, + &soc_codec_dev_gtm601, >m601_dai, 1); +} + +static int gtm601_platform_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + return 0; +} + +MODULE_ALIAS("platform:gtm601_codec_audio"); + +#if defined(CONFIG_OF) +static const struct of_device_id gtm601_codec_of_match[] = { + { .compatible = "option,gtm601", }, + {}, +}; +MODULE_DEVICE_TABLE(of, gtm601_codec_of_match); +#endif + +static struct platform_driver gtm601_codec_driver = { + .driver = { + .name = "gtm601", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(gtm601_codec_of_match), + }, + + .probe = gtm601_platform_probe, + .remove = gtm601_platform_remove, +}; + +module_platform_driver(gtm601_codec_driver); + +MODULE_DESCRIPTION("ASoC gtm601 driver"); +MODULE_AUTHOR("Marek Belisko "); +MODULE_LICENSE("GPL"); -- cgit v0.10.2 From 1fdc5ae80868637926e76a32e8c62cdd093b48f4 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Sat, 20 Jun 2015 22:47:02 +0200 Subject: Documentation: vendor-prefixes: Add option prefix Add option to vendor-prefixes file which will be used for Option NV company. Signed-off-by: Marek Belisko Signed-off-by: Mark Brown diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index d444757..d247994 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -150,6 +150,7 @@ nvidia NVIDIA nxp NXP Semiconductors onnn ON Semiconductor Corp. opencores OpenCores.org +option Option NV ortustech Ortus Technology Co., Ltd. ovti OmniVision Technologies panasonic Panasonic Corporation -- cgit v0.10.2 From 726f783e803cc254b1a8a9a1dc3e5808fee02760 Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Mon, 22 Jun 2015 23:36:03 +0800 Subject: ASoC: fix platform_no_drv_owner.cocci warnings sound/soc/codecs/gtm601.c:86:4-9: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci CC: Marek Belisko Signed-off-by: Fengguang Wu Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c index 1b77ff2..393001c 100644 --- a/sound/soc/codecs/gtm601.c +++ b/sound/soc/codecs/gtm601.c @@ -83,7 +83,6 @@ MODULE_DEVICE_TABLE(of, gtm601_codec_of_match); static struct platform_driver gtm601_codec_driver = { .driver = { .name = "gtm601", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(gtm601_codec_of_match), }, -- cgit v0.10.2 From beb5f8659ccd89a70b0a3ff28e32dbd8065df818 Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Mon, 22 Jun 2015 23:48:25 +0800 Subject: ASoC: gtm601_dai can be static Signed-off-by: Fengguang Wu Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c index 393001c..7004eba 100644 --- a/sound/soc/codecs/gtm601.c +++ b/sound/soc/codecs/gtm601.c @@ -33,7 +33,7 @@ static const struct snd_soc_dapm_route gtm601_dapm_routes[] = { { "Capture", NULL, "AIN" }, }; -struct snd_soc_dai_driver gtm601_dai = { +static struct snd_soc_dai_driver gtm601_dai = { .name = "gtm601", .playback = { .stream_name = "Playback", -- cgit v0.10.2 From d49796317d4968b29ccdee7b9586385ae20b60a3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 24 Jun 2015 10:55:24 +0800 Subject: ASoC: gtm601: Fix modalias The MODULE_ALIAS needs to match the driver name to make module auto-loading work. Also move MODULE_ALIAS close to other MODULE_* macro. Signed-off-by: Axel Lin Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c index 7004eba..12d15e5 100644 --- a/sound/soc/codecs/gtm601.c +++ b/sound/soc/codecs/gtm601.c @@ -70,8 +70,6 @@ static int gtm601_platform_remove(struct platform_device *pdev) return 0; } -MODULE_ALIAS("platform:gtm601_codec_audio"); - #if defined(CONFIG_OF) static const struct of_device_id gtm601_codec_of_match[] = { { .compatible = "option,gtm601", }, @@ -95,3 +93,4 @@ module_platform_driver(gtm601_codec_driver); MODULE_DESCRIPTION("ASoC gtm601 driver"); MODULE_AUTHOR("Marek Belisko "); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:gtm601"); -- cgit v0.10.2 From 02a9547e9b3f10d73fde66f52fc8b2a375a300cd Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 7 Jul 2015 12:57:19 +0800 Subject: ASoC: gtm601: Constify soc_codec_dev_gtm601 Also clean up the code a bit by fixing indent. Signed-off-by: Axel Lin Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c index 12d15e5..0b80052 100644 --- a/sound/soc/codecs/gtm601.c +++ b/sound/soc/codecs/gtm601.c @@ -51,7 +51,7 @@ static struct snd_soc_dai_driver gtm601_dai = { }, }; -static struct snd_soc_codec_driver soc_codec_dev_gtm601 = { +static const struct snd_soc_codec_driver soc_codec_dev_gtm601 = { .dapm_widgets = gtm601_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets), .dapm_routes = gtm601_dapm_routes, @@ -80,10 +80,9 @@ MODULE_DEVICE_TABLE(of, gtm601_codec_of_match); static struct platform_driver gtm601_codec_driver = { .driver = { - .name = "gtm601", - .of_match_table = of_match_ptr(gtm601_codec_of_match), + .name = "gtm601", + .of_match_table = of_match_ptr(gtm601_codec_of_match), }, - .probe = gtm601_platform_probe, .remove = gtm601_platform_remove, }; -- cgit v0.10.2 From 89e0e250f92b0b0233337043ddf76f261916036c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 9 Jul 2015 11:21:03 +0300 Subject: ASoC: fsl: fsl_spdif: signedness bug in fsl_spdif_startup() We need "i" to be signed or it leads to a forever loop in the error handling. Fixes: fa3be9208dcb ('ASoC: fsl: fsl_spdif: Check for clk_prepare_enable() error') Signed-off-by: Dan Carpenter Acked-by: Nicolin Chen Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 8e93221..851b833 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -454,7 +454,8 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream, struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(rtd->cpu_dai); struct platform_device *pdev = spdif_priv->pdev; struct regmap *regmap = spdif_priv->regmap; - u32 scr, mask, i; + u32 scr, mask; + int i; int ret; /* Reset module and interrupts only for first initialization */ -- cgit v0.10.2 From bf08f39e6088c52c6fc7cce2ef7fbbd7bf4692b9 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 30 Jul 2015 18:18:45 +0200 Subject: ASoC: Export OF module alias information in missing codec drivers The I2C core always reports the MODALIAS uevent as "i2c: Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c index 66bb446..ab39de6 100644 --- a/sound/soc/codecs/da9055.c +++ b/sound/soc/codecs/da9055.c @@ -1533,6 +1533,7 @@ static const struct of_device_id da9055_of_match[] = { { .compatible = "dlg,da9055-codec", }, { } }; +MODULE_DEVICE_TABLE(of, da9055_of_match); /* I2C codec control layer */ static struct i2c_driver da9055_i2c_driver = { diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index dac5beb..0617415 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -598,6 +598,7 @@ static const struct of_device_id wm8510_of_match[] = { { .compatible = "wlf,wm8510" }, { }, }; +MODULE_DEVICE_TABLE(of, wm8510_of_match); static const struct regmap_config wm8510_regmap = { .reg_bits = 7, diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 43ea8ae..483ec72 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -430,6 +430,7 @@ static const struct of_device_id wm8523_of_match[] = { { .compatible = "wlf,wm8523" }, { }, }; +MODULE_DEVICE_TABLE(of, wm8523_of_match); static const struct regmap_config wm8523_regmap = { .reg_bits = 8, diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 759a792..a9f3900 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -916,6 +916,7 @@ static const struct of_device_id wm8580_of_match[] = { { .compatible = "wlf,wm8580" }, { }, }; +MODULE_DEVICE_TABLE(of, wm8580_of_match); static const struct regmap_config wm8580_regmap = { .reg_bits = 7, -- cgit v0.10.2 From 8277df3c66f1a8cecfadc29f7394f623263b4445 Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:21:35 +0200 Subject: ASoC: fsl_ssi: enable IPG clock during AC'97 reg access IPG clock have to be enabled during AC'97 CODEC register access in fsl_ssi driver. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index c7647e0..9c46c7d 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1127,10 +1127,17 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg, struct regmap *regs = fsl_ac97_data->regs; unsigned int lreg; unsigned int lval; + int ret; if (reg > 0x7f) return; + ret = clk_prepare_enable(fsl_ac97_data->clk); + if (ret) { + pr_err("ac97 write clk_prepare_enable failed: %d\n", + ret); + return; + } lreg = reg << 12; regmap_write(regs, CCSR_SSI_SACADD, lreg); @@ -1141,6 +1148,8 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg, regmap_update_bits(regs, CCSR_SSI_SACNT, CCSR_SSI_SACNT_RDWR_MASK, CCSR_SSI_SACNT_WR); udelay(100); + + clk_disable_unprepare(fsl_ac97_data->clk); } static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, @@ -1151,6 +1160,14 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, unsigned short val = -1; u32 reg_val; unsigned int lreg; + int ret; + + ret = clk_prepare_enable(fsl_ac97_data->clk); + if (ret) { + pr_err("ac97 read clk_prepare_enable failed: %d\n", + ret); + return -1; + } lreg = (reg & 0x7f) << 12; regmap_write(regs, CCSR_SSI_SACADD, lreg); @@ -1162,6 +1179,8 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, regmap_read(regs, CCSR_SSI_SACDAT, ®_val); val = (reg_val >> 4) & 0xffff; + clk_disable_unprepare(fsl_ac97_data->clk); + return val; } -- cgit v0.10.2 From 793e3e9eeffc3e270483a450bc08e60f38e401ff Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:22:53 +0200 Subject: ASoC: fsl_ssi: AC'97 DAI driver needs probe method too AC'97 DAI driver struct need the same probe method as I2S one to setup DMA params in fsl_ssi driver. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 9c46c7d..2ce9e1d 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1101,6 +1101,7 @@ static const struct snd_soc_component_driver fsl_ssi_component = { static struct snd_soc_dai_driver fsl_ssi_ac97_dai = { .bus_control = true, + .probe = fsl_ssi_dai_probe, .playback = { .stream_name = "AC97 Playback", .channels_min = 2, -- cgit v0.10.2 From 06cb373692083d169ab080b31c55af91d22b6d99 Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:24:10 +0200 Subject: ASoC: fsl_ssi: enable AC'97 asymmetric rates AC'97 bus can support asymmetric playback/capture rates so enable them in this case in fsl_ssi driver. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 2ce9e1d..f3034b9 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1377,7 +1377,9 @@ static int fsl_ssi_probe(struct platform_device *pdev) /* Are the RX and the TX clocks locked? */ if (!of_find_property(np, "fsl,ssi-asynchronous", NULL)) { - ssi_private->cpu_dai_drv.symmetric_rates = 1; + if (!fsl_ssi_is_ac97(ssi_private)) + ssi_private->cpu_dai_drv.symmetric_rates = 1; + ssi_private->cpu_dai_drv.symmetric_channels = 1; ssi_private->cpu_dai_drv.symmetric_samplebits = 1; } -- cgit v0.10.2 From 04143d614f3af84a3f39e79a24a7ca740bd39efd Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:25:31 +0200 Subject: ASoC: fsl_ssi: add AC'97 ops setting check and cleanup Check whether setting AC'97 ops succeeded and clean them on removal so the fsl_ssi driver can be reloaded. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index f3034b9..0b4fcd9 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1340,7 +1340,11 @@ static int fsl_ssi_probe(struct platform_device *pdev) fsl_ac97_data = ssi_private; - snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); + ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); + if (ret) { + dev_err(&pdev->dev, "could not set AC'97 ops\n"); + return ret; + } } else { /* Initialize this copy of the CPU DAI driver structure */ memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template, @@ -1480,6 +1484,9 @@ static int fsl_ssi_remove(struct platform_device *pdev) if (ssi_private->soc->imx) fsl_ssi_imx_clean(pdev, ssi_private); + if (fsl_ssi_is_ac97(ssi_private)) + snd_soc_set_ac97_ops(NULL); + return 0; } -- cgit v0.10.2 From 8ed0c842153434fa3aeeb89d16b71ac7dc8e12ee Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:26:44 +0200 Subject: ASoC: fsl_ssi: instantiate AC'97 CODEC Instantiate AC'97 CODEC in fsl_ssi driver AC'97 mode. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0b4fcd9..e79dc16 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1460,6 +1460,27 @@ done: _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private, ssi_private->dai_fmt); + if (fsl_ssi_is_ac97(ssi_private)) { + u32 ssi_idx; + + ret = of_property_read_u32(np, "cell-index", &ssi_idx); + if (ret) { + dev_err(&pdev->dev, "cannot get SSI index property\n"); + goto error_sound_card; + } + + ssi_private->pdev = + platform_device_register_data(NULL, + "ac97-codec", ssi_idx, NULL, 0); + if (IS_ERR(ssi_private->pdev)) { + ret = PTR_ERR(ssi_private->pdev); + dev_err(&pdev->dev, + "failed to register AC97 codec platform: %d\n", + ret); + goto error_sound_card; + } + } + return 0; error_sound_card: -- cgit v0.10.2 From dce0332c85c4d9eb5d96182c56f63cd20566f073 Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Wed, 5 Aug 2015 17:29:02 +0200 Subject: ASoC: fsl_ssi: adjust set DAI format in AC'97 mode Adjust set DAI format function in fsl_ssi driver so it doesn't fail and clears RXDIR in AC'97 mode. Signed-off-by: Maciej Szmigiero Signed-off-by: Mark Brown diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index e79dc16..f03d57e 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -900,14 +900,16 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev, scr &= ~CCSR_SSI_SCR_SYS_CLK_EN; break; default: - return -EINVAL; + if (!fsl_ssi_is_ac97(ssi_private)) + return -EINVAL; } stcr |= strcr; srcr |= strcr; - if (ssi_private->cpu_dai_drv.symmetric_rates) { - /* Need to clear RXDIR when using SYNC mode */ + if (ssi_private->cpu_dai_drv.symmetric_rates + || fsl_ssi_is_ac97(ssi_private)) { + /* Need to clear RXDIR when using SYNC or AC97 mode */ srcr &= ~CCSR_SSI_SRCR_RXDIR; scr |= CCSR_SSI_SCR_SYN; } -- cgit v0.10.2 From 3b7ce99748f0d006f9d1aa85709872e7b46787f7 Mon Sep 17 00:00:00 2001 From: Ricard Wanderlof Date: Thu, 27 Aug 2015 11:35:20 +0200 Subject: ASoC: ics43432: Add codec driver for InvenSense ICS-43432 Add support for the InvenSense ICS-43432 I2S MEMS microphone. This is a non-software-configurable MEMS microphone with I2S output. Tested on a setup with a single ICS-43432 (the device itself supports stereo operation using a hardware pin controlling left vs. right channel output). Signed-off-by: Ricard Wanderlof Signed-off-by: Mark Brown diff --git a/Documentation/devicetree/bindings/sound/ics43432.txt b/Documentation/devicetree/bindings/sound/ics43432.txt new file mode 100644 index 0000000..b02e3a6 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/ics43432.txt @@ -0,0 +1,17 @@ +Invensense ICS-43432 MEMS microphone with I2S output. + +There are no software configuration options for this device, indeed, the only +host connection is the I2S interface. Apart from requirements on clock +frequency (460 kHz to 3.379 MHz according to the data sheet) there must be +64 clock cycles in each stereo output frame; 24 of the 32 available bits +contain audio data. A hardware pin determines if the device outputs data +on the left or right channel of the I2S frame. + +Required properties: + - compatible : Must be "invensense,ics43432" + +Example: + + ics43432: ics43432 { + compatible = "invensense,ics43432"; + }; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index d444757..80bf96d 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -110,6 +110,7 @@ ingenic Ingenic Semiconductor innolux Innolux Corporation intel Intel Corporation intercontrol Inter Control Group +invensense InvenSense Inc. isee ISEE 2007 S.L. isil Intersil karo Ka-Ro electronics GmbH diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index efaafce..1bb6446 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -62,6 +62,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_BT_SCO select SND_SOC_ES8328_SPI if SPI_MASTER select SND_SOC_ES8328_I2C if I2C + select SND_SOC_ICS43432 select SND_SOC_ISABELLE if I2C select SND_SOC_JZ4740_CODEC select SND_SOC_LM4857 if I2C @@ -446,6 +447,9 @@ config SND_SOC_ES8328_SPI tristate select SND_SOC_ES8328 +config SND_SOC_ICS43432 + tristate + config SND_SOC_ISABELLE tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index cf160d9..5a19a67 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -55,6 +55,7 @@ snd-soc-dmic-objs := dmic.o snd-soc-es8328-objs := es8328.o snd-soc-es8328-i2c-objs := es8328-i2c.o snd-soc-es8328-spi-objs := es8328-spi.o +snd-soc-ics43432-objs := ics43432.o snd-soc-isabelle-objs := isabelle.o snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o @@ -242,6 +243,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o +obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o diff --git a/sound/soc/codecs/ics43432.c b/sound/soc/codecs/ics43432.c new file mode 100644 index 0000000..4f202c1 --- /dev/null +++ b/sound/soc/codecs/ics43432.c @@ -0,0 +1,77 @@ +/* + * I2S MEMS microphone driver for InvenSense ICS-43432 + * + * - Non configurable. + * - I2S interface, 64 BCLs per frame, 32 bits per channel, 24 bit data + * + * Copyright (c) 2015 Axis Communications AB + * + * Licensed under GPL2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ICS43432_RATE_MIN 7190 /* Hz, from data sheet */ +#define ICS43432_RATE_MAX 52800 /* Hz, from data sheet */ + +#define ICS43432_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32) + +static struct snd_soc_dai_driver ics43432_dai = { + .name = "ics43432-hifi", + .capture = { + .stream_name = "Capture", + .channels_min = 1, + .channels_max = 2, + .rate_min = ICS43432_RATE_MIN, + .rate_max = ICS43432_RATE_MAX, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .formats = ICS43432_FORMATS, + }, +}; + +static struct snd_soc_codec_driver ics43432_codec_driver = { +}; + +static int ics43432_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, &ics43432_codec_driver, + &ics43432_dai, 1); +} + +static int ics43432_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + return 0; +} + +#ifdef CONFIG_OF +static const struct of_device_id ics43432_ids[] = { + { .compatible = "invensense,ics43432", }, + { } +}; +MODULE_DEVICE_TABLE(of, ics43432_dt_ids); +#endif + +static struct platform_driver ics43432_driver = { + .driver = { + .name = "ics43432", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ics43432_ids), + }, + .probe = ics43432_probe, + .remove = ics43432_remove, +}; + +module_platform_driver(ics43432_driver); + +MODULE_DESCRIPTION("ASoC ICS43432 driver"); +MODULE_AUTHOR("Ricard Wanderlof "); +MODULE_LICENSE("GPLv2"); -- cgit v0.10.2 From 11d932416ecada27ca7576dca7e74e23477df7ef Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Fri, 28 Aug 2015 10:04:03 +0800 Subject: ASoC: ics43432: fix platform_no_drv_owner.cocci warnings sound/soc/codecs/ics43432.c:66:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci CC: Ricard Wanderlof Signed-off-by: Fengguang Wu Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/ics43432.c b/sound/soc/codecs/ics43432.c index 4f202c1..d217fed 100644 --- a/sound/soc/codecs/ics43432.c +++ b/sound/soc/codecs/ics43432.c @@ -63,7 +63,6 @@ MODULE_DEVICE_TABLE(of, ics43432_dt_ids); static struct platform_driver ics43432_driver = { .driver = { .name = "ics43432", - .owner = THIS_MODULE, .of_match_table = of_match_ptr(ics43432_ids), }, .probe = ics43432_probe, -- cgit v0.10.2 From 2f38bc8829b83aed3e2c5e6d43a430d39f1b0e1d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 28 Aug 2015 11:23:05 +0800 Subject: ASoC: ics43432: Fix module license Signed-off-by: Axel Lin Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/ics43432.c b/sound/soc/codecs/ics43432.c index d217fed..7c35c98 100644 --- a/sound/soc/codecs/ics43432.c +++ b/sound/soc/codecs/ics43432.c @@ -6,7 +6,7 @@ * * Copyright (c) 2015 Axis Communications AB * - * Licensed under GPL2. + * Licensed under GPL v2. */ #include @@ -73,4 +73,4 @@ module_platform_driver(ics43432_driver); MODULE_DESCRIPTION("ASoC ICS43432 driver"); MODULE_AUTHOR("Ricard Wanderlof "); -MODULE_LICENSE("GPLv2"); +MODULE_LICENSE("GPL v2"); -- cgit v0.10.2 From b37bfdaac914f4886b8be803703b12177eb873f6 Mon Sep 17 00:00:00 2001 From: Ricard Wanderlof Date: Fri, 28 Aug 2015 12:11:48 +0200 Subject: ASoC: ics43432: Fix build errors Fix build errors Signed-off-by: Ricard Wanderlof Signed-off-by: Mark Brown diff --git a/sound/soc/codecs/ics43432.c b/sound/soc/codecs/ics43432.c index 7c35c98..dd850b9 100644 --- a/sound/soc/codecs/ics43432.c +++ b/sound/soc/codecs/ics43432.c @@ -57,7 +57,7 @@ static const struct of_device_id ics43432_ids[] = { { .compatible = "invensense,ics43432", }, { } }; -MODULE_DEVICE_TABLE(of, ics43432_dt_ids); +MODULE_DEVICE_TABLE(of, ics43432_ids); #endif static struct platform_driver ics43432_driver = { -- cgit v0.10.2