All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] MAX98088/9 of features
@ 2018-10-05  7:58 Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland; +Cc: devicetree, alsa-devel, kernel

Hi,

this the v2 with the integrated review from the v1 [1].

I picked up the max98088 patches from Andreas series [2] and ported them
to the new kernel.

Regards,
Marco

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/ \
    2018-September/140501.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/ \
    2015-February/324440.html

Changes:

v2:
 - make master clock optional
 - be more verbose in commit messages

Andreas Färber (3):
  ASoC: dt-bindings: add max98088 audio codec
  ASoC: max98088: add OF support
  ASoC: max98088: Add master clock handling

Marco Felsch (2):
  ASoC: dt-bindings: max98088: add external clock binding
  ASoC: max98988: make it selectable

 .../bindings/sound/maxim,max98088.txt         | 23 ++++++++++++
 sound/soc/codecs/Kconfig                      |  2 +-
 sound/soc/codecs/max98088.c                   | 36 +++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98088.txt

-- 
2.19.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec
  2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
@ 2018-10-05  7:58 ` Marco Felsch
  2018-10-12 20:29   ` Rob Herring
  2018-10-05  7:58 ` [PATCH v2 2/5] ASoC: max98088: add OF support Marco Felsch
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland
  Cc: devicetree, alsa-devel, Andreas Färber, kernel

From: Andreas Färber <afaerber@suse.de>

This patch adds the bindings for maxim max98088/9 audio codec.

Signed-off-by: Andreas Färber <afaerber@suse.de>
[m.felsch@pengutronix.de: adapt commit message]
[m.felsch@pengutronix.de: adapt formatting]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 .../devicetree/bindings/sound/maxim,max98088.txt  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98088.txt

diff --git a/Documentation/devicetree/bindings/sound/maxim,max98088.txt b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
new file mode 100644
index 000000000000..a79ad5c7af88
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
@@ -0,0 +1,15 @@
+MAX98088 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+- compatible: "maxim,max98088" or "maxim,max98089".
+- reg: The I2C address of the device.
+
+Example:
+
+max98089: codec@10 {
+	compatible = "maxim,max98089";
+	reg = <0x10>;
+};
-- 
2.19.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH v2 2/5] ASoC: max98088: add OF support
  2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
@ 2018-10-05  7:58 ` Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland
  Cc: devicetree, alsa-devel, Andreas Färber, kernel

From: Andreas Färber <afaerber@suse.de>

MAX98088 is just an older version of the MAX98089 device. Both devices
have the same capabilities. There is only one minor difference in JACK
detection and the related power-save modi, but the MAX98089 is backward
compatible to the MAX98088.

Signed-off-by: Andreas Färber <afaerber@suse.de>
[m.felsch@pengutronix.de: add CONFIG_OF compile switch]
[m.felsch@pengutronix.de: adapt commit message]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/codecs/max98088.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index fb515aaa54fc..9450d5d9c492 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1742,9 +1742,19 @@ static const struct i2c_device_id max98088_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id max98088_of_match[] = {
+	{ .compatible = "maxim,max98088" },
+	{ .compatible = "maxim,max98089" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, max98088_of_match);
+#endif
+
 static struct i2c_driver max98088_i2c_driver = {
 	.driver = {
 		.name = "max98088",
+		.of_match_table = of_match_ptr(max98088_of_match),
 	},
 	.probe  = max98088_i2c_probe,
 	.id_table = max98088_i2c_id,
-- 
2.19.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH v2 3/5] ASoC: dt-bindings: max98088: add external clock binding
  2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 2/5] ASoC: max98088: add OF support Marco Felsch
@ 2018-10-05  7:58 ` Marco Felsch
  2018-10-08 18:54   ` Applied "ASoC: dt-bindings: max98088: add external clock binding" to the asoc tree Mark Brown
  2018-10-05  7:58 ` [PATCH v2 4/5] ASoC: max98088: Add master clock handling Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 5/5] ASoC: max98988: make it selectable Marco Felsch
  4 siblings, 1 reply; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland; +Cc: devicetree, alsa-devel, kernel

Allow setting the clock provider for the external clock called "mclk".

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 .../devicetree/bindings/sound/maxim,max98088.txt          | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/maxim,max98088.txt b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
index a79ad5c7af88..da764d913319 100644
--- a/Documentation/devicetree/bindings/sound/maxim,max98088.txt
+++ b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
@@ -7,9 +7,17 @@ Required properties:
 - compatible: "maxim,max98088" or "maxim,max98089".
 - reg: The I2C address of the device.
 
+Optional properties:
+
+- clocks: the clock provider of MCLK, see ../clock/clock-bindings.txt section
+  "consumer" for more information.
+- clock-names: must be set to "mclk"
+
 Example:
 
 max98089: codec@10 {
 	compatible = "maxim,max98089";
 	reg = <0x10>;
+	clocks = <&clks IMX6QDL_CLK_CKO2>;
+	clock-names = "mclk";
 };
-- 
2.19.0

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

* [PATCH v2 4/5] ASoC: max98088: Add master clock handling
  2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
                   ` (2 preceding siblings ...)
  2018-10-05  7:58 ` [PATCH v2 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
@ 2018-10-05  7:58 ` Marco Felsch
  2018-10-05  7:58 ` [PATCH v2 5/5] ASoC: max98988: make it selectable Marco Felsch
  4 siblings, 0 replies; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland
  Cc: devicetree, alsa-devel, Andreas Färber, kernel, Tushar Behera

From: Andreas Färber <afaerber@suse.de>

If master clock is provided through device tree, then update
the master clock frequency during set_sysclk.

Cc: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Tushar Behera <trblinux@gmail.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
[m.felsch@pengutronix.de: move mclk request to i2c_probe]
[m.felsch@pengutronix.de: make use of snd_soc_component_get_bias_level()]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/codecs/max98088.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 9450d5d9c492..ca172a4b6849 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -16,6 +16,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
+#include <linux/clk.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -42,6 +43,7 @@ struct max98088_priv {
 	struct regmap *regmap;
 	enum max98088_type devtype;
 	struct max98088_pdata *pdata;
+	struct clk *mclk;
 	unsigned int sysclk;
 	struct max98088_cdata dai[2];
 	int eq_textcnt;
@@ -1103,6 +1105,11 @@ static int max98088_dai_set_sysclk(struct snd_soc_dai *dai,
        if (freq == max98088->sysclk)
                return 0;
 
+	if (!IS_ERR(max98088->mclk)) {
+		freq = clk_round_rate(max98088->mclk, freq);
+		clk_set_rate(max98088->mclk, freq);
+	}
+
        /* Setup clocks for slave mode, and using the PLL
         * PSCLK = 0x01 (when master clk is 10MHz to 20MHz)
         *         0x02 (when master clk is 20MHz to 30MHz)..
@@ -1310,6 +1317,20 @@ static int max98088_set_bias_level(struct snd_soc_component *component,
 		break;
 
 	case SND_SOC_BIAS_PREPARE:
+		/*
+		 * SND_SOC_BIAS_PREPARE is called while preparing for a
+		 * transition to ON or away from ON. If current bias_level
+		 * is SND_SOC_BIAS_ON, then it is preparing for a transition
+		 * away from ON. Disable the clock in that case, otherwise
+		 * enable it.
+		 */
+		if (!IS_ERR(max98088->mclk)) {
+			if (snd_soc_component_get_bias_level(component) ==
+			    SND_SOC_BIAS_ON)
+				clk_disable_unprepare(max98088->mclk);
+			else
+				clk_prepare_enable(max98088->mclk);
+		}
 		break;
 
 	case SND_SOC_BIAS_STANDBY:
@@ -1725,6 +1746,11 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
        if (IS_ERR(max98088->regmap))
 	       return PTR_ERR(max98088->regmap);
 
+	max98088->mclk = devm_clk_get(&i2c->dev, "mclk");
+	if (IS_ERR(max98088->mclk))
+		if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER)
+			return PTR_ERR(max98088->mclk);
+
        max98088->devtype = id->driver_data;
 
        i2c_set_clientdata(i2c, max98088);
-- 
2.19.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH v2 5/5] ASoC: max98988: make it selectable
  2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
                   ` (3 preceding siblings ...)
  2018-10-05  7:58 ` [PATCH v2 4/5] ASoC: max98088: Add master clock handling Marco Felsch
@ 2018-10-05  7:58 ` Marco Felsch
  4 siblings, 0 replies; 8+ messages in thread
