From: ChiYuan Huang <cy_huang@richtek.com>
To: Mark Brown <broonie@kernel.org>
Cc: <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
<robh+dt@kernel.org>, <lgirdwood@gmail.com>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] regulator: rt5739: Add DID check and compatible for rt5733
Date: Thu, 29 Jun 2023 09:27:03 +0800 [thread overview]
Message-ID: <20230629012703.GA10948@linuxcarl2.richtek.com> (raw)
In-Reply-To: <2a8732f4-13fe-476d-9ae7-b970bd82c218@sirena.org.uk>
On Wed, Jun 28, 2023 at 12:47:50PM +0100, Mark Brown wrote:
> On Wed, Jun 28, 2023 at 04:47:17PM +0800, cy_huang@richtek.com wrote:
>
> > + if (did == RT5733_CHIPDIE_ID) {
> > + min_uV = RT5733_VOLT_MINUV;
> > + max_uV = RT5733_VOLT_MAXUV;
> > + step_uV = RT5733_VOLT_STPUV;
> > + } else {
> > + min_uV = RT5739_VOLT_MINUV;
> > + max_uV = RT5739_VOLT_MAXUV;
> > + step_uV = RT5739_VOLT_STPUV;
> > + }
>
> It would be better to write these as switch statements so if any more
> variants turn up they can be added more easily.
Since the IC difference is only voltage range and step, They can be retrieved from the
regulator description.
To check DID here may not a good coding.
I may rewrite it as below
max_uV = desc->min_uV + desc->uV_step * (desc->n_voltages - 1);
And put a switch case for DID check in 'init_regulator_desc'.
Is it better?
next prev parent reply other threads:[~2023-06-29 1:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 8:47 [PATCH 0/2] Add support for RT5733 cy_huang
2023-06-28 8:47 ` [PATCH 1/2] regulator: dt-bindings: rt5739: Add compatible for rt5733 cy_huang
2023-06-28 9:38 ` Rob Herring
2023-06-29 2:05 ` ChiYuan Huang
2023-06-28 15:41 ` Rob Herring
2023-06-28 8:47 ` [PATCH 2/2] regulator: rt5739: Add DID check and " cy_huang
2023-06-28 11:47 ` Mark Brown
2023-06-29 1:27 ` ChiYuan Huang [this message]
2023-07-12 14:29 ` [PATCH 0/2] Add support for RT5733 Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230629012703.GA10948@linuxcarl2.richtek.com \
--to=cy_huang@richtek.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).