[PATCH 0/4] iio: light: stk3310: support powering off during suspend

2024-04-14 Thread Aren Moynihan
need to make sure that it gets reinitialized with the same parameters after resume. Aren Moynihan (2): dt-bindings: iio: light: stk33xx: add regulator for vdd supply iio: light: stk3310: log error if reading the chip id fails Ondrej Jirman (2): iio: light: stk3310: Implement vdd supply and

[PATCH 1/4] dt-bindings: iio: light: stk33xx: add regulator for vdd supply

2024-04-14 Thread Aren Moynihan
Signed-off-by: Aren Moynihan --- Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml index f6e22dc9814a..db35e239d4a8

[PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-14 Thread Aren Moynihan
From: Ondrej Jirman VDD power input can be used to completely power off the chip during system suspend. Do so if available. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- drivers/iio/light/stk3310.c | 56 +++-- 1 file changed, 53 insertions

[PATCH 3/4] iio: light: stk3310: log error if reading the chip id fails

2024-04-14 Thread Aren Moynihan
If the chip isn't powered, this call is likely to return an error. Without a log here the driver will silently fail to probe. Common errors are ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus isn't powered). Signed-off-by: Aren Moynihan --- drivers/iio/ligh

[PATCH 4/4] arm64: dts: allwinner: pinephone: Add power supply to stk3311

2024-04-14 Thread Aren Moynihan
From: Ondrej Jirman This makes the driver disable the supply during sleep. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64

[PATCH v2 4/6] iio: light: stk3310: use dev_err_probe where possible

2024-04-23 Thread Aren Moynihan
Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Added in v2 drivers/iio/light/stk3310.c | 44 + 1 file changed, 20

[PATCH v2 0/6] iio: light: stk3310: support powering off during suspend

2024-04-23 Thread Aren Moynihan
t out is more likely to cause issues than including it. - Convert stk3310 to use dev_err_probe for errors. - Always enable / disable regulators and rely on dummy devices if they're not specified. - more listed in individual patches Aren Moynihan (4): dt-bindings: iio: light: stk33x

[PATCH v2 1/6] dt-bindings: iio: light: stk33xx: add vdd and leda regulators

2024-04-23 Thread Aren Moynihan
stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply - add supplies to examples

[PATCH v2 5/6] iio: light: stk3310: log error if reading the chip id fails

2024-04-23 Thread Aren Moynihan
If the chip isn't powered, this call is likely to return an error. Without a log here the driver will silently fail to probe. Common errors are ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus isn't powered). Signed-off-by: Aren Moynihan --- Notes:

[PATCH v2 6/6] arm64: dts: allwinner: pinephone: Add power supplies to stk3311

2024-04-23 Thread Aren Moynihan
From: Ondrej Jirman This makes the driver disable the supply during sleep. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend

2024-04-23 Thread Aren Moynihan
From: Ondrej Jirman VDD power input can be used to completely power off the chip during system suspend. Do so if available. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - always enable / disable regulators and rely on a dummy regulator if

[PATCH v2 3/6] iio: light: stk3310: Manage LED power supply

2024-04-23 Thread Aren Moynihan
The stk3310 and stk3310 chips have an input for power to the infrared LED. Add support for managing it's state. Signed-off-by: Aren Moynihan --- drivers/iio/light/stk3310.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/stk331

[PATCH v4 3/6] iio: light: stk3310: Implement vdd and leda supplies

2024-11-02 Thread Aren Moynihan
-off-by: Aren Moynihan --- Notes: Changes in v4: - fix variable declaration order in stk3310_resume to match the rest of the driver Changes in v3: - use bulk regulators instead of two individual ones - handle cleanup using devm callbacks instead of the remove

[PATCH v4 5/6] iio: light: stk3310: log error if reading the chip id fails

2024-11-02 Thread Aren Moynihan
probe, and this condition should return an error, which fits what dev_err_probe is designed for. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - get a struct device ahead of time so it can be passed as "dev" instead of "&client->dev" Changes

[PATCH v4 0/6] iio: light: stk3310: support powering off during suspend

2024-11-02 Thread Aren Moynihan
o use dev_err_probe for errors. - Always enable / disable regulators and rely on dummy devices if they're not specified. - more listed in individual patches Aren Moynihan (5): dt-bindings: iio: light: stk33xx: add vdd and leda regulators iio: light: stk3310: handle all remove logic with devm

[PATCH v4 4/6] iio: light: stk3310: use dev_err_probe where possible

2024-11-02 Thread Aren Moynihan
Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - Get a struct device ahead of time so it can be passed as "dev"

[PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks

2024-11-02 Thread Aren Moynihan
Using devm callbacks helps to make the ordering of probe / remove operations easier to reason about and removes some duplicate code between the probe error path and driver remove. --- Notes: Changes in v4: - also replace mutex_init with devm_mutex_init Added in v3 drivers/iio/l

[PATCH v4 1/6] dt-bindings: iio: light: stk33xx: add vdd and leda regulators

2024-11-02 Thread Aren Moynihan
stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan Reviewed-by: Krzysztof Kozlowski --- Notes: Changes in v2: - add leda-supply

[PATCH v4 6/6] arm64: dts: allwinner: pinephone: Add power supplies to stk3311

2024-11-02 Thread Aren Moynihan
From: Ondrej Jirman This allows the driver to properly handle powering this device, and disable power during suspend. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2

[PATCH v3 4/6] iio: light: stk3310: use dev_err_probe where possible

2024-10-28 Thread Aren Moynihan
Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Added in v2 drivers/iio/light/stk3310.c | 47 - 1 file changed, 20

Re: [PATCH v3 3/6] iio: light: stk3310: Implement vdd and leda supplies

2024-10-28 Thread Aren Moynihan
On Mon, Oct 28, 2024 at 04:38:37PM +0200, Andy Shevchenko wrote: > On Mon, Oct 28, 2024 at 10:19:57AM -0400, Aren Moynihan wrote: > > The vdd and leda supplies must be powered on for the chip to function > > and can be powered off during system suspend. > > > > Co-

[PATCH v3 1/6] dt-bindings: iio: light: stk33xx: add vdd and leda regulators

2024-10-28 Thread Aren Moynihan
stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan Reviewed-by: Krzysztof Kozlowski --- Notes: Changes in v2: - add leda-supply

[PATCH v3 3/6] iio: light: stk3310: Implement vdd and leda supplies

2024-10-28 Thread Aren Moynihan
The vdd and leda supplies must be powered on for the chip to function and can be powered off during system suspend. Co-developed-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: I'm not sure what the proper way to handle attribution for this patch is. It was origionally

[PATCH v3 6/6] arm64: dts: allwinner: pinephone: Add power supplies to stk3311

2024-10-28 Thread Aren Moynihan
From: Ondrej Jirman This allows the driver to properly handle powering this device, and disable power during suspend. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2

[PATCH v3 0/6] iio: light: stk3310: support powering off during suspend

2024-10-28 Thread Aren Moynihan
ssues than including it. - Convert stk3310 to use dev_err_probe for errors. - Always enable / disable regulators and rely on dummy devices if they're not specified. - more listed in individual patches Aren Moynihan (5): dt-bindings: iio: light: stk33xx: add vdd and leda regulators ii

[PATCH v3 5/6] iio: light: stk3310: log error if reading the chip id fails

2024-10-28 Thread Aren Moynihan
If the chip isn't powered, this call is likely to return an error. Without a log here the driver will silently fail to probe. Common errors are ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus isn't powered). Signed-off-by: Aren Moynihan --- Notes:

[PATCH v3 2/6] iio: light: stk3310: handle all remove logic with devm callbacks

2024-10-28 Thread Aren Moynihan
Using devm callbacks helps to make the ordering of probe / remove operations easier to reason about and removes some duplicate code between the probe error path and driver remove. --- Notes: Added in v3 drivers/iio/light/stk3310.c | 35 +++ 1 file changed, 19

[PATCH v5 3/8] iio: light: stk3310: implement vdd and leda supplies

2025-02-08 Thread Aren Moynihan
-off-by: Aren Moynihan --- Notes: Changes in v5: - explicitely include array_size.h Changes in v4: - fix variable declaration order in stk3310_resume to match the rest of the driver Changes in v3: - use bulk regulators instead of two individual ones

[PATCH v5 6/8] iio: light: stk3310: use dev_err_probe where possible

2025-02-08 Thread Aren Moynihan
Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - Get a struct device ahead of time so it can be passed as "dev"

[PATCH v5 5/8] iio: light: stk3310: refactor to always make dev a variable

2025-02-08 Thread Aren Moynihan
This reduces syntactic noise where the dev variable is used, which should help improve readability. Signed-off-by: Aren Moynihan --- Notes: Added in v5 drivers/iio/light/stk3310.c | 40 ++--- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a

[PATCH v5 4/8] iio: light: stk3310: simplify and inline STK3310_REGFIELD macro

2025-02-08 Thread Aren Moynihan
This macro has a conditional return statement, which obfuscates control flow. Inlining makes the control flow more clear. This also switches to using dev_err_probe for error reporting, which is a shorter way of expressing the same logic as before. Signed-off-by: Aren Moynihan --- Notes

[PATCH v5 8/8] arm64: dts: allwinner: pinephone: add power supplies to stk3311

2025-02-08 Thread Aren Moynihan
From: Ondrej Jirman This allows the driver to properly handle powering this device, and disable power during suspend. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2

[PATCH v5 0/8] iio: light: stk3310: support powering off during suspend

2025-02-08 Thread Aren Moynihan
rors. - Always enable / disable regulators and rely on dummy devices if they're not specified. - more listed in individual patches Aren Moynihan (7): dt-bindings: iio: light: stk33xx: add vdd and leda regulators iio: light: stk3310: handle all remove logic with devm callbacks iio: li

[PATCH v5 1/8] dt-bindings: iio: light: stk33xx: add vdd and leda regulators

2025-02-08 Thread Aren Moynihan
stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan Reviewed-by: Krzysztof Kozlowski --- Notes: Changes in v2: - add leda-supply

[PATCH v5 2/8] iio: light: stk3310: handle all remove logic with devm callbacks

2025-02-08 Thread Aren Moynihan
Using devm callbacks helps to make the ordering of probe / remove operations easier to reason about and removes some duplicate code between the probe error path and driver remove. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - also replace mutex_init with devm_mutex_init

[PATCH v5 7/8] iio: light: stk3310: log error if reading the chip id fails

2025-02-08 Thread Aren Moynihan
probe, and this condition should return an error, which fits what dev_err_probe is designed for. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - get a struct device ahead of time so it can be passed as "dev" instead of "&client->dev" Changes