From: Marco Felsch @ 2018-10-05  7:58 UTC (permalink / raw)
  To: lgirdwood, broonie, robh+dt, mark.rutland; +Cc: devicetree, alsa-devel, kernel

Currently the driver will build only if SND_SOC_ALL_CODECS is set.
Adding a Kconfig menu description to build the driver standalone.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/codecs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index efb095dbcd71..b43f85b38e72 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -629,7 +629,7 @@ config SND_SOC_LM49453
 	tristate
 
 config SND_SOC_MAX98088
-       tristate
+	tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
 
 config SND_SOC_MAX98090
        tristate
-- 
2.19.0

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

* Applied "ASoC: dt-bindings: max98088: add external clock binding" to the asoc tree
  2018-10-05  7:58 ` [PATCH v2 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
@ 2018-10-08 18:54   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2018-10-08 18:54 UTC (permalink / raw)
  To: Marco Felsch
  Cc: mark.rutland, devicetree, alsa-devel, lgirdwood, robh+dt,
	broonie, kernel

The patch

   ASoC: dt-bindings: max98088: add external clock binding

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d6ed11edab5dd10ddf5548c02a9a1132ec728640 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Fri, 5 Oct 2018 09:58:10 +0200
Subject: [PATCH] ASoC: dt-bindings: max98088: add external clock binding

Allow setting the clock provider for the external clock called "mclk".

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/maxim,max98088.txt          | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/maxim,max98088.txt b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
index a79ad5c7af88..da764d913319 100644
--- a/Documentation/devicetree/bindings/sound/maxim,max98088.txt
+++ b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
@@ -7,9 +7,17 @@ Required properties:
 - compatible: "maxim,max98088" or "maxim,max98089".
 - reg: The I2C address of the device.
 
+Optional properties:
+
+- clocks: the clock provider of MCLK, see ../clock/clock-bindings.txt section
+  "consumer" for more information.
+- clock-names: must be set to "mclk"
+
 Example:
 
 max98089: codec@10 {
 	compatible = "maxim,max98089";
 	reg = <0x10>;
+	clocks = <&clks IMX6QDL_CLK_CKO2>;
+	clock-names = "mclk";
 };
-- 
2.19.0

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

* Re: [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec
  2018-10-05  7:58 ` [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
@ 2018-10-12 20:29   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2018-10-12 20:29 UTC (permalink / raw)
  To: Marco Felsch
  Cc: mark.rutland, devicetree, alsa-devel, lgirdwood, robh+dt,
	broonie, kernel, Andreas Färber

On Fri,  5 Oct 2018 09:58:08 +0200, Marco Felsch wrote:
> From: Andreas Färber <afaerber@suse.de>
> 
> This patch adds the bindings for maxim max98088/9 audio codec.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> [m.felsch@pengutronix.de: adapt commit message]
> [m.felsch@pengutronix.de: adapt formatting]
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  .../devicetree/bindings/sound/maxim,max98088.txt  | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98088.txt
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2018-10-12 20:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05  7:58 [PATCH v2 0/5] MAX98088/9 of features Marco Felsch
2018-10-05  7:58 ` [PATCH v2 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
2018-10-12 20:29   ` Rob Herring
2018-10-05  7:58 ` [PATCH v2 2/5] ASoC: max98088: add OF support Marco Felsch
2018-10-05  7:58 ` [PATCH v2 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
2018-10-08 18:54   ` Applied "ASoC: dt-bindings: max98088: add external clock binding" to the asoc tree Mark Brown
2018-10-05  7:58 ` [PATCH v2 4/5] ASoC: max98088: Add master clock handling Marco Felsch
2018-10-05  7:58 ` [PATCH v2 5/5] ASoC: max98988: make it selectable Marco Felsch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.