2015-04-30 21:28:19

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 0/3] ASoC: Add gtm601 simple codec

Following patch series add support for gtm601 PCM audio.
gtm601 is UMTS modem which provide I2S interface for rx/tx data.
Codec is connected to cpu in master mode (rate is determined by Master and
Bit clocks).

Marek Belisko (3):
ASoC: Add gtm601 codec driver
Documentation: devicetree: sound: Add documentation for gtm601 codec
Documentation: vendor-prefixes: Add option prefix

Documentation/devicetree/bindings/sound/gtm601.txt | 14 +++
.../devicetree/bindings/vendor-prefixes.txt | 1 +
sound/soc/codecs/Kconfig | 4 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/gtm601.c | 106 +++++++++++++++++++++
5 files changed, 127 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/gtm601.txt
create mode 100644 sound/soc/codecs/gtm601.c

--
1.9.1


2015-04-30 21:28:57

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 1/3] 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 <[email protected]>
---
sound/soc/codecs/Kconfig | 4 ++
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/gtm601.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 112 insertions(+)
create mode 100644 sound/soc/codecs/gtm601.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 061c465..c399a5d 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -170,6 +170,7 @@ config SND_SOC_ALL_CODECS
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_GTM601
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
@@ -844,6 +845,9 @@ config SND_SOC_WM9712
config SND_SOC_WM9713
tristate

+config SND_SOC_GTM601
+ tristate 'GTM601 UMTS modem audio codec'
+
# Amp
config SND_SOC_LM4857
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index abe2d7e..bcafd4a 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -175,6 +175,7 @@ snd-soc-wm9705-objs := wm9705.o
snd-soc-wm9712-objs := wm9712.o
snd-soc-wm9713-objs := wm9713.o
snd-soc-wm-hubs-objs := wm_hubs.o
+snd-soc-gtm601-objs := gtm601.o

# Amp
snd-soc-max9877-objs := max9877.o
@@ -357,6 +358,7 @@ obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o
obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
+obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o

# Amp
obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
diff --git a/sound/soc/codecs/gtm601.c b/sound/soc/codecs/gtm601.c
new file mode 100644
index 0000000..05234a1
--- /dev/null
+++ b/sound/soc/codecs/gtm601.c
@@ -0,0 +1,106 @@
+/*
+ * This is a simple driver for the GTM601 Voice PCM interface
+ *
+ * Copyright (C) 2015 Goldelico GmbH
+ *
+ * Author: Marek Belisko <[email protected]>
+ *
+ * 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 as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/ac97_codec.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+
+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" },
+};
+
+/*
+ * Note this is a simple chip with no configuration interface, sample rate is
+ * determined automatically by examining the Master clock and Bit clock ratios
+ */
+
+#define GTM601_RATES (SNDRV_PCM_RATE_8000)
+
+struct snd_soc_dai_driver gtm601_dai = {
+ .name = "gtm601",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 1,
+ .rates = GTM601_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ },
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 1,
+ .rates = GTM601_RATES,
+ .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, &gtm601_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 <[email protected]>");
+MODULE_LICENSE("GPL v2");
--
1.9.1

2015-04-30 21:28:41

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 2/3] Documentation: devicetree: sound: Add documentation for gtm601 codec

Add small documentation for gtm601 UMTS modem audio interface.

Signed-off-by: Marek Belisko <[email protected]>
---
Documentation/devicetree/bindings/sound/gtm601.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/gtm601.txt

diff --git a/Documentation/devicetree/bindings/sound/gtm601.txt b/Documentation/devicetree/bindings/sound/gtm601.txt
new file mode 100644
index 0000000..2d2dbfc
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/gtm601.txt
@@ -0,0 +1,14 @@
+GTM601 UMTS modem audio interface CODEC
+
+This device has no configuration interface. Sample rate is determined automatically
+by examining the Master clock and Bit clock ratios.
+
+Required properties:
+
+ - compatible : "option,gtm601"
+
+Example:
+
+codec: gtm601_codec {
+ compatible = "option,gtm601";
+};
--
1.9.1

2015-04-30 21:28:26

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 3/3] 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 <[email protected]>
---
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index b6682ab..ed3bd55 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -142,6 +142,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
--
1.9.1

2015-05-01 07:30:17

by Paul Bolle

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

Just a nit: a license mismatch.

On Thu, 2015-04-30 at 23:28 +0200, Marek Belisko wrote:
> --- /dev/null
> +++ b/sound/soc/codecs/gtm601.c

> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.

This states the license is GPL v2 or later.

> +MODULE_LICENSE("GPL v2");

And, according to include/linux/module.h, this states the license is
(just) GPL v2. So I think either the comment at the top of this file or
the ident used in the MODULE_LICESE() macro should change.


