* [PATCH 1/5] ASoC: dt-bindings: add max98088 audio codec
2018-09-25 14:23 [PATCH 0/5] MAX98088/9 of features Marco Felsch
@ 2018-09-25 14:23 ` Marco Felsch
2018-09-25 14:23 ` [PATCH 2/5] ASoC: max98088: add OF support Marco Felsch
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2018-09-25 14:23 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] 12+ messages in thread* [PATCH 2/5] ASoC: max98088: add OF support
2018-09-25 14:23 [PATCH 0/5] MAX98088/9 of features Marco Felsch
2018-09-25 14:23 ` [PATCH 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
@ 2018-09-25 14:23 ` Marco Felsch
2018-09-25 17:11 ` Mark Brown
2018-09-25 14:23 ` [PATCH 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Marco Felsch @ 2018-09-25 14:23 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 an older version of the MAX98089 device.
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] 12+ messages in thread* Re: [PATCH 2/5] ASoC: max98088: add OF support
2018-09-25 14:23 ` [PATCH 2/5] ASoC: max98088: add OF support Marco Felsch
@ 2018-09-25 17:11 ` Mark Brown
2018-09-26 10:42 ` Marco Felsch
0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2018-09-25 17:11 UTC (permalink / raw)
To: Marco Felsch
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood, robh+dt, kernel,
Andreas Färber
[-- Attachment #1.1: Type: text/plain, Size: 208 bytes --]
On Tue, Sep 25, 2018 at 04:23:49PM +0200, Marco Felsch wrote:
> From: Andreas Färber <afaerber@suse.de>
>
> MAX98088 is an older version of the MAX98089 device.
With no software visible diffferences?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] ASoC: max98088: add OF support
2018-09-25 17:11 ` Mark Brown
@ 2018-09-26 10:42 ` Marco Felsch
0 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2018-09-26 10:42 UTC (permalink / raw)
To: Mark Brown
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood, robh+dt, kernel,
Andreas Färber
On 18-09-25 10:11, Mark Brown wrote:
> On Tue, Sep 25, 2018 at 04:23:49PM +0200, Marco Felsch wrote:
> > From: Andreas Färber <afaerber@suse.de>
> >
> > MAX98088 is an older version of the MAX98089 device.
>
> With no software visible diffferences?
I reviewd both RMs a 2nd time and see only a realy minor difference for
register 0x02 and 0x4e. Both covers a different jack plugin/off
handling.
0x02:
MAX98088 - Bit6 indicate JACKSNS State
MAX98089 - Bit6/7 indicates JACKSNS State
But this register is never read by the driver.
0x4e:
MAX98088 - Bit0 is reserved
MAX98089 - Bit0 is JDWK
The register has the default value for both chips and this value is set
during probe().
So I see no other software differences, but maybe a Maxim FAE can help
us?
Regards,
Marco
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/5] ASoC: dt-bindings: max98088: add external clock binding
2018-09-25 14:23 [PATCH 0/5] MAX98088/9 of features Marco Felsch
2018-09-25 14:23 ` [PATCH 1/5] ASoC: dt-bindings: add max98088 audio codec Marco Felsch
2018-09-25 14:23 ` [PATCH 2/5] ASoC: max98088: add OF support Marco Felsch
@ 2018-09-25 14:23 ` Marco Felsch
2018-09-25 14:23 ` [PATCH 4/5] ASoC: max98088: Add master clock handling Marco Felsch
2018-09-25 14:23 ` [PATCH 5/5] ASoC: max98988: make it selectable Marco Felsch
4 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2018-09-25 14:23 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, mark.rutland; +Cc: devicetree, alsa-devel, kernel
Allow setting the external clock called "mclk" in the device tree.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
Documentation/devicetree/bindings/sound/maxim,max98088.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/maxim,max98088.txt b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
index a79ad5c7af88..c575806c9e18 100644
--- a/Documentation/devicetree/bindings/sound/maxim,max98088.txt
+++ b/Documentation/devicetree/bindings/sound/maxim,max98088.txt
@@ -6,10 +6,15 @@ Required properties:
- compatible: "maxim,max98088" or "maxim,max98089".
- reg: The I2C address of the device.
+- 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] 12+ messages in thread* [PATCH 4/5] ASoC: max98088: Add master clock handling
2018-09-25 14:23 [PATCH 0/5] MAX98088/9 of features Marco Felsch
` (2 preceding siblings ...)
2018-09-25 14:23 ` [PATCH 3/5] ASoC: dt-bindings: max98088: add external clock binding Marco Felsch
@ 2018-09-25 14:23 ` Marco Felsch
2018-09-25 17:17 ` Mark Brown
2018-09-25 14:23 ` [PATCH 5/5] ASoC: max98988: make it selectable Marco Felsch
4 siblings, 1 reply; 12+ messages in thread
From: Marco Felsch @ 2018-09-25 14:23 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, mark.rutland
Cc: devicetree, alsa-devel, Andreas Färber, kernel,
Javier Martinez Canillas, 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>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
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 | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 9450d5d9c492..01f1ea0af9c1 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,14 @@ 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 -EPROBE_DEFER;
+ dev_err(&i2c->dev, "Invalid MCLK\n");
+ return -EINVAL;
+ }
+
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] 12+ messages in thread* Re: [PATCH 4/5] ASoC: max98088: Add master clock handling
2018-09-25 14:23 ` [PATCH 4/5] ASoC: max98088: Add master clock handling Marco Felsch
@ 2018-09-25 17:17 ` Mark Brown
2018-09-26 10:00 ` Marco Felsch
0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2018-09-25 17:17 UTC (permalink / raw)
To: Marco Felsch
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood,
Javier Martinez Canillas, robh+dt, kernel, Andreas Färber,
Tushar Behera
[-- Attachment #1.1: Type: text/plain, Size: 945 bytes --]
On Tue, Sep 25, 2018 at 04:23:51PM +0200, Marco Felsch wrote:
> From: Andreas Färber <afaerber@suse.de>
>
> If master clock is provided through device tree, then update
> the master clock frequency during set_sysclk.
This changelog suggests that the clock is optional...
> + if (!IS_ERR(max98088->mclk)) {
> + freq = clk_round_rate(max98088->mclk, freq);
> + clk_set_rate(max98088->mclk, freq);
> + }
...as does much of the code (note BTw that this ignores errors setting
the clock)...
> + max98088->mclk = devm_clk_get(&i2c->dev, "mclk");
> + if (IS_ERR(max98088->mclk)) {
> + if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> + dev_err(&i2c->dev, "Invalid MCLK\n");
> + return -EINVAL;
> + }
> +
...but the probe function makes it mandatory (and also throws away the
error code from clk_get() if it's not -EPROBE_DEFER). Is this the best
choice? It seems inconsistent anyway.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 4/5] ASoC: max98088: Add master clock handling
2018-09-25 17:17 ` Mark Brown
@ 2018-09-26 10:00 ` Marco Felsch
2018-09-26 12:22 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Marco Felsch @ 2018-09-26 10:00 UTC (permalink / raw)
To: Mark Brown
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood,
Javier Martinez Canillas, robh+dt, kernel, Andreas Färber,
Tushar Behera
Hi Mark,
thanks for review.
On 18-09-25 10:17, Mark Brown wrote:
> On Tue, Sep 25, 2018 at 04:23:51PM +0200, Marco Felsch wrote:
> > From: Andreas Färber <afaerber@suse.de>
> >
> > If master clock is provided through device tree, then update
> > the master clock frequency during set_sysclk.
>
> This changelog suggests that the clock is optional...
Your are right, it was my fail to make it not optional.
>
> > + if (!IS_ERR(max98088->mclk)) {
> > + freq = clk_round_rate(max98088->mclk, freq);
> > + clk_set_rate(max98088->mclk, freq);
> > + }
>
> ...as does much of the code (note BTw that this ignores errors setting
> the clock)...
>
> > + max98088->mclk = devm_clk_get(&i2c->dev, "mclk");
> > + if (IS_ERR(max98088->mclk)) {
> > + if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER)
> > + return -EPROBE_DEFER;
> > + dev_err(&i2c->dev, "Invalid MCLK\n");
> > + return -EINVAL;
> > + }
> > +
>
> ...but the probe function makes it mandatory (and also throws away the
> error code from clk_get() if it's not -EPROBE_DEFER). Is this the best
> choice? It seems inconsistent anyway.
One question, should it optional or not? If not I will fix it to return
the clk_get error else I will drop it. It shouldn't be optional In my
point of view, since it is needed by the chip.
Regards,
Marco
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 4/5] ASoC: max98088: Add master clock handling
2018-09-26 10:00 ` Marco Felsch
@ 2018-09-26 12:22 ` Mark Brown
2018-09-26 12:30 ` Marco Felsch
0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2018-09-26 12:22 UTC (permalink / raw)
To: Marco Felsch
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood,
Javier Martinez Canillas, robh+dt, kernel, Andreas Färber,
Tushar Behera
[-- Attachment #1.1: Type: text/plain, Size: 346 bytes --]
On Wed, Sep 26, 2018 at 12:00:30PM +0200, Marco Felsch wrote:
> One question, should it optional or not? If not I will fix it to return
> the clk_get error else I will drop it. It shouldn't be optional In my
> point of view, since it is needed by the chip.
Optional seems safer, requiring the clock isn't going to work so well on
ACPI systems.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] ASoC: max98088: Add master clock handling
2018-09-26 12:22 ` Mark Brown
@ 2018-09-26 12:30 ` Marco Felsch
0 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2018-09-26 12:30 UTC (permalink / raw)
To: Mark Brown
Cc: mark.rutland, devicetree, alsa-devel, lgirdwood,
Andreas Färber, robh+dt, kernel, Javier Martinez Canillas,
Tushar Behera
On 18-09-26 13:22, Mark Brown wrote:
> On Wed, Sep 26, 2018 at 12:00:30PM +0200, Marco Felsch wrote:
>
> > One question, should it optional or not? If not I will fix it to return
> > the clk_get error else I will drop it. It shouldn't be optional In my
> > point of view, since it is needed by the chip.
>
> Optional seems safer, requiring the clock isn't going to work so well on
> ACPI systems.
Okay, I will integrate it in my v2.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/5] ASoC: max98988: make it selectable
2018-09-25 14:23 [PATCH 0/5] MAX98088/9 of features Marco Felsch
` (3 preceding siblings ...)
2018-09-25 14:23 ` [PATCH 4/5] ASoC: max98088: Add master clock handling Marco Felsch
@ 2018-09-25 14:23 ` Marco Felsch
4 siblings, 0 replies; 12+ messages in thread
From: Marco Felsch @ 2018-09-25 14:23 UTC (permalink / raw)
To: lgirdwood, broonie, robh+dt, mark.rutland; +Cc: devicetree, alsa-devel, kernel
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] 12+ messages in thread