* [PATCH 0/2] Add support for LX1308
@ 2026-04-22 12:06 Brian Chiang
2026-04-22 12:06 ` [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support Brian Chiang
2026-04-22 12:06 ` [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 Brian Chiang
0 siblings, 2 replies; 8+ messages in thread
From: Brian Chiang @ 2026-04-22 12:06 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jonathan Corbet, Shuah Khan
Cc: linux-hwmon, devicetree, linux-kernel, linux-doc, Brian Chiang
The LX1308 is a high-efficiency, non-isolated power module. The module
operates from a 40V to 60V DC primary bus and a 12V regulated output
voltage. It can deliver up to 860W continuous and 1300W in transient.
The built-in digital controller can store and restore module
configurations. The fault status, input voltage, output voltage, output
current, and temperature are monitored via the PMBus interface.
Add support for this driver.
Signed-off-by: Brian Chiang <chiang.brian@inventec.com>
---
Brian Chiang (2):
dt-bindings: (pmbus/lx1308) Add LX1308 support
hwmon: (pmbus/lx1308) Add support for LX1308
.../bindings/hwmon/pmbus/luxshare,lx1308.yaml | 49 +++++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/lx1308.rst | 90 +++++++++
MAINTAINERS | 8 +
drivers/hwmon/pmbus/Kconfig | 10 +
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/lx1308.c | 204 +++++++++++++++++++++
8 files changed, 365 insertions(+)
---
base-commit: 591cd656a1bf5ea94a222af5ef2ee76df029c1d2
change-id: 20260415-add-support-lx1308-165a4206ab69
Best regards,
--
Brian Chiang <chiang.brian@inventec.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support 2026-04-22 12:06 [PATCH 0/2] Add support for LX1308 Brian Chiang @ 2026-04-22 12:06 ` Brian Chiang 2026-04-23 8:41 ` Krzysztof Kozlowski 2026-04-22 12:06 ` [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 Brian Chiang 1 sibling, 1 reply; 8+ messages in thread From: Brian Chiang @ 2026-04-22 12:06 UTC (permalink / raw) To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan Cc: linux-hwmon, devicetree, linux-kernel, linux-doc, Brian Chiang Add device tree bindings for the Luxshare LX1308, a high-efficiency 12V 860W DC/DC power module with PMBus interface. Signed-off-by: Brian Chiang <chiang.brian@inventec.com> --- .../bindings/hwmon/pmbus/luxshare,lx1308.yaml | 49 ++++++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 8 ++++ 3 files changed, 59 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml new file mode 100644 index 000000000000..a8d92447508d --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/pmbus/luxshare,lx1308.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Luxshare LX1308 Digital DC/DC Power Module + +maintainers: + - Brian Chiang <chiang.brian@inventec.com> + +description: | + The LX1308 is a high-efficiency, non-isolated, regulated 12V, 860W, + digital DC/DC power module. The module operates from a 40V to 60V DC + primary bus and provides a 12V regulated output voltage. It can deliver + up to 860W continuous and 1300W in transient. + +properties: + compatible: + enum: + - luxshare,lx1308lch + - luxshare,lx1308nch + - luxshare,lx1308sch + - luxshare,lx1308ldh + - luxshare,lx1308ndh + - luxshare,lx1308sdh + - luxshare,lx1308 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + power-module@60 { + compatible = "luxshare,lx1308"; + reg = <0x60>; + }; + }; diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index ee7fd3cfe203..67fb1592daaa 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -967,6 +967,8 @@ patternProperties: description: Shenzhen Luckfox Technology Co., Ltd. "^lunzn,.*": description: Shenzhen Lunzn Technology Co., Ltd. + "^luxshare,.*": + description: Luxshare-ICT Co., Ltd. "^luxul,.*": description: Lagrand | AV "^lwn,.*": diff --git a/MAINTAINERS b/MAINTAINERS index c3fe46d7c4bc..58fa595cff6a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15175,6 +15175,14 @@ S: Maintained F: Documentation/devicetree/bindings/iio/light/liteon,ltr390.yaml F: drivers/iio/light/ltr390.c +LUXSHARE LX1308 PMBUS DRIVER +M: Brian Chiang <chiang.brian@inventec.com> +L: linux-hwmon@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml +F: Documentation/hwmon/lx1308.rst +F: drivers/hwmon/pmbus/lx1308.c + LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei <ioana.ciornei@nxp.com> L: netdev@vger.kernel.org -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support 2026-04-22 12:06 ` [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support Brian Chiang @ 2026-04-23 8:41 ` Krzysztof Kozlowski 2026-04-27 11:15 ` Brian Chiang 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2026-04-23 8:41 UTC (permalink / raw) To: Brian Chiang Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan, linux-hwmon, devicetree, linux-kernel, linux-doc On Wed, Apr 22, 2026 at 12:06:15PM +0000, Brian Chiang wrote: > Add device tree bindings for the Luxshare LX1308, a high-efficiency > 12V 860W DC/DC power module with PMBus interface. > > Signed-off-by: Brian Chiang <chiang.brian@inventec.com> > --- > .../bindings/hwmon/pmbus/luxshare,lx1308.yaml | 49 ++++++++++++++++++++++ > .../devicetree/bindings/vendor-prefixes.yaml | 2 + > MAINTAINERS | 8 ++++ > 3 files changed, 59 insertions(+) > > diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml > new file mode 100644 > index 000000000000..a8d92447508d > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml > @@ -0,0 +1,49 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > + Drop blank line here > +$id: http://devicetree.org/schemas/hwmon/pmbus/luxshare,lx1308.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Luxshare LX1308 Digital DC/DC Power Module > + > +maintainers: > + - Brian Chiang <chiang.brian@inventec.com> > + > +description: | Do not need '|' unless you need to preserve formatting. > + The LX1308 is a high-efficiency, non-isolated, regulated 12V, 860W, > + digital DC/DC power module. The module operates from a 40V to 60V DC > + primary bus and provides a 12V regulated output voltage. It can deliver > + up to 860W continuous and 1300W in transient. > + > +properties: > + compatible: > + enum: > + - luxshare,lx1308lch > + - luxshare,lx1308nch > + - luxshare,lx1308sch > + - luxshare,lx1308ldh > + - luxshare,lx1308ndh > + - luxshare,lx1308sdh > + - luxshare,lx1308 What are all these devices? What are the differences? Especially, what is the difference between lx1308sdh and lx1308? > + > + reg: > + maxItems: 1 No properties? Looks like suitable for trivial bundings. > + > +required: > + - compatible > + - reg > + > +additionalProperties: false > + > +examples: > + - | > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + power-module@60 { > + compatible = "luxshare,lx1308"; > + reg = <0x60>; > + }; > + }; > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml > index ee7fd3cfe203..67fb1592daaa 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml > +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml > @@ -967,6 +967,8 @@ patternProperties: > description: Shenzhen Luckfox Technology Co., Ltd. > "^lunzn,.*": > description: Shenzhen Lunzn Technology Co., Ltd. > + "^luxshare,.*": > + description: Luxshare-ICT Co., Ltd. > "^luxul,.*": > description: Lagrand | AV > "^lwn,.*": > diff --git a/MAINTAINERS b/MAINTAINERS > index c3fe46d7c4bc..58fa595cff6a 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -15175,6 +15175,14 @@ S: Maintained > F: Documentation/devicetree/bindings/iio/light/liteon,ltr390.yaml > F: drivers/iio/light/ltr390.c > > +LUXSHARE LX1308 PMBUS DRIVER > +M: Brian Chiang <chiang.brian@inventec.com> > +L: linux-hwmon@vger.kernel.org > +S: Maintained > +F: Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml > +F: Documentation/hwmon/lx1308.rst > +F: drivers/hwmon/pmbus/lx1308.c There are no such files Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support 2026-04-23 8:41 ` Krzysztof Kozlowski @ 2026-04-27 11:15 ` Brian Chiang 2026-04-27 13:35 ` Guenter Roeck 0 siblings, 1 reply; 8+ messages in thread From: Brian Chiang @ 2026-04-27 11:15 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan, linux-hwmon, devicetree, linux-kernel, linux-doc On Thu, Apr 23, 2026 at 10:41:18AM +0200, Krzysztof Kozlowski wrote: >On Wed, Apr 22, 2026 at 12:06:15PM +0000, Brian Chiang wrote: >> Add device tree bindings for the Luxshare LX1308, a high-efficiency >> 12V 860W DC/DC power module with PMBus interface. >> >> Signed-off-by: Brian Chiang <chiang.brian@inventec.com> >> --- >> .../bindings/hwmon/pmbus/luxshare,lx1308.yaml | 49 ++++++++++++++++++++++ >> .../devicetree/bindings/vendor-prefixes.yaml | 2 + >> MAINTAINERS | 8 ++++ >> 3 files changed, 59 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml >> new file mode 100644 >> index 000000000000..a8d92447508d >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml >> @@ -0,0 +1,49 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> + > >Drop blank line here Will fix in v2. > >> +$id: http://devicetree.org/schemas/hwmon/pmbus/luxshare,lx1308.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Luxshare LX1308 Digital DC/DC Power Module >> + >> +maintainers: >> + - Brian Chiang <chiang.brian@inventec.com> >> + >> +description: | > >Do not need '|' unless you need to preserve formatting. Will drop the '|' in v2. > >> + The LX1308 is a high-efficiency, non-isolated, regulated 12V, 860W, >> + digital DC/DC power module. The module operates from a 40V to 60V DC >> + primary bus and provides a 12V regulated output voltage. It can deliver >> + up to 860W continuous and 1300W in transient. >> + >> +properties: >> + compatible: >> + enum: >> + - luxshare,lx1308lch >> + - luxshare,lx1308nch >> + - luxshare,lx1308sch >> + - luxshare,lx1308ldh >> + - luxshare,lx1308ndh >> + - luxshare,lx1308sdh >> + - luxshare,lx1308 > >What are all these devices? What are the differences? > >Especially, what is the difference between lx1308sdh and lx1308? Thanks for catching this. The suffix letters encode purely mechanical/packaging options with no software visibility: 1st letter - pin length (S=0.11", N=0.145", L=0.17") 2nd letter - pin assignment (C=pin14 IShare, D=pin14 NC, S=pin9/14 used as Vo sense) 3rd letter - HSP option (H=HSP, O=open frame) 4th letter - output cap (blank=600uF, C=2000uF) All variants share the same PMBus register map, scaling, and behavior. > >> + >> + reg: >> + maxItems: 1 > >No properties? Looks like suitable for trivial bundings. Agreed. Since there are no device-specific properties and software-wise this is a single device, I will drop the standalone binding in v2 and add a single entry to trivial-devices.yaml: - description: Luxshare LX1308 12V/860W digital DC/DC power module compatible: luxshare,lx1308 The mechanical variant information will be documented in Documentation/hwmon/lx1308.rst (sent in patch 2/2) so integrators can still find it, without polluting the ABI. > >> + >> +required: >> + - compatible >> + - reg >> + >> +additionalProperties: false >> + >> +examples: >> + - | >> + i2c { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + power-module@60 { >> + compatible = "luxshare,lx1308"; >> + reg = <0x60>; >> + }; >> + }; >> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml >> index ee7fd3cfe203..67fb1592daaa 100644 >> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml >> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml >> @@ -967,6 +967,8 @@ patternProperties: >> description: Shenzhen Luckfox Technology Co., Ltd. >> "^lunzn,.*": >> description: Shenzhen Lunzn Technology Co., Ltd. >> + "^luxshare,.*": >> + description: Luxshare-ICT Co., Ltd. >> "^luxul,.*": >> description: Lagrand | AV >> "^lwn,.*": >> diff --git a/MAINTAINERS b/MAINTAINERS >> index c3fe46d7c4bc..58fa595cff6a 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -15175,6 +15175,14 @@ S: Maintained >> F: Documentation/devicetree/bindings/iio/light/liteon,ltr390.yaml >> F: drivers/iio/light/ltr390.c >> >> +LUXSHARE LX1308 PMBUS DRIVER >> +M: Brian Chiang <chiang.brian@inventec.com> >> +L: linux-hwmon@vger.kernel.org >> +S: Maintained >> +F: Documentation/devicetree/bindings/hwmon/pmbus/luxshare,lx1308.yaml > > >> +F: Documentation/hwmon/lx1308.rst >> +F: drivers/hwmon/pmbus/lx1308.c > >There are no such files These files are added in patch 2/2 of this series: https://lore.kernel.org/lkml/20260422-add-support-lx1308-v1-0-9b8322f45aae@inventec.com/ I will note the series ordering more clearly in the v2 cover letter. > >Best regards, >Krzysztof > Thanks for the review. Best regards, Brian ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support 2026-04-27 11:15 ` Brian Chiang @ 2026-04-27 13:35 ` Guenter Roeck 0 siblings, 0 replies; 8+ messages in thread From: Guenter Roeck @ 2026-04-27 13:35 UTC (permalink / raw) To: Brian Chiang, Krzysztof Kozlowski Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan, linux-hwmon, devicetree, linux-kernel, linux-doc On 4/27/26 04:15, Brian Chiang wrote: ... >> No properties? Looks like suitable for trivial bundings. > > Agreed. Since there are no device-specific properties and software-wise > this is a single device, I will drop the standalone binding in v2 and > add a single entry to trivial-devices.yaml: > > - description: Luxshare LX1308 12V/860W digital DC/DC power module > compatible: luxshare,lx1308 > > The mechanical variant information will be documented in > Documentation/hwmon/lx1308.rst (sent in patch 2/2) so integrators can > still find it, without polluting the ABI. > Mechanical variants are irrelevant for the driver, and may change over time. Please drop entirely, or maybe just state that multiple mechanical variants are available and refer to the datasheet for details. Thanks, Guenter ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 2026-04-22 12:06 [PATCH 0/2] Add support for LX1308 Brian Chiang 2026-04-22 12:06 ` [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support Brian Chiang @ 2026-04-22 12:06 ` Brian Chiang 2026-04-23 8:43 ` Krzysztof Kozlowski 1 sibling, 1 reply; 8+ messages in thread From: Brian Chiang @ 2026-04-22 12:06 UTC (permalink / raw) To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan Cc: linux-hwmon, devicetree, linux-kernel, linux-doc, Brian Chiang Add support for the Luxshare LX1308, a high-efficiency 12V 860W DC/DC power module. The module operates from 40-60V input voltage. Signed-off-by: Brian Chiang <chiang.brian@inventec.com> --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/lx1308.rst | 90 ++++++++++++++++++ drivers/hwmon/pmbus/Kconfig | 10 ++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/lx1308.c | 204 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 306 insertions(+) diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index b2ca8513cfcd..c86c21554c37 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -145,6 +145,7 @@ Hardware Monitoring Kernel Drivers ltc4261 ltc4282 ltc4286 + lx1308 macsmc-hwmon max127 max15301 diff --git a/Documentation/hwmon/lx1308.rst b/Documentation/hwmon/lx1308.rst new file mode 100644 index 000000000000..c1b72e1647c5 --- /dev/null +++ b/Documentation/hwmon/lx1308.rst @@ -0,0 +1,90 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver lx1308 +==================== + +Supported chips: + + * Luxshare LX1308 + + Prefixes: 'lx1308' + + Addresses scanned: - + + Datasheet: Datasheet is not publicly available. + +Author: Brian Chiang <chiang.brian@inventec.com> + + +Description +----------- + +The LX1308 is a high-efficiency, non-isolated, regulated 12V, 860W, +digital DC/DC power module. The module operates from a 40V to 60V DC +primary bus and provides a 12V regulated output voltage. It can deliver +up to 860W continuous and 1300W in transient. + +The module has slow OCP and fast OCP. If the module output current is higher +than slow OCP set point and the lasting time is also longer than the delay, +the module will shut down and retry 3 time, if the fault still exists then +module enter latch mode. + +If the module output current is higher than fast OCP set point then it shut +down and enter latch mode. + +The driver is a client driver to the core PMBus driver. +Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers. + + +Usage Notes +----------- + +This driver does not auto-detect devices. You will have to instantiate the +devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for +details. + + +Sysfs entries +------------- + +======================= ====================================================== +curr1_alarm Input current alarm +curr1_input Input current (IIN) +curr1_label "iin" +curr2_crit Output over current fault threshold (slow OCP, 60ms delay) +curr2_crit_alarm Output over current fault alarm +curr2_input Output current (IOUT) +curr2_label "iout1" +curr2_max Output over current warning threshold (slow OCP, 60ms delay) +curr2_max_alarm Output over current warning alarm +in1_crit Input over voltage fault threshold +in1_crit_alarm Input over voltage fault alarm +in1_input Input voltage (VIN) +in1_label "vin" +in1_lcrit Input under voltage fault threshold +in1_lcrit_alarm Input under voltage fault alarm +in1_max Input over voltage warning threshold +in1_max_alarm Input over voltage warning alarm +in1_min Input under voltage warning threshold +in1_min_alarm Input under voltage warning alarm +in2_crit Output over voltage fault threshold +in2_crit_alarm Output over voltage fault alarm +in2_input Output voltage (VOUT) +in2_label "vout1" +in2_lcrit Output under voltage fault threshold +in2_lcrit_alarm Output under voltage fault alarm +in2_max Output over voltage warning threshold +in2_max_alarm Output over voltage warning alarm +in2_min Output under voltage warning threshold +in2_min_alarm Output under voltage warning alarm +power1_alarm Input power alarm +power1_input Input power (PIN) +power1_label "pin" +power2_input Output power (POUT) +power2_label "pout1" +temp1_crit Over temperature fault threshold +temp1_crit_alarm Over temperature fault alarm +temp1_input Module hot spot temperature +temp1_max Over temperature warning threshold +temp1_max_alarm Over temperature warning alarm +======================= ====================================================== diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index fc1273abe357..1c5dc4294248 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -221,6 +221,16 @@ config SENSORS_ISL68137 This driver can also be built as a module. If so, the module will be called isl68137. +config SENSORS_LX1308 + tristate "Luxshare LX1308 DC/DC Power Module" + help + If you say yes here you get hardware monitoring support for + Luxshare LX1308, a high-efficiency 12V 860W DC/DC power module + with PMBus interface. + + This driver can also be built as a module. If so, the module will + be called lx1308. + config SENSORS_LM25066 tristate "National Semiconductor LM25066 and compatibles" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index d6c86924f887..4861e144c7e7 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_SENSORS_IR36021) += ir36021.o obj-$(CONFIG_SENSORS_IR38064) += ir38064.o obj-$(CONFIG_SENSORS_IRPS5401) += irps5401.o obj-$(CONFIG_SENSORS_ISL68137) += isl68137.o +obj-$(CONFIG_SENSORS_LX1308) += lx1308.o obj-$(CONFIG_SENSORS_LM25066) += lm25066.o obj-$(CONFIG_SENSORS_LT3074) += lt3074.o obj-$(CONFIG_SENSORS_LT7182S) += lt7182s.o diff --git a/drivers/hwmon/pmbus/lx1308.c b/drivers/hwmon/pmbus/lx1308.c new file mode 100644 index 000000000000..c7a7a1fd4f21 --- /dev/null +++ b/drivers/hwmon/pmbus/lx1308.c @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <linux/err.h> +#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include "pmbus.h" + +#define LX1308_MFR_IOUT_OCP3_FAULT 0xBE +#define LX1308_MFR_IOUT_OCP3_WARN 0xBF + +/* + * Decode a Linear11-encoded word to an integer value. + * Linear11 format: bits[15:11] = signed 5-bit exponent, + * bits[10:0] = signed 11-bit mantissa. Result = mant * 2^exp. + */ +static inline int linear11_to_int(u16 word) +{ + s16 exp = ((s16)word) >> 11; + s16 mant = ((s16)((word & 0x7ff) << 5)) >> 5; + + return (exp >= 0) ? (mant << exp) : (mant / (1 << (-exp))); +} + +static int lx1308_read_word_data(struct i2c_client *client, int page, + int phase, int reg) +{ + int ret; + + if (page > 0) + return -ENXIO; + + switch (reg) { + /* + * The LX1308 OCP3 registers (slow OCP, 60ms delay) use a + * manufacturer-specific U8.0 format. Read the byte value N and present + * it as a Linear11 word with exponent 0. + */ + case PMBUS_IOUT_OC_FAULT_LIMIT: + ret = i2c_smbus_read_byte_data(client, LX1308_MFR_IOUT_OCP3_FAULT); + if (ret < 0) + break; + ret &= 0x7FF; + break; + + case PMBUS_IOUT_OC_WARN_LIMIT: + ret = i2c_smbus_read_byte_data(client, LX1308_MFR_IOUT_OCP3_WARN); + if (ret < 0) + break; + ret &= 0x7FF; + break; + + /* + * The following registers are not implemented by the LX1308. Return + * -ENXIO to suppress the corresponding sysfs attributes. + */ + case PMBUS_IIN_OC_WARN_LIMIT: + case PMBUS_IIN_OC_FAULT_LIMIT: + case PMBUS_IOUT_UC_FAULT_LIMIT: + case PMBUS_PIN_OP_WARN_LIMIT: + case PMBUS_POUT_OP_WARN_LIMIT: + case PMBUS_UT_WARN_LIMIT: + case PMBUS_UT_FAULT_LIMIT: + case PMBUS_MFR_IIN_MAX: + case PMBUS_MFR_IOUT_MAX: + case PMBUS_MFR_VIN_MIN: + case PMBUS_MFR_VIN_MAX: + case PMBUS_MFR_VOUT_MIN: + case PMBUS_MFR_VOUT_MAX: + case PMBUS_MFR_PIN_MAX: + case PMBUS_MFR_POUT_MAX: + case PMBUS_MFR_MAX_TEMP_1: + ret = -ENXIO; + break; + + default: + ret = -ENODATA; + break; + } + + return ret; +} + +static int lx1308_write_word_data(struct i2c_client *client, int page, + int reg, u16 word) +{ + int ret; + + if (page > 0) + return -ENXIO; + + switch (reg) { + case PMBUS_IOUT_OC_FAULT_LIMIT: + /* + * Decode Linear11 word from pmbus_core back to a plain integer + * and write as the U8.0 byte the device expects. + */ + ret = i2c_smbus_write_byte_data(client, LX1308_MFR_IOUT_OCP3_FAULT, + clamp_val(linear11_to_int(word), 0, 255)); + break; + + case PMBUS_IOUT_OC_WARN_LIMIT: + ret = i2c_smbus_write_byte_data(client, LX1308_MFR_IOUT_OCP3_WARN, + clamp_val(linear11_to_int(word), 0, 255)); + break; + + default: + ret = -ENODATA; + break; + } + + return ret; +} + +static struct pmbus_driver_info lx1308_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = linear, + .format[PSC_CURRENT_IN] = linear, + .format[PSC_CURRENT_OUT] = linear, + .format[PSC_POWER] = linear, + .format[PSC_TEMPERATURE] = linear, + + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT + | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT + | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP + | PMBUS_HAVE_STATUS_INPUT, + + .read_word_data = lx1308_read_word_data, + .write_word_data = lx1308_write_word_data, +}; + +static const struct i2c_device_id lx1308_id[] = { + { "lx1308" }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, lx1308_id); + +static int lx1308_probe(struct i2c_client *client) +{ + u8 buf[I2C_SMBUS_BLOCK_MAX + 1]; + const struct i2c_device_id *mid; + int ret; + + ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to read manufacturer id\n"); + buf[ret] = '\0'; + + if (ret != 12 || strncmp(buf, "LUXSHARE", 8)) + return dev_err_probe(&client->dev, -ENODEV, + "Unsupported Manufacturer ID '%s'\n", buf); + + ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to read Manufacturer Model\n"); + buf[ret] = '\0'; + + for (mid = lx1308_id; mid->name[0]; mid++) { + if (!strncasecmp(mid->name, buf, strlen(mid->name))) + break; + } + if (!mid->name[0]) + return dev_err_probe(&client->dev, -ENODEV, + "Unsupported Manufacturer Model '%s'\n", buf); + + ret = i2c_smbus_read_block_data(client, PMBUS_MFR_REVISION, buf); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to read Manufacturer Revision\n"); + buf[ret] = '\0'; + + if (ret != 12 || buf[0] != 'V') + return dev_err_probe(&client->dev, -ENODEV, + "Unsupported Manufacturer Revision '%s'\n", buf); + return pmbus_do_probe(client, &lx1308_info); +} + +static const struct of_device_id lx1308_of_match[] = { + { .compatible = "luxshare,lx1308" }, + { } +}; + +MODULE_DEVICE_TABLE(of, lx1308_of_match); + +static struct i2c_driver lx1308_driver = { + .driver = { + .name = "lx1308", + .of_match_table = lx1308_of_match, + }, + .probe = lx1308_probe, + .id_table = lx1308_id, +}; + +module_i2c_driver(lx1308_driver); + +MODULE_AUTHOR("Brian Chiang <chiang.brian@inventec.com>"); +MODULE_DESCRIPTION("PMBus driver for Luxshare LX1308"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("PMBUS"); -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 2026-04-22 12:06 ` [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 Brian Chiang @ 2026-04-23 8:43 ` Krzysztof Kozlowski 2026-04-27 11:15 ` Brian Chiang 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2026-04-23 8:43 UTC (permalink / raw) To: Brian Chiang Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan, linux-hwmon, devicetree, linux-kernel, linux-doc On Wed, Apr 22, 2026 at 12:06:16PM +0000, Brian Chiang wrote: > + > +static struct pmbus_driver_info lx1308_info = { > + .pages = 1, > + .format[PSC_VOLTAGE_IN] = linear, > + .format[PSC_VOLTAGE_OUT] = linear, > + .format[PSC_CURRENT_IN] = linear, > + .format[PSC_CURRENT_OUT] = linear, > + .format[PSC_POWER] = linear, > + .format[PSC_TEMPERATURE] = linear, > + > + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT > + | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT > + | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT > + | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP > + | PMBUS_HAVE_STATUS_INPUT, > + > + .read_word_data = lx1308_read_word_data, > + .write_word_data = lx1308_write_word_data, > +}; > + > +static const struct i2c_device_id lx1308_id[] = { > + { "lx1308" }, > + { } > +}; All ID tables should be next to each other, usually just before the struct with driver. > + > +MODULE_DEVICE_TABLE(i2c, lx1308_id); > + ... > + if (ret != 12 || buf[0] != 'V') > + return dev_err_probe(&client->dev, -ENODEV, > + "Unsupported Manufacturer Revision '%s'\n", buf); > + return pmbus_do_probe(client, &lx1308_info); > +} > + > +static const struct of_device_id lx1308_of_match[] = { > + { .compatible = "luxshare,lx1308" }, Where is the rest of your compatibles? Do not document ABI which is unused. submitting-patches in DT forbids that. > + { } > +}; > + > +MODULE_DEVICE_TABLE(of, lx1308_of_match); Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 2026-04-23 8:43 ` Krzysztof Kozlowski @ 2026-04-27 11:15 ` Brian Chiang 0 siblings, 0 replies; 8+ messages in thread From: Brian Chiang @ 2026-04-27 11:15 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Corbet, Shuah Khan, linux-hwmon, devicetree, linux-kernel, linux-doc >> + >> +static struct pmbus_driver_info lx1308_info = { >> + .pages = 1, >> + .format[PSC_VOLTAGE_IN] = linear, >> + .format[PSC_VOLTAGE_OUT] = linear, >> + .format[PSC_CURRENT_IN] = linear, >> + .format[PSC_CURRENT_OUT] = linear, >> + .format[PSC_POWER] = linear, >> + .format[PSC_TEMPERATURE] = linear, >> + >> + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT >> + | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT >> + | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT >> + | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP >> + | PMBUS_HAVE_STATUS_INPUT, >> + >> + .read_word_data = lx1308_read_word_data, >> + .write_word_data = lx1308_write_word_data, >> +}; >> + >> +static const struct i2c_device_id lx1308_id[] = { >> + { "lx1308" }, >> + { } >> +}; > >All ID tables should be next to each other, usually just before the >struct with driver. Will reorganize in v2 - i2c_device_id and of_device_id tables grouped together immediately before struct i2c_driver. > >> + >> +MODULE_DEVICE_TABLE(i2c, lx1308_id); >> + > >... > >> + if (ret != 12 || buf[0] != 'V') >> + return dev_err_probe(&client->dev, -ENODEV, >> + "Unsupported Manufacturer Revision '%s'\n", buf); >> + return pmbus_do_probe(client, &lx1308_info); >> +} >> + >> +static const struct of_device_id lx1308_of_match[] = { >> + { .compatible = "luxshare,lx1308" }, > >Where is the rest of your compatibles? Do not document ABI which is >unused. submitting-patches in DT forbids that. Addressed in the patch 1/2 reply: the variant compatibles encode only mechanical differences (pin length, pin-14 assignment, output cap) that are invisible to software. In v2 I will drop them from the binding and move to trivial-devices.yaml with a single "luxshare,lx1308" compatible. > >> + { } >> +}; >> + >> +MODULE_DEVICE_TABLE(of, lx1308_of_match); > >Best regards, >Krzysztof > Best regards, Brian ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-04-27 13:36 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-22 12:06 [PATCH 0/2] Add support for LX1308 Brian Chiang 2026-04-22 12:06 ` [PATCH 1/2] dt-bindings: (pmbus/lx1308) Add LX1308 support Brian Chiang 2026-04-23 8:41 ` Krzysztof Kozlowski 2026-04-27 11:15 ` Brian Chiang 2026-04-27 13:35 ` Guenter Roeck 2026-04-22 12:06 ` [PATCH 2/2] hwmon: (pmbus/lx1308) Add support for LX1308 Brian Chiang 2026-04-23 8:43 ` Krzysztof Kozlowski 2026-04-27 11:15 ` Brian Chiang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox