Skip to contentSkip to conversation

ASoC: samsung: Spring sound support

PATCH In review Andreas Färber 7 participants 30 messages Feb 18, 2015 – Feb 23, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover ASoC: samsung: Spring sound support

Hello,

This series prepares sound support for the HP Chromebook 11.

Regards,
Andreas

Andreas F?rber (6):
ASoC: max98088: Document DT bindings
ASoC: max98088: Add DT bindings
ARM: dts: Add max98089 to exynos5250-spring
ASoC: samsung: Document binding for max98089 based Snow driver
ASoC: samsung: Extend Snow driver to support max98089
ARM: dts: Add sound support to exynos5250-spring

 .../devicetree/bindings/sound/max98088.txt         | 16 ++++++++++++
 Documentation/devicetree/bindings/sound/snow.txt   |  1 +
 arch/arm/boot/dts/exynos5250-spring.dts            | 30 ++++++++++++++++++++++
 sound/soc/codecs/max98088.c                        |  8 ++++++
 sound/soc/samsung/Kconfig                          |  1 +
 sound/soc/samsung/snow.c                           |  1 +
 6 files changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98088.txt
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/6 ASoC: max98088: Document DT bindings

---
 Documentation/devicetree/bindings/sound/max98088.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98088.txt
Documentation/devicetree/bindings/sound/max98088.txt new file +16 -0
new file mode 100644
index 000000000000..6f8fe85040ee
@@ -0,0 +1,16 @@
+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>;
+};
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Hello Andreas,

Quoted 19 lines · Andreas Färber
---
 Documentation/devicetree/bindings/sound/max98088.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98088.txt
Documentation/devicetree/bindings/sound/max98088.txt new file +6 -0
new file mode 100644
index 000000000000..6f8fe85040ee
@@ -0,0 +1,16 @@
+MAX98088 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+

Documentation/devicetree/bindings/sound/max98088.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/sound/max98088.txt new file +10 -0
+- compatible : "maxim,max98088" or "maxim,max98089".
+
+- reg : The I2C address of the device.
+
+Example:
+
+max98089: codec@10 {
+	compatible = "maxim,max98089";
+	reg = <0x10>;
+};

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

Best regards,
Javier

#3 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Hello Javier, Doug,

Am 19.02.2015 um 14:55 schrieb Javier Martinez Canillas:

Quoted 39 lines · Andreas Färber
Quoted 19 lines
---
 Documentation/devicetree/bindings/sound/max98088.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98088.txt
Documentation/devicetree/bindings/sound/max98088.txt new file +6 -0
new file mode 100644
index 000000000000..6f8fe85040ee
@@ -0,0 +1,16 @@
+MAX98088 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+

Documentation/devicetree/bindings/sound/max98088.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/sound/max98088.txt new file +10 -0
+- compatible : "maxim,max98088" or "maxim,max98089".
+
+- reg : The I2C address of the device.
+
+Example:
+
+max98089: codec@10 {
+	compatible = "maxim,max98089";
+	reg = <0x10>;
+};

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

Quoted 6 lines

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

When I prepared this patch, I believe it was a straight copy from max98090. Sounds like they changed since then.

My 6/6 adopted the mclk clock from your now-cancelled v2 patch for Snow, assuming it would be the same on all Chromebooks. I tested that last change by checking for errors in dmesg.

Doug, can you advise on how the clock wiring is for Spring?

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#4 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Andreas,

Quoted 15 lines · Andreas Färber
Quoted 8 lines

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

Quoted 6 lines

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

Quoted 8 lines

When I prepared this patch, I believe it was a straight copy from max98090. Sounds like they changed since then.

My 6/6 adopted the mclk clock from your now-cancelled v2 patch for Snow, assuming it would be the same on all Chromebooks. I tested that last change by checking for errors in dmesg.

Doug, can you advise on how the clock wiring is for Spring?

I can confirm that XCLKOUT is connected to the codec MCLK on the Spring schematics I have.

-Doug

#5 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Am 19.02.2015 um 18:48 schrieb Doug Anderson:

Quoted 19 lines · Andreas Färber
Quoted 18 lines
Quoted 8 lines

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

Quoted 6 lines

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

When I prepared this patch, I believe it was a straight copy from max98090. Sounds like they changed since then.

Quoted 8 lines
Quoted 5 lines

My 6/6 adopted the mclk clock from your now-cancelled v2 patch for Snow, assuming it would be the same on all Chromebooks. I tested that last change by checking for errors in dmesg.

Doug, can you advise on how the clock wiring is for Spring?

I can confirm that XCLKOUT is connected to the codec MCLK on the Spring schematics I have.

Thanks! I updated max98088 and had it working on first boot, but on second boot it complained about the frequency:

[    7.896834] max98088 7-0010: revision A
[    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
[    7.919367] max98088 7-0010: Invalid master clock frequency
[    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
failed: -22
[    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
[    7.920109] snow-audio: probe of sound failed with error -22

Will investigate.

Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#6 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Am 19.02.2015 um 19:40 schrieb Andreas Färber:

Quoted 32 lines

Am 19.02.2015 um 18:48 schrieb Doug Anderson:

Quoted 19 lines · Andreas Färber
Quoted 18 lines
Quoted 8 lines

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

Quoted 6 lines

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

When I prepared this patch, I believe it was a straight copy from max98090. Sounds like they changed since then.

Quoted 8 lines
Quoted 5 lines

My 6/6 adopted the mclk clock from your now-cancelled v2 patch for Snow, assuming it would be the same on all Chromebooks. I tested that last change by checking for errors in dmesg.

Doug, can you advise on how the clock wiring is for Spring?

I can confirm that XCLKOUT is connected to the codec MCLK on the Spring schematics I have.

Thanks! I updated max98088 and had it working on first boot, but on second boot it complained about the frequency:

Quoted 7 lines
[    7.896834] max98088 7-0010: revision A
[    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
[    7.919367] max98088 7-0010: Invalid master clock frequency
[    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
failed: -22
[    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
[    7.920109] snow-audio: probe of sound failed with error -22

Reproducible on third boot.

On a suspicion, the fourth boot I waited for the double-beep of the firmware (waiting for Ctrl+d/u), and then it did work.

So it seems the mclk is not always set up properly by the kernel, relying on firmware. Who's in charge of setting that clock up?

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#7 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Hello Andreas,

We already talked over irc but for completeness I'll comment here as well.

Quoted 5 lines · Andreas Färber

Am 19.02.2015 um 19:40 schrieb Andreas Färber:

Quoted 4 lines

Am 19.02.2015 um 18:48 schrieb Doug Anderson:

Quoted 3 lines · Andreas Färber
Quoted 2 lines
Quoted 2 lines

I see that a master clock (mclk) is added in patch 6/6 but the max98088 codec driver does handle this clock.

Sorry, I wanted to say " the driver *does not* handle this clock" but fortunately you understood what I meant :)

Quoted 28 lines
Quoted 28 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines

If the SoC XCLKOUT provides the master clock to the max98089 codec in Spring like is the case for the max9809{0,5} codecs in the Snow and Peach Pit/Pi Chromebooks then you need to do something along the lines of the following commits:

Quoted 6 lines

e3048c3d2be5 ASoC: max98095: Add master clock handling b10ab7b838bd ASoC: max98090: Add master clock handling

If that's the case you also have to mention in the DT binding doc that "clocks" and "clock-names" are optional properties like Documentation/devicetree/bindings/sound/max9809{0,5}.txt.

When I prepared this patch, I believe it was a straight copy from max98090. Sounds like they changed since then.

Quoted 8 lines
Quoted 5 lines

My 6/6 adopted the mclk clock from your now-cancelled v2 patch for Snow, assuming it would be the same on all Chromebooks. I tested that last change by checking for errors in dmesg.

Doug, can you advise on how the clock wiring is for Spring?

I can confirm that XCLKOUT is connected to the codec MCLK on the Spring schematics I have.

Thanks! I updated max98088 and had it working on first boot, but on second boot it complained about the frequency:

Quoted 8 lines
Quoted 7 lines
[    7.896834] max98088 7-0010: revision A
[    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
[    7.919367] max98088 7-0010: Invalid master clock frequency
[    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
failed: -22
[    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
[    7.920109] snow-audio: probe of sound failed with error -22

I had the same error on Snow but even on the first boot and after doing some code archeology, I found the following commit [0] in a Samsung downstream tree that solves the issue.

The problem is that clk_round_rate(max98095->mclk, freq) returns 0 as the rounded rate if XCLOUT is not allowed to be re-parented on rate change.

With Tushar's patch I see that clk_round_rate() returns 24000000 (24MHz) so the codec driver setups the correct PLL clock.

You mentioned that it does make the error go away but still audio is not working on Spring. Let's see if someone has an idea of what could be missing.

Quoted 8 lines

Reproducible on third boot.

On a suspicion, the fourth boot I waited for the double-beep of the firmware (waiting for Ctrl+d/u), and then it did work.

So it seems the mclk is not always set up properly by the kernel, relying on firmware. Who's in charge of setting that clock up?

Right, it seems audio is only working due the firmware doing some previous setup. Probably it works on every boot if you have "sound init" as a part of the u-boot boot commands?

Quoted 3 lines

Regards,
Andreas

Best regards,
Javier

[0]: https://github.com/exynos-reference/kernel/commit/34ae055b32e621409a92dea6a29f65b723798f33

#8 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Am 19.02.2015 um 21:48 schrieb Javier Martinez Canillas:

Quoted 14 lines · Andreas Färber
Quoted 12 lines

Am 19.02.2015 um 19:40 schrieb Andreas Färber:

Quoted 10 lines

I updated max98088 and had it working on first boot, but on second boot it complained about the frequency:

[    7.896834] max98088 7-0010: revision A
[    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
[    7.919367] max98088 7-0010: Invalid master clock frequency
[    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
failed: -22
[    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
[    7.920109] snow-audio: probe of sound failed with error -22
Quoted 6 lines

I had the same error on Snow but even on the first boot and after doing some code archeology, I found the following commit [0] in a Samsung downstream tree that solves the issue.

The problem is that clk_round_rate(max98095->mclk, freq) returns 0 as the rounded rate if XCLOUT is not allowed to be re-parented on rate change.

Same on Spring:

sound/soc/codecs/max98088.c +0 -0
index 1aa81321afba..46dc64675c26 100644
@@ -1365,6 +1365,7 @@ static int max98088_dai_set_sysclk(struct

snd_soc_dai *dai,

        if (!IS_ERR(max98088->mclk)) {
                freq = clk_round_rate(max98088->mclk, freq);
+               dev_warn(codec->dev, "freq = %u\n", freq);
                clk_set_rate(max98088->mclk, freq);
        }
Quoted 2 lines

With Tushar's patch I see that clk_round_rate() returns 24000000 (24MHz) so the codec driver setups the correct PLL clock.

Ditto. With the clkout reparenting patch, clk_round_rate() returns 24MHz just like when double-beep-initialized. However when not double-beep-initialized, the driver initializes, but no audible output, so there must be another missing puzzle piece.

Quoted 9 lines
Quoted 5 lines

On a suspicion, the fourth boot I waited for the double-beep of the firmware (waiting for Ctrl+d/u), and then it did work.

So it seems the mclk is not always set up properly by the kernel, relying on firmware. Who's in charge of setting that clock up?

Right, it seems audio is only working due the firmware doing some previous setup. Probably it works on every boot if you have "sound init" as a part of the u-boot boot commands?

Indeed it does, 24 MHz without the reparenting patch, and sound working.

'sound init' code:
https://github.com/afaerber/u-boot/blob/spring/drivers/sound/max98088.c

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#9 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Quoted 8 lines · Andreas Färber
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So it seems the mclk is not always set up properly by the kernel, relying on firmware. Who's in charge of setting that clock up?

Right, it seems audio is only working due the firmware doing some previous setup. Probably it works on every boot if you have "sound init" as a part of the u-boot boot commands?

Indeed it does, 24 MHz without the reparenting patch, and sound working.

You can have parent of the CLKOUT clock set by the clk core if it is specified in device tree in the PMU (the clkout clock supplier) device node.

Similarly as we did for the Odroix U3:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/exynos4412-odroid-common.dtsi#n39

Relying on the clk_set_rate() to set the parent clock is not optimal IMO. Presumably you need to set select stable parent clock for clkout like XXTI. But I'm not very familiar with exyno5250 and that might be something different.

Signature · 2 lines
Regards,
Sylwester
#10 lore raw

Re: [PATCH 1/6] ASoC: max98088: Document DT bindings

Hello Sylwester,

Quoted 14 lines · Sylwester Nawrocki
Quoted 8 lines · Andreas Färber
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

So it seems the mclk is not always set up properly by the kernel, relying on firmware. Who's in charge of setting that clock up?

Right, it seems audio is only working due the firmware doing some previous setup. Probably it works on every boot if you have "sound init" as a part of the u-boot boot commands?

Indeed it does, 24 MHz without the reparenting patch, and sound working.

You can have parent of the CLKOUT clock set by the clk core if it is specified in device tree in the PMU (the clkout clock supplier) device node.

Quoted 8 lines

Similarly as we did for the Odroix U3:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/exynos4412-odroid-common.dtsi#n39

Relying on the clk_set_rate() to set the parent clock is not optimal IMO. Presumably you need to set select stable parent clock for clkout like XXTI. But I'm not very familiar with exyno5250 and that might be something different.

Thanks a lot for your suggestion. I'll drop Tushar's patch to allow clkout to be reparent during set_rate then and change his DTS patch to set a default parent for CLKOUT using "assigned-clock-parents".

Best regards,
Javier

#11 lore raw

PATCH 2/6 ASoC: max98088: Add DT bindings

In reply to Andreas Färber

"maxim,max98089" will be used for the Spring Chromebook.

---
 sound/soc/codecs/max98088.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/max98088.c +8 -0
index 805b3f8cd39d..69a21d1946e3 100644
@@ -2009,10 +2009,18 @@ static const struct i2c_device_id max98088_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
 
+static const struct of_device_id max98088_of_match[] = {
+	{ .compatible = "maxim,max98088" },
+	{ .compatible = "maxim,max98089" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, max98088_of_match);
+
 static struct i2c_driver max98088_i2c_driver = {
 	.driver = {
 		.name = "max98088",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(max98088_of_match),
 	},
 	.probe  = max98088_i2c_probe,
 	.remove = max98088_i2c_remove,
Signature · 1 line
2.1.4
#12 lore raw

Re: [PATCH 2/6] ASoC: max98088: Add DT bindings

Hello.

Quoted 12 lines · Andreas Färber

"maxim,max98089" will be used for the Spring Chromebook.

---
  sound/soc/codecs/max98088.c | 8 ++++++++
  1 file changed, 8 insertions(+)
sound/soc/codecs/max98088.c +0 -0
index 805b3f8cd39d..69a21d1946e3 100644

sound/soc/codecs/max98088.c static const struct i2c_device_id max98088_i2c_id[] = { · line 2012

Quoted 4 lines
sound/soc/codecs/max98088.c +1 -0
@@ -2009,10 +2009,18 @@ static const struct i2c_device_id max98088_i2c_id[] = {
  };
  MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
 
+static const struct of_device_id max98088_of_match[] = {

If I don't mistake, gcc will complain about this variable being unused if
CONFIG_OF=n.

sound/soc/codecs/max98088.c static const struct i2c_device_id max98088_i2c_id[] = { · line 2023

Quoted 11 lines
sound/soc/codecs/max98088.c +7 -0
+	{ .compatible = "maxim,max98088" },
+	{ .compatible = "maxim,max98089" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, max98088_of_match);
+
  static struct i2c_driver max98088_i2c_driver = {
  	.driver = {
  		.name = "max98088",
  		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(max98088_of_match),

You probably don;t need of_match_ptr(). Either that or do something with
the match table, like enclosing into #ifdef or annotating with '__maybe_unused'.

[...]

WBR, Sergei

#13 lore raw

Re: [PATCH 2/6] ASoC: max98088: Add DT bindings

Hi,

Am 18.02.2015 um 20:08 schrieb Sergei Shtylyov:

Quoted 18 lines · Andreas Färber
Quoted 17 lines

"maxim,max98089" will be used for the Spring Chromebook.

---
  sound/soc/codecs/max98088.c | 8 ++++++++
  1 file changed, 8 insertions(+)
sound/soc/codecs/max98088.c +0 -0
index 805b3f8cd39d..69a21d1946e3 100644
@@ -2009,10 +2009,18 @@ static const struct i2c_device_id
 max98088_i2c_id[] = {
  };
  MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
 
Quoted 4 lines

sound/soc/codecs/max98088.c static const struct i2c_device_id max98088_i2c_id[] = { · line 2012

Quoted 1 line
sound/soc/codecs/max98088.c +1 -0
+static const struct of_device_id max98088_of_match[] = {

If I don't mistake, gcc will complain about this variable being
unused if CONFIG_OF=n.

I assume there will be no warning because of the "const". For just "static" you would be right.

Quoted 7 lines
Quoted 7 lines
sound/soc/codecs/max98088.c +6 -0
+    { .compatible = "maxim,max98088" },
+    { .compatible = "maxim,max98089" },
+    { }
+};
+MODULE_DEVICE_TABLE(of, max98088_of_match);
+
  static struct i2c_driver max98088_i2c_driver = {
Quoted 8 lines

sound/soc/codecs/max98088.c static const struct i2c_device_id max98088_i2c_id[] = { · line 2023

Quoted 4 lines
sound/soc/codecs/max98088.c +1 -0
      .driver = {
          .name = "max98088",
          .owner = THIS_MODULE,
+        .of_match_table = of_match_ptr(max98088_of_match),

You probably don;t need of_match_ptr(). Either that or do something
with the match table, like enclosing into #ifdef or annotating with '__maybe_unused'.

This was copied from max98090 and max98095.

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#14 lore raw

PATCH 1/1 ASoC: max98088: Add master clock handling

In reply to Andreas Färber

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

---
 sound/soc/codecs/max98088.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
sound/soc/codecs/max98088.c +24 -0
index 69a21d1946e3..1aa81321afba 100644
@@ -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;
@@ -1361,6 +1363,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)..
@@ -1568,6 +1575,19 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
 		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 (codec->dapm.bias_level == SND_SOC_BIAS_ON)
+				clk_disable_unprepare(max98088->mclk);
+			else
+				clk_prepare_enable(max98088->mclk);
+		}
 		break;
 
 	case SND_SOC_BIAS_STANDBY:
@@ -1900,6 +1920,10 @@ static int max98088_probe(struct snd_soc_codec *codec)
        max98088->sysclk = (unsigned)-1;
        max98088->eq_textcnt = 0;
 
+       max98088->mclk = devm_clk_get(codec->dev, "mclk");
+       if (PTR_ERR(max98088->mclk) == -EPROBE_DEFER)
+               return -EPROBE_DEFER;
+
        cdata = &max98088->dai[0];
        cdata->rate = (unsigned)-1;
        cdata->fmt  = (unsigned)-1;
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#15 lore raw

Re: [alsa-devel] [PATCH] ASoC: max98088: Add master clock handling

Quoted 9 lines · Andreas Färber

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

---
 sound/soc/codecs/max98088.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Looks good.

Signature · 1 line
Tushar Behera
#16 lore raw

Re: [alsa-devel] [PATCH] ASoC: max98088: Add master clock handling

Hello,

Quoted 11 lines · Tushar Behera
Quoted 9 lines · Andreas Färber

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

---
 sound/soc/codecs/max98088.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
Quoted 4 lines

Looks good.

Looks good to me as well.

Best regards,
Javier

#17 lore raw

Re: [alsa-devel] [PATCH] ASoC: max98088: Add master clock handling

Hi,

Am 23.02.2015 um 09:29 schrieb Javier Martinez Canillas:

Quoted 12 lines · Tushar Behera
Quoted 11 lines · Andreas Färber
Quoted 9 lines

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

---
 sound/soc/codecs/max98088.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
Quoted 8 lines
Quoted 4 lines

Looks good.

Looks good to me as well.

Thanks guys. One self-doubt: Is there any downside to returning -EPROBE_DEFER after regcache_mark_dirty(max98088->regmap)? I.e., should I move the last hunk some lines up to be the very first thing executed?

Cheers,
Andreas

Signature · 7 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#18 lore raw

PATCH 3/6 ARM: dts: Add max98089 to exynos5250-spring

In reply to Andreas Färber
---
 arch/arm/boot/dts/exynos5250-spring.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/exynos5250-spring.dts +5 -0
index d075a68ac078..866beb4e0597 100644
@@ -400,6 +400,11 @@
 	samsung,i2c-sda-delay = <100>;
 	samsung,i2c-max-bus-freq = <66000>;
 
+	max98089: codec@10 {
+		compatible = "maxim,max98089", "maxim,max98088";
+		reg = <0x10>;
+	};
+
 	temperature-sensor@4c {
 		compatible = "gmt,g781";
 		reg = <0x4c>;
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#19 lore raw

PATCH 4/6 ASoC: samsung: Document binding for max98089 based Snow driver

In reply to Andreas Färber
---
 Documentation/devicetree/bindings/sound/snow.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/snow.txt +1 -0
index 6df74f15687f..1430a6bdb2ae 100644
@@ -2,6 +2,7 @@ Audio Binding for Snow boards
 
 Required properties:
 - compatible : Can be one of the following,
+			"google,snow-audio-max98089" or
 			"google,snow-audio-max98090" or
 			"google,snow-audio-max98091" or
 			"google,snow-audio-max98095"
Signature · 1 line
2.1.4
Acked-by on v1 4/6
#20 lore raw

Re: [alsa-devel] [PATCH 4/6] ASoC: samsung: Document binding for max98089 based Snow driver

Quoted 11 lines · Andreas Färber
---
 Documentation/devicetree/bindings/sound/snow.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/snow.txt +0 -0
index 6df74f15687f..1430a6bdb2ae 100644

Documentation/devicetree/bindings/sound/snow.txt Audio Binding for Snow boards · line 8

Quoted 7 lines
Documentation/devicetree/bindings/sound/snow.txt +1 -0
@@ -2,6 +2,7 @@ Audio Binding for Snow boards
 
 Required properties:
 - compatible : Can be one of the following,
+			"google,snow-audio-max98089" or
 			"google,snow-audio-max98090" or
 			"google,snow-audio-max98091" or
 			"google,snow-audio-max98095"

Looks good.

Signature · 5 lines
Tushar Behera
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#21 lore raw

PATCH 5/6 ASoC: samsung: Extend Snow driver to support max98089

In reply to Andreas Färber

This is needed for Spring.

---
 sound/soc/samsung/Kconfig | 1 +
 sound/soc/samsung/snow.c  | 1 +
 2 files changed, 2 insertions(+)
sound/soc/samsung/Kconfig +1 -0
index 3cebf6ca03df..222181655e4f 100644
@@ -214,6 +214,7 @@ config SND_SOC_LITTLEMILL
 config SND_SOC_SNOW
 	tristate "Audio support for Google Snow boards"
 	depends on SND_SOC_SAMSUNG && I2C
+	select SND_SOC_MAX98088
 	select SND_SOC_MAX98090
 	select SND_SOC_MAX98095
 	select SND_SAMSUNG_I2S
sound/soc/samsung/snow.c +1 -0
index 7651dc924161..89d7e39b206e 100644
@@ -105,6 +105,7 @@ static int snow_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id snow_of_match[] = {
+	{ .compatible = "google,snow-audio-max98089", },
 	{ .compatible = "google,snow-audio-max98090", },
 	{ .compatible = "google,snow-audio-max98091", },
 	{ .compatible = "google,snow-audio-max98095", },
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#22 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

sound/soc/samsung/snow.c static int snow_probe(struct platform_device *pdev) · line 111

Quoted 5 lines · Andreas F?rber

static const struct of_device_id snow_of_match[] = {

sound/soc/samsung/snow.c +1 -0
+	{ .compatible = "google,snow-audio-max98089", },
 	{ .compatible = "google,snow-audio-max98090", },
 	{ .compatible = "google,snow-audio-max98091", },
 	{ .compatible = "google,snow-audio-max98095", },

Since we completely ignore the CODEC in the property might it not be
better to just add a plain old snow-audio compatible and bind to that,
that way we don't need these driver updates? Just the "snow" bit should
be enough to know it's one of this class of machines.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150219/738f8ed8/attachment.sig>

#23 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

Am 19.02.2015 um 10:44 schrieb Mark Brown:

Quoted 12 lines · Andreas Färber

sound/soc/samsung/snow.c static int snow_probe(struct platform_device *pdev) · line 111

Quoted 6 lines

static const struct of_device_id snow_of_match[] = {

sound/soc/samsung/snow.c +1 -0
+	{ .compatible = "google,snow-audio-max98089", },
 	{ .compatible = "google,snow-audio-max98090", },
 	{ .compatible = "google,snow-audio-max98091", },
 	{ .compatible = "google,snow-audio-max98095", },

Since we completely ignore the CODEC in the property might it not be better to just add a plain old snow-audio compatible and bind to that, that way we don't need these driver updates? Just the "snow" bit should be enough to know it's one of this class of machines.

Personally I don't mind either way, but I'd rather leave that decision to Google/Samsung people.

With all those Tegra and Rockchip based Chromebooks popping up, are there any further Exynos based Chromebooks planned using this driver, or is it the last of its kind?

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#24 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

In reply to Mark Brown

Mark,

Quoted 8 lines · Mark Brown
Quoted 5 lines · Andreas Färber

static const struct of_device_id snow_of_match[] = {
+ { .compatible = "google,snow-audio-max98089", },

      { .compatible = "google,snow-audio-max98090", },
      { .compatible = "google,snow-audio-max98091", },
      { .compatible = "google,snow-audio-max98095", },
Quoted 4 lines

Since we completely ignore the CODEC in the property might it not be better to just add a plain old snow-audio compatible and bind to that, that way we don't need these driver updates? Just the "snow" bit should be enough to know it's one of this class of machines.

I think what you're suggesting is that here we should add a new compatible string "google,snow-audio" instead of adding "google,snow-audio-max98089" here. Then the sound node in the spring DTS would look like:

  compatible = "google,snow-audio-max98089", "google,snow-audio";

That would allow us to later figure out that we're on a board with max98089 in case it became important but means that any other minor tweaks like this wouldn't need anything special. I haven't tried that to make sure that the fallback compatible string actually works in this case, but it seems like the right way to go...

Sound good?

-Doug
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

Am 19.02.2015 um 18:44 schrieb Doug Anderson:

Quoted 14 lines · Mark Brown
Quoted 8 lines · Andreas Färber
Quoted 6 lines

static const struct of_device_id snow_of_match[] = {
+ { .compatible = "google,snow-audio-max98089", },

      { .compatible = "google,snow-audio-max98090", },
      { .compatible = "google,snow-audio-max98091", },
      { .compatible = "google,snow-audio-max98095", },
Quoted 4 lines

Since we completely ignore the CODEC in the property might it not be better to just add a plain old snow-audio compatible and bind to that, that way we don't need these driver updates? Just the "snow" bit should be enough to know it's one of this class of machines.

Quoted 6 lines

I think what you're suggesting is that here we should add a new compatible string "google,snow-audio" instead of adding "google,snow-audio-max98089" here. Then the sound node in the spring DTS would look like:

  compatible = "google,snow-audio-max98089", "google,snow-audio";

If we want to be specific just in case, was it an active decision not to use "google,peach-pi[t]-audio-max98..."?

Again, either way works for me.

Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#26 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

Andreas,

Quoted 20 lines · Andreas Färber

Am 19.02.2015 um 18:44 schrieb Doug Anderson:

Quoted 19 lines · Mark Brown
Quoted 8 lines · Andreas Färber
Quoted 6 lines

static const struct of_device_id snow_of_match[] = {
+ { .compatible = "google,snow-audio-max98089", },

      { .compatible = "google,snow-audio-max98090", },
      { .compatible = "google,snow-audio-max98091", },
      { .compatible = "google,snow-audio-max98095", },
Quoted 4 lines

Since we completely ignore the CODEC in the property might it not be better to just add a plain old snow-audio compatible and bind to that, that way we don't need these driver updates? Just the "snow" bit should be enough to know it's one of this class of machines.

I think what you're suggesting is that here we should add a new compatible string "google,snow-audio" instead of adding "google,snow-audio-max98089" here. Then the sound node in the spring DTS would look like:

Quoted 6 lines
Quoted 1 line
  compatible = "google,snow-audio-max98089", "google,snow-audio";

If we want to be specific just in case, was it an active decision not to use "google,peach-pi[t]-audio-max98..."?

Again, either way works for me.

I don't think it was an active decision, but I am certainly nowhere near an audio expert and I don't think I made that particular decision (I could be wrong).

One could make the argument that "snow" describes the general hookup style of the hardware and then you list the actual codec after that, but that's a pretty weak argument...

-Doug
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#27 lore raw

Re: [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089

In reply to Doug Anderson
Quoted 8 lines · Doug Anderson

On Thu, Feb 19, 2015 at 1:44 AM, Mark Brown <[email protected]> wrote:

I think what you're suggesting is that here we should add a new compatible string "google,snow-audio" instead of adding "google,snow-audio-max98089" here. Then the sound node in the spring DTS would look like:

  compatible = "google,snow-audio-max98089", "google,snow-audio";

Yes.

#28 lore raw

PATCH 6/6 ARM: dts: Add sound support to exynos5250-spring

In reply to Andreas Färber
---
 arch/arm/boot/dts/exynos5250-spring.dts | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/exynos5250-spring.dts +25 -0
index 866beb4e0597..142e0550e223 100644
@@ -49,6 +49,17 @@
 		};
 	};
 
+	sound {
+		compatible = "google,snow-audio-max98089";
+		samsung,model = "Spring-I2S-MAX98089";
+		samsung,i2s-controller = <&i2s0>;
+		samsung,audio-codec = <&max98089>;
+		clocks = <&pmu_system_controller 0>;
+		clock-names = "mclk";
+		pinctrl-names = "default";
+		pinctrl-0 = <&mic_det_gpio>, <&hp_det_gpio>;
+	};
+
 	usb-hub {
 		compatible = "smsc,usb3503a";
 		reset-gpios = <&gpe1 0 GPIO_ACTIVE_LOW>;
@@ -499,6 +510,20 @@
 		samsung,pin-drv = <0>;
 	};
 
+	mic_det_gpio: mic-det-gpio {
+		samsung,pins = "gpx2-0";
+		samsung,pin-function = <0>;
+		samsung,pin-pud = <0>;
+		samsung,pin-drv = <0>;
+	};
+
+	hp_det_gpio: hp-det-gpio {
+		samsung,pins = "gpx2-2";
+		samsung,pin-function = <0>;
+		samsung,pin-pud = <0>;
+		samsung,pin-drv = <0>;
+	};
+
 	s5m8767_ds: s5m8767-ds {
 		samsung,pins = "gpx2-3", "gpx2-4", "gpx2-5";
 		samsung,pin-function = <0>;
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#29 lore raw

Re: [PATCH 6/6] ARM: dts: Add sound support to exynos5250-spring

Hello Andreas,

Quoted 10 lines · Andreas Färber
---
 arch/arm/boot/dts/exynos5250-spring.dts | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/exynos5250-spring.dts +0 -0
index 866beb4e0597..142e0550e223 100644

arch/arm/boot/dts/exynos5250-spring.dts line 58

Quoted 10 lines
arch/arm/boot/dts/exynos5250-spring.dts +7 -0
@@ -49,6 +49,17 @@
 		};
 	};
 
+	sound {
+		compatible = "google,snow-audio-max98089";
+		samsung,model = "Spring-I2S-MAX98089";
+		samsung,i2s-controller = <&i2s0>;
+		samsung,audio-codec = <&max98089>;
+		clocks = <&pmu_system_controller 0>;
+		clock-names = "mclk";

Related to my comment in patch 1/6, "mclk" should be defined in the codec device node. I know that you probably used as a reference Tushar's patch
[0] I posted recently but I just figured out that his dependency patch [1] mentioned in [2] handled the master clock in the ASoC machine driver but the final version merged handled it in the codec drivers.

I asked Kukjin to drop the patch to Snow and Peach Pit/Pi and will post a correct version as a part of a series once I've sound working.

arch/arm/boot/dts/exynos5250-spring.dts line 62

Quoted 4 lines
arch/arm/boot/dts/exynos5250-spring.dts +4 -0
+		pinctrl-names = "default";
+		pinctrl-0 = <&mic_det_gpio>, <&hp_det_gpio>;
+	};
+

The mic and headphone jack detection are still not supported in the Snow ASoC machine driver so this pinctrl are not needed but I guess it doesn't hurt to have them mux'ed too.

Best regards,
Javier

[0]: https://lkml.org/lkml/2015/2/6/495
[1]: https://lkml.org/lkml/2014/5/20/4
[2]: https://patches.linaro.org/30406/