On Wed 2019-03-27 23:12:09, Jacek Anaszewski wrote: > Marek, > > On 3/27/19 4:36 PM, Marek Behún wrote: > >The controller supports setting brightness of each channel of the RGB > >LEDs. Utilize this by adding support for setting continuous brightness > >of the entire LED by setting the same brightness on all 3 channels. > > > >Signed-off-by: Marek Behún <marek.behun@xxxxxx> > >--- > > drivers/leds/Kconfig | 4 ++-- > > drivers/leds/leds-turris-omnia.c | 10 +++++++++- > > 2 files changed, 11 insertions(+), 3 deletions(-) > > > >diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig > >index adcd53c02b3c..f97ef7977b24 100644 > >--- a/drivers/leds/Kconfig > >+++ b/drivers/leds/Kconfig > >@@ -137,8 +137,8 @@ config LEDS_TURRIS_OMNIA > > side of CZ.NIC's Turris Omnia router. There are 12 RGB LEDs on the > > front panel. > > This driver does not currently support setting LED colors, only > >- on/off state. Also HW triggering is disabled when the controller > >- is probed by this driver. > >+ brightness. Also HW triggering is disabled when the controller is > >+ probed by this driver. > > config LEDS_LM3530 > > tristate "LCD Backlight driver for LM3530" > >diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c > >index 9b96a2da4e38..ade467dbe609 100644 > >--- a/drivers/leds/leds-turris-omnia.c > >+++ b/drivers/leds/leds-turris-omnia.c > >@@ -46,7 +46,7 @@ static int omnia_led_brightness_set_blocking(struct led_classdev *led, > > struct omnia_leds *leds = dev_get_drvdata(led->dev->parent); > > int idx = omnia_led_idx(leds, led); > > int ret; > >- u8 state; > >+ u8 buf[5], state; > > if (idx < 0) > > return idx; > >@@ -55,8 +55,16 @@ static int omnia_led_brightness_set_blocking(struct led_classdev *led, > > if (brightness) > > state |= CMD_LED_STATE_ON; > >+ buf[0] = CMD_LED_COLOR; > >+ buf[1] = idx; > >+ buf[2] = buf[3] = buf[4] = brightness; > > If each logical LED has has three channels, then to be compatible with > current RGB LEDs in the LED subsystem, the channels must be exposed as > individual LED class devices. Yep, unfortunately that would cause compatibility problems in near future -- they want trigger functionality for RGB LED. That's why I asked Marek to send basic support, first. I believe we should take this first, then sort out hw triggers and RGB support. > > mutex_lock(&leds->lock); > >+ > > ret = i2c_smbus_write_byte_data(leds->client, CMD_LED_STATE, state); > >+ if (ret >= 0) > >+ ret = i2c_master_send(leds->client, buf, 5); > > Could you switch to using regmap for the whole driver, please? Will regmap handle i2c_master_send()? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Attachment:
signature.asc
Description: Digital signature