kernel: ar8327: support LED device tree bindings

The ar8216 switch driver supports exposing configuration of AR8327 and
AR8337 switch LEDs to the userspace, however it is only configurable
through platform data, causing the devices ported from ar71xx target to
lack the support.
Since there is still a long way to go until we can migrate the target to
qca8k, an interim solution is needed.
Extend ar8327_hw_config_of function to parse a "leds"
subnode, which will populate the missing platform data based on device
tree contents, and restore the existing support for the LEDs.
Standard bindings apply, mapping "reg" property to LED index, with
addition of "qca,led-mode" property, which selects HW (0) or SW (1)
mode, defaulting to HW mode.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/12487
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Lech Perczak
2021-09-14 23:39:41 +02:00
committed by Hauke Mehrtens
parent 5a4f8b26f0
commit 3ba4a4e32c
3 changed files with 41 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ struct ar8327_led_info {
bool active_low;
enum ar8327_led_num led_num;
enum ar8327_led_mode mode;
struct fwnode_handle *fwnode;
};
#define AR8327_LED_INFO(_led, _mode, _name) { \