Message ID | 20230322160926.948687-8-dan.scally@ideasonboard.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | Add WLED support to TPS68470 LED driver | expand |
Hi, On 3/22/23 17:09, Daniel Scally wrote: > On platforms with the TPS68470 PMIC, we need to be able to define > which of the LEDs powered by the PMIC should be used by each of > the sensors that consume its resources. Add the ability to define > tables of LED lookup data to the board data file. > > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > drivers/platform/x86/intel/int3472/tps68470.c | 8 ++++++++ > drivers/platform/x86/intel/int3472/tps68470.h | 8 ++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c > index 818f2fc5bf2a..07ac7b5b9082 100644 > --- a/drivers/platform/x86/intel/int3472/tps68470.c > +++ b/drivers/platform/x86/intel/int3472/tps68470.c > @@ -206,6 +206,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) > for (i = 0; i < board_data->n_gpiod_lookups; i++) > gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); > > + if (board_data->led_lookups) > + for (i = 0; i < board_data->led_lookups->n_lookups; i++) > + led_add_lookup(&board_data->led_lookups->lookup_table[i]); > + > ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, > cells, TPS68470_WIN_MFD_CELL_COUNT, > NULL, 0, NULL); > @@ -214,6 +218,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) > if (ret) { > for (i = 0; i < board_data->n_gpiod_lookups; i++) > gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); > + > + if (board_data->led_lookups) > + for (i = 0; i < board_data->led_lookups->n_lookups; i++) > + led_remove_lookup(&board_data->led_lookups->lookup_table[i]); > } > > break; > diff --git a/drivers/platform/x86/intel/int3472/tps68470.h b/drivers/platform/x86/intel/int3472/tps68470.h > index ce50687db6fb..c03884654898 100644 > --- a/drivers/platform/x86/intel/int3472/tps68470.h > +++ b/drivers/platform/x86/intel/int3472/tps68470.h > @@ -11,14 +11,22 @@ > #ifndef _INTEL_SKL_INT3472_TPS68470_H > #define _INTEL_SKL_INT3472_TPS68470_H > > +#include <linux/leds.h> > + > struct gpiod_lookup_table; > struct tps68470_regulator_platform_data; > struct tps68470_led_platform_data; > > +struct tps68470_led_lookups { > + unsigned int n_lookups; > + struct led_lookup_data lookup_table[]; > +}; > + > struct int3472_tps68470_board_data { > const char *dev_name; > const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; > const struct tps68470_led_platform_data *tps68470_led_pdata; > + struct tps68470_led_lookups *led_lookups; > unsigned int n_gpiod_lookups; > struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; > };
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 818f2fc5bf2a..07ac7b5b9082 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -206,6 +206,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) for (i = 0; i < board_data->n_gpiod_lookups; i++) gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + if (board_data->led_lookups) + for (i = 0; i < board_data->led_lookups->n_lookups; i++) + led_add_lookup(&board_data->led_lookups->lookup_table[i]); + ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, cells, TPS68470_WIN_MFD_CELL_COUNT, NULL, 0, NULL); @@ -214,6 +218,10 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) if (ret) { for (i = 0; i < board_data->n_gpiod_lookups; i++) gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + + if (board_data->led_lookups) + for (i = 0; i < board_data->led_lookups->n_lookups; i++) + led_remove_lookup(&board_data->led_lookups->lookup_table[i]); } break; diff --git a/drivers/platform/x86/intel/int3472/tps68470.h b/drivers/platform/x86/intel/int3472/tps68470.h index ce50687db6fb..c03884654898 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.h +++ b/drivers/platform/x86/intel/int3472/tps68470.h @@ -11,14 +11,22 @@ #ifndef _INTEL_SKL_INT3472_TPS68470_H #define _INTEL_SKL_INT3472_TPS68470_H +#include <linux/leds.h> + struct gpiod_lookup_table; struct tps68470_regulator_platform_data; struct tps68470_led_platform_data; +struct tps68470_led_lookups { + unsigned int n_lookups; + struct led_lookup_data lookup_table[]; +}; + struct int3472_tps68470_board_data { const char *dev_name; const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; const struct tps68470_led_platform_data *tps68470_led_pdata; + struct tps68470_led_lookups *led_lookups; unsigned int n_gpiod_lookups; struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; };
On platforms with the TPS68470 PMIC, we need to be able to define which of the LEDs powered by the PMIC should be used by each of the sensors that consume its resources. Add the ability to define tables of LED lookup data to the board data file. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- drivers/platform/x86/intel/int3472/tps68470.c | 8 ++++++++ drivers/platform/x86/intel/int3472/tps68470.h | 8 ++++++++ 2 files changed, 16 insertions(+)