2023-03-03 10:04:21

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 0/3] Add "mclk" support for maxim,max9867

This series adds support for the clocks properties in the
maxim,max9867 bindings. Furthermore the binding definitions are
converted from txt to yaml.

The clock property is needed to define the mclk for one of our
boards which uses the the i.MX8MP SAI MCLK as clock for the
maxim,max9867.

ChangeLog:
v2:
- dt-bindings:
- add "additionalProperties: false" property
- remove "clock-names" property
- fix $id
- fix example
- max9867:
- Enable and prepare mclk on SND_SOC_BIAS_ON
- disable and unprepare mclk on SND_SOC_BIAS_OFF
- drop "mclk" clock-name

Signed-off-by: Richard Leitner <[email protected]>
---
Benjamin Bara (1):
ASoC: maxim,max9867: add "mclk" support

Richard Leitner (2):
ASoC: dt-bindings: maxim,max9867: convert txt bindings to yaml
ASoC: dt-bindings: maxim,max9867: add clocks property

.../devicetree/bindings/sound/max9867.txt | 17 ------
.../devicetree/bindings/sound/maxim,max9867.yaml | 66 ++++++++++++++++++++++
sound/soc/codecs/max9867.c | 19 ++++++-
3 files changed, 83 insertions(+), 19 deletions(-)
---
base-commit: c9c3395d5e3dcc6daee66c6908354d47bf98cb0c
change-id: 20230302-max9867-49081908a2ab

Best regards,
--
Richard Leitner <[email protected]>



2023-03-03 10:04:23

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 1/3] ASoC: dt-bindings: maxim,max9867: convert txt bindings to yaml

From: Richard Leitner <[email protected]>

Convert from max9867.txt to maxim,max9867.yaml and add missing
'#sound-dai-cells' property.

Signed-off-by: Richard Leitner <[email protected]>
---
.../devicetree/bindings/sound/max9867.txt | 17 -------
.../devicetree/bindings/sound/maxim,max9867.yaml | 55 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/max9867.txt b/Documentation/devicetree/bindings/sound/max9867.txt
deleted file mode 100644
index b8bd914ee697..000000000000
--- a/Documentation/devicetree/bindings/sound/max9867.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-max9867 codec
-
-This device supports I2C mode only.
-
-Required properties:
-
-- compatible : "maxim,max9867"
-- reg : The chip select number on the I2C bus
-
-Example:
-
-&i2c {
- max9867: max9867@18 {
- compatible = "maxim,max9867";
- reg = <0x18>;
- };
-};
diff --git a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
new file mode 100644
index 000000000000..74cd163546ec
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/maxim,max9867.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX9867 CODEC
+
+description: |
+ This device supports I2C only.
+ Pins on the device (for linking into audio routes):
+ * LOUT
+ * ROUT
+ * LINL
+ * LINR
+ * MICL
+ * MICR
+ * DMICL
+ * DMICR
+
+maintainers:
+ - Ladislav Michl <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ compatible:
+ enum:
+ - maxim,max9867
+
+ '#sound-dai-cells':
+ const: 0
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ codec@18 {
+ compatible = "maxim,max9867";
+ #sound-dai-cells = <0>;
+ reg = <0x18>;
+ };
+ };
+...

--
2.39.2


2023-03-03 10:04:26

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 2/3] ASoC: dt-bindings: maxim,max9867: add clocks property

From: Richard Leitner <[email protected]>

Add clocks property to require a "mclk" definition for the
maxim,max9867 codec.

Signed-off-by: Richard Leitner <[email protected]>
---
Documentation/devicetree/bindings/sound/maxim,max9867.yaml | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
index 74cd163546ec..6f27029b137d 100644
--- a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
+++ b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
@@ -35,9 +35,13 @@ properties:
reg:
maxItems: 1

+ clocks:
+ maxItems: 1
+
required:
- compatible
- reg
+ - clocks

additionalProperties: false

@@ -50,6 +54,13 @@ examples:
compatible = "maxim,max9867";
#sound-dai-cells = <0>;
reg = <0x18>;
+ clocks = <&codec_clk>;
};
};
+
+ codec_clk: clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <12288000>;
+ };
...

--
2.39.2


2023-03-03 10:04:37

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 3/3] ASoC: maxim,max9867: add "mclk" support

From: Benjamin Bara <[email protected]>

Add basic support for the codecs' mclk.
Enable it on SND_SOC_BIAS_ON, disable it on SND_SOC_BIAS_OFF.

Signed-off-by: Benjamin Bara <[email protected]>
Signed-off-by: Richard Leitner <[email protected]>
---
sound/soc/codecs/max9867.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index e161ab037bf7..ae552d72beec 100644
--- a/sound/soc/codecs/max9867.c
+++ b/sound/soc/codecs/max9867.c
@@ -6,6 +6,7 @@
// Copyright 2018 Ladislav Michl <[email protected]>
//

+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
@@ -16,6 +17,7 @@
#include "max9867.h"

struct max9867_priv {
+ struct clk *mclk;
struct regmap *regmap;
const struct snd_pcm_hw_constraint_list *constraints;
unsigned int sysclk, pclk;
@@ -577,6 +579,11 @@ static int max9867_set_bias_level(struct snd_soc_component *component,
struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);

switch (level) {
+ case SND_SOC_BIAS_ON:
+ err = clk_prepare_enable(max9867->mclk);
+ if (err)
+ return err;
+ break;
case SND_SOC_BIAS_STANDBY:
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
err = regcache_sync(max9867->regmap);
@@ -595,6 +602,7 @@ static int max9867_set_bias_level(struct snd_soc_component *component,
return err;

regcache_mark_dirty(max9867->regmap);
+ clk_disable_unprepare(max9867->mclk);
break;
default:
break;
@@ -663,9 +671,16 @@ static int max9867_i2c_probe(struct i2c_client *i2c)
dev_info(&i2c->dev, "device revision: %x\n", reg);
ret = devm_snd_soc_register_component(&i2c->dev, &max9867_component,
max9867_dai, ARRAY_SIZE(max9867_dai));
- if (ret < 0)
+ if (ret < 0) {
dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
- return ret;
+ return ret;
+ }
+
+ max9867->mclk = devm_clk_get(&i2c->dev, NULL);
+ if (IS_ERR(max9867->mclk))
+ return PTR_ERR(max9867->mclk);
+
+ return 0;
}

static const struct i2c_device_id max9867_i2c_id[] = {

--
2.39.2


2023-03-03 10:08:17

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] ASoC: dt-bindings: maxim,max9867: convert txt bindings to yaml

On 03/03/2023 11:04, [email protected] wrote:
> From: Richard Leitner <[email protected]>
>
> Convert from max9867.txt to maxim,max9867.yaml and add missing
> '#sound-dai-cells' property.
>
> Signed-off-by: Richard Leitner <[email protected]>
> ---
> .../devicetree/bindings/sound/max9867.txt | 17 -------
> .../devicetree/bindings/sound/maxim,max9867.yaml | 55 ++++++++++++++++++++++
> 2 files changed, 55 insertions(+), 17 deletions(-)
>

Looks ok. Need to wait for Rob's bot to check for issues.


Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-03 10:09:23

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ASoC: dt-bindings: maxim,max9867: add clocks property

On 03/03/2023 11:04, [email protected] wrote:
> From: Richard Leitner <[email protected]>
>
> Add clocks property to require a "mclk" definition for the
> maxim,max9867 codec.

But why? You just wrote what the patch does, which is easy to see.
Commit msgs should explain why you are doing something.

>
> Signed-off-by: Richard Leitner <[email protected]>
> ---
> Documentation/devicetree/bindings/sound/maxim,max9867.yaml | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> index 74cd163546ec..6f27029b137d 100644
> --- a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> +++ b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> @@ -35,9 +35,13 @@ properties:
> reg:
> maxItems: 1
>
> + clocks:
> + maxItems: 1
> +
> required:
> - compatible
> - reg
> + - clocks
>
> additionalProperties: false
>
> @@ -50,6 +54,13 @@ examples:
> compatible = "maxim,max9867";
> #sound-dai-cells = <0>;
> reg = <0x18>;
> + clocks = <&codec_clk>;
> };
> };
> +
> + codec_clk: clock {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <12288000>;

Drop the node, it's entirely common/regular stuff.

Best regards,
Krzysztof


2023-03-03 10:19:13

by Richard Leitner

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ASoC: dt-bindings: maxim,max9867: add clocks property

Hi Krzysztof,
thanks for the review and quick response!

On Fri, Mar 03, 2023 at 11:09:15AM +0100, Krzysztof Kozlowski wrote:
> On 03/03/2023 11:04, [email protected] wrote:
> > From: Richard Leitner <[email protected]>
> >
> > Add clocks property to require a "mclk" definition for the
> > maxim,max9867 codec.
>
> But why? You just wrote what the patch does, which is easy to see.
> Commit msgs should explain why you are doing something.

Ok. Will adapt the message in v3.

>
> >
> > Signed-off-by: Richard Leitner <[email protected]>
> > ---
> > Documentation/devicetree/bindings/sound/maxim,max9867.yaml | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> > index 74cd163546ec..6f27029b137d 100644
> > --- a/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> > +++ b/Documentation/devicetree/bindings/sound/maxim,max9867.yaml
> > @@ -35,9 +35,13 @@ properties:
> > reg:
> > maxItems: 1
> >
> > + clocks:
> > + maxItems: 1
> > +
> > required:
> > - compatible
> > - reg
> > + - clocks
> >
> > additionalProperties: false
> >
> > @@ -50,6 +54,13 @@ examples:
> > compatible = "maxim,max9867";
> > #sound-dai-cells = <0>;
> > reg = <0x18>;
> > + clocks = <&codec_clk>;
> > };
> > };
> > +
> > + codec_clk: clock {
> > + compatible = "fixed-clock";
> > + #clock-cells = <0>;
> > + clock-frequency = <12288000>;
>
> Drop the node, it's entirely common/regular stuff.

True. I thought it is nessecary for
"make DT_CHECKER_FLAGS=-m dt_binding_check"
to succeed. But I just learned it in fact isn't.
Thanks for the pointer and that eureka moment ????.

Will fix that in v3.

>
> Best regards,
> Krzysztof
>

regards;rl

2023-03-06 13:32:57

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Add "mclk" support for maxim,max9867

On Fri, 03 Mar 2023 11:04:00 +0100, [email protected] wrote:
> This series adds support for the clocks properties in the
> maxim,max9867 bindings. Furthermore the binding definitions are
> converted from txt to yaml.
>
> The clock property is needed to define the mclk for one of our
> boards which uses the the i.MX8MP SAI MCLK as clock for the
> maxim,max9867.
>
> [...]

Applied to

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

Thanks!

[1/3] ASoC: dt-bindings: maxim,max9867: convert txt bindings to yaml
commit: 6668f70abeea30f4674b2fdbc4232d5c3611b272
[2/3] ASoC: dt-bindings: maxim,max9867: add clocks property
commit: d63e55b3e8ec90da69107f32038f3059d7317cc5
[3/3] ASoC: maxim,max9867: add "mclk" support
commit: 448b06ba107d925d59d02781acdd2e4ad12dda0b

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


2023-03-28 06:03:35

by Richard Leitner

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Add "mclk" support for maxim,max9867

Hi Mark, Hi Krzysztof,

sorry for coming back to you on this series, but I have a question on
the "workflow"...

On Mon, Mar 06, 2023 at 01:32:10PM +0000, Mark Brown wrote:
> On Fri, 03 Mar 2023 11:04:00 +0100, [email protected] wrote:
> > This series adds support for the clocks properties in the
> > maxim,max9867 bindings. Furthermore the binding definitions are
> > converted from txt to yaml.
> >
> > The clock property is needed to define the mclk for one of our
> > boards which uses the the i.MX8MP SAI MCLK as clock for the
> > maxim,max9867.
> >
> > [...]
>
> Applied to
>
> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
>
> Thanks!
>
> [1/3] ASoC: dt-bindings: maxim,max9867: convert txt bindings to yaml
> commit: 6668f70abeea30f4674b2fdbc4232d5c3611b272
> [2/3] ASoC: dt-bindings: maxim,max9867: add clocks property
> commit: d63e55b3e8ec90da69107f32038f3059d7317cc5
> [3/3] ASoC: maxim,max9867: add "mclk" support
> commit: 448b06ba107d925d59d02781acdd2e4ad12dda0b
>
> 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.

As Krzysztof requested some changes on the clocks property dt-bindings
patch (#2) commit message... How should I handle this?

The changes requested on the patch content (dts example) should be sent
as incremental patch to the original series, I guess?

see https://lore.kernel.org/lkml/[email protected]/

>
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
>
> Thanks,
> Mark
>

Thanks & regards;rl

2023-03-28 07:42:32

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Add "mclk" support for maxim,max9867

On 28/03/2023 07:59, Richard Leitner wrote:
>> should be sent as incremental updates against current git, existing
>> patches will not be replaced.
>
> As Krzysztof requested some changes on the clocks property dt-bindings
> patch (#2) commit message... How should I handle this?
>
> The changes requested on the patch content (dts example) should be sent
> as incremental patch to the original series, I guess?

Incremental updates, so new patch. Rebase on maintainer's tree next
branch or linux-next (usually linux-next is the easiest but for
cross-tree patches might create inapplicable series).

Best regards,
Krzysztof

2023-03-28 12:43:59

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Add "mclk" support for maxim,max9867

On Tue, Mar 28, 2023 at 07:59:16AM +0200, Richard Leitner wrote:

> As Krzysztof requested some changes on the clocks property dt-bindings
> patch (#2) commit message... How should I handle this?

> The changes requested on the patch content (dts example) should be sent
> as incremental patch to the original series, I guess?

If it's just the commit message it's too late. Otherwise incremental
patches against current git.


Attachments:
(No filename) (437.00 B)
signature.asc (499.00 B)
Download all attachments