Message ID | 20230414-pmi632-v1-4-fe94dc414832@z3ntu.xyz |
---|---|
State | Superseded |
Headers | show |
Series | Add PMI632 PMIC and RGB LED on sdm632-fairphone-fp3 | expand |
On 14.04.2023 01:17, Luca Weiss wrote: > The PMI632 PMIC contains 5 PWM channels, 3 of which can be used for > LEDs. > > For the LED pattern it doesn't have LUT like other PMICs but uses SDAM > instead. This is not currently implemented in the driver but since LPG > works fine without it, add support for the PMIC now. > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- Matches everything i see in 4.19! Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Konrad > drivers/leds/rgb/leds-qcom-lpg.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c > index 67f48f222109..51763ecb8c1e 100644 > --- a/drivers/leds/rgb/leds-qcom-lpg.c > +++ b/drivers/leds/rgb/leds-qcom-lpg.c > @@ -1353,6 +1353,20 @@ static const struct lpg_data pm8994_lpg_data = { > }, > }; > > +/* PMI632 uses SDAM instead of LUT for pattern */ > +static const struct lpg_data pmi632_lpg_data = { > + .triled_base = 0xd000, > + > + .num_channels = 5, > + .channels = (const struct lpg_channel_data[]) { > + { .base = 0xb300, .triled_mask = BIT(7) }, > + { .base = 0xb400, .triled_mask = BIT(6) }, > + { .base = 0xb500, .triled_mask = BIT(5) }, > + { .base = 0xb600 }, > + { .base = 0xb700 }, > + }, > +}; > + > static const struct lpg_data pmi8994_lpg_data = { > .lut_base = 0xb000, > .lut_size = 24, > @@ -1436,6 +1450,7 @@ static const struct of_device_id lpg_of_table[] = { > { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data }, > { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data }, > { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data }, > + { .compatible = "qcom,pmi632-lpg", .data = &pmi632_lpg_data }, > { .compatible = "qcom,pmi8994-lpg", .data = &pmi8994_lpg_data }, > { .compatible = "qcom,pmi8998-lpg", .data = &pmi8998_lpg_data }, > { .compatible = "qcom,pmc8180c-lpg", .data = &pm8150l_lpg_data }, >
On Fri 2023-04-14 01:17:48, Luca Weiss wrote: > The PMI632 PMIC contains 5 PWM channels, 3 of which can be used for > LEDs. > > For the LED pattern it doesn't have LUT like other PMICs but uses SDAM > instead. This is not currently implemented in the driver but since LPG > works fine without it, add support for the PMIC now. > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Acked-by: Pavel Machek <pavel@ucw.cz>
diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c index 67f48f222109..51763ecb8c1e 100644 --- a/drivers/leds/rgb/leds-qcom-lpg.c +++ b/drivers/leds/rgb/leds-qcom-lpg.c @@ -1353,6 +1353,20 @@ static const struct lpg_data pm8994_lpg_data = { }, }; +/* PMI632 uses SDAM instead of LUT for pattern */ +static const struct lpg_data pmi632_lpg_data = { + .triled_base = 0xd000, + + .num_channels = 5, + .channels = (const struct lpg_channel_data[]) { + { .base = 0xb300, .triled_mask = BIT(7) }, + { .base = 0xb400, .triled_mask = BIT(6) }, + { .base = 0xb500, .triled_mask = BIT(5) }, + { .base = 0xb600 }, + { .base = 0xb700 }, + }, +}; + static const struct lpg_data pmi8994_lpg_data = { .lut_base = 0xb000, .lut_size = 24, @@ -1436,6 +1450,7 @@ static const struct of_device_id lpg_of_table[] = { { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data }, { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data }, { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data }, + { .compatible = "qcom,pmi632-lpg", .data = &pmi632_lpg_data }, { .compatible = "qcom,pmi8994-lpg", .data = &pmi8994_lpg_data }, { .compatible = "qcom,pmi8998-lpg", .data = &pmi8998_lpg_data }, { .compatible = "qcom,pmc8180c-lpg", .data = &pm8150l_lpg_data },
The PMI632 PMIC contains 5 PWM channels, 3 of which can be used for LEDs. For the LED pattern it doesn't have LUT like other PMICs but uses SDAM instead. This is not currently implemented in the driver but since LPG works fine without it, add support for the PMIC now. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> --- drivers/leds/rgb/leds-qcom-lpg.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)