From: Zev Weiss <zev@bewilderbeest.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH v2 2/2] misc: Add power-efuse driver
Date: Tue, 8 Mar 2022 00:23:43 -0800 [thread overview]
Message-ID: <YicSj3ZuetRkYxH1@hatter.bewilderbeest.net> (raw)
In-Reply-To: <YicAzSara5Sr3LQ7@kroah.com>
On Mon, Mar 07, 2022 at 11:07:57PM PST, Greg Kroah-Hartman wrote:
>On Mon, Mar 07, 2022 at 05:18:10PM -0800, Zev Weiss wrote:
>> +static DEVICE_ATTR(operstate, 0644, efuse_show_operstate, efuse_set_operstate);
>
>DEVICE_ATTR_RW()?
>
Ack.
>> +
>> +#define EFUSE_ERROR_ATTR(name, bit) \
>> + static ssize_t efuse_show_##name(struct device *dev, struct device_attribute *attr, \
>> + char *buf) \
>> + { \
>> + struct efuse *efuse = dev_get_drvdata(dev); \
>> + int status = efuse_update_error_flags(efuse); \
>> + if (status) \
>> + return status; \
>> + return sysfs_emit(buf, "%d\n", !!(efuse->error_flags.cache & bit)); \
>> + } \
>> + static DEVICE_ATTR(name, 0444, efuse_show_##name, NULL)
>
>DEVICE_ATTR_RO()?
>
Ack.
>> +EFUSE_ERROR_ATTR(under_voltage, REGULATOR_ERROR_UNDER_VOLTAGE);
>> +EFUSE_ERROR_ATTR(over_current, REGULATOR_ERROR_OVER_CURRENT);
>> +EFUSE_ERROR_ATTR(regulation_out, REGULATOR_ERROR_REGULATION_OUT);
>> +EFUSE_ERROR_ATTR(fail, REGULATOR_ERROR_FAIL);
>> +EFUSE_ERROR_ATTR(over_temp, REGULATOR_ERROR_OVER_TEMP);
>> +EFUSE_ERROR_ATTR(under_voltage_warn, REGULATOR_ERROR_UNDER_VOLTAGE_WARN);
>> +EFUSE_ERROR_ATTR(over_current_warn, REGULATOR_ERROR_OVER_CURRENT_WARN);
>> +EFUSE_ERROR_ATTR(over_voltage_warn, REGULATOR_ERROR_OVER_VOLTAGE_WARN);
>> +EFUSE_ERROR_ATTR(over_temp_warn, REGULATOR_ERROR_OVER_TEMP_WARN);
>> +
>> +static struct attribute *efuse_attrs[] = {
>> + &dev_attr_operstate.attr,
>> + &dev_attr_under_voltage.attr,
>> + &dev_attr_over_current.attr,
>> + &dev_attr_regulation_out.attr,
>> + &dev_attr_fail.attr,
>> + &dev_attr_over_temp.attr,
>> + &dev_attr_under_voltage_warn.attr,
>> + &dev_attr_over_current_warn.attr,
>> + &dev_attr_over_voltage_warn.attr,
>> + &dev_attr_over_temp_warn.attr,
>> + NULL,
>> +};
>> +ATTRIBUTE_GROUPS(efuse);
>
>Shouldn't these all just be what all regulator drivers report? Or power
>drivers? I find it odd that this would be the first driver that would
>need to export these types of attributes. Surely there's already a
>class for this?
>
The attributes available from the underlying regulator device don't
include the error flags, and while they do include its state
('operstate' here), it's a read-only attribute, and from previous
discussions with Mark I gathered that was unlikely to change (whereas it
being read-write is a critical part of this driver's functionality).
Given his input on the first stab at this I took a while back, I've been
hoping to hear from Mark as to whether this looked more like something
he'd find palatable; perhaps he could chime in on this too? (And/or on
the regulator API question in the cover letter.)
Thanks,
Zev
next prev parent reply other threads:[~2022-03-08 8:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 1:18 [PATCH v2 0/2] " Zev Weiss
2022-03-08 1:18 ` [PATCH v2 1/2] dt-bindings: Add power-efuse binding Zev Weiss
2022-03-11 15:24 ` Rob Herring
2022-03-11 21:48 ` Zev Weiss
2022-03-12 0:08 ` Rob Herring
2022-03-12 0:39 ` Zev Weiss
2022-03-08 1:18 ` [PATCH v2 2/2] misc: Add power-efuse driver Zev Weiss
2022-03-08 7:06 ` Greg Kroah-Hartman
2022-03-08 7:45 ` Zev Weiss
2022-03-08 7:07 ` Greg Kroah-Hartman
2022-03-08 8:23 ` Zev Weiss [this message]
2022-04-11 22:09 ` Zev Weiss
2022-04-12 4:53 ` Greg Kroah-Hartman
2022-04-13 9:03 ` Zev Weiss
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=YicSj3ZuetRkYxH1@hatter.bewilderbeest.net \
--to=zev@bewilderbeest.net \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openbmc@lists.ozlabs.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
all inboxes | Powered by JetHome®