Commit graph

6 commits

Author SHA1 Message Date
Jesse Karjalainen
b441b95a59 leds: pca995x: Fix typo in pca995x_of_match's of_device_id entry
Remove the stray space between the '.' and the 'data' field name in
the PCA995x device-tree match table.

Signed-off-by: Jesse Karjalainen <jesse@ponkila.com>
Link: https://lore.kernel.org/r/20250426020454.47059-1-jesse@ponkila.com
Signed-off-by: Lee Jones <lee@kernel.org>
2025-05-14 09:25:04 +01:00
Javier Carrasco
82c5ada1f9 leds: pca995x: Fix device child node usage in pca995x_probe()
The current implementation accesses the `child` fwnode handle outside of
device_for_each_child_node() without incrementing its refcount.

Add the missing call to `fwnode_handle_get(child)`.

The cleanup process where `child` is accessed is not right either
because a single call to `fwnode_handle_put()` is carried out in case of
an error, ignoring unasigned nodes at the point when the error happens.

Keep `child` inside of the first loop, and use the helper pointer that
receives references via `fwnode_handle_get()` to handle the child nodes
within the second loop. Keeping `child` inside the first node has also
the advantage that the scoped version of the loop can be used.

Fixes: ee4e80b296 ("leds: pca995x: Add support for PCA995X chips")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240807-leds-pca995x-fix-fwnode-usage-v1-1-8057c84dc583@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-08-16 17:01:19 +01:00
Javier Carrasco
6eefd65ba6 leds: pca995x: Use device_for_each_child_node() to access device child nodes
The iterated nodes are direct children of the device node, and the
`device_for_each_child_node()` macro accounts for child node
availability.

`fwnode_for_each_available_child_node()` is meant to access the child
nodes of an fwnode, and therefore not direct child nodes of the device
node.

Use `device_for_each_child_node()` to indicate device's direct child
nodes.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240805-device_for_each_child_node-available-v3-2-48243a4aa5c0@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-08-05 17:00:22 +01:00
Pieterjan Camerlynck
68d6520d2e leds: leds-pca995x: Add support for NXP PCA9956B
Add support for PCA9956B chip, which belongs to the same family.

This chip features 24 instead of 16 outputs, so add a chipdef struct to
deal with the different register layouts.

Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pieterjan Camerlynck <pieterjanca@gmail.com>
Link: https://lore.kernel.org/r/20240711-pca995x-v4-2-702a67148065@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-08-01 13:40:04 +01:00
Marek Vasut
179507fcd5 leds: pca995x: Fix MODULE_DEVICE_TABLE for OF
Fix copy-paste error in MODULE_DEVICE_TABLE() for the OF table,
use the 'of' first parameter instead of duplicate 'i2c'.

Fixes: ee4e80b296 ("leds: pca995x: Add support for PCA995X chips")
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230809125314.531806-1-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-08-15 18:30:07 +01:00
Isai Gaspar
ee4e80b296 leds: pca995x: Add support for PCA995X chips
The PCA995x chips are I2C controlled LED drivers. Each chip has
up to 16 outputs, each one with an individual 8-bit resolution
PWM for brightness control.

Signed-off-by: Isai Gaspar <isaiezequiel.gaspar@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de> # Basically rewrite the driver
Link: https://lore.kernel.org/r/20230713163516.21644-2-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-07-28 09:26:28 +01:00