Paul Bolle

2015-05-01 11:03:24

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

On Thu, Apr 30, 2015 at 11:28:01PM +0200, Marek Belisko wrote:

> 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_GTM601
> help
> +config SND_SOC_GTM601
> + tristate 'GTM601 UMTS modem audio codec'
> +

Keep Makefile and Kconfig sorted.

> +/*
> + * Note this is a simple chip with no configuration interface, sample rate is
> + * determined automatically by examining the Master clock and Bit clock ratios
> + */

> +#define GTM601_RATES (SNDRV_PCM_RATE_8000)

Does it or doesn't it support multiple sample rates?


Attachments:
(No filename) (632.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-05-01 11:36:52

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

Hi Mark,

On Fri, May 1, 2015 at 1:03 PM, Mark Brown <[email protected]> wrote:
> On Thu, Apr 30, 2015 at 11:28:01PM +0200, Marek Belisko wrote:
>
>> 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_GTM601
>> help
>> +config SND_SOC_GTM601
>> + tristate 'GTM601 UMTS modem audio codec'
>> +
>
> Keep Makefile and Kconfig sorted.
Ok.
>
>> +/*
>> + * Note this is a simple chip with no configuration interface, sample rate is
>> + * determined automatically by examining the Master clock and Bit clock ratios
>> + */
>
>> +#define GTM601_RATES (SNDRV_PCM_RATE_8000)
>
> Does it or doesn't it support multiple sample rates?
It support only 8kHz rate. I'll remove define and use SNDRV_PCM_RATE_8000
only in gtm601_dai struct.

Thanks and BR.

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

2015-05-01 11:39:43

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

Hi Paul,

On Fri, May 1, 2015 at 9:30 AM, Paul Bolle <[email protected]> wrote:
> Just a nit: a license mismatch.
Right, I copy and paste license header from wm827 driver but add
MODULE_LICENSE wrong version. I'll update in next version. Thanks.
>
> On Thu, 2015-04-30 at 23:28 +0200, Marek Belisko wrote:
>> --- /dev/null
>> +++ b/sound/soc/codecs/gtm601.c
>
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License as published by the
>> + * Free Software Foundation; either version 2 of the License, or (at your
>> + * option) any later version.
>
> This states the license is GPL v2 or later.
>
>> +MODULE_LICENSE("GPL v2");
>
> And, according to include/linux/module.h, this states the license is
> (just) GPL v2. So I think either the comment at the top of this file or
> the ident used in the MODULE_LICESE() macro should change.
>
>
> Paul Bolle
>

BR,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

2015-05-01 14:02:42

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

On Fri, May 01, 2015 at 01:36:48PM +0200, Belisko Marek wrote:
> On Fri, May 1, 2015 at 1:03 PM, Mark Brown <[email protected]> wrote:
> > On Thu, Apr 30, 2015 at 11:28:01PM +0200, Marek Belisko wrote:

> >> +/*
> >> + * Note this is a simple chip with no configuration interface, sample rate is
> >> + * determined automatically by examining the Master clock and Bit clock ratios
> >> + */
> >
> >> +#define GTM601_RATES (SNDRV_PCM_RATE_8000)

> > Does it or doesn't it support multiple sample rates?

> It support only 8kHz rate. I'll remove define and use SNDRV_PCM_RATE_8000
> only in gtm601_dai struct.

I was more commenting on the fact that the comment immediately above
says that the sample rate is determined automatically which suggests
that multiple sample rates are supported.


Attachments:
(No filename) (791.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-05-01 20:34:29

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH 1/3] ASoC: Add gtm601 codec driver

On Fri, May 1, 2015 at 4:02 PM, Mark Brown <[email protected]> wrote:
> On Fri, May 01, 2015 at 01:36:48PM +0200, Belisko Marek wrote:
>> On Fri, May 1, 2015 at 1:03 PM, Mark Brown <[email protected]> wrote:
>> > On Thu, Apr 30, 2015 at 11:28:01PM +0200, Marek Belisko wrote:
>
>> >> +/*
>> >> + * Note this is a simple chip with no configuration interface, sample rate is
>> >> + * determined automatically by examining the Master clock and Bit clock ratios
>> >> + */
>> >
>> >> +#define GTM601_RATES (SNDRV_PCM_RATE_8000)
>
>> > Does it or doesn't it support multiple sample rates?
>
>> It support only 8kHz rate. I'll remove define and use SNDRV_PCM_RATE_8000
>> only in gtm601_dai struct.
>
> I was more commenting on the fact that the comment immediately above
> says that the sample rate is determined automatically which suggests
> that multiple sample rates are supported.
OK I see. Checked with gtm601 datasheet max master clock is 2.048MHz so
it is 8kHz LRCLK. Sorry for confusing comment.

BR,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com