From: Mike Looijmans <mike.looijmans@topic.nl>
To: Mark Brown <broonie@kernel.org>
Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Add ltc3562 voltage regulator driver
Date: Fri, 31 Oct 2014 15:07:57 +0100 [thread overview]
Message-ID: <545397BD.1070701@topic.nl> (raw)
In-Reply-To: <20141030165133.GB18557@sirena.org.uk>
On 30-10-2014 17:51, Mark Brown wrote:
> On Thu, Oct 30, 2014 at 12:26:55PM +0100, Mike Looijmans wrote:
>> The ltc3562 is an I2C controlled regulator supporting 4 independent
>> outputs.
>>
>> v2: Prefix "lltc" to devicetree properties. Use the same property names
>> as the ltc3589 driver. Remove default-voltage property. Use
>> devm_register_regulator.
>
> As covered in SubmittingPatches things like this should be after ---.
>
>> +Required properties:
>> +- compatible: "ltc3562"
>
> This needs a vendor in the compatible string.
Will do.
>> +Required child node:
>> +- regulators: Contains four regulator child nodes R400B, R600B, R400A, R600A,
>> + specifying the initialization data as documented in
>> + Documentation/devicetree/bindings/regulator/regulator.txt.
>
> All regulator child nodes should be optional.
>
>> + R600A_reg: R600A {
>> + regulator-name = "R600A";
>
> Remove these regulator-names, this is for the name of the supplies on
> the board not the regulator itself.
>
>> +static int ltc3562_write(struct i2c_client *i2c, u8 reg_a, u8 reg_b);
>> +static int ltc3562_dummy_write(struct i2c_client *i2c);
>
> This appears to be reimplementing regmap (including a cache). Please
> use that instead. Pretty much the entire driver could then be replaced
> with the regmap helpers, none of the operations look like they'd be
> needed, and you'd get the regmap diagnostic infrastructure.
The chip doesn't have an I2C register map, it uses "commands".
It does not support read transactions at all, it will NACK those. The
first byte contains a bit mask that tells which outputs are to be
configured and in what mode, the next is the enable bit and setpoint
value. The first byte already contains data, it's not just an address.
I would have used regmap if I thought it'd help (if only for the
diagnostics), but it simply doesn't fit here.
If you insist, I can probably get it to fit on regmap, but that would
still mean implementing some custom write method that translates between
some non-existing registry format and what the chip really wants.
>> + np = of_node_get(i2c->dev.of_node);
>> + np_regulators = of_get_child_by_name(np, "regulators");
>
>> + np_child = of_get_child_by_name(np_regulators,
>> + ltc3562_regulators[i].name);
>> + if (np_child == NULL) {
>
> Use the core support for looking up constraints please - set
> regulators_node and so on.
I'll dig into it, seems that there's more infrastructure here to use.
>> +static struct i2c_driver ltc3562_i2c_driver = {
>> + .driver = {
>> + .name = "LTC3562",
>> + .owner = THIS_MODULE,
>> + },
>> + .probe = ltc3562_i2c_probe,
>> + .id_table = ltc3562_i2c_id,
>> +};
>
> You need to supply an of_match_table too.
Hmm, that would explain why I couldn't get it to work using
"lltc,ltc3562" during our first attempts at the driver.
--
Mike Looijmans
next prev parent reply other threads:[~2014-10-31 14:16 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 8:15 Add ltc3562 voltage regulator driver Mike Looijmans
2014-10-29 8:16 ` [PATCH] " Mike Looijmans
2014-10-29 12:30 ` Mark Brown
2014-10-30 6:47 ` Mike Looijmans
2014-10-30 10:15 ` Mark Brown
2014-10-30 10:29 ` Mike Looijmans
2014-10-30 10:53 ` Mike Looijmans
2014-10-30 10:58 ` Mark Brown
2014-10-30 11:31 ` Mike Looijmans
2014-10-30 12:04 ` Mark Brown
2014-10-30 11:26 ` [PATCH v2] " Mike Looijmans
2014-10-30 16:51 ` Mark Brown
2014-10-31 14:07 ` Mike Looijmans [this message]
2014-10-31 18:17 ` Mark Brown
2014-11-03 8:10 ` Mike Looijmans
2014-11-03 12:09 ` Mark Brown
2014-11-03 14:48 ` Mike Looijmans
2014-11-03 15:10 ` Mark Brown
2014-11-03 17:38 ` Mike Looijmans
2014-11-04 8:55 ` Mike Looijmans
2014-11-04 11:34 ` Mark Brown
2014-11-04 12:47 ` Mike Looijmans
2014-11-04 13:35 ` Mike Looijmans
2014-11-04 19:47 ` Mark Brown
2014-11-05 9:06 ` Krzysztof Kozlowski
2014-11-05 11:45 ` Mike Looijmans
2014-11-04 6:50 ` [PATCH v3] " Mike Looijmans
2014-11-04 20:26 ` Mark Brown
2014-11-05 11:41 ` Mike Looijmans
2014-11-05 13:34 ` Mark Brown
2014-10-29 10:03 ` 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=545397BD.1070701@topic.nl \
--to=mike.looijmans@topic.nl \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.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).