Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2551817imi; Mon, 25 Jul 2022 01:28:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u2SrrRCDPMMV110HXeL1TXMkGSeuP6TFbuWO4Pjb3FmEaGWjJ53K0efAJunF+v68eoqygo X-Received: by 2002:a05:6402:348e:b0:43c:37a:26d with SMTP id v14-20020a056402348e00b0043c037a026dmr3457315edc.279.1658737691077; Mon, 25 Jul 2022 01:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658737691; cv=none; d=google.com; s=arc-20160816; b=ca00ZzwPP+9o9VsDUGlELmpVOutZF7GNlGzsNR7kmhNDh31AM2zTN+cEmbp/Jktnma Ah1mvCMkpceinM9Oxvi2FDxFumZtf8ph4beCICPrjbWxh+w/Q0TfJCNdxXRmqXAP4hcb jJaZsIC1RmAJBO455h3qDmgycDxNmL0F5qNNKbGLkqUHjMB5iu4sDpjbopDdc5O5vkm1 OPorhF2I3MR8BTTu1zbWeTEt64iFwHlwR8Iu+4DSTvMJtTh9UzrlUXuZ5gEYspZWw3xJ pDyHMtdLhePDh+t512DiWYYrQ6DPIPLXDaPYtkrwNFnv0nonB/8IG7Wc00SFRri1ksAY ryLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=J5rSRKJzZCEe75lE89H4BacTqhlHPMQzJe7RV2ORfWI=; b=qp71X101qKneSSkpL3aqTqbfBZkqnO6sqekzuaIChSNFr0ioHtRpMPRkEVRTaGwvWT v8Xv54V/R4huOcFmHdO7qk/iZCsYn0eJmGx2Dj08Az+yf3972cho203wHGGYhCdloXP2 NIBmoD26bjwqjqn9CxO4K59a3ZplXOx/xJ8MYm097ZYhjA+LsQ64EXhXu5SVo4peKDvM QtIcrbeNeDXJDPUB7pTgtLCcZSkF624HBRKRbEQj6rOFkrie5qy9nR3oxS+2Ncd5Fuvm yeCFaeZeMewuledr7nMzBTPau0EyamVx2j9udIAPYvsI+pT9D62y3KqwmTOCi4Gj0Q6U Oc+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BNlVjsxR; 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 nd39-20020a17090762a700b007262944c626si14408224ejc.873.2022.07.25.01.27.46; Mon, 25 Jul 2022 01:28:11 -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=BNlVjsxR; 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 S233335AbiGYIZs (ORCPT + 99 others); Mon, 25 Jul 2022 04:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbiGYIZq (ORCPT ); Mon, 25 Jul 2022 04:25:46 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A1E13E9B; Mon, 25 Jul 2022 01:25:45 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id tk8so19173658ejc.7; Mon, 25 Jul 2022 01:25:45 -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; bh=J5rSRKJzZCEe75lE89H4BacTqhlHPMQzJe7RV2ORfWI=; b=BNlVjsxRro5TG97838xZbVcQ/pG/LD+g/7G/AjwrIrlPvPS37j9HRk59ZPvQZFMbo9 MnOMniee2k168J7vlVevltwedsYw1fwJcNYMweUNuLPFL7JEp9m9CEssAgQLNBEXPpLX 65np3ghAZ/JI0ou7IY+VAdXdeEM9Dx5l6K3VMtdxVw5MaZ+JcN9Mz6qTKX+a72GlbThf YgqMy4pPKGjxlN3v8ojq6p7cX1h0ysW9lnKZ5pLCEPb56UCWlozkB+OoACaoaIIUBRbZ /V/wW4p+YYsXXLnpTvXofuXoBPwxmOEVHWVRTZH6OK6PGjSYJaBn82vKtB7a1B3eaVvy gAUg== 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; bh=J5rSRKJzZCEe75lE89H4BacTqhlHPMQzJe7RV2ORfWI=; b=KmLawa8UXbcqBjf0QeFvLCZ0gZkepy9msxh2TcI45J0/AKstyDM2vjS0jhEAhMMHcC XINhzzdIYVcgr/l48JvCkbsxVjj7kCBVvm8pju+RoZsEEyuUtcuCpYdfwDZcQigmYPRI 7cflqhlNiNtCzGshQnufoaJoVY8PeAQr/5sonhpTcD4hCt8GwwjsLrZbP5Es3OdbsNqR BEyW4qunCBOr9c4YGiDmIRuC8Metmp/9wifmWsDyLzBeg781ZGF7VSTjkC3i4CE6kj35 S5I0eRZsw2MAO2G+FinrnraRM0k1vuHs0IDIIfWGgq55Z5a4+4yqqfkGD4YEkTrIjMJT QC1w== X-Gm-Message-State: AJIora+hU7VC0LcDSE7wGV5cpWcVpLHCTv4zPhAEsYsFqMl0u7nfMIIr BawBilq4Fe/pPdBgumbhzhronxEJSql//Xjj4ks= X-Received: by 2002:a17:906:8a4a:b0:72b:5b23:3065 with SMTP id gx10-20020a1709068a4a00b0072b5b233065mr9396194ejc.557.1658737543426; Mon, 25 Jul 2022 01:25:43 -0700 (PDT) MIME-Version: 1.0 References: <20220722102407.2205-1-peterwu.pub@gmail.com> <20220722102407.2205-11-peterwu.pub@gmail.com> In-Reply-To: <20220722102407.2205-11-peterwu.pub@gmail.com> From: Andy Shevchenko Date: Mon, 25 Jul 2022 10:25:06 +0200 Message-ID: Subject: Re: [PATCH v6 10/13] power: supply: mt6370: Add MediaTek MT6370 charger driver To: ChiaEn Wu Cc: 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" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Fri, Jul 22, 2022 at 12:25 PM ChiaEn Wu wrote: > > From: ChiaEn Wu > > MediaTek MT6370 is a SubPMIC consisting of a single cell battery charger > with ADC monitoring, RGB LEDs, dual channel flashlight, WLED backlight > driver, display bias voltage supply, one general purpose LDO, and the > USB Type-C & PD controller complies with the latest USB Type-C and PD > standards. > > This adds MediaTek MT6370 Charger driver support. The charger module > of MT6370 supports High-Accuracy Voltage/Current Regulation, > Average Input Current Regulation, Battery Temperature Sensing, > Over-Temperature Protection, DPDM Detection for BC1.2. ... > +static inline void mt6370_chg_enable_irq(struct mt6370_priv *priv, > + const char *irq_name, bool en) > +{ > + int irq_num; > + struct platform_device *pdev = to_platform_device(priv->dev); > + > + irq_num = platform_get_irq_byname(pdev, irq_name); Every time the IRQ is not found you will get an error message printed here. 1) Is IRQ optional? 2) If not, can't you do validation only once? > + if (irq_num < 0) > + return; > + > + if (en) > + enable_irq(irq_num); > + else > + disable_irq_nosync(irq_num); > +} ... > + ret = mt6370_chg_field_set(priv, F_USBCHGEN, 0); > + if (ret < 0) { > + ret = mt6370_chg_field_set(priv, F_ICHG, 900000); > + if (ret < 0) { > + ret = mt6370_chg_field_set(priv, F_IINLMTSEL, 3); > + if (ret < 0) { Do all these ' < 0' parts make sense? (Not only these cases, but in many in the entire driver) ... > + /* Check in otg mode or not */ OTG ... > + ret = devm_request_threaded_irq(priv->dev, ret, NULL, > + mt6370_chg_irqs[i].handler, > + IRQF_TRIGGER_FALLING, > + dev_name(priv->dev), priv); > + Redundant blank line. > + if (ret < 0) > + return dev_err_probe(priv->dev, ret, > + "Failed to request irq %s\n", > + mt6370_chg_irqs[i].name); > + } -- With Best Regards, Andy Shevchenko