All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v3] ASoC: ADAU7118: add bindings for managing pins drive strength
@ 2022-05-17  5:48 Dylan Laduranty
  2022-05-17  5:48 ` [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
  0 siblings, 1 reply; 5+ messages in thread
From: Dylan Laduranty @ 2022-05-17  5:48 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 v2:
 Fixes commit description length

 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] 5+ messages in thread

* [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-17  5:48 [PATCH 1/2 v3] ASoC: ADAU7118: add bindings for managing pins drive strength Dylan Laduranty
@ 2022-05-17  5:48 ` Dylan Laduranty
  2022-05-17  8:18   ` Sa, Nuno
  0 siblings, 1 reply; 5+ messages in thread
From: Dylan Laduranty @ 2022-05-17  5:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Dylan Laduranty, nuno.sa

Update driver doc with new entries for managing pins drive strength.
Add a table to describe possible values for each entry.

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

 Changes since v3:
 Add missing commit description message


 .../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] 5+ messages in thread

* RE: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-17  5:48 ` [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
@ 2022-05-17  8:18   ` Sa, Nuno
  2022-05-17  8:40     ` Dylan Laduranty
  0 siblings, 1 reply; 5+ messages in thread
From: Sa, Nuno @ 2022-05-17  8:18 UTC (permalink / raw)
  To: Dylan Laduranty, alsa-devel@alsa-project.org

Hi Dylan,

> -----Original Message-----
> From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> Sent: Tuesday, May 17, 2022 7:48 AM
> To: alsa-devel@alsa-project.org
> Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> <dylan.laduranty@mesotic.com>
> Subject: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for
> pins drive strength
> 
> [External]
> 
> Update driver doc with new entries for managing pins drive strength.
> Add a table to describe possible values for each entry.
> 
> Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> ---

Just a note for the future. In my previous review I said something
like:

"
... With that fixed:

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

Hence, you could/should have included my 'Reviewed-by' tag in v3.

- Nuno Sá

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

* Re: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-17  8:18   ` Sa, Nuno
@ 2022-05-17  8:40     ` Dylan Laduranty
  2022-05-17  8:43       ` Sa, Nuno
  0 siblings, 1 reply; 5+ messages in thread
From: Dylan Laduranty @ 2022-05-17  8:40 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org, Sa, Nuno

Hi Nuno,

> Hi Dylan,
> 
> > -----Original Message-----
> > From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > Sent: Tuesday, May 17, 2022 7:48 AM
> > To: alsa-devel@alsa-project.org
> > Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> > <dylan.laduranty@mesotic.com>
> > Subject: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for
> > pins drive strength
> > 
> > [External]
> > 
> > Update driver doc with new entries for managing pins drive strength.
> > Add a table to describe possible values for each entry.
> > 
> > Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > ---
> 
> Just a note for the future. In my previous review I said something
> like:
> 
> "
> ... With that fixed:
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> "
> 
> Hence, you could/should have included my 'Reviewed-by' tag in v3.
I apologize, this is my first contribution to Linux kernel so I am not 
comfortable with this yet. I'll resend this serie later today.

> 
> - Nuno Sá

Dylan Laduranty





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

* RE: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for pins drive strength
  2022-05-17  8:40     ` Dylan Laduranty
@ 2022-05-17  8:43       ` Sa, Nuno
  0 siblings, 0 replies; 5+ messages in thread
From: Sa, Nuno @ 2022-05-17  8:43 UTC (permalink / raw)
  To: Dylan Laduranty, alsa-devel@alsa-project.org



> -----Original Message-----
> From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> Sent: Tuesday, May 17, 2022 10:40 AM
> To: alsa-devel@alsa-project.org; Sa, Nuno <Nuno.Sa@analog.com>
> Subject: Re: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries
> for pins drive strength
> 
> [External]
> 
> Hi Nuno,
> 
> > Hi Dylan,
> >
> > > -----Original Message-----
> > > From: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > > Sent: Tuesday, May 17, 2022 7:48 AM
> > > To: alsa-devel@alsa-project.org
> > > Cc: Sa, Nuno <Nuno.Sa@analog.com>; Dylan Laduranty
> > > <dylan.laduranty@mesotic.com>
> > > Subject: [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries
> for
> > > pins drive strength
> > >
> > > [External]
> > >
> > > Update driver doc with new entries for managing pins drive
> strength.
> > > Add a table to describe possible values for each entry.
> > >
> > > Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
> > > ---
> >
> > Just a note for the future. In my previous review I said something
> > like:
> >
> > "
> > ... With that fixed:
> >
> > Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> > "
> >
> > Hence, you could/should have included my 'Reviewed-by' tag in v3.
> I apologize, this is my first contribution to Linux kernel so I am not
> comfortable with this yet. I'll resend this serie later today.
> 
No need to apologize...

I don't think you need to re-send the patches as the maintainer can
apply the tags while applying the patches. So I would not send new
patches unless explicitly requested by the maintainer...

- Nuno Sá 


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-17  5:48 [PATCH 1/2 v3] ASoC: ADAU7118: add bindings for managing pins drive strength Dylan Laduranty
2022-05-17  5:48 ` [PATCH 2/2 v3] dt-bindings: ADAU7118: add new entries for " Dylan Laduranty
2022-05-17  8:18   ` Sa, Nuno
2022-05-17  8:40     ` Dylan Laduranty
2022-05-17  8:43       ` 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.