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 X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32206C433E0 for ; Fri, 25 Dec 2020 11:34:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C31C722512 for ; Fri, 25 Dec 2020 11:34:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C31C722512 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:From:To:Date:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BKPSHVRMrisbQTtig1iKvjNzuRNcfDrbz3go+LfmcEQ=; b=dq6zLDA4DIU/rYdCLYEu4/Lvqf HjteklcrPfFwqKf6E+A0hTzW+iyORhKjmnkZNASSqT0jG5nQ/KVK011epMHbbauhaQFq51GubdEcO GHBOgQEzVTKoe73JmGryAJg9AgF8J3KK7KQgbHLSsFzdPjyL9p+tZPsW5sNiQDAD24QwBpUT/9s4J IDDv1MFXhzIaq4ccYTh/Egqep9etrI4Ko+Gw42Cd0frX605TC7IkkvE2WMoKTq0Jjl5iy4+sVTHNA igxXc8bwBPdG/YTjxja68ajE5P2VCPTbnwkoHGMuHCLP3EloQRlT7DyzAtyUMsLxUvsANH/fcGirZ qbX6qtRA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kslLh-0000VW-HX; Fri, 25 Dec 2020 11:33:33 +0000 Received: from mail-40133.protonmail.ch ([185.70.40.133]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kslLd-0000Uc-Lp for linux-arm-kernel@lists.infradead.org; Fri, 25 Dec 2020 11:33:31 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201225_063329_946334_EDBDA7B0 X-CRM114-Status: GOOD ( 23.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Timon Baetz Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , Liam Girdwood , Rob Herring , Sebastian Reichel , Chanwoo Choi , MyungJoo Ham , ~postmarketos/upstreaming@lists.sr.ht, Lee Jones , linux-arm-kernel@lists.infradead.org, Marek Szyprowski 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 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: > > > On Thu, 24 Dec 2020 10:55:59 +0100, Krzysztof Kozlowski wrote: > > > > > @@ -170,6 +237,28 @@ static int max8997_battery_probe(struct platform_device *pdev) > > > > > return PTR_ERR(charger->battery); > > > > > } > > > > > > > > > > + charger->reg = devm_regulator_get(&pdev->dev, "charger"); > > > > > > > > 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, just > > > > dev_err() so failure will be spotted with dmesg. > > > > > > I will switch to devm_regulator_get_optional() and print an error on > > > failure, thanks. > > > > > > > It will complain on older DTBs because you are introducing incompatible > > > > change, but that's expected. Just correct all other in-tree DTS. > > > > > > 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. > > > > +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 add > > 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? It > > depends whether MFD will respect such field... If it disables the > > charger, you're done. > > 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel