Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1010068pxk; Thu, 10 Sep 2020 04:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKFRexgGtZryxhmtMBSpPJh84oEfEYF8XiW6mGshxzKp7qYIBQDjvSTKj3/aBGQz3gQgrz X-Received: by 2002:a17:906:4cc7:: with SMTP id q7mr8566049ejt.437.1599738908690; Thu, 10 Sep 2020 04:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599738908; cv=none; d=google.com; s=arc-20160816; b=acwpsy3P5n6eJcikHD6jXYsmNUqn8wYScijkB2BKOl0bRhbrzbA6WXoLKY4ZTS1SHg Qbpimk5grJdiTrLQS0AjOXenbS9koi/dUETsXkCckYK04aQ+yOTGHha9pIdYr9qe/Sqc QBfjXIBDiNdwZQTgjSGj7yx3QEzVz4ET9CgVc8OQsEHaDQBkGzlZ8U/bZJ2dYF++Be35 TyEunv2XuHkraYE59hx6pRXiPlZAFEN0Mx4vWeugLZEEqQw1A0VMXgrxkP2vXRSUQpjA HQLA20HP32picwa8GDkoZY6QquzYefOQ32YiaJKbThPzveYFfxaVMyN8IIomHq/i1NTs L13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Nw0E6gxQ2hI2c4XtcGgjWtuM2BIER2w0GyM871TVHiE=; b=1FWRK/xw1Gamj6aGCoQ6ziAcbJRIJXEcJYSI53/iFQr3N1gTX5S1Cd8WNJn+ejSC7Y Tjp0jQ4nMDF63SdlHI37O1UbPdVfwIWSkkhRUaMzU22lLVsPUQ+HsG+yaKO8OUb4gyY/ mOZKBJ9S1XoG3k7oG2kwTUK3GpnCuUILJYrzLqo+lE/th6oFVuYD1u58vc1NeTip7eBF cJE1zgFk7piBda94XMnusO/a7X2J2IzR8KXIVYy2jNgN122U90pMsS32cfYp8qPCzpYR 5+mQjcjeNZWLUVkuaSaAYY6IpzPGbUTqAV63fbgthij5xR1T8qzxJnjw3MrjJYwYBQei kWMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TA0eyE+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t21si3347753edy.123.2020.09.10.04.54.45; Thu, 10 Sep 2020 04:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TA0eyE+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730477AbgIJLwj (ORCPT + 99 others); Thu, 10 Sep 2020 07:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729779AbgIJLsp (ORCPT ); Thu, 10 Sep 2020 07:48:45 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF1CBC061573; Thu, 10 Sep 2020 04:46:26 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id z19so4467737pfn.8; Thu, 10 Sep 2020 04:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Nw0E6gxQ2hI2c4XtcGgjWtuM2BIER2w0GyM871TVHiE=; b=TA0eyE+C1G8SDT1g5ewoXGJN+Pte1ilhz6PSvNsNQH/mV4ErK+fr1FKYJ9wwPMZILn Ed9l1+V5/pBZwg5KGPHzH1iXJCdMvytO1u91dfuuG+lMPlsArNoDH+qw7TUyX0uiGSc+ VXGaMnOwU72TeQuVxi9MIWYcowk6asEF0ZqZ6tufgjirVCiWVm3rsYZnUaRnh+2shh/z NQ5hL/IDyaxFs4dIWHN7DIGNG7A0eZwb+btta7syG8UFhXCh07oWcy4FrSD7DXR2tKnY TDOBpN1OMQz5PcPCCq662olaEJv89X4VHgMO5GRUc3beDuHuLwWCgHU6dTHXkIVBnwib RRIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Nw0E6gxQ2hI2c4XtcGgjWtuM2BIER2w0GyM871TVHiE=; b=KurtnkqvzfgvUeTd3yApv+ZEop9d9SIxU9LWF/bNji6+5vpHrMrZfR9tM7wIMiK1/U u9OuayzLNA74+qi6hoTnSzVXDx1gZtAkFE+N3g31L+2g8c4jVwzEI38QZ3kQsWPMVuwi ssk1XdRIKUl5QjIlQoihMFNvsZ86J+cABYU1lbUofJBjJ6OZiCydfI1to2lxIHk2ORGZ OTtKfVjUpN70qCTNweLbBKSYRioAWUzD80lzGfwjQ2vX15INQyry0f+Z426GFvvXXflw uwxzPGqfxa93ddYHZ5nlRfyJxO87uJkd7tttUH/H4Krhj7h0EM8GTXF3YubJkx7lTjCA riMQ== X-Gm-Message-State: AOAM530Dk1Aw+2VCL+KrETO6PCM623ZiSzUNsTcqPhS6Kl9ZN2FXoErF UyADLFFmBPuWVlTCCCqyYrTF6i3PxdEYd49dXts= X-Received: by 2002:a63:ec4c:: with SMTP id r12mr4068361pgj.74.1599738385970; Thu, 10 Sep 2020 04:46:25 -0700 (PDT) MIME-Version: 1.0 References: <1599474459-20853-1-git-send-email-gene.chen.richtek@gmail.com> <1599474459-20853-2-git-send-email-gene.chen.richtek@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Thu, 10 Sep 2020 14:46:08 +0300 Message-ID: Subject: Re: [PATCH v3 1/2] leds: mt6360: Add LED driver for MT6360 To: Gene Chen Cc: Jacek Anaszewski , Pavel Machek , Rob Herring , Matthias Brugger , Dan Murphy , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Gene Chen , Wilma.Wu@mediatek.com, shufan_lee@richtek.com, cy_huang@richtek.com, benjamin.chao@mediatek.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 11:11 AM Gene Chen wr= ote: > Andy Shevchenko =E6=96=BC 2020=E5=B9=B49=E6= =9C=889=E6=97=A5 =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=889:48=E5=AF=AB=E9=81= =93=EF=BC=9A > > On Mon, Sep 7, 2020 at 1:31 PM Gene Chen = wrote: > > > From: Gene Chen ... > > > + if (priv->fled_strobe_used) { > > > + dev_warn(lcdev->dev, "Please disable strobe first [%d= ]\n", priv->fled_strobe_used); > > > + return -EINVAL; > > > > Hmm... Shouldn't be guaranteed by some framework? > > > > Because both Flash LED use single logically control. > It doesn't exist one LED is torch mode, and the other is strobe mode. You mean you have always an attribute for hardware even if it doesn't support a feature? Can you consider hiding attributes? ... > > > + lcdev->max_brightness =3D (val - MT6360_ITORCH_MIN) / MT6360_= ITORCH_STEP + 1; > > > > DIV_ROUND_UP(val - MT6360_ITORCH_MIN, MT6360_ITORCH_STEP) ? > > > > This is mapping 0~val to 1~max_brightness as level. > I convert val below MT6360_ITORCH_STEP to 1 for ignore max_brightness > =3D 0, because 0 means disable. > There is a little difference from DIV_ROUND_UP. What div_round_up does is (x + y - 1) / y What do you do x / y + 1 =3D (x + y)/y =3D ((x + 1) + y - 1)/y =3D DIV_ROUND_UP(x+1,y) So, DIV_ROUND_UP(val - MT6360_ITORCH_MIN + 1, MT6360_ITORCH_STEP) ? (yes I made classical off-by-one error) --=20 With Best Regards, Andy Shevchenko