[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeafmppD=Ge-kGZ7ab8=P9p5wmZXi_1fKFf+1uVA-SNog@mail.gmail.com>
Date: Mon, 25 Jul 2022 10:25:06 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: ChiaEn Wu <peterwu.pub@...il.com>
Cc: Lee Jones <lee.jones@...aro.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
Jingoo Han <jingoohan1@...il.com>, Pavel Machek <pavel@....cz>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Sebastian Reichel <sre@...nel.org>,
Chunfeng Yun <chunfeng.yun@...iatek.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Guenter Roeck <linux@...ck-us.net>,
"Krogerus, Heikki" <heikki.krogerus@...ux.intel.com>,
Helge Deller <deller@....de>,
ChiaEn Wu <chiaen_wu@...htek.com>,
Alice Chen <alice_chen@...htek.com>,
cy_huang <cy_huang@...htek.com>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
USB <linux-usb@...r.kernel.org>,
linux-iio <linux-iio@...r.kernel.org>,
"open list:FRAMEBUFFER LAYER" <linux-fbdev@...r.kernel.org>,
szuni chen <szunichen@...il.com>
Subject: Re: [PATCH v6 10/13] power: supply: mt6370: Add MediaTek MT6370
charger driver
On Fri, Jul 22, 2022 at 12:25 PM ChiaEn Wu <peterwu.pub@...il.com> wrote:
>
> From: ChiaEn Wu <chiaen_wu@...htek.com>
>
> 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
Powered by blists - more mailing lists