devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ingi Kim <ingi2.kim@samsung.com>
Cc: cooloney@gmail.com, rpurdie@rpsys.net, robh+dt@kernel.org,
	pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	sakari.ailus@iki.fi, j.anaszewski@samsung.com,
	varkabhadram@gmail.com, sw0312.kim@samsung.com,
	cw00.choi@samsung.com, jh80.chung@samsung.com,
	ideal.song@samsung.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org
Subject: Re: [PATCH v5 3/3] leds: Add ktd2692 flash LED driver
Date: Tue, 31 Mar 2015 21:07:30 -0700	[thread overview]
Message-ID: <1427861250.18175.51.camel@perches.com> (raw)
In-Reply-To: <1427860708-32559-4-git-send-email-ingi2.kim@samsung.com>

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?

  reply	other threads:[~2015-04-01  4:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  3:58 [PATCH v5 0/3] Add ktd2692 Flash LED driver using LED Flash class Ingi Kim
2015-04-01  3:58 ` [PATCH v5 1/3] of: Add vendor prefix for Kinetic technologies Ingi Kim
2015-04-01  3:58 ` [PATCH v5 2/3] leds: ktd2692: add device tree bindings for ktd2692 Ingi Kim
     [not found] ` <1427860708-32559-1-git-send-email-ingi2.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-04-01  3:58   ` [PATCH v5 3/3] leds: Add ktd2692 flash LED driver Ingi Kim
2015-04-01  4:07     ` Joe Perches [this message]
2015-04-10  6:42       ` Ingi Kim
2015-04-01  6:47     ` Jacek Anaszewski
2015-04-10  6:40       ` Ingi Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427861250.18175.51.camel@perches.com \
    --to=joe@perches.com \
    --cc=cooloney@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ideal.song@samsung.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=ingi2.kim@samsung.com \
    --cc=j.anaszewski@samsung.com \
    --cc=jh80.chung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=sakari.ailus@iki.fi \
    --cc=sw0312.kim@samsung.com \
    --cc=varkabhadram@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).