Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7151670pxu; Fri, 25 Dec 2020 03:38:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrcNXWhBZYwD801DsNLF1dSGblRAzskofqP5TVwZC+Lh/bY16shM8HNRxoV8Qss1xxmxjW X-Received: by 2002:a17:907:20cc:: with SMTP id qq12mr32745150ejb.316.1608896295304; Fri, 25 Dec 2020 03:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608896295; cv=none; d=google.com; s=arc-20160816; b=XS1dOEklPZ6pFHyDUmgO8n/cTsODh1BEbWY0moBTnKMjecpZZUVK2vbNN8KcUL2bFX /alA0qAtJ8KIH3d+5XUnUoCABm5XJYxmPyLUaKlpuONdRiql9A/UonhQ9KevffyN58Mc 6hve8b/DbIPpcvPSOuDcWC+OXxFTDvrbyThcK4xb7vShzvHq1ARsH+425Z+8YIIjU0pd 1mw3kl6YHlrLojSq89JEUPDvKNCAOTNN9Dv4OYW5FKYl7TtuGbbWG1uQqP29UKrNii6V FE2ndaiRDTwIaQGMoOtDmqg1mEWZ1CJG3TnE47h0bRCpYUMg+WYRCzE6VcoUuve5O2CC 4Rwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=AZddA3E2efwA1g+qUEHAnTmghSFKPKy2RpOAJ63m37w=; b=D/ZxKJuWC6iiS/dZazFR1IJ1XCu7wG54AzJDsQsop7fcnLePEYp4NHzT7IrC/wvGIe lNALNE9vYinVDvqO5/nkSXw3vHx83bHOfWnAY4hwob+BL2xZxYw1Aa/q+1XOAPHj/d7C OuobC28ZMHcgjHXGDoK74fnLn6jKSkGt/vFZ/7UCeRX4CvS2jn+5Z10pM0AKuQ/qFNSy TdVhF+cVdDCbHpPUUf/HuwspA+B1+GVM80jbhyWqCZnQfCGF1EfQZTwBVnqt/BduH/jA +JBx4/lWqDOhfELSc9EKknOxE7thsVxLScrA1QLrpeWx81yBGEuw44wPUnpRx2JtpirG mTOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail header.b=CulIJ8pT; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu15si14412292ejb.667.2020.12.25.03.37.52; Fri, 25 Dec 2020 03:38:15 -0800 (PST) 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=@protonmail.com header.s=protonmail header.b=CulIJ8pT; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729269AbgLYLeK (ORCPT + 99 others); Fri, 25 Dec 2020 06:34:10 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:28397 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729255AbgLYLeJ (ORCPT ); Fri, 25 Dec 2020 06:34:09 -0500 Date: Fri, 25 Dec 2020 11:33:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1608896006; bh=AZddA3E2efwA1g+qUEHAnTmghSFKPKy2RpOAJ63m37w=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=CulIJ8pTiO+N29SlJ4WYYiLNR/jgDe/D8X0fj6eDY0Mpd9ZD8w5goQnRBthx7a56E bMRJe30Fi6oZbhZ+23cwDQBLeS/2vM//Ys2koHBXTWoC3O4c+ExG7nPJhGbXIEm2gz eietdbr2GeFARhMuxFDn4X9V5v029lPKckzKNGGc= To: Krzysztof Kozlowski From: Timon Baetz Cc: Liam Girdwood , Mark Brown , Rob Herring , MyungJoo Ham , Chanwoo Choi , Lee Jones , Sebastian Reichel , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Marek Szyprowski Reply-To: Timon Baetz Subject: Re: [PATCH v4 4/7] power: supply: max8997_charger: Set CHARGER current limit Message-ID: <20201225123300.07c84dd8.timon.baetz@protonmail.com> In-Reply-To: <20201224140038.GA48009@kozik-lap> References: <20201223134221.804943-1-timon.baetz@protonmail.com> <20201223134221.804943-4-timon.baetz@protonmail.com> <20201224095559.GB10937@kozik-lap> <20201224141246.7ad0ffc4.timon.baetz@protonmail.com> <20201224133706.GA22856@kozik-lap> <20201224140038.GA48009@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Dec 2020 15:00:38 +0100, Krzysztof Kozlowski wrote: > On Thu, Dec 24, 2020 at 02:37:06PM +0100, Krzysztof Kozlowski wrote: > > On Thu, Dec 24, 2020 at 01:13:02PM +0000, Timon Baetz wrote: =20 > > > On Thu, 24 Dec 2020 10:55:59 +0100, Krzysztof Kozlowski wrote: =20 > > > > > @@ -170,6 +237,28 @@ static int max8997_battery_probe(struct plat= form_device *pdev) > > > > > =09=09return PTR_ERR(charger->battery); > > > > > =09} > > > > > > > > > > +=09charger->reg =3D devm_regulator_get(&pdev->dev, "charger"); = =20 > > > > > > > > Since you do not use get_optional, you will always get a dummy > > > > regulator. In case of error, you should either print it or entirely= fail > > > > the probe. Silently continuing makes it difficult to spot errors. > > > > > > > > Since the driver could operate in case of extcon/regulator error, j= ust > > > > dev_err() so failure will be spotted with dmesg. =20 > > > > > > I will switch to devm_regulator_get_optional() and print an error on > > > failure, thanks. > > > =20 > > > > It will complain on older DTBs because you are introducing incompat= ible > > > > change, but that's expected. Just correct all other in-tree DTS. = =20 > > > > > > The other 2 in-tree DTS don't have CHARGER regulators. Not sure > > > how to correct those. Should I add muic and charger nodes without a > > > charger-supply? It will still complain in that case. =20 > > > > +Cc Marek, > > > > This is why leaving the code as is - devm_regulator_get(), not optional > > - makes sense. Core would provide dummy regulator, so you only have to > > provide MUIC node. > > > > If you change the code to devm_regulator_get_optional(), you need to ad= d > > everything: the charger regulator, the charger node and MUIC node. > > > > For Trats, the configuration should be similar as i9100, although I > > don't know the exact values of chargign voltage. > > > > For Origen, there is no battery, so the power supply should not bind. > > Maybe this could be achieved with "status disabled" for charger node? I= t > > depends whether MFD will respect such field... If it disables the > > charger, you're done. =20 >=20 > I just looked at the MFD code and tested it - it nicely skips disabled > devices. Therefore, for Origen I propose to add disabled nodes for > charger and MUIC because these pins are not connected. No need to add > regulators in such case. With a dummy regulator regulator_set_current_limit() fails with -EINVAL. Isn't it better to just skip charging control (and dev_info()) when there= =20 is no extcon or regulator? The charger driver would still probe without those 2 properties and work as before. Adding disabled nodes for Origen would probably still makes sense. I also noticed that adding nodes for those MFD cells prints "DMA mask not set" which seems to be related to https://lkml.org/lkml/2020/4/23/873. Any suggestions on how to handle that? Thanks, Timon