Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbbK3Cbu (ORCPT ); Sun, 29 Nov 2015 21:31:50 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:56768 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbbK3Cbr convert rfc822-to-8bit (ORCPT ); Sun, 29 Nov 2015 21:31:47 -0500 X-AuditID: cbfee690-f79646d000001316-a2-565bb510aa7f MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT Message-id: <565BB510.2040903@samsung.com> Date: Mon, 30 Nov 2015 11:31:44 +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> In-reply-to: <5656D43D.106@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJIsWRmVeSWpSXmKPExsWyRsSkQFdga3SYwdTrmhbbjzxjtTj9aRu7 xfwj51gt+t8sZLU492olo8Wk+xNYLHqvPme0uP/1KKPF5V1z2Cy2vlnHaLH0+kUmiwnT17JY tO49wm6xe9dToAHdrBYzJr9kcxDwWDNvDaPH5b5eJo+Vy7+weWxa1cnmcefaHjaPeScDPfbM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phTChQKSCwuVtK3wzQhNMRN1wKmMULXNyQIrsfIAA0krGHMeLNj IVvBKbGK2/d2MTUw3hTsYuTkkBAwkbi04A4bhC0mceHeeiCbi0NIYBajxJvnHYwgCV4BQYkf k++xdDFycDALyEscuZQNYapLTJmSC1H+gFGibc9/dohyLYl929uZQGwWAVWJA4t2gMXZBNQk bqxYCBYXFUiQOH72B5gtIqAv0dDQxwgyiFngM5PE/Jn3WUASwgI+En8+/4Y66B6jxPNzE8A6 OIE279kyk20CI9CZCPfNQrhvFsJ9CxiZVzFKpBYkFxQnpeca5aWW6xUn5haX5qXrJefnbmIE p5Vn0jsYD+9yP8QowMGoxMMrYRYdJsSaWFZcmXuIUYKDWUmE93khUIg3JbGyKrUoP76oNCe1 +BCjKdCDE5mlRJPzgSkvryTe0NjEzMjSyNzQwsjYXEmcd9+lyDAhgfTEktTs1NSC1CKYPiYO TqkGRvPSeu0Gz7MbV025z3VXINZoakCjK5f2hblCf5zyf0VfE7gWmJvaYTSh2Or6sfb1S37+ EGx7IHlz/Tb9XvPfl+SqY6bu9Zj9mKPK2tLz/cTzypeaRDPuL9VZVZMrIPboO99it+y9Z/q7 8zU2VT5SipMyl9yid9ZIVeP3pnCeze9ZE+YLh91/qsRSnJFoqMVcVJwIAGbrZNZBAwAA 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: 3047 Lines: 93 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. In consideration of delay, of course, the brightness is set just when it would be changed. >>>> + >>>> + 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/