From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D443BC43334 for ; Wed, 20 Jul 2022 09:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233688AbiGTJpa (ORCPT ); Wed, 20 Jul 2022 05:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbiGTJp3 (ORCPT ); Wed, 20 Jul 2022 05:45:29 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B64B417049; Wed, 20 Jul 2022 02:45:27 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id a15so17294669pjs.0; Wed, 20 Jul 2022 02:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=RzIw6shq7/p2+9kSSnoLEbXRnqiI0CLXZmBib/B9u6Kz+jdHcSFA9jwb13WPFuw4Rq fi+khaia4vqt0KsUbkVtO8cUSAaWDP5Ofp48hzPoXCkPZvWgqhkzGT7gkdifkkVaGpHP Vjv3e5tTMQKX0ji35J52361j9AXAKZk5adFFy1pVLa86yW7MyrxApLc4xmk2hbLHtdMG Jes4+tanrARtJLDZwim6oT2dcwDiqz9CLMbWipXP/zxJit1vFscdZDO3CQ1i6W9x76Rs LQQiVVOsCpnwlMhlfGSqg7u3rZoTAS4/CJgRyacjIrYgPsi8ovT389k2cQ09CBUGmpVl CoVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=PXWHLZmznHKvQponPvP6u3yOx/7XdeixN+RgtWryRyN/wkoksJYXz/HRjZ+io42myz KuuOd2RAg+EtT/yjTo5HauAOmUrlbRxHPknyinFyWXF1xbUDt9eMFzkIZrJniVlNaHrk McMwm3PFN2g1Ha9mCbRpLtHqc0IqwNwPzx5SUnBFlrtRYRK0F8ZGNIY2J7DNa59PHu6M QxLVd0ZXsyo8/KrtwKmyu0DlEYSlfh/MLECa8CYbNm/o+3gDTYDz1jpiWapriHjlbk5i xvio+qFj1BkHpTeP1L1oRtARfUKaGla1qMrT1kQAt33PK7VhqxYgPYvJ9V0Pr7nvl6or vMTw== X-Gm-Message-State: AJIora+RbGtdhXY6VTnu4pc8TjQnBvpjEB6yXEDc198rgNBM7yKTyxtt +lQRXOUMEX7+lSYPehoUttE= X-Google-Smtp-Source: AGRyM1sQfw9FLzUYvY3KYvRCDYSTojdB7+ka4nuileRmLrHXrjld7ic/4DquoAhGcv6UAgnVdVkJ2Q== X-Received: by 2002:a17:903:245:b0:16b:9c49:6b1c with SMTP id j5-20020a170903024500b0016b9c496b1cmr36679021plh.153.1658310326952; Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Received: from cyhuang-hp-elitebook-840-g3.rt ([2402:7500:487:b1ec:fd78:6fba:974b:164e]) by smtp.gmail.com with ESMTPSA id x1-20020a170902a38100b0015ee60ef65bsm13417514pla.260.2022.07.20.02.45.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Date: Wed, 20 Jul 2022 17:45:15 +0800 From: ChiYuan Huang 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 , ChiYuan Huang Subject: Re: [PATCH v5 11/13] leds: mt6370: Add MediaTek MT6370 current sink type LED Indicator support Message-ID: <20220720094510.GA29755@cyhuang-hp-elitebook-840-g3.rt> References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-12-peterwu.pub@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org 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 = F_LED1_DUTY; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_DUTY; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_DUTY; > > + break; > > + default: > > + sel_field = F_LED4_DUTY; > > Missed break; > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + sel_field = F_LED1_FREQ; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_FREQ; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_FREQ; > > + break; > > + default: > > + sel_field = F_LED4_FREQ; > > Ditto. > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + case MT6370_LED_ISNK2: > > + case MT6370_LED_ISNK3: > > + *base = MT6370_REG_RGB1_TR + led_no * 3; > > + break; > > + default: > > + *base = 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] = {0}; > > { } should suffice > > In the above range selector, we use the 'logic or' to generate the 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 = 0; i < P_MAX_PATTERNS; i++) { > > + curr = pattern + i; > > + > > + sel_range = i == P_LED_TOFF ? R_LED_TOFF : R_LED_TRFON; > > + > > + linear_range_get_selector_within(priv->ranges + sel_range, > > + curr->delta_t, &sel); > > + > > + val[i / 2] |= 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 = 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 = fwnode_property_read_u32(child, "color", &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 = devm_kzalloc(&pdev->dev, > > + struct_size(priv, leds, count), GFP_KERNEL); > > At least one parameter can be placed on the previous line. > > > + if (!priv) > > + return -ENOMEM; > > -- > With Best Regards, > Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8551EC43334 for ; Wed, 20 Jul 2022 09:45:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8281E11B787; Wed, 20 Jul 2022 09:45:28 +0000 (UTC) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by gabe.freedesktop.org (Postfix) with ESMTPS id B044311B787 for ; Wed, 20 Jul 2022 09:45:27 +0000 (UTC) Received: by mail-pl1-x634.google.com with SMTP id y24so1237887plh.7 for ; Wed, 20 Jul 2022 02:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=RzIw6shq7/p2+9kSSnoLEbXRnqiI0CLXZmBib/B9u6Kz+jdHcSFA9jwb13WPFuw4Rq fi+khaia4vqt0KsUbkVtO8cUSAaWDP5Ofp48hzPoXCkPZvWgqhkzGT7gkdifkkVaGpHP Vjv3e5tTMQKX0ji35J52361j9AXAKZk5adFFy1pVLa86yW7MyrxApLc4xmk2hbLHtdMG Jes4+tanrARtJLDZwim6oT2dcwDiqz9CLMbWipXP/zxJit1vFscdZDO3CQ1i6W9x76Rs LQQiVVOsCpnwlMhlfGSqg7u3rZoTAS4/CJgRyacjIrYgPsi8ovT389k2cQ09CBUGmpVl CoVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=FrS7Pd8VVWUygCGpEDh5575j3BHiEHARIWyulv9a+YL96AhiETF7TQIo4wpRx404Q0 ceJOqmKpKF865TgmC0h1lqpZNGVarag/MPXOp6CavQe8gkbfhJQ0sBryn4vYwVFSbsT+ Q1hzi+H+83bNOu9VgBbnw9RiBVjmSv0TtpkfFkq1qJ0vW1o/eG/VWuLj4PU6ZBhhMaKR yXzqevMiWvArPn8i+Yyc386N2mG3IvzglG9fk7j2ZgED7HrFz09jYLXyT9j55XiTwIRe w9dCEUWpO6vFr7AzF69hx3InTCkt9ChNneTC7tfCor/e8BCdiKjuxrQkd78MxTB4PmUZ hK4A== X-Gm-Message-State: AJIora+LEGekeV9eVa0GFOrn6yih/UoxuuW4m3xaGsIsQgVyZfOCpo31 wvhoKpgSv6gAx1b36nuE04U= X-Google-Smtp-Source: AGRyM1sQfw9FLzUYvY3KYvRCDYSTojdB7+ka4nuileRmLrHXrjld7ic/4DquoAhGcv6UAgnVdVkJ2Q== X-Received: by 2002:a17:903:245:b0:16b:9c49:6b1c with SMTP id j5-20020a170903024500b0016b9c496b1cmr36679021plh.153.1658310326952; Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Received: from cyhuang-hp-elitebook-840-g3.rt ([2402:7500:487:b1ec:fd78:6fba:974b:164e]) by smtp.gmail.com with ESMTPSA id x1-20020a170902a38100b0015ee60ef65bsm13417514pla.260.2022.07.20.02.45.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Date: Wed, 20 Jul 2022 17:45:15 +0800 From: ChiYuan Huang To: Andy Shevchenko Subject: Re: [PATCH v5 11/13] leds: mt6370: Add MediaTek MT6370 current sink type LED Indicator support Message-ID: <20220720094510.GA29755@cyhuang-hp-elitebook-840-g3.rt> References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-12-peterwu.pub@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:FRAMEBUFFER LAYER" , "Krogerus, Heikki" , Pavel Machek , Alice Chen , linux-iio , dri-devel , Liam Girdwood , cy_huang , Krzysztof Kozlowski , Lee Jones , Linux LED Subsystem , Daniel Thompson , Helge Deller , ChiYuan Huang , Rob Herring , Chunfeng Yun , Guenter Roeck , devicetree , Linux PM , szuni chen , Mark Brown , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , ChiaEn Wu , linux-arm Mailing List , Jingoo Han , USB , Sebastian Reichel , Linux Kernel Mailing List , ChiaEn Wu , Greg Kroah-Hartman , Jonathan Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 = F_LED1_DUTY; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_DUTY; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_DUTY; > > + break; > > + default: > > + sel_field = F_LED4_DUTY; > > Missed break; > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + sel_field = F_LED1_FREQ; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_FREQ; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_FREQ; > > + break; > > + default: > > + sel_field = F_LED4_FREQ; > > Ditto. > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + case MT6370_LED_ISNK2: > > + case MT6370_LED_ISNK3: > > + *base = MT6370_REG_RGB1_TR + led_no * 3; > > + break; > > + default: > > + *base = 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] = {0}; > > { } should suffice > > In the above range selector, we use the 'logic or' to generate the 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 = 0; i < P_MAX_PATTERNS; i++) { > > + curr = pattern + i; > > + > > + sel_range = i == P_LED_TOFF ? R_LED_TOFF : R_LED_TRFON; > > + > > + linear_range_get_selector_within(priv->ranges + sel_range, > > + curr->delta_t, &sel); > > + > > + val[i / 2] |= 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 = 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 = fwnode_property_read_u32(child, "color", &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 = devm_kzalloc(&pdev->dev, > > + struct_size(priv, leds, count), GFP_KERNEL); > > At least one parameter can be placed on the previous line. > > > + if (!priv) > > + return -ENOMEM; > > -- > With Best Regards, > Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71E71C43334 for ; Wed, 20 Jul 2022 09:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=stTsAPKqeI9g5R/zpkEK7F3Rh851o47B1ljSxBEfzqI=; b=ja2zuHrL6/ezxu I0q4ZPM60ngxaHJNNrO/pg3KL75RiFck9BKubEJKYU0gM3Si3S6NVssAhj7BLbeT93S/R7TQJ6CGG Aa0Xp6yKzMirRVmjfbQGImQwTZo/GogpayCSVKW2N23VluzkWxQ/8ubVlHpV0kD6zXjhxLbA+DGco AO4/7ZASsuzOkb0X62cwIV1FW4RHXm9iUaNw63JWWosy0s33PzX/JwWMRRytUfhoZ8pHfDq+k0naJ np4uM/sbAjAYdRiMbEMHKAUDLH2BA0JI0hBqsDXhHGxgS7CD+6TQB+jX2F9vVDsDCDi8H+It53N/K ZRYo8EFbW09KroS2Ol7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE6Gs-003TUs-Cm; Wed, 20 Jul 2022 09:45:34 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE6Go-003TPz-VD; Wed, 20 Jul 2022 09:45:32 +0000 Received: by mail-pj1-x102a.google.com with SMTP id o18so3092843pjs.2; Wed, 20 Jul 2022 02:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=RzIw6shq7/p2+9kSSnoLEbXRnqiI0CLXZmBib/B9u6Kz+jdHcSFA9jwb13WPFuw4Rq fi+khaia4vqt0KsUbkVtO8cUSAaWDP5Ofp48hzPoXCkPZvWgqhkzGT7gkdifkkVaGpHP Vjv3e5tTMQKX0ji35J52361j9AXAKZk5adFFy1pVLa86yW7MyrxApLc4xmk2hbLHtdMG Jes4+tanrARtJLDZwim6oT2dcwDiqz9CLMbWipXP/zxJit1vFscdZDO3CQ1i6W9x76Rs LQQiVVOsCpnwlMhlfGSqg7u3rZoTAS4/CJgRyacjIrYgPsi8ovT389k2cQ09CBUGmpVl CoVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X3mlWFpj4S2AEsT7TyVuZdiSzXmbO7C8MQMMt/vGg64=; b=PSeHD/3ddq9LfYuy/TBmfnhwwt0+OZAH3rla8VikYUp30vkpwLtvzrlrjrNnVrqyyB x2e4Ypm44n5GaDol91b3Em6g5I+uAIPCN2nzQWFSDC73KEnYoxka1HuzmFTZQzJ1TjmG gHyQyrE61MJXSRH9X2RYr+yYSbVotTTudg3zSjrESRBUGrCQUT0+EH+Z5e8aV0AJie6X aVl9XIlOYk8ShNSnxzpTKl73F+DwEjTJkCh164OrqZyEnpVB3LSiLEo0Jj45D+4kJjPq cFnbSwJKnY+ylhQ18FJx6hn8LpG/7aqdFLrlokdynFSfNl7jtjdWCOjUgyh5fb+HrQqc 5sQQ== X-Gm-Message-State: AJIora/HdkwNLdY3Z6A557knrhQnUZeXa0hjSTPrKrZVd+/01ZWOPFAK RyAvx8m3WXwmbV44Mq29nh0= X-Google-Smtp-Source: AGRyM1sQfw9FLzUYvY3KYvRCDYSTojdB7+ka4nuileRmLrHXrjld7ic/4DquoAhGcv6UAgnVdVkJ2Q== X-Received: by 2002:a17:903:245:b0:16b:9c49:6b1c with SMTP id j5-20020a170903024500b0016b9c496b1cmr36679021plh.153.1658310326952; Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Received: from cyhuang-hp-elitebook-840-g3.rt ([2402:7500:487:b1ec:fd78:6fba:974b:164e]) by smtp.gmail.com with ESMTPSA id x1-20020a170902a38100b0015ee60ef65bsm13417514pla.260.2022.07.20.02.45.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2022 02:45:26 -0700 (PDT) Date: Wed, 20 Jul 2022 17:45:15 +0800 From: ChiYuan Huang 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 , ChiYuan Huang Subject: Re: [PATCH v5 11/13] leds: mt6370: Add MediaTek MT6370 current sink type LED Indicator support Message-ID: <20220720094510.GA29755@cyhuang-hp-elitebook-840-g3.rt> References: <20220715112607.591-1-peterwu.pub@gmail.com> <20220715112607.591-12-peterwu.pub@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_024531_018523_4A31B289 X-CRM114-Status: GOOD ( 37.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 = F_LED1_DUTY; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_DUTY; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_DUTY; > > + break; > > + default: > > + sel_field = F_LED4_DUTY; > > Missed break; > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + sel_field = F_LED1_FREQ; > > + break; > > + case MT6370_LED_ISNK2: > > + sel_field = F_LED2_FREQ; > > + break; > > + case MT6370_LED_ISNK3: > > + sel_field = F_LED3_FREQ; > > + break; > > + default: > > + sel_field = F_LED4_FREQ; > > Ditto. > > > + } > > ... > > > + switch (led_no) { > > + case MT6370_LED_ISNK1: > > + case MT6370_LED_ISNK2: > > + case MT6370_LED_ISNK3: > > + *base = MT6370_REG_RGB1_TR + led_no * 3; > > + break; > > + default: > > + *base = 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] = {0}; > > { } should suffice > > In the above range selector, we use the 'logic or' to generate the 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 = 0; i < P_MAX_PATTERNS; i++) { > > + curr = pattern + i; > > + > > + sel_range = i == P_LED_TOFF ? R_LED_TOFF : R_LED_TRFON; > > + > > + linear_range_get_selector_within(priv->ranges + sel_range, > > + curr->delta_t, &sel); > > + > > + val[i / 2] |= 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 = 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 = fwnode_property_read_u32(child, "color", &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 = devm_kzalloc(&pdev->dev, > > + struct_size(priv, leds, count), GFP_KERNEL); > > At least one parameter can be placed on the previous line. > > > + if (!priv) > > + return -ENOMEM; > > -- > With Best Regards, > Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel