lkml.org 
[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/3] leds: Add ktd2692 flash LED driver
Hi Joe,

Thanks for the review.

On 2015년 04월 01일 13:07, Joe Perches wrote:
> On Wed, 2015-04-01 at 12:58 +0900, Ingi Kim wrote:
>> This patch adds a driver to support the ktd2692 flash LEDs.
>> ktd2692 can control flash current by ExpressWire interface.
>
> trivia:
>
>> diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
> []
>> +static void ktd2692_brightness_set(struct ktd2692_context *led,
>> + enum led_brightness brightness)
>> +{
>> + mutex_lock(&led->lock);
>> +
>> + if (brightness == LED_OFF) {
>> + led->mode = KTD2692_MODE_DISABLE;
>> + gpio_set_value(led->aux_gpio, KTD2692_LOW);
>> + goto out;
>> + }
>> +
>> + ktd2692_expresswire_write(led, KTD2692_REG_MOVIE_CURRENT_BASE |
>> + KTD2692_BRIGHTNESS_RANGE_255_TO_8(brightness));
>> + led->mode = KTD2692_MODE_MOVIE;
>> +
>> +out:
>> + ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);
>> + mutex_unlock(&led->lock);
>> +}
>
> Perhaps this function would be better with if/else
> without the out: label
>
>> +static int ktd2692_led_flash_strobe_set(struct led_classdev_flash *fled_cdev,
>> + bool state)
>> +{
>> + struct ktd2692_context *led = fled_cdev_to_led(fled_cdev);
>> + struct led_flash_setting *timeout = &fled_cdev->timeout;
>> + u32 flash_tm_reg;
>> +
>> + mutex_lock(&led->lock);
>> +
>> + if (state == 0) {
>> + led->mode = KTD2692_MODE_DISABLE;
>> + gpio_set_value(led->aux_gpio, KTD2692_LOW);
>> + goto done;
>> + }
>> +
>> + flash_tm_reg = GET_TIMEOUT_OFFSET(timeout->val, timeout->step);
>> + ktd2692_expresswire_write(led, flash_tm_reg
>> + | KTD2692_REG_FLASH_TIMEOUT_BASE);
>> +
>> + led->mode = KTD2692_MODE_FLASH;
>> + gpio_set_value(led->aux_gpio, KTD2692_HIGH);
>> +
>> +done:
>> + ktd2692_expresswire_write(led, led->mode | KTD2692_REG_MODE_BASE);
>
> Same if/else with the done: label?
>
>

Sorry about late comments,
It'll be pushed next patch

Thank you


\
 
 \ /
  Last update: 2015-04-10 09:21    [W:0.092 / U:9.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site