Skip to contentSkip to conversation

ASoC: nau8825: Add ADCOUT IO drive strength control

PATCH In review David Lin 2 participants 6 messages Sep 12, 2022 – Sep 13, 2022

Subsystems (3)
lore
Share & tools
lore

David Lin

author
#0 lore raw

PATCH 1/2 ASoC: nau8825: Add ADCOUT IO drive strength control

Add a property to control the driving of ADCOUT.

---
 sound/soc/codecs/nau8825.c | 6 ++++++
 sound/soc/codecs/nau8825.h | 3 +++
 2 files changed, 9 insertions(+)
sound/soc/codecs/nau8825.c +6 -0
index 8213273f501e..c41ac7b9217b 100644
@@ -1983,6 +1983,10 @@ static void nau8825_init_regs(struct nau8825 *nau8825)
 	/* Disable short Frame Sync detection logic */
 	regmap_update_bits(regmap, NAU8825_REG_LEFT_TIME_SLOT,
 		NAU8825_DIS_FS_SHORT_DET, NAU8825_DIS_FS_SHORT_DET);
+	/* ADCDAT IO drive strength control */
+	regmap_update_bits(regmap, NAU8825_REG_CHARGE_PUMP,
+			   NAU8825_ADCOUT_DS_MASK,
+			   nau8825->adcout_ds << NAU8825_ADCOUT_DS_SFT);
 }
 
 static const struct regmap_config nau8825_regmap_config = {
@@ -2521,6 +2525,7 @@ static void nau8825_print_device_properties(struct nau8825 *nau8825)
 			nau8825->jack_eject_debounce);
 	dev_dbg(dev, "crosstalk-enable:     %d\n",
 			nau8825->xtalk_enable);
+	dev_dbg(dev, "adcout-drive-str:     %d\n", nau8825->adcout_ds);
 }
 
 static int nau8825_read_device_properties(struct device *dev,
@@ -2587,6 +2592,7 @@ static int nau8825_read_device_properties(struct device *dev,
 		nau8825->jack_eject_debounce = 0;
 	nau8825->xtalk_enable = device_property_read_bool(dev,
 		"nuvoton,crosstalk-enable");
+	nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-str");
 
 	nau8825->mclk = devm_clk_get(dev, "mclk");
 	if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) {
sound/soc/codecs/nau8825.h +3 -0
index 887bbff03ec6..6d112b6145df 100644
@@ -418,6 +418,8 @@
 #define NAU8825_POWERUP_HP_DRV_L	(1 << 0)
 
 /* CHARGE_PUMP (0x80) */
+#define NAU8825_ADCOUT_DS_SFT	12
+#define NAU8825_ADCOUT_DS_MASK	(1 << NAU8825_ADCOUT_DS_SFT)
 #define NAU8825_JAMNODCLOW	(1 << 10)
 #define NAU8825_POWER_DOWN_DACR	(1 << 9)
 #define NAU8825_POWER_DOWN_DACL	(1 << 8)
@@ -477,6 +479,7 @@ struct nau8825 {
 	int imp_rms[NAU8825_XTALK_IMM];
 	int xtalk_enable;
 	bool xtalk_baktab_initialized; /* True if initialized. */
+	bool adcout_ds;
 };
 
 int nau8825_enable_jack_detect(struct snd_soc_component *component,
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 ASoC: dt-bindings: nau8825: Add ADCOUT IO drive strength control

Add a property to control the driving of ADCOUT.

---
 Documentation/devicetree/bindings/sound/nau8825.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/sound/nau8825.txt +2 -0
index 388a7bc60b1f..bad7d7c5bb45 100644
@@ -71,6 +71,8 @@ Optional properties:
 
   - nuvoton,crosstalk-enable: make crosstalk function enable if set.
 
+  - nuvoton,adcout-drive-str: make ADCOUT IO drive strength with stronger if set.
+
   - clocks: list of phandle and clock specifier pairs according to common clock bindings for the
       clocks described in clock-names
   - clock-names: should include "mclk" for the MCLK master clock
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 2/2] ASoC: dt-bindings: nau8825: Add ADCOUT IO drive strength control

Documentation/devicetree/bindings/sound/nau8825.txt Optional properties: · line 75

Quoted 2 lines · David Lin
Documentation/devicetree/bindings/sound/nau8825.txt +2 -0
+  - nuvoton,adcout-drive-str: make ADCOUT IO drive strength with stronger if set.
+

This isn't the clearest property name or description TBH. For a device specific setting like this it might be clearer to add a reference to the register bit so it's easier for people to tie the behaviour back to the actual device behaviour change. There's also probably something clearer than "stronger" that could be used here.

Perhaps adding something like "strong" would be good - with the name I'd expected the property to be a numerical strength rather than a boolean.

#3 lore raw

Re: [PATCH 2/2] ASoC: dt-bindings: nau8825: Add ADCOUT IO drive strength control

Quoted 10 lines · Mark Brown

Documentation/devicetree/bindings/sound/nau8825.txt Optional properties: · line 75

Quoted 2 lines · David Lin
Documentation/devicetree/bindings/sound/nau8825.txt +2 -0
+  - nuvoton,adcout-drive-str: make ADCOUT IO drive strength with stronger if set.
+

This isn't the clearest property name or description TBH. For a device specific setting like this it might be clearer to add a reference to the register bit so it's easier for people to tie the behaviour back to the actual device behaviour change. There's also probably something clearer than "stronger" that could be used here.

OK, maybe I should change property name to "adcout-drive-strong" and the description to "make the drive strength of ADCOUT IO PIN strong if set. Otherwise, the drive keeps normal strength.".

Quoted 3 lines

Perhaps adding something like "strong" would be good - with the name I'd expected the property to be a numerical strength rather than a boolean.

From our design, the register just have one bit for this feature, so
the strength just have normal or stronger. Therefore, I use boolean
property for it.
________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: dt-bindings: nau8825: Add ADCOUT IO drive strength control

Quoted 3 lines · On Tue, Sep 13, 2022 at 03:25:39PM +0800, AS50 CTLin0 wrote:

OK, maybe I should change property name to "adcout-drive-strong" and the description to "make the drive strength of ADCOUT IO PIN strong if set. Otherwise, the drive keeps normal strength.".

That sounds good.

Quoted 7 lines
Quoted 3 lines

Perhaps adding something like "strong" would be good - with the name I'd expected the property to be a numerical strength rather than a boolean.

From our design, the register just have one bit for this feature, so the strength just have normal or stronger. Therefore, I use boolean property for it.

Using a boolean property is fine, it just feels weird that it doesn't say specifically what "stronger" means here. I was just thinking adding a note in the description but either way it's not essential.

#5 lore raw

Re: [PATCH 2/2] ASoC: dt-bindings: nau8825: Add ADCOUT IO drive strength control

Quoted 10 lines · Mark Brown
Quoted 3 lines · On Tue, Sep 13, 2022 at 03:25:39PM +0800, AS50 CTLin0 wrote:

OK, maybe I should change property name to "adcout-drive-strong" and the description to "make the drive strength of ADCOUT IO PIN strong if set. Otherwise, the drive keeps normal strength.".

That sounds good.

Quoted 3 lines
Quoted 3 lines

Perhaps adding something like "strong" would be good - with the name I'd expected the property to be a numerical strength rather than a boolean.

Quoted 7 lines
Quoted 3 lines

From our design, the register just have one bit for this feature, so
the strength just have normal or stronger. Therefore, I use boolean property for it.

Using a boolean property is fine, it just feels weird that it doesn't say specifically what "stronger" means here. I was just thinking adding a note in the description but either way it's not essential.

Thanks for your review. It will make the patch more clearly.

I will refine it and send new patches for review.

________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.