Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755712AbbLAByZ (ORCPT ); Mon, 30 Nov 2015 20:54:25 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:56744 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbbLAByX (ORCPT ); Mon, 30 Nov 2015 20:54:23 -0500 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 X-AuditID: cbfee68d-f79646d000001355-cc-565cfdccc6af Content-transfer-encoding: 8BIT Message-id: <565CFDCC.3090108@samsung.com> Date: Tue, 01 Dec 2015 10:54:20 +0900 From: Ingi Kim User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Jacek Anaszewski Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, sameo@linux.intel.com, lee.jones@linaro.org, rpurdie@rpsys.net, inki.dae@samsung.com, sw0312.kim@samsung.com, beomho.seo@samsung.com, andi.shyti@samsung.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH v6 2/2] leds: rt5033: Add RT5033 Flash led device driver References: <1448446948-13729-1-git-send-email-ingi2.kim@samsung.com> <1448446948-13729-3-git-send-email-ingi2.kim@samsung.com> <5655D001.8090803@samsung.com> <5656BC88.2070603@samsung.com> <5656D43D.106@samsung.com> <565BB510.2040903@samsung.com> <565C2C1A.3080100@samsung.com> In-reply-to: <565C2C1A.3080100@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsWyRsSkUPfM35gwg58brC22H3nGanH60zZ2 i/lHzrFa9L9ZyGpx7tVKRotJ9yewWPRefc5ocf/rUUaLy7vmsFlsfbOO0WLp9YtMFhOmr2Wx aN17hN1i966nQAO6WS1mTH7J5iDgsWbeGkaPy329TB4rl39h89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kFhcrKRvh2lCaIibrgVMY4Sub0gQXI+RARpIWMOYsfix T8FGmYqlf8sbGHeIdTFycEgImEi8PMnSxcgJZIpJXLi3nq2LkYtDSGAWo8T/KWsYQRK8AoIS PybfYwGpZxaQlzhyKRvCVJeYMiUXovwBo8T5VyvZIcq1JDacbQWzWQRUJVqedjCB2GwCahI3 ViwEs0UFEiSOn/0BZosI6Es0NPQxggxiFvjMJDF/5n2wg4QFfCT+fP4NddA8JomPs96AdXAK aEvcPnaNbQIj0JkI981CuG8Wwn0LGJlXMUqkFiQXFCel5xrlpZbrFSfmFpfmpesl5+duYgQn lGfSOxgP73I/xCjAwajEw3tgVUyYEGtiWXFl7iFGCQ5mJRHe1b+BQrwpiZVVqUX58UWlOanF hxhNgR6cyCwlmpwPTHZ5JfGGxiZmRpZG5oYWRsbmSuK8+y5FhgkJpCeWpGanphakFsH0MXFw SjUwelioyXJZsRxemfaio3lqwTPZL/YpLZ77Z+1/uW6jl8rrbUwTw4uZPgoVLmiTOaSlFMD6 mtN678kFez8qbDfb/3qhrXjKMq/zP0Oiq98zs0z7PUnE0iLon9fWLvZdm26/O3I0+JzJSt5r irvOX5TjubXzBFOU+i3v+Mt28Tb37PqOLWqZU54pr8RSnJFoqMVcVJwIAH2JmQ0+AwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3767 Lines: 116 Hi Jacek, On 2015년 11월 30일 19:59, Jacek Anaszewski wrote: > Hi Ingi, > > On 11/30/2015 03:31 AM, Ingi Kim wrote: >> Hi Jacek, >> >> On 2015년 11월 26일 18:43, Jacek Anaszewski wrote: >>> Hi Ingi, >>> >>> On 11/26/2015 09:02 AM, Ingi Kim wrote: >>> [...] >>>>>> +torch_unlock: >>>>>> + mutex_unlock(&led->lock); >>>>>> + return ret; >>>>>> +} >>>>>> + >>>>>> +static int rt5033_led_flash_brightness_set(struct led_classdev_flash *fled_cdev, >>>>>> + u32 brightness) >>>>>> +{ >>>>>> + struct rt5033_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); >>>>>> + struct rt5033_led *led = sub_led_to_led(sub_led); >>>>>> + >>>>>> + mutex_lock(&led->lock); >>>>>> + sub_led->flash_brightness = brightness; >>>>>> + mutex_unlock(&led->lock); >>>>> >>>>> Mutex protection is redundant in this case. You would need it if device >>>>> state was also changed here. >>>> >>>> Okay, I'll remove it. >>>> >>>>> >>>>> BTW why flash brightness can't be written to the device here? >>>>> >>>> >>>> Flash brightness is only affected when FLED flashed (strobing). >>>> So, I think it is better to be written in rt5033_led_flash_strobe_set function. >>> >>> strobe_set op should strobe the flash ASAP, and delegating brightness >>> setting there extends a delay between calling strobe_set op >>> and actual flash strobe. If you set the brightness here, then you >>> wouldn't have to do that in the strobe_set op, of course unless the >>> the brightness is altered through the API of the other LED, in two >>> separate LEDs case. >>> >> >> The brightness may be able to change its brightness in two separate LEDs case as you see. >> So, I think it would be better to write brightness setting in strobe_op. > > Could you motivate your statement, please? Why would it be better? > >> In consideration of delay, of course, the brightness is set just when it would be changed. > > I think that joint iout arrangement will be prevailing - this is the > case for your board, isn't it? With the modification I am proposing > the gain is clear. > You're right, thanks. Did you mean that flash attributes should be written on their ops(flash brightness, flash timeout)? let me update the driver on your suggestion. >>>>>> + >>>>>> + return 0; >>>>>> +} >>>>>> + >>>>>> +static int rt5033_led_flash_timeout_set(struct led_classdev_flash *fled_cdev, >>>>>> + u32 timeout) >>>>>> +{ >>>>>> + struct rt5033_sub_led *sub_led = flcdev_to_sub_led(fled_cdev); >>>>>> + struct rt5033_led *led = sub_led_to_led(sub_led); >>>>>> + >>>>>> + mutex_lock(&led->lock); >>>>>> + sub_led->flash_timeout = timeout; >>>>>> + mutex_unlock(&led->lock); >>>>> >>>>> Ditto. >>>>> >>> >>> Timeout should be also written here. >>> >> >> The timeout may be able to change its flash timeout in two separate LEDs case as you see. >> So, I think it would be better to write timeout setting in strobe_op. >> In consideration of delay, of course, the timeout is set just when it would be changed. >> >>> If you will add regmap_write in both ops, then mutex protection will >>> have to be preserved, to assure consistency between registers state >>> and sub_led->flash_brightness and sub_led->flash_timeout state. >>> >> >> Thanks, but mutex protection is useless in this case. >> so I try to remove it. >> >>>> >>>>>> +#define RT5033_FLED_CTRL4_VTRREG_MAX 0x60 >>>>> >>>>> Rename DEF to MASK. >>> >>> Hmm, here it should be: Rename MAX to MASK. >>> >> >> Oh >> Okay, Thanks :) >> > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/