linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: Add gtm601 simple codec
@ 2015-04-30 21:28 Marek Belisko
  2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Marek Belisko @ 2015-04-30 21:28 UTC (permalink / raw)
  To: perex, tiwai
  Cc: broonie, hns, devicetree, linux-kernel, alsa-devel, Marek Belisko

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-04-30 21:28 [PATCH 0/3] ASoC: Add gtm601 simple codec Marek Belisko
@ 2015-04-30 21:28 ` Marek Belisko
  2015-05-01  7:30   ` Paul Bolle
  2015-05-01 11:03   ` Mark Brown
  2015-04-30 21:28 ` [PATCH 2/3] Documentation: devicetree: sound: Add documentation for gtm601 codec Marek Belisko
  2015-04-30 21:28 ` [PATCH 3/3] Documentation: vendor-prefixes: Add option prefix Marek Belisko
  2 siblings, 2 replies; 10+ messages in thread
From: Marek Belisko @ 2015-04-30 21:28 UTC (permalink / raw)
  To: perex, tiwai
  Cc: broonie, hns, devicetree, linux-kernel, alsa-devel, Marek Belisko

This driver add PCM interface to a GTM601 UMTS modem chip.
There is no configuration interface.

Signed-off-by: Marek Belisko <marek@goldelico.com>
---
 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 <marek@goldelico.com>
+ *
+ * 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 <marek@goldelico.com>");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] Documentation: devicetree: sound: Add documentation for gtm601 codec
  2015-04-30 21:28 [PATCH 0/3] ASoC: Add gtm601 simple codec Marek Belisko
  2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
@ 2015-04-30 21:28 ` Marek Belisko
  2015-04-30 21:28 ` [PATCH 3/3] Documentation: vendor-prefixes: Add option prefix Marek Belisko
  2 siblings, 0 replies; 10+ messages in thread
From: Marek Belisko @ 2015-04-30 21:28 UTC (permalink / raw)
  To: perex, tiwai
  Cc: broonie, hns, devicetree, linux-kernel, alsa-devel, Marek Belisko

Add small documentation for gtm601 UMTS modem audio interface.

Signed-off-by: Marek Belisko <marek@goldelico.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] Documentation: vendor-prefixes: Add option prefix
  2015-04-30 21:28 [PATCH 0/3] ASoC: Add gtm601 simple codec Marek Belisko
  2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
  2015-04-30 21:28 ` [PATCH 2/3] Documentation: devicetree: sound: Add documentation for gtm601 codec Marek Belisko
@ 2015-04-30 21:28 ` Marek Belisko
  2 siblings, 0 replies; 10+ messages in thread
From: Marek Belisko @ 2015-04-30 21:28 UTC (permalink / raw)
  To: perex, tiwai
  Cc: broonie, hns, devicetree, linux-kernel, alsa-devel, Marek Belisko

Add option to vendor-prefixes file which will be used for Option NV company.

Signed-off-by: Marek Belisko <marek@goldelico.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
@ 2015-05-01  7:30   ` Paul Bolle
  2015-05-01 11:39     ` Belisko Marek
  2015-05-01 11:03   ` Mark Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Bolle @ 2015-05-01  7:30 UTC (permalink / raw)
  To: Marek Belisko
  Cc: perex, tiwai, broonie, hns, devicetree, linux-kernel, alsa-devel

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
  2015-05-01  7:30   ` Paul Bolle
@ 2015-05-01 11:03   ` Mark Brown
  2015-05-01 11:36     ` Belisko Marek
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Brown @ 2015-05-01 11:03 UTC (permalink / raw)
  To: Marek Belisko; +Cc: perex, tiwai, hns, devicetree, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

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?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-05-01 11:03   ` Mark Brown
@ 2015-05-01 11:36     ` Belisko Marek
  2015-05-01 14:02       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Belisko Marek @ 2015-05-01 11:36 UTC (permalink / raw)
  To: Mark Brown
  Cc: perex, tiwai, Dr. H. Nikolaus Schaller, devicetree, LKML, alsa-devel

Hi Mark,

On Fri, May 1, 2015 at 1:03 PM, Mark Brown <broonie@kernel.org> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-05-01  7:30   ` Paul Bolle
@ 2015-05-01 11:39     ` Belisko Marek
  0 siblings, 0 replies; 10+ messages in thread
From: Belisko Marek @ 2015-05-01 11:39 UTC (permalink / raw)
  To: Paul Bolle
  Cc: perex, tiwai, Mark Brown, Dr. H. Nikolaus Schaller, devicetree,
	LKML, alsa-devel

Hi Paul,

On Fri, May 1, 2015 at 9:30 AM, Paul Bolle <pebolle@tiscali.nl> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-05-01 11:36     ` Belisko Marek
@ 2015-05-01 14:02       ` Mark Brown
  2015-05-01 20:34         ` Belisko Marek
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2015-05-01 14:02 UTC (permalink / raw)
  To: Belisko Marek
  Cc: perex, tiwai, Dr. H. Nikolaus Schaller, devicetree, LKML, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

On Fri, May 01, 2015 at 01:36:48PM +0200, Belisko Marek wrote:
> On Fri, May 1, 2015 at 1:03 PM, Mark Brown <broonie@kernel.org> 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: Add gtm601 codec driver
  2015-05-01 14:02       ` Mark Brown
@ 2015-05-01 20:34         ` Belisko Marek
  0 siblings, 0 replies; 10+ messages in thread
From: Belisko Marek @ 2015-05-01 20:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: perex, tiwai, Dr. H. Nikolaus Schaller, devicetree, LKML, alsa-devel

On Fri, May 1, 2015 at 4:02 PM, Mark Brown <broonie@kernel.org> 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 <broonie@kernel.org> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-05-01 20:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 21:28 [PATCH 0/3] ASoC: Add gtm601 simple codec Marek Belisko
2015-04-30 21:28 ` [PATCH 1/3] ASoC: Add gtm601 codec driver Marek Belisko
2015-05-01  7:30   ` Paul Bolle
2015-05-01 11:39     ` Belisko Marek
2015-05-01 11:03   ` Mark Brown
2015-05-01 11:36     ` Belisko Marek
2015-05-01 14:02       ` Mark Brown
2015-05-01 20:34         ` Belisko Marek
2015-04-30 21:28 ` [PATCH 2/3] Documentation: devicetree: sound: Add documentation for gtm601 codec Marek Belisko
2015-04-30 21:28 ` [PATCH 3/3] Documentation: vendor-prefixes: Add option prefix Marek Belisko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).