Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5296310imw; Wed, 20 Jul 2022 03:00:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sVsPC9SLU2uOI9cgR2nofRIsgS5yTn6LFQl9XhCF98urnpiHO4GF9umUEAYuARCHsloWAj X-Received: by 2002:a17:907:72ca:b0:72f:1a9b:361b with SMTP id du10-20020a17090772ca00b0072f1a9b361bmr18698900ejc.274.1658311219594; Wed, 20 Jul 2022 03:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658311219; cv=none; d=google.com; s=arc-20160816; b=HfsAqrC3X2BTTLSwpRMAcqx2W/84MoBPp1Y42cUPG6GW+vnRDc/7K5VEBiTsn8zcuo rjY5rsp11YoCtnZVYXs+AXuPYVB9V98DbyXqets8RFB1D4DCrMTtyX/w8a1aABKIkEvx KdA6ubtBsKdIJiA177hbjh1i0N3XirFYQVmnPLK0oNgfvPP1jzfvCRQjJRfQ15OA0UtI JmgEb9nI941n6BnIO2m+Jo0rlMwLupt3B+GafBVVt2JXadWII+Qmubiu6oL2pcSDtvq8 etHv6er9Lai+YYgNU8COXSSTZtQDKXaZ+yYDuJqjgypy/wKN++vhQUJkPsmdBPpNZyxF lg+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=c+pvmwXxIE3jKXaJBEBBqNcZCeI+2ftzet1Ejv5LXxE=; b=WCVYnhG3SltXG2Xqy7Bzu7WW7NA4EG4XfOfyUSkGrxBMpizI2EgjfMSIYtXM7skRbP 8v7FR4ROoiUnO+0NdrOKLCMAuuTigl6LHacFRLAy1PzwjlFYbsRoFgPBHkOZEq7S1Ykr 4L+tCk1hiFqcsmYQLVe2SCZ46gkGf7wpZkOTH+G0Zif4HxMnXyXasrlNHv/DqLKBdnux ifJibuRaT1CKZYAPoxy8fNRGTp4Zc2vmwyxY+8JYhPlpSJRKAVUHdOIZe7aWV5728BaE tn0mMwjgYVaaxCXXgIE4wuExGnshFA8KukJ+3V+PDTG1friKN7lIm8une043wYa+GL5o Cy8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Bl/Uxa8x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a1709062dd500b00706b9787b43si16536279eji.319.2022.07.20.02.59.53; Wed, 20 Jul 2022 03:00:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Bl/Uxa8x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232230AbiGTJsx (ORCPT + 99 others); Wed, 20 Jul 2022 05:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231826AbiGTJst (ORCPT ); Wed, 20 Jul 2022 05:48:49 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E39655AF; Wed, 20 Jul 2022 02:48:48 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id z13so5771235wro.13; Wed, 20 Jul 2022 02:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=c+pvmwXxIE3jKXaJBEBBqNcZCeI+2ftzet1Ejv5LXxE=; b=Bl/Uxa8xKm77kppS+zbyPUqMX6ThytrscVsgl1YNbRNeKe8x3wNYy9xN2LJQgC4b+m CVtxDHN3+NlCmmeGfSPK3c/2bgbcIaqjyJ8UOOrc7fgYnHXVJpL9/jlthv7pWdx9kOH1 LZ8Ke+TTociEGnkw6Kb2NrqYVzWsyeo9vazoQxsfc7PDfRMUmtJMmZ2JjxhubAt8pfFH oIQiGQ/fJdWsK3BswigHb/+Qw2e86Dg2TDS2EAHuCLGkXQC7NROzCqqyLHBKgPM7Xxl8 znyAJjdKjHqrO6ONRWcA3n3b8veOJmnjbOX7I+MBtOPTMpYlt0dx+flde0eKnhS9oZA+ 5LkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=c+pvmwXxIE3jKXaJBEBBqNcZCeI+2ftzet1Ejv5LXxE=; b=zm/QX45d+Mq9PhohE71568aOFJBPpbFe7wxDQk34r2O2J8cCArx5iVOiwWhmnBxQWz e+9/7NCWMYxGOdb450CFH13Xs8+wD2HvMjZk/aK6teRylv4EcO6sf9FL9nfI9X+GuljY t3TApFUPaqbN8SzVKt7cmA4B+ge5/uDhjLKArCJBjIARuUMM0OnGD230e8JujxssWXpA ncDZooT4JZLS1TApVC5i7jHiDNBp1TW4MU3h9OFf49Gg4IiBfOETKvmE0V1KGvqOUt7G Yn46NBlMQ32/2eWQpyrnkCg/4ajf4fEUizgM/0V6jqmusoQFIMh9PPQDNirhY47+Mo8D azwA== X-Gm-Message-State: AJIora9Nws0kRDpeOhHskrMn3R+TY5xMg7/PGShiCuaPk8hajCH7cOxJ VllcfJuzXjYnrG+pFKpJr8H1BNSdRGiwZA+0bTU= X-Received: by 2002:a05:6000:98b:b0:21d:b70f:2726 with SMTP id by11-20020a056000098b00b0021db70f2726mr29986145wrb.237.1658310526656; Wed, 20 Jul 2022 02:48:46 -0700 (PDT) MIME-Version: 1.0 References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-12-peterwu.pub@gmail.com> <20220720094510.GA29755@cyhuang-hp-elitebook-840-g3.rt> In-Reply-To: <20220720094510.GA29755@cyhuang-hp-elitebook-840-g3.rt> From: ChiYuan Huang Date: Wed, 20 Jul 2022 17:48:34 +0800 Message-ID: Subject: Re: [PATCH v5 11/13] leds: mt6370: Add MediaTek MT6370 current sink type LED Indicator support To: Andy Shevchenko Cc: ChiaEn Wu , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sebastian Reichel , Chunfeng Yun , Greg Kroah-Hartman , Jonathan Cameron , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Guenter Roeck , "Krogerus, Heikki" , Helge Deller , ChiaEn Wu , Alice Chen , cy_huang , dri-devel , Linux LED Subsystem , devicetree , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List , Linux PM , USB , linux-iio , "open list:FRAMEBUFFER LAYER" , szuni chen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ChiYuan Huang =E6=96=BC 2022=E5=B9=B47=E6=9C=8820=E6= =97=A5 =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=885:45=E5=AF=AB=E9=81=93=EF=BC=9A > > On Fri, Jul 15, 2022 at 08:29:42PM +0200, Andy Shevchenko wrote: > > On Fri, Jul 15, 2022 at 1:29 PM ChiaEn Wu wrote= : > > > > > > From: ChiYuan Huang > > > > > > The MediaTek MT6370 is a highly-integrated smart power management IC, > > > which includes a single cell Li-Ion/Li-Polymer switching battery > > > charger, a USB Type-C & Power Delivery (PD) controller, dual > > > Flash LED current sources, a RGB LED driver, a backlight WLED driver, > > > a display bias driver and a general LDO for portable devices. > > > > > > In MediaTek MT6370, there are four channel current-sink RGB LEDs that > > > support hardware pattern for constant current, PWM, and breath mode. > > > Isink4 channel can also be used as a CHG_VIN power good indicator. > > > > ... > > > > > + This driver can also be built as a module. If so the module > > > > so, the > > > > > + will be called "leds-mt6370.ko". > > > > No ".ko". > > > > Why did you ignore these comments? Please go and fix _everywhere_ in > > your series. > > It's basically the rule of thumb, if the reviewer gives a comment > > against an occurrence of something, go through entire series and check > > if there are other places like commented one and address them all. > > > > ... > > > > > + * Author: Alice Chen > > > > Strange, the commit message doesn't have a corresponding SoB, why? > > > Yes, there're two authors Alice and me. > I'll correct it in next. > > ... > > > > > +#define MT6370_PWM_DUTY 31 > > > +#define MT6372_PMW_DUTY 255 > > > > Looks like these are limits by hardware? > > Check with the datasheet if (BIT(x) - 1) makes more sense here. > > > > ... > > > > > + switch (led_no) { > > > + case MT6370_LED_ISNK1: > > > + sel_field =3D F_LED1_DUTY; > > > + break; > > > + case MT6370_LED_ISNK2: > > > + sel_field =3D F_LED2_DUTY; > > > + break; > > > + case MT6370_LED_ISNK3: > > > + sel_field =3D F_LED3_DUTY; > > > + break; > > > + default: > > > + sel_field =3D F_LED4_DUTY; > > > > Missed break; > > > > > + } > > > > ... > > > > > + switch (led_no) { > > > + case MT6370_LED_ISNK1: > > > + sel_field =3D F_LED1_FREQ; > > > + break; > > > + case MT6370_LED_ISNK2: > > > + sel_field =3D F_LED2_FREQ; > > > + break; > > > + case MT6370_LED_ISNK3: > > > + sel_field =3D F_LED3_FREQ; > > > + break; > > > + default: > > > + sel_field =3D F_LED4_FREQ; > > > > Ditto. > > > > > + } > > > > ... > > > > > + switch (led_no) { > > > + case MT6370_LED_ISNK1: > > > + case MT6370_LED_ISNK2: > > > + case MT6370_LED_ISNK3: > > > + *base =3D MT6370_REG_RGB1_TR + led_no * 3; > > > + break; > > > + default: > > > + *base =3D MT6370_REG_RGB_CHRIND_TR; > > > > Ditto. > > It seems you dropped them for all switch-cases. It's not goot, please > > restore them back. > > > > > + } > > > > ... > > > > > + u8 val[P_MAX_PATTERNS / 2] =3D {0}; > > > > { } should suffice > > > > > In the above range selector, we use the 'logic or' to generate the typo, it's 'below'. > pattern values. > > If to change it from '{0} to '{ }', is it correct? > > > + /* > > > + * Pattern list > > > + * tr1: byte 0, b'[7: 4] > > > + * tr2: byte 0, b'[3: 0] > > > + * tf1: byte 1, b'[7: 4] > > > + * tf2: byte 1, b'[3: 0] > > > + * ton: byte 2, b'[7: 4] > > > + * toff: byte 2, b'[3: 0] > > > + */ > > > + for (i =3D 0; i < P_MAX_PATTERNS; i++) { > > > + curr =3D pattern + i; > > > + > > > + sel_range =3D i =3D=3D P_LED_TOFF ? R_LED_TOFF : R_LE= D_TRFON; > > > + > > > + linear_range_get_selector_within(priv->ranges + sel_r= ange, > > > + curr->delta_t, &sel)= ; > > > + > > > + val[i / 2] |=3D sel << (4 * ((i + 1) % 2)); > > > + } > > > + > > > + memcpy(pattern_val, val, 3); > > > + return 0; > > > +} > > > > ... > > > > > +out: > > > > out_unlock: > > > > > + mutex_unlock(&priv->lock); > > > + > > > + return ret; > > > > ... > > > > > +out: > > > > Ditto. And so on. > > > > > + mutex_unlock(&priv->lock); > > > + > > > + return ret; > > > > ... > > > > > + sub_led =3D devm_kzalloc(priv->dev, > > > + sizeof(*sub_led) * MC_CHANNEL_= NUM, > > > + GFP_KERNEL); > > > > NIH devm_kcalloc(). Also check if you really need zeroed data. > > > Ok, and after the check, I also need to add one line to set the intensity= to 0. > > > + if (!sub_led) > > > + return -ENOMEM; > > > > ... > > > > > + ret =3D fwnode_property_read_u32(child, "colo= r", &color); > > > + if (ret) { > > > + dev_err(priv->dev, > > > + "led %d, no color specified\n= ", > > > + led->index); > > > + return ret; > > > > return dev_err_probe(...) ; ? > > > > Ditto for many places in your entire series. > > > > > + } > > > > ... > > > > > + priv =3D devm_kzalloc(&pdev->dev, > > > + struct_size(priv, leds, count), GFP_KERNE= L); > > > > At least one parameter can be placed on the previous line. > > > > > + if (!priv) > > > + return -ENOMEM; > > > > -- > > With Best Regards, > > Andy Shevchenko