Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbbKZJnd (ORCPT ); Thu, 26 Nov 2015 04:43:33 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:41867 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753036AbbKZJn3 (ORCPT ); Thu, 26 Nov 2015 04:43:29 -0500 X-AuditID: cbfec7f5-f79b16d000005389-ca-5656d43e74b7 Message-id: <5656D43D.106@samsung.com> Date: Thu, 26 Nov 2015 10:43:25 +0100 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: Ingi Kim 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> In-reply-to: <5656BC88.2070603@samsung.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsVy+t/xq7p2V8LCDE73yVtsP/KM1eL0p23s FvOPnGO16H+zkNXi3KuVjBY7bn5hs5h0fwKLxf2vRxktLu+aw2ax9c06Roul1y8yWUyYvpbF onXvEXaL3bueAg3oZrWYMfklm4OAx5p5axg9Lvf1MnmsXP6FzWPTqk42jzvX9rB5zDsZ6LFn /g9Wj74tqxg9Pm+SC+CM4rJJSc3JLEst0rdL4MrY2vmOreCJQMXON/4NjNN4uxg5OSQETCR2 XF3LBGGLSVy4t56ti5GLQ0hgKaPE6W+fWCCcZ4wSu7/9Zwap4hVQk5jUtpsRxGYRUJW4v+4P G4jNJmAo8fPFa7BJogIREn9O72OFqBeU+DH5HguILSKgInHnaQvYUGaBz0wS82feB0sIC/hI /Pn8G2r1QUaJX7+PgnVzCmhLLLo6HWwzs4CZxKOWdVC2vMTmNW+ZJzAKzEKyZBaSsllIyhYw Mq9iFE0tTS4oTkrPNdIrTswtLs1L10vOz93ECImzrzsYlx6zOsQowMGoxMNbYBsWJsSaWFZc mXuIUYKDWUmE99U5oBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHembvehwgJpCeWpGanphakFsFk mTg4pRoYjVsPPr9aNFf75bva5nDNK5tEhW4c+5Ajfef9t9TnRxQ2v8v5K7jir5qh4wevBze8 F6z5tWPVlV9bF+477nd2RV1/zvTOyBjDgywNSrrvmFMtNd8ErHI8rxHjfZb9oKXeF4vS7acd q+PvrwmqmBLJuuvh2cSUhINfLp80Cddseq+fVsK8zog7WomlOCPRUIu5qDgRAPwlW/2vAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2322 Lines: 76 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. >>> + >>> + 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. 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. > >>> +#define RT5033_FLED_CTRL4_VTRREG_MAX 0x60 >> >> Rename DEF to MASK. Hmm, here it should be: Rename MAX to MASK. -- Best Regards, Jacek Anaszewski -- 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/