mbox series

[v3,0/3] Kinetic ExpressWire library and KTD2801 backlight driver

Message ID 20240120-ktd2801-v3-0-fe2cbafffb21@skole.hr
Headers show
Series Kinetic ExpressWire library and KTD2801 backlight driver | expand

Message

Duje Mihanović Jan. 20, 2024, 9:26 p.m. UTC
Hello,

This series adds support for the Kinetic KTD2801 LED backlight driver
IC found in samsung,coreprimevelte.

Support is already upstream for the somewhat similar KTD2692 flash
driver, and this series since v3 also moves its ExpressWire code into a
separate library and converts the KTD2692 driver to use that library.

Signed-off-by: Duje Mihanović <duje.mihanovic@skole.hr>
---
Changes in v3:
- Split ExpressWire code into library (and convert KTD2692 to use this
  library)
- Rewrite commit messages
- Add link to datasheet
- Drop of.h include in ktd2801
- Use _cansleep and usleep_range when powering off
- Clean up bitwise operation in update_status
- Link to v2: https://lore.kernel.org/r/20240118-ktd2801-v2-0-425cf32e0769@skole.hr

Changes in v2:
- Address maintainer comments:
  - Drop MODULE_ALIAS
  - Rename enable-gpios to ctrl-gpios
  - Rename ktd2801_backlight->desc to ktd2801_backlight->gpiod
  - Give time constants more descriptive names and note their origins in
    Samsung driver
  - Convert to GPIO_ACTIVE_HIGH
- Update trailers
- Link to v1: https://lore.kernel.org/r/20231005-ktd2801-v1-0-43cd85b0629a@skole.hr

---
Duje Mihanović (3):
      leds: ktd2692: move ExpressWire code to library
      dt-bindings: backlight: add Kinetic KTD2801 binding
      backlight: Add Kinetic KTD2801 backlight support

 .../bindings/leds/backlight/kinetic,ktd2801.yaml   |  46 +++++++
 MAINTAINERS                                        |  13 ++
 drivers/leds/Kconfig                               |   3 +
 drivers/leds/Makefile                              |   3 +
 drivers/leds/flash/Kconfig                         |   1 +
 drivers/leds/flash/leds-ktd2692.c                  |  91 ++++---------
 drivers/leds/leds-expresswire.c                    |  59 +++++++++
 drivers/video/backlight/Kconfig                    |   8 ++
 drivers/video/backlight/Makefile                   |   1 +
 drivers/video/backlight/ktd2801-backlight.c        | 143 +++++++++++++++++++++
 include/linux/leds-expresswire.h                   |  35 +++++
 11 files changed, 336 insertions(+), 67 deletions(-)
---
base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a
change-id: 20231004-ktd2801-0f3883cb59d0

Best regards,

Comments

Duje Mihanović Jan. 22, 2024, 4:57 p.m. UTC | #1
On Monday, January 22, 2024 5:50:11 PM CET Daniel Thompson wrote:
> On Mon, Jan 22, 2024 at 05:24:51PM +0100, Duje Mihanović wrote:
> > I believe a "select" would be more appropriate here unless these 
backlights
> > should be hidden if GPIOLIB is disabled. The catch with "select" is that
> > there seems to be no way to throw in the "|| COMPILE_TEST" other GPIO-
based
> > backlights have and I'm not sure what to do about that.
> 
> I think the "|| COMPILE_TEST" might just be a copy 'n paste'ism (in fact I
> may even have been guilty off propagating it in reviews when checking
> for inconsistencies).
> 
> AFAICT nothing will inhibit setting GPIOLIB so allyes- and allmodconfig
> builds will always end up with GPIOLIB enabled. If we are happy to
> select it then I think that is enough!

In that case I guess I'll just make it select GPIOLIB.

Regards,
--
Duje
Duje Mihanović Jan. 22, 2024, 5:26 p.m. UTC | #2
On Monday, January 22, 2024 5:57:53 PM CET Duje Mihanović wrote:
> On Monday, January 22, 2024 5:50:11 PM CET Daniel Thompson wrote:
> > AFAICT nothing will inhibit setting GPIOLIB so allyes- and allmodconfig
> > builds will always end up with GPIOLIB enabled. If we are happy to
> > select it then I think that is enough!
> 
> In that case I guess I'll just make it select GPIOLIB.

Nevermind that, it'll have to be 'depends on' after all:

drivers/gpio/Kconfig:6:error: recursive dependency detected!
drivers/gpio/Kconfig:6: symbol GPIOLIB is selected by LEDS_EXPRESSWIRE
drivers/leds/Kconfig:184:       symbol LEDS_EXPRESSWIRE depends on NEW_LEDS
drivers/leds/Kconfig:9: symbol NEW_LEDS is selected by SENSORS_APPLESMC
drivers/hwmon/Kconfig:348:      symbol SENSORS_APPLESMC depends on HWMON
drivers/hwmon/Kconfig:6:        symbol HWMON is selected by EEEPC_LAPTOP
drivers/platform/x86/Kconfig:325:       symbol EEEPC_LAPTOP depends on 
ACPI_VIDEO
drivers/acpi/Kconfig:209:       symbol ACPI_VIDEO depends on 
BACKLIGHT_CLASS_DEVICE
drivers/video/backlight/Kconfig:136:    symbol BACKLIGHT_CLASS_DEVICE is 
selected by FB_BACKLIGHT
drivers/video/fbdev/core/Kconfig:180:   symbol FB_BACKLIGHT is selected by 
FB_SSD1307
drivers/video/fbdev/Kconfig:1934:       symbol FB_SSD1307 depends on GPIOLIB
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

Regards,
--
Duje
Daniel Thompson Jan. 22, 2024, 5:50 p.m. UTC | #3
On Mon, Jan 22, 2024 at 06:26:04PM +0100, Duje Mihanović wrote:
> On Monday, January 22, 2024 5:57:53 PM CET Duje Mihanović wrote:
> > On Monday, January 22, 2024 5:50:11 PM CET Daniel Thompson wrote:
> > > AFAICT nothing will inhibit setting GPIOLIB so allyes- and allmodconfig
> > > builds will always end up with GPIOLIB enabled. If we are happy to
> > > select it then I think that is enough!
> >
> > In that case I guess I'll just make it select GPIOLIB.
>
> Nevermind that, it'll have to be 'depends on' after all:
>
> drivers/gpio/Kconfig:6:error: recursive dependency detected!
> drivers/gpio/Kconfig:6: symbol GPIOLIB is selected by LEDS_EXPRESSWIRE
> drivers/leds/Kconfig:184:       symbol LEDS_EXPRESSWIRE depends on NEW_LEDS

Can this dependency could be broken by declaring LEDS_EXPRESSWIRE at
the top (or bottom) of the KConfig file (it's an option without a UI
and does not need to be within the if NEW_LEDS block).

I'm aware this kind of change could provoke an argument about which
sub-system the expresswire code should live in... but I think it's
a worthwhile change anyway! We shouldn't need NEW_LEDS for this.


Daniel.
Duje Mihanović Jan. 22, 2024, 6:13 p.m. UTC | #4
On Monday, January 22, 2024 6:50:31 PM CET Daniel Thompson wrote:
> On Mon, Jan 22, 2024 at 06:26:04PM +0100, Duje Mihanović wrote:
> > On Monday, January 22, 2024 5:57:53 PM CET Duje Mihanović wrote:
> > > On Monday, January 22, 2024 5:50:11 PM CET Daniel Thompson wrote:
> > > > AFAICT nothing will inhibit setting GPIOLIB so allyes- and 
allmodconfig
> > > > builds will always end up with GPIOLIB enabled. If we are happy to
> > > > select it then I think that is enough!
> > > 
> > > In that case I guess I'll just make it select GPIOLIB.
> > 
> > Nevermind that, it'll have to be 'depends on' after all:
> > 
> > drivers/gpio/Kconfig:6:error: recursive dependency detected!
> > drivers/gpio/Kconfig:6: symbol GPIOLIB is selected by LEDS_EXPRESSWIRE
> > drivers/leds/Kconfig:184:       symbol LEDS_EXPRESSWIRE depends on 
NEW_LEDS
> 
> Can this dependency could be broken by declaring LEDS_EXPRESSWIRE at
> the top (or bottom) of the KConfig file (it's an option without a UI
> and does not need to be within the if NEW_LEDS block).

Nope, the only change is that the dependency graph is somewhat shorter:

drivers/gpio/Kconfig:6:error: recursive dependency detected!
drivers/gpio/Kconfig:6: symbol GPIOLIB is selected by LEDS_EXPRESSWIRE
drivers/leds/Kconfig:9: symbol LEDS_EXPRESSWIRE is selected by 
BACKLIGHT_KTD2801
drivers/video/backlight/Kconfig:186:    symbol BACKLIGHT_KTD2801 depends on 
BACKLIGHT_CLASS_DEVICE
drivers/video/backlight/Kconfig:136:    symbol BACKLIGHT_CLASS_DEVICE is 
selected by FB_BACKLIGHT
drivers/video/fbdev/core/Kconfig:180:   symbol FB_BACKLIGHT is selected by 
FB_SSD1307
drivers/video/fbdev/Kconfig:1934:       symbol FB_SSD1307 depends on GPIOLIB
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"

Regards,
--
Duje