[6/8] ASoC: rt5682: Support dbvdd and ldo1-in supplies

Message ID 20221028205540.3197304-7-nfraprado@collabora.com
State New
Headers
Series Adjust usage of rt5682(s) power supply properties |

Commit Message

Nícolas F. R. A. Prado Oct. 28, 2022, 8:55 p.m. UTC
  Add support for the dbvdd and ldo1-in supplies.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

 sound/soc/codecs/rt5682.c | 2 ++
 sound/soc/codecs/rt5682.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Comments

AngeloGioacchino Del Regno Oct. 31, 2022, 12:53 p.m. UTC | #1
Il 28/10/22 22:55, Nícolas F. R. A. Prado ha scritto:
> Add support for the dbvdd and ldo1-in supplies.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
  
Mark Brown Oct. 31, 2022, 1:09 p.m. UTC | #2
On Fri, Oct 28, 2022 at 04:55:38PM -0400, Nícolas F. R. A. Prado wrote:

> @@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
>  	"AVDD",
>  	"MICVDD",
>  	"VBAT",
> +	"dbvdd",
> +	"ldo1-in",

Why are we making these inconsistent in style with the other supplies?
  
AngeloGioacchino Del Regno Oct. 31, 2022, 1:41 p.m. UTC | #3
Il 31/10/22 14:09, Mark Brown ha scritto:
> On Fri, Oct 28, 2022 at 04:55:38PM -0400, Nícolas F. R. A. Prado wrote:
> 
>> @@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
>>   	"AVDD",
>>   	"MICVDD",
>>   	"VBAT",
>> +	"dbvdd",
>> +	"ldo1-in",
> 
> Why are we making these inconsistent in style with the other supplies?

Right. That would be the same for rt5682s, and for the entire series. :\

Cheers,
angelo
  
Nícolas F. R. A. Prado Oct. 31, 2022, 4:31 p.m. UTC | #4
On Mon, Oct 31, 2022 at 01:09:28PM +0000, Mark Brown wrote:
> On Fri, Oct 28, 2022 at 04:55:38PM -0400, Nícolas F. R. A. Prado wrote:
> 
> > @@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
> >  	"AVDD",
> >  	"MICVDD",
> >  	"VBAT",
> > +	"dbvdd",
> > +	"ldo1-in",
> 
> Why are we making these inconsistent in style with the other supplies?

In short because the other supplies already have users while these are new ones.
My understanding was that new supplies should have lowercase names, following DT
convention. But I do see the argument on having them all be consistent for a
single driver/binding. If there are no remarks from Rob or Krzysztof I can
change it in the next version.

Thanks,
Nícolas
  
Rob Herring Oct. 31, 2022, 7:09 p.m. UTC | #5
On Mon, Oct 31, 2022 at 12:31:40PM -0400, Nícolas F. R. A. Prado wrote:
> On Mon, Oct 31, 2022 at 01:09:28PM +0000, Mark Brown wrote:
> > On Fri, Oct 28, 2022 at 04:55:38PM -0400, Nícolas F. R. A. Prado wrote:
> > 
> > > @@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
> > >  	"AVDD",
> > >  	"MICVDD",
> > >  	"VBAT",
> > > +	"dbvdd",
> > > +	"ldo1-in",
> > 
> > Why are we making these inconsistent in style with the other supplies?
> 
> In short because the other supplies already have users while these are new ones.
> My understanding was that new supplies should have lowercase names, following DT
> convention. But I do see the argument on having them all be consistent for a
> single driver/binding. If there are no remarks from Rob or Krzysztof I can
> change it in the next version.

We want lowercase and consistency... Between the 2, I pick consistency.

Rob
  
Nícolas F. R. A. Prado Oct. 31, 2022, 7:38 p.m. UTC | #6
On Mon, Oct 31, 2022 at 02:09:38PM -0500, Rob Herring wrote:
> On Mon, Oct 31, 2022 at 12:31:40PM -0400, Nícolas F. R. A. Prado wrote:
> > On Mon, Oct 31, 2022 at 01:09:28PM +0000, Mark Brown wrote:
> > > On Fri, Oct 28, 2022 at 04:55:38PM -0400, Nícolas F. R. A. Prado wrote:
> > > 
> > > > @@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
> > > >  	"AVDD",
> > > >  	"MICVDD",
> > > >  	"VBAT",
> > > > +	"dbvdd",
> > > > +	"ldo1-in",
> > > 
> > > Why are we making these inconsistent in style with the other supplies?
> > 
> > In short because the other supplies already have users while these are new ones.
> > My understanding was that new supplies should have lowercase names, following DT
> > convention. But I do see the argument on having them all be consistent for a
> > single driver/binding. If there are no remarks from Rob or Krzysztof I can
> > change it in the next version.
> 
> We want lowercase and consistency... Between the 2, I pick consistency.

We could have both if we converted the existing ones to lowercase first, but as
I mentioned in [1] this requires using devm_regulator_get_optional() before
falling back, which seemed like an abuse of that API and to unnecessarily
complicate the code.

So leaving the existing ones as they are and just keeping the consistency for
the new ones seems like the way forward.

[1] https://lore.kernel.org/all/20221028211224.iiphmwrpqqs27jr4@notapiano/

Thanks,
Nícolas
  
Mark Brown Oct. 31, 2022, 9:54 p.m. UTC | #7
On Mon, Oct 31, 2022 at 03:38:10PM -0400, Nícolas F. R. A. Prado wrote:

> We could have both if we converted the existing ones to lowercase first, but as
> I mentioned in [1] this requires using devm_regulator_get_optional() before
> falling back, which seemed like an abuse of that API and to unnecessarily
> complicate the code.

Yeah, it's definitely not what the ABI is for and probably more trouble
than it's worth.  We *could* probably write some helpers that handle
legacy supply names to the regulator core code if someone really wanted
to retire old names, that way the complication would be shared between
users which seems more managable but someone would still need the time
and enthusiasm to write the code.
  

Patch

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 2df95e792900..f0a400285dcf 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -35,6 +35,8 @@  const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
 	"AVDD",
 	"MICVDD",
 	"VBAT",
+	"dbvdd",
+	"ldo1-in",
 };
 EXPORT_SYMBOL_GPL(rt5682_supply_names);
 
diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
index 52ff0d9c36c5..d568c6993c33 100644
--- a/sound/soc/codecs/rt5682.h
+++ b/sound/soc/codecs/rt5682.h
@@ -1424,7 +1424,7 @@  enum {
 	RT5682_CLK_SEL_I2S2_ASRC,
 };
 
-#define RT5682_NUM_SUPPLIES 3
+#define RT5682_NUM_SUPPLIES 5
 
 struct rt5682_priv {
 	struct snd_soc_component *component;