All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing pins drive strength
@ 2022-05-12 19:13 Dylan Laduranty
  2022-05-12 19:13 ` [PATCH 2/2] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
  2022-05-13  7:07 ` [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing " Sa, Nuno
  0 siblings, 2 replies; 6+ messages in thread
From: Dylan Laduranty @ 2022-05-12 19:13 UTC (permalink / raw)
  To: alsa-devel; +Cc: Dylan Laduranty, nuno.sa

This allows users to change SDATA and both PDM clocks pins drive strength during device probing according to their need.

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
---

Changes since v1: split new bindings and documentation into separate patches

 sound/soc/codecs/adau7118.c | 62 ++++++++++++++++++++++++++++++++++---
 1 file changed, 58 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/adau7118.c b/sound/soc/codecs/adau7118.c
index 841229dcbca1..18c1f246f911 100644
--- a/sound/soc/codecs/adau7118.c
+++ b/sound/soc/codecs/adau7118.c
@@ -29,6 +29,12 @@
 				FIELD_PREP(ADAU7118_LRCLK_BCLK_POL_MASK, x)
 #define ADAU7118_SPT_SLOT_MASK		GENMASK(7, 4)
 #define ADAU7118_SPT_SLOT(x)		FIELD_PREP(ADAU7118_SPT_SLOT_MASK, x)
+#define ADAU7118_DS_PDM_CLK0_MASK	GENMASK(1, 0)
+#define ADAU7118_DS_PDM_CLK0(x)		FIELD_PREP(ADAU7118_DS_PDM_CLK0_MASK, x)
+#define ADAU7118_DS_PDM_CLK1_MASK	GENMASK(3, 2)
+#define ADAU7118_DS_PDM_CLK1(x)		FIELD_PREP(ADAU7118_DS_PDM_CLK1_MASK, x)
+#define ADAU7118_DS_SDATA_MASK		GENMASK(5, 4)
+#define ADAU7118_DS_SDATA(x)		FIELD_PREP(ADAU7118_DS_SDATA_MASK, x)
 #define ADAU7118_FULL_SOFT_R_MASK	BIT(1)
 #define ADAU7118_FULL_SOFT_R(x)		FIELD_PREP(ADAU7118_FULL_SOFT_R_MASK, x)
 
@@ -489,7 +495,7 @@ static int adau7118_regulator_setup(struct adau7118_data *st)
 static int adau7118_parset_dt(const struct adau7118_data *st)
 {
 	int ret;
-	u32 dec_ratio = 0;
+	u32 val32 = 0;
 	/* 4 inputs */
 	u32 clk_map[4], regval;
 
@@ -497,9 +503,9 @@ static int adau7118_parset_dt(const struct adau7118_data *st)
 		return 0;
 
 	ret = device_property_read_u32(st->dev, "adi,decimation-ratio",
-				       &dec_ratio);
+				       &val32);
 	if (!ret) {
-		switch (dec_ratio) {
+		switch (val32) {
 		case 64:
 			regval = ADAU7118_DEC_RATIO(0);
 			break;
@@ -510,7 +516,7 @@ static int adau7118_parset_dt(const struct adau7118_data *st)
 			regval = ADAU7118_DEC_RATIO(2);
 			break;
 		default:
-			dev_err(st->dev, "Invalid dec ratio: %u", dec_ratio);
+			dev_err(st->dev, "Invalid dec ratio: %u", val32);
 			return -EINVAL;
 		}
 
@@ -537,6 +543,54 @@ static int adau7118_parset_dt(const struct adau7118_data *st)
 			return ret;
 	}
 
+	ret = device_property_read_u32(st->dev, "adi,pdm-clk0-ds",
+					&val32);
+	if (!ret) {
+		if (val32 > 3) {
+			dev_err(st->dev, "Invalid pdm-clk0-ds: %u", val32);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(st->map,
+					ADAU7118_REG_DRIVE_STRENGTH,
+					ADAU7118_DS_PDM_CLK0_MASK,
+					ADAU7118_DS_PDM_CLK0(val32));
+		if (ret)
+			return ret;
+	}
+
+	ret = device_property_read_u32(st->dev, "adi,pdm-clk1-ds",
+					&val32);
+	if (!ret) {
+		if (val32 > 3) {
+			dev_err(st->dev, "Invalid pdm-clk1-ds: %u", val32);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(st->map,
+					ADAU7118_REG_DRIVE_STRENGTH,
+					ADAU7118_DS_PDM_CLK1_MASK,
+					ADAU7118_DS_PDM_CLK1(val32));
+		if (ret)
+			return ret;
+	}
+
+	ret = device_property_read_u32(st->dev, "adi,sdata-ds",
+					&val32);
+	if (!ret) {
+		if (val32 > 3) {
+			dev_err(st->dev, "Invalid sdata-ds: %u", val32);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(st->map,
+					ADAU7118_REG_DRIVE_STRENGTH,
+					ADAU7118_DS_SDATA_MASK,
+					ADAU7118_DS_SDATA(val32));
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
-- 
2.17.1


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

* [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-12 19:13 [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing pins drive strength Dylan Laduranty
@ 2022-05-12 19:13 ` Dylan Laduranty
  2022-05-13  7:08   ` Sa, Nuno
  2022-05-13  7:07 ` [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing " Sa, Nuno
  1 sibling, 1 reply; 6+ messages in thread
From: Dylan Laduranty @ 2022-05-12 19:13 UTC (permalink / raw)
  To: alsa-devel; +Cc: Dylan Laduranty, nuno.sa

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
---

Changes since v1:
Add description values table per new entries

 .../bindings/sound/adi,adau7118.yaml          | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/adi,adau7118.yaml b/Documentation/devicetree/bindings/sound/adi,adau7118.yaml
index fb78967ee17b..226693ebd446 100644
--- a/Documentation/devicetree/bindings/sound/adi,adau7118.yaml
+++ b/Documentation/devicetree/bindings/sound/adi,adau7118.yaml
@@ -51,6 +51,42 @@ properties:
       maximum: 1
     default: [0, 0, 1, 1]
 
+  adi,pdm-clk0-ds:
+    description: |
+      This property set the drive strength of PDM CLK0 output pad.
+      Possible values are: 0, 1, 2, 3 as per the following table:
+      0 = 2.5 mA / 3.3V
+      1 =   5 mA / 3.3V
+      2 =  10 mA / 3.3V
+      3 =  25 mA / 3.3V
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [3, 2, 1, 0]
+    default: 2
+
+  adi,pdm-clk1-ds:
+    description: |
+      This property set the drive strength of PDM CLK1 output pad.
+      Possible values are: 0, 1, 2, 3 as per the following table:
+      0 = 2.5 mA / 3.3V
+      1 =   5 mA / 3.3V
+      2 =  10 mA / 3.3V
+      3 =  25 mA / 3.3V
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [3, 2, 1, 0]
+    default: 2
+
+  adi,sdata-ds:
+    description: |
+      This property set the drive strength of SDATA output pad.
+      Possible values are: 0, 1, 2, 3 as per the following table:
+      0 = 2.5 mA / 3.3V
+      1 =   5 mA / 3.3V
+      2 =  10 mA / 3.3V
+      3 =  25 mA / 3.3V
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [3, 2, 1, 0]
+    default: 2
+
 required:
   - "#sound-dai-cells"
   - compatible
@@ -73,6 +109,9 @@ examples:
                 dvdd-supply = <&supply>;
                 adi,pdm-clk-map = <1 1 0 0>;
                 adi,decimation-ratio = <16>;
+                adi,pdm-clk0-ds = <3>;
+                adi,pdm-clk1-ds = <3>;
+                adi,sdata-ds = <3>;
         };
     };
 
-- 
2.17.1


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

* RE: [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing pins drive strength
  2022-05-12 19:13 [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing pins drive strength Dylan Laduranty
  2022-05-12 19:13 ` [PATCH 2/2] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
@ 2022-05-13  7:07 ` Sa, Nuno
  1 sibling, 0 replies; 6+ messages in thread
From: Sa, Nuno @ 2022-05-13  7:07 UTC (permalink / raw)
  To: Dylan Laduranty, alsa-devel

> From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> Sent: Thursday, May 12, 2022 9:14 PM
> To: alsa-devel@alsa-project.org
> Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> <dylan.laduranty@mesotic.com>
> Subject: [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing
> pins drive strength
> 
> [External]
> 
> This allows users to change SDATA and both PDM clocks pins drive
> strength during device probing according to their need.
> 
> Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> ---

I think checkpatch will complain about the length of your commit
message. With that fixed:

Reviewed-by: Nuno Sá <nuno.sa@analog.com>


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

* RE: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-12 19:13 ` [PATCH 2/2] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
@ 2022-05-13  7:08   ` Sa, Nuno
  2022-05-13  7:14     ` Dylan Laduranty
  0 siblings, 1 reply; 6+ messages in thread
From: Sa, Nuno @ 2022-05-13  7:08 UTC (permalink / raw)
  To: Dylan Laduranty, alsa-devel



> -----Original Message-----
> From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> Sent: Thursday, May 12, 2022 9:14 PM
> To: alsa-devel@alsa-project.org
> Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> <dylan.laduranty@mesotic.com>
> Subject: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins
> drive strength
> 
> [External]
> 
> Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> ---
> 

checkpatch will complain about not having a commit message.
With that fixed:

Reviewed-by: Nuno Sá <nuno.sa@analog.com>


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

* Re: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-13  7:08   ` Sa, Nuno
@ 2022-05-13  7:14     ` Dylan Laduranty
  2022-05-13  8:35       ` Sa, Nuno
  0 siblings, 1 reply; 6+ messages in thread
From: Dylan Laduranty @ 2022-05-13  7:14 UTC (permalink / raw)
  To: Sa, Nuno; +Cc: alsa-devel

Le vendredi 13 mai 2022, 09:08:13 CEST Sa, Nuno a écrit :
> > -----Original Message-----
> > From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > Sent: Thursday, May 12, 2022 9:14 PM
> > To: alsa-devel@alsa-project.org
> > Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> > <dylan.laduranty@mesotic.com>
> > Subject: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins
> > drive strength
> > 
> > [External]
> > 
> > Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > ---
> 
> checkpatch will complain about not having a commit message.
> With that fixed:

Oops sorry about that. Should I resend a V2 with a proper commit message for 
this patch (or both patches ?)  Or maybe prepare a V3 with more description 
(and a commit message for this one) ?

> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>

Dylan Laduranty





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

* RE: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-13  7:14     ` Dylan Laduranty
@ 2022-05-13  8:35       ` Sa, Nuno
  0 siblings, 0 replies; 6+ messages in thread
From: Sa, Nuno @ 2022-05-13  8:35 UTC (permalink / raw)
  To: Dylan Laduranty; +Cc: alsa-devel



> -----Original Message-----
> From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> Sent: Friday, May 13, 2022 9:15 AM
> To: Sa, Nuno <Nuno.Sa@analog.com>
> Cc: alsa-devel@alsa-project.org
> Subject: Re: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for
> pins drive strength
> 
> [External]
> 
> Le vendredi 13 mai 2022, 09:08:13 CEST Sa, Nuno a écrit :
> > > -----Original Message-----
> > > From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > > Sent: Thursday, May 12, 2022 9:14 PM
> > > To: alsa-devel@alsa-project.org
> > > Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> > > <dylan.laduranty@mesotic.com>
> > > Subject: [PATCH 2/2] dt-bindings: ADAU7118: add new entries for
> pins
> > > drive strength
> > >
> > > [External]
> > >
> > > Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > > ---
> >
> > checkpatch will complain about not having a commit message.
> > With that fixed:
> 
> Oops sorry about that. Should I resend a V2 with a proper commit
> message for
> this patch (or both patches ?)  Or maybe prepare a V3 with more
> description
> (and a commit message for this one) ?

Well, I think you should have been marked these patches as v2 already :).
Anyways, I'm not sure but I would say you should send a v3 with the
changes in the messages and make sure to keep checkpatch happy.

- Nuno Sá

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

end of thread, other threads:[~2022-05-13  8:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 19:13 [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing pins drive strength Dylan Laduranty
2022-05-12 19:13 ` [PATCH 2/2] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
2022-05-13  7:08   ` Sa, Nuno
2022-05-13  7:14     ` Dylan Laduranty
2022-05-13  8:35       ` Sa, Nuno
2022-05-13  7:07 ` [PATCH 1/2 v2] ASoC: ADAU7118: add bindings for managing " Sa, Nuno

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.