misc: Add power-efuse driver
Subsystems (2)
v2 cover misc: Add power-efuse driver
Hello,
This is a second revision of the v1 patch series posted previously [2].
Changes since v1:
- dropped pmbus/lm25066 patches, submitted separately via hwmon tree [Guenter]
- fixed indentation in power-efuse.yaml [Rob's bot]
- added more detailed description in power-efuse.yaml [Rob]
- added sysfs ABI documentation [Greg]
- replaced manual struct attribute_group and sysfs_create_group() with ATTRIBUTE_GROUPS() and driver.dev_groups [Greg]
A lightly edited version of the previous cover letter follows.
This patch series is another incarnation of some previous efforts [0] at enabling userspace access to the OPERATION state (and now status flags) of PMBus devices, specifically with respect to efuses protecting general-purpose power outputs. This functionality is an important component enabling a port of OpenBMC to the Delta AHE-50DC Open19 power shelf [1].
The first patch adds dt-bindings, and the second adds the implementation of the power-efuse driver. The driver is fairly simple; it merely provides a sysfs interface to enable, disable, and retrieve error flags from an underlying regulator (which in the expected usage will most likely be a PMBus device).
There is one aspect of its usage of the regulator API I'm a bit uncertain about, however: this driver seems like a case where an exclusive 'get' of the regulator (i.e. devm_regulator_get_exclusive() instead of devm_regulator_get() in efuse_probe()) would be appropriate, since in the intended usage no other device should be using an efuse's regulator. With an exclusive get though, the regulator's use_count and the consumer's enable_count don't balance out properly to allow the enable/disable operations to work properly (the former ending up one more than the latter, leading to enable_count underflows on attempts to disable the regulator). So at least for now it's using a non-exclusive get -- I'd be happy to hear any pointers on a way to allow an exclusive get to work here, though.
Thanks,
Zev
[0] https://lore.kernel.org/openbmc/[email protected]/
[1] https://www.open19.org/marketplace/delta-16kw-power-shelf/
[2] https://lore.kernel.org/openbmc/[email protected]/
Zev Weiss (2):
dt-bindings: Add power-efuse binding
misc: Add power-efuse driver
.../ABI/testing/sysfs-driver-power-efuse | 32 +++ .../devicetree/bindings/misc/power-efuse.yaml | 49 ++++ MAINTAINERS | 5 + drivers/misc/Kconfig | 15 ++ drivers/misc/Makefile | 1 + drivers/misc/power-efuse.c | 212 ++++++++++++++++++ 6 files changed, 314 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-power-efuse create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yaml create mode 100644 drivers/misc/power-efuse.c
Signature · 1 line
2.35.1
PATCH v2 1/2 dt-bindings: Add power-efuse binding
This can be used to describe a power output supplied by a regulator device that the system controls.
--- .../devicetree/bindings/misc/power-efuse.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yaml
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/power-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic power efuse device + +maintainers: + - Zev Weiss <[email protected]> + +description: | + This binding describes a physical power output supplied by a + regulator providing efuse functionality (manual on/off control, and + auto-shutoff if current, voltage, or thermal limits are exceeded). + + These may be found on systems such as "smart" network PDUs, and + typically supply power to devices entirely separate from the system + described by the device-tree by way of an external connector such as + an Open19 power cable: + + https://www.open19.org/marketplace/coolpower-cable-assembly-8ru/ + +properties: + compatible: + const: power-efuse + + vout-supply: + description: + phandle to the regulator providing power for the efuse + + error-flags-cache-ttl-ms: + description: + The number of milliseconds the vout-supply regulator's error + flags should be cached before re-fetching them. + +required: + - compatible + - vout-supply + +additionalProperties: false + +examples: + - | + efuse { + compatible = "power-efuse"; + vout-supply = <&efuse_reg>; + error-flags-cache-ttl-ms = <500>; + };
Signature · 1 line
2.35.1
Rob Herring
maintainerRe: [PATCH v2 1/2] dt-bindings: Add power-efuse binding
Quoted 27 lines · Zev Weiss
This can be used to describe a power output supplied by a regulator device that the system controls.
Signed-off-by Zev Weiss <[email protected]>--- .../devicetree/bindings/misc/power-efuse.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yamlDocumentation/devicetree/bindings/misc/power-efuse.yaml new file +12
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/power-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic power efuse device + +maintainers: + - Zev Weiss <[email protected]> + +description: |
Documentation/devicetree/bindings/misc/power-efuse.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +10
-0+ This binding describes a physical power output supplied by a + regulator providing efuse functionality (manual on/off control, and + auto-shutoff if current, voltage, or thermal limits are exceeded). + + These may be found on systems such as "smart" network PDUs, and + typically supply power to devices entirely separate from the system + described by the device-tree by way of an external connector such as + an Open19 power cable: + + https://www.open19.org/marketplace/coolpower-cable-assembly-8ru/
Not really a helpful link...
I still don't understand what the h/w looks like here. At least I now understand we're talking a fuse on power rail, not efuses in an SoC used as OTP bits or feature disables.
Documentation/devicetree/bindings/misc/power-efuse.yaml line 30
Quoted 8 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +8
-0+ +properties: + compatible: + const: power-efuse + + vout-supply: + description: + phandle to the regulator providing power for the efuse
Vout is a supply to the efuse and not the rail being fused?
Sorry, I know nothing about how an efuse is implemented so you are going to have to explain or draw it.
Documentation/devicetree/bindings/misc/power-efuse.yaml line 35
Quoted 5 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +5
-0+ + error-flags-cache-ttl-ms: + description: + The number of milliseconds the vout-supply regulator's error + flags should be cached before re-fetching them.
How does one fetch/read? the error flags?
Quoted 18 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +14
-0+ +required: + - compatible + - vout-supply + +additionalProperties: false + +examples: + - | + efuse { + compatible = "power-efuse"; + vout-supply = <&efuse_reg>; + error-flags-cache-ttl-ms = <500>; + };Signature · 1 line
2.35.1
Re: [PATCH v2 1/2] dt-bindings: Add power-efuse binding
Quoted 41 lines · Rob Herring
Quoted 27 lines · Zev Weiss
This can be used to describe a power output supplied by a regulator device that the system controls.
Signed-off-by Zev Weiss <[email protected]>--- .../devicetree/bindings/misc/power-efuse.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yamlDocumentation/devicetree/bindings/misc/power-efuse.yaml new file +12
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/power-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic power efuse device + +maintainers: + - Zev Weiss <[email protected]> + +description: |Documentation/devicetree/bindings/misc/power-efuse.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +10
-0+ This binding describes a physical power output supplied by a + regulator providing efuse functionality (manual on/off control, and + auto-shutoff if current, voltage, or thermal limits are exceeded). + + These may be found on systems such as "smart" network PDUs, and + typically supply power to devices entirely separate from the system + described by the device-tree by way of an external connector such as + an Open19 power cable: + + https://www.open19.org/marketplace/coolpower-cable-assembly-8ru/Not really a helpful link...
Quoted 4 lines
I still don't understand what the h/w looks like here. At least I now understand we're talking a fuse on power rail, not efuses in an SoC used as OTP bits or feature disables.
The systems this would actually be used for would be things like these:
- https://www.open19.org/marketplace/delta-16kw-power-shelf/
- https://www.open19.org/marketplace/inspur-open19-power-shelf-ob19200l1/
The rightmost pictures on those pages show the four black connectors where the cable assembly linked in the patch plugs in, each of which provides the outputs from 12 such efuses, on 12 pairs of ground and +12VDC pins. (There are also two more single outputs off to the side.)
It essentially just amounts to an external power output supplied by a regulator, with the regulator providing an on/off switch, overcurrent protection, etc.
And yes, the ambiguity of the "efuse" terminology is unfortunate (the "power-" prefix was an attempt to clarify it slightly). That's the term used in the documentation for the hardware and hence is what I've called it here, but I'd be open to using a different name if that would help.
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml line 30
Quoted 8 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +8
-0+ +properties: + compatible: + const: power-efuse + + vout-supply: + description: + phandle to the regulator providing power for the efuseVout is a supply to the efuse and not the rail being fused?
Yeah, that was a fairly muddled description -- it's really the latter. Perhaps:
phandle to the regulator providing power for the output rail controlled by the efuse
?
Quoted 4 lines
Sorry, I know nothing about how an efuse is implemented so you are going to have to explain or draw it.
Quoted 8 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml line 35
Quoted 5 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +5
-0+ + error-flags-cache-ttl-ms: + description: + The number of milliseconds the vout-supply regulator's error + flags should be cached before re-fetching them.How does one fetch/read? the error flags?
In the specific case I'm dealing with, via PMBus STATUS_* commands, though I was aiming to keep this more generic so it could potentially be used to describe non-PMBus arrangements (in the Linux case, via whatever mechanism the implementation of the regulator's .get_error_flags() function uses).
Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +14
-1+ +required: + - compatible + - vout-supply + +additionalProperties: false + +examples: + - | + efuse { + compatible = "power-efuse"; + vout-supply = <&efuse_reg>; + error-flags-cache-ttl-ms = <500>; + }; --2.35.1
Rob Herring
maintainerRe: [PATCH v2 1/2] dt-bindings: Add power-efuse binding
Quoted 42 lines · Zev Weiss
Quoted 41 lines · Rob Herring
Quoted 27 lines · Zev Weiss
This can be used to describe a power output supplied by a regulator device that the system controls.
Signed-off-by Zev Weiss <[email protected]>--- .../devicetree/bindings/misc/power-efuse.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yamlDocumentation/devicetree/bindings/misc/power-efuse.yaml new file +12
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/power-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic power efuse device + +maintainers: + - Zev Weiss <[email protected]> + +description: |Documentation/devicetree/bindings/misc/power-efuse.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +10
-0+ This binding describes a physical power output supplied by a + regulator providing efuse functionality (manual on/off control, and + auto-shutoff if current, voltage, or thermal limits are exceeded). + + These may be found on systems such as "smart" network PDUs, and + typically supply power to devices entirely separate from the system + described by the device-tree by way of an external connector such as + an Open19 power cable: + + https://www.open19.org/marketplace/coolpower-cable-assembly-8ru/Not really a helpful link...
Quoted 8 lines
Quoted 4 lines
I still don't understand what the h/w looks like here. At least I now understand we're talking a fuse on power rail, not efuses in an SoC used as OTP bits or feature disables.
The systems this would actually be used for would be things like these:
- https://www.open19.org/marketplace/delta-16kw-power-shelf/
- https://www.open19.org/marketplace/inspur-open19-power-shelf-ob19200l1/
Those still don't help show me what the h/w looks like. High level schematics is what I'm looking for.
Quoted 43 lines
The rightmost pictures on those pages show the four black connectors where the cable assembly linked in the patch plugs in, each of which provides the outputs from 12 such efuses, on 12 pairs of ground and +12VDC pins. (There are also two more single outputs off to the side.)
It essentially just amounts to an external power output supplied by a regulator, with the regulator providing an on/off switch, overcurrent protection, etc.
And yes, the ambiguity of the "efuse" terminology is unfortunate (the "power-" prefix was an attempt to clarify it slightly). That's the term used in the documentation for the hardware and hence is what I've called it here, but I'd be open to using a different name if that would help.
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml line 30
Quoted 8 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +8
-0+ +properties: + compatible: + const: power-efuse + + vout-supply: + description: + phandle to the regulator providing power for the efuseVout is a supply to the efuse and not the rail being fused?
Yeah, that was a fairly muddled description -- it's really the latter. Perhaps:
phandle to the regulator providing power for the output rail controlled by the efuse
?
Quoted 10 lines
Sorry, I know nothing about how an efuse is implemented so you are going to have to explain or draw it.
Quoted 5 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +5
-0+ + error-flags-cache-ttl-ms: + description: + The number of milliseconds the vout-supply regulator's error + flags should be cached before re-fetching them.
Quoted 7 lines
Quoted 2 lines
How does one fetch/read? the error flags?
In the specific case I'm dealing with, via PMBus STATUS_* commands, though I was aiming to keep this more generic so it could potentially be used to describe non-PMBus arrangements (in the Linux case, via whatever mechanism the implementation of the regulator's .get_error_flags() function uses).
PMBus is I2C (subset). What device(s) is on the PMBus?
Here's what I've got for connections so far:
Vout(regulator)-->|efuse|-->12V
Host-->PMbus--->????
Rob
Re: [PATCH v2 1/2] dt-bindings: Add power-efuse binding
Quoted 107 lines · Rob Herring
Quoted 42 lines · Zev Weiss
Quoted 41 lines · Rob Herring
Quoted 27 lines · Zev Weiss
This can be used to describe a power output supplied by a regulator device that the system controls.
Signed-off-by Zev Weiss <[email protected]>--- .../devicetree/bindings/misc/power-efuse.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/power-efuse.yamlDocumentation/devicetree/bindings/misc/power-efuse.yaml new file +12
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/power-efuse.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic power efuse device + +maintainers: + - Zev Weiss <[email protected]> + +description: |Documentation/devicetree/bindings/misc/power-efuse.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +10
-0+ This binding describes a physical power output supplied by a + regulator providing efuse functionality (manual on/off control, and + auto-shutoff if current, voltage, or thermal limits are exceeded). + + These may be found on systems such as "smart" network PDUs, and + typically supply power to devices entirely separate from the system + described by the device-tree by way of an external connector such as + an Open19 power cable: + + https://www.open19.org/marketplace/coolpower-cable-assembly-8ru/Not really a helpful link...
Quoted 8 lines
Quoted 4 lines
I still don't understand what the h/w looks like here. At least I now understand we're talking a fuse on power rail, not efuses in an SoC used as OTP bits or feature disables.
The systems this would actually be used for would be things like these:
- https://www.open19.org/marketplace/delta-16kw-power-shelf/
- https://www.open19.org/marketplace/inspur-open19-power-shelf-ob19200l1/Those still don't help show me what the h/w looks like. High level schematics is what I'm looking for.
Quoted 43 lines
The rightmost pictures on those pages show the four black connectors where the cable assembly linked in the patch plugs in, each of which provides the outputs from 12 such efuses, on 12 pairs of ground and +12VDC pins. (There are also two more single outputs off to the side.)
It essentially just amounts to an external power output supplied by a regulator, with the regulator providing an on/off switch, overcurrent protection, etc.
And yes, the ambiguity of the "efuse" terminology is unfortunate (the "power-" prefix was an attempt to clarify it slightly). That's the term used in the documentation for the hardware and hence is what I've called it here, but I'd be open to using a different name if that would help.
Quoted 10 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml line 30
Quoted 8 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +8
-0+ +properties: + compatible: + const: power-efuse + + vout-supply: + description: + phandle to the regulator providing power for the efuseVout is a supply to the efuse and not the rail being fused?
Yeah, that was a fairly muddled description -- it's really the latter. Perhaps:
phandle to the regulator providing power for the output rail controlled by the efuse
?
Quoted 10 lines
Sorry, I know nothing about how an efuse is implemented so you are going to have to explain or draw it.
Quoted 5 lines
Documentation/devicetree/bindings/misc/power-efuse.yaml new file +5
-0+ + error-flags-cache-ttl-ms: + description: + The number of milliseconds the vout-supply regulator's error + flags should be cached before re-fetching them.Quoted 7 lines
Quoted 2 lines
How does one fetch/read? the error flags?
In the specific case I'm dealing with, via PMBus STATUS_* commands, though I was aiming to keep this more generic so it could potentially be used to describe non-PMBus arrangements (in the Linux case, via whatever mechanism the implementation of the regulator's .get_error_flags() function uses).
Quoted 8 lines
PMBus is I2C (subset). What device(s) is on the PMBus?
Here's what I've got for connections so far:
Vout(regulator)-->|efuse|-->12V
Host-->PMbus--->????
On the hardware I'm currently working with (the Delta unit linked above), the PMBus device is a TI LM25066 with various other components (MOSFET, thermal diode, sense resistor, etc.) in the surrounding circuitry. My understanding is that "efuse" as used by the manufacturer refers to the combined circuit, including the LM25066.
Is that a sufficient "high level schematic", or is there additional information you're looking for? I do have access to a detailed schematic of the circuit, but unfortunately I don't think I'm at liberty to share it.
(I don't know exactly what the Inspur unit uses because I haven't dealt with that one first-hand, but I'd guess it's probably broadly similar.)
Thanks,
Zev
PATCH v2 2/2 misc: Add power-efuse driver
In reply to Zev WeissThis driver provides a sysfs interface to access the on/off state and error flags of a regulator supplying a power output controlled by the system.
--- .../ABI/testing/sysfs-driver-power-efuse | 32 +++ MAINTAINERS | 5 + drivers/misc/Kconfig | 15 ++ drivers/misc/Makefile | 1 + drivers/misc/power-efuse.c | 212 ++++++++++++++++++ 5 files changed, 265 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-power-efuse create mode 100644 drivers/misc/power-efuse.c
Documentation/ABI/testing/sysfs-driver-power-efuse new file +32 -0
@@ -0,0 +1,32 @@ +What: /sys/bus/platform/drivers/power-efuse/\*/operstate +Date: February 2022 +KernelVersion: 5.18 +Contact: Zev Weiss <[email protected] +Description: The operating state of the efuse as either "on" or "off"; either + value can be written to set the operating state. +Users: OpenBMC <[email protected]> + +What: /sys/bus/platform/drivers/power-efuse/\*/fail +Date: February 2022 +KernelVersion: 5.18 +Contact: Zev Weiss <[email protected] +Description: 0 if the efuse is operating normally, or 1 if it has tripped + (operating state set to "on" but the hardware has shut off the + output due to a fault). +Users: OpenBMC <[email protected]> + +What: /sys/bus/platform/drivers/power-efuse/\*/{under_voltage,over_current,regulation_out,over_temp} +Date: February 2022 +KernelVersion: 5.18 +Contact: Zev Weiss <[email protected] +Description: 1 if the underlying regulator reports a fault of the type + indicated by the name of the file, 0 otherwise. +Users: OpenBMC <[email protected]> + +What: /sys/bus/platform/drivers/power-efuse/\*/{under_voltage,over_current,over_voltage,over_temp}_warn +Date: February 2022 +KernelVersion: 5.18 +Contact: Zev Weiss <[email protected] +Description: 1 if the underlying regulator reports a warning of the type + indicated by the name of the file, 0 otherwise. +Users: OpenBMC <[email protected]>
MAINTAINERS +5 -0
@@ -7058,6 +7058,11 @@ S: Orphan W: http://aeschi.ch.eu.org/efs/ F: fs/efs/ +POWER EFUSE DRIVER +M: Zev Weiss <[email protected]> +S: Maintained +F: drivers/misc/power-efuse.c + EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER M: Douglas Miller <[email protected]> L: [email protected]
drivers/misc/Kconfig +15 -0
@@ -470,6 +470,21 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A host ports using only one USB controller. +config POWER_EFUSE + tristate "Power efuse driver support" + depends on OF && REGULATOR + help + This driver supports a regulator device functioning as a + power efuse, with status bits and an on/off switch available + via sysfs. + + A typical use for this would be for an efuse controlling a + generic power output for supplying power to devices external + to the system running this driver (such as in the management + controller of a "smart" PDU or similar), allowing the + operator to manually turn the output on and off, check if + the efuse has tripped due to overload, etc. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -59,3 +59,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_HI6421V600_IRQ) += hi6421v600-irq.o +obj-$(CONFIG_POWER_EFUSE) += power-efuse.o
drivers/misc/power-efuse.c new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerQuoted 4 lines · Zev Weiss
MAINTAINERS +0
-0@@ -7058,6 +7058,11 @@ S: Orphan W: http://aeschi.ch.eu.org/efs/
MAINTAINERS S: Orphan · line 7068
Quoted 10 lines
MAINTAINERS +5
-0F: fs/efs/ +POWER EFUSE DRIVER +M: Zev Weiss <[email protected]> +S: Maintained +F: drivers/misc/power-efuse.c + EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER M: Douglas Miller <[email protected]> L: [email protected]
Entries need to be in sorted order :(
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Zev Weiss
MAINTAINERS +0
-0@@ -7058,6 +7058,11 @@ S: Orphan W: http://aeschi.ch.eu.org/efs/ F: fs/efs/
Quoted 11 lines
MAINTAINERS S: Orphan · line 7068
Quoted 8 lines
MAINTAINERS +5
-0+POWER EFUSE DRIVER +M: Zev Weiss <[email protected]> +S: Maintained +F: drivers/misc/power-efuse.c + EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER M: Douglas Miller <[email protected]> L: [email protected]Entries need to be in sorted order :(
Ack, forgot to move it when I renamed an earlier incarnation from "efuse" to "power-efuse"...will fix.
Zev
Greg Kroah-Hartman
maintainerQuoted 1 line · Zev Weiss
+static
DEVICE_ATTR(operstate, 0644, efuse_show_operstate, efuse_set_operstate);
DEVICE_ATTR_RW()?
drivers/misc/power-efuse.c line 136
Quoted 12 lines
drivers/misc/power-efuse.c new file +12
-0+ +#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()?
Quoted 14 lines
drivers/misc/power-efuse.c new file +14
-0+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,
drivers/misc/power-efuse.c line 161
Quoted 10 lines
drivers/misc/power-efuse.c new file +10
-0+ &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?
thanks,
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
Quoted 1 line · Zev Weiss
+static
DEVICE_ATTR(operstate, 0644, efuse_show_operstate, efuse_set_operstate);
DEVICE_ATTR_RW()?
Ack.
Quoted 6 lines
Quoted 6 lines
drivers/misc/power-efuse.c new file +6
-0+ +#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); \
Quoted 9 lines
drivers/misc/power-efuse.c line 136
Quoted 6 lines
drivers/misc/power-efuse.c new file +6
-0+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.
Quoted 21 lines
Quoted 21 lines
drivers/misc/power-efuse.c new file +21
-0+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,
Quoted 9 lines
drivers/misc/power-efuse.c line 161
Quoted 3 lines
drivers/misc/power-efuse.c new file +3
-0+ 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
Quoted 33 lines · Zev Weiss
Quoted 21 lines · Greg Kroah-Hartman
Quoted 21 lines
drivers/misc/power-efuse.c new file +21
-0+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,Quoted 9 lines
drivers/misc/power-efuse.c line 161
Quoted 3 lines
drivers/misc/power-efuse.c new file +3
-0+ 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?
Quoted 4 lines
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.)
Ping...Mark (or Liam?), any thoughts on an appropriate path forward on this?
Thanks,
Zev
Greg Kroah-Hartman
maintainerQuoted 40 lines · Zev Weiss
Quoted 39 lines · Zev Weiss
Quoted 21 lines · Greg Kroah-Hartman
Quoted 21 lines
drivers/misc/power-efuse.c new file +21
-0+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,Quoted 9 lines
drivers/misc/power-efuse.c line 161
Quoted 3 lines
drivers/misc/power-efuse.c new file +3
-0+ 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).
Quoted 7 lines
Quoted 5 lines
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.)
Ping...Mark (or Liam?), any thoughts on an appropriate path forward on this?
Make it a regular regulator driver please.
thanks,
greg k-h
Quoted 6 lines · Greg Kroah-Hartman
Quoted 2 lines · Zev Weiss
Ping...Mark (or Liam?), any thoughts on an appropriate path forward on this?
Make it a regular regulator driver please.
The existing userspace-consumer regulator driver does provide some of the functionality I'm looking for (the on/off switch), and I think would be pretty easy to extend to provide the rest of it as well. When I previously proposed using it as such though, Mark stated quite firmly that that wasn't going to fly [0]; this approach was my attempt at implementing a generic, abstracted mechanism as he had suggested later in that thread, though I haven't gotten any further feedback from him on what he thought of it.
If he's had a change of heart and would be open to the userspace-consumer driver taking on a bit of new functionality I'd be happy to go that route though.
[0] https://lore.kernel.org/openbmc/[email protected]/
Thanks,
Zev