mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: George Stark <gnstark@salutedevices.com>
To: Dmitry Rokosov <ddrokosov@salutedevices.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <lee@kernel.org>, <pavel@ucw.cz>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
	<kernel@sberdevices.ru>, <rockosov@gmail.com>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-leds@vger.kernel.org>
Subject: Re: [PATCH v1 09/11] leds: aw200xx: improve autodim calculation method
Date: Tue, 17 Oct 2023 00:22:51 +0300	[thread overview]
Message-ID: <49b1d68c-2f16-2efd-ae24-2e2bd95a094b@salutedevices.com> (raw)
In-Reply-To: <20231009140225.gj7vkmmio5xfvtnk@CAB-WSD-L081021>



On 10/9/23 17:02, Dmitry Rokosov wrote:
> On Mon, Oct 09, 2023 at 04:18:08PM +0300, Dmitry Rokosov wrote:
>> On Fri, Oct 06, 2023 at 09:03:47PM +0300, Andy Shevchenko wrote:
>>> On Fri, Oct 6, 2023 at 7:05 PM Dmitry Rokosov
>>> <ddrokosov@salutedevices.com> wrote:
>>>>
>>>> From: George Stark <gnstark@salutedevices.com>
>>>>
>>>> use DIV_ROUND_UP instead of coarse div
>>>
>>> Please, respect English grammar and punctuation.
>>> Refer to macros and functions as func() (note the parentheses).
>>>
>>> ...
>>>
>>>>   #define AW200XX_REG_DIM2FADE(x) ((x) + 1)
>>>> +#define AW200XX_REG_FADE2DIM(fade) \
>>>> +       DIV_ROUND_UP((fade) * AW200XX_DIM_MAX, AW200XX_FADE_MAX)
>>>
>>> Have you checked if the overflow is _now_ possible (compiling on
>>> 32-bit platforms as well)?
>>
>> I suppose we shouldn't carry on about overflow here because the value of
>> fade cannot exceed 255, and DIM_MAX is set at 63
>>
>> You can find maximum values of fade and dim in the aw200xx driver
>> header:
>>
>> #define AW200XX_DIM_MAX                  (BIT(6) - 1)
>> #define AW200XX_FADE_MAX                 (BIT(8) - 1)
> 
> I agree that checking if the fade is not greater than FADE_MAX will not
> be excessive. The LED subsystem is capable of sending brightness levels
> higher than 255
> 

Probably we should set max_brightness to AW200XX_FADE_MAX in 
led_classdev when adding leds.

-- 
Best regards
George

  reply	other threads:[~2023-10-16 21:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 16:04 [PATCH v1 00/11] leds: aw200xx: several driver updates Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 01/11] leds: aw200xx: fix write to DIM parameter Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 02/11] dt-bindings: leds: aw200xx: fix led dt node pattern Dmitry Rokosov
2023-10-10 14:11   ` Rob Herring
2023-10-06 16:04 ` [PATCH v1 03/11] leds: aw200xx: support HWEN hardware control Dmitry Rokosov
2023-10-06 17:57   ` Andy Shevchenko
2023-10-09 13:09     ` Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 04/11] dt-bindings: leds: aw200xx: introduce optional hwen-gpio property Dmitry Rokosov
2023-10-10 14:13   ` Rob Herring
2023-10-10 14:57     ` Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 05/11] leds: aw200xx: calculate dts property display_rows in driver Dmitry Rokosov
2023-10-06 17:59   ` Andy Shevchenko
2023-10-09 13:20     ` Dmitry Rokosov
2023-10-16 23:30       ` George Stark
2023-10-06 16:04 ` [PATCH v1 06/11] dt-bindings: leds: aw200xx: remove property "awinic,display-rows" Dmitry Rokosov
2023-10-10 14:15   ` Rob Herring
2023-10-06 16:04 ` [PATCH v1 07/11] leds: aw200xx: add delay after software reset Dmitry Rokosov
2023-10-06 18:01   ` Andy Shevchenko
2023-10-09 13:14     ` Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 08/11] leds: aw200xx: enable disable_locking flag in regmap config Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 09/11] leds: aw200xx: improve autodim calculation method Dmitry Rokosov
2023-10-06 18:03   ` Andy Shevchenko
2023-10-09 13:18     ` Dmitry Rokosov
2023-10-09 14:02       ` Dmitry Rokosov
2023-10-16 21:22         ` George Stark [this message]
2023-10-06 16:04 ` [PATCH v1 10/11] leds: aw200xx: add support for aw20108 device Dmitry Rokosov
2023-10-06 16:04 ` [PATCH v1 11/11] dt-bindings: leds: Add binding for AW20108 led driver Dmitry Rokosov
2023-10-10 14:17   ` Rob Herring

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=49b1d68c-2f16-2efd-ae24-2e2bd95a094b@salutedevices.com \
    --to=gnstark@salutedevices.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=ddrokosov@salutedevices.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@sberdevices.ru \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=rockosov@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

all inboxes | Powered by JetHome®