Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp791441rwd; Sun, 14 May 2023 06:42:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6uQLMtot/CyVGi8MX7ucgFirZB/Nhdcl7POmVaIZM2MNNv/fVhaSBpOOlm+nsAYKXB2506 X-Received: by 2002:a17:902:9a85:b0:1ac:618a:ba9c with SMTP id w5-20020a1709029a8500b001ac618aba9cmr21301421plp.49.1684071752243; Sun, 14 May 2023 06:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684071752; cv=none; d=google.com; s=arc-20160816; b=dChNDavYgLdecOFJYlTWi5rVxsN8XcFlIg9JEB+yhu5MrhvfEXdYZsJP0SW0q446gm hLocv64TsBCm+xCAzZ1OAwqyh1VVs2qpS8qacs5FkSfSYgP/lOpL2nx91gqUlY/Wmdy8 /x1cvvfjwAcMePwuXYOjojNL0+DMZOCT4lKvlFPXcATf4b+Me5dnLrK4KyXLOq3d3ezp BMg1EX8UCH5gJkZhRFyuqP8s206XT6/LnxtguCc3G6dTsQsscpt67E0SRY/9iIG4IbMc DHbsVXZfvfZVefO03r/5o56qyqrZ/MvChRCY7YDcrlbkwgcrk1m8OaGV9eH+SZlHaqgi Tq5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4FWmRfs7yx3IOYIayoPinOb2mIoFyDgaxGg2QcZUWGk=; b=oMFJhcttskKUHan5obPVapoO9npcvyZMzFjeKQjhGNO6JGFz8i6MHibRRj0+h56JBN cBGYDaRpYrrrefDYgliMly7r8iVHmcYMYBo7agblOq3xQS5aHjMD3h4W59s/RgDqeLDE 41Cc5hmtKJT0lAucBcTqlPm2IJmCd5g/bnzVdSOx7h3YOaVRHXUaL5goAA+p4Tltq1cb VozINTbUzPN7Qge8TkAwX8gLAuiqtwbmJ4JiGOOW7zRFqih8LhpSaGymoH0AQBlCcrP+ RYp3rvipeHVdX1zC4TjFa5QaTvFzYAWbO06WJQBt1ON/MWygF/uY0QWkfS5fkhi0LfLM bmqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b=CfcKA7Yt; 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=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a1709027b9000b001adcdac8969si7760579pll.463.2023.05.14.06.42.19; Sun, 14 May 2023 06:42:32 -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=@rocketmail.com header.s=s2048 header.b=CfcKA7Yt; 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=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233590AbjENMzK (ORCPT + 99 others); Sun, 14 May 2023 08:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbjENMzJ (ORCPT ); Sun, 14 May 2023 08:55:09 -0400 Received: from sonic301-21.consmr.mail.ir2.yahoo.com (sonic301-21.consmr.mail.ir2.yahoo.com [77.238.176.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3ABD1BF6 for ; Sun, 14 May 2023 05:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1684068904; bh=4FWmRfs7yx3IOYIayoPinOb2mIoFyDgaxGg2QcZUWGk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=CfcKA7Ytpb+JA8OE6ioIQG+MIp/8eyKdUFsA3pXDlB4pM3H0b7FqtN+rsnwQ7Aio3DAoeJxzM7RkUp5pU7w3pq+xGgkU8EeTDhmHYlqTUMHDAvr6Gkr36W19GHDBXwf1MBBS2ufUNczJWR2/5wQvEGCV8KRQN1xnrOZ1BOlsDnNoKDTrKo/gLF7xwbWC57NsHDWZ6HV3gprBYDKkDShQIBG3NgK8uFD/x3J8QyabDXQ80nQRKXPfRs7LgyAyuFpf5PrkYsMQCxRi3hZshBfO9ROaMZ0kHn2Crsu+D5I9vq6zPFH4YloLn73MT5oz70FbyAgvJnBURa5WFFz6s/k9XA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1684068904; bh=rHgPN1HIDU+dzt5eIS9VyEQOLS00FFWUl06jFXgW9IA=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=gCbQCS7oM6Ad+66GHlUvKim/i/GzWoUK1vPsG065ocebiEXLupdbra0HOxruWel6PocVVeC2q93aq160XQfE+dNWdFJWs3XM+8sEw4lJ+bunJYUt0pbh1FL/S4Yj6muFHHonW3r3f7/WpBdKKkh+Evb4+p4VET230QHQBybtuNkLltA5i+CIDfgdPU+A3yF+Wwem0aGuvd7cZsr9FvtdWg4s4eCR0Z8u+kD21FzLII6ywsaDcbah2iLnsdqufnmq31VaqZWoQGVLgNT+uYkYFOJ2iABoIqgtiglkzjsgX0GKYNyB1nBvYGP63+ir2VlCePUbvm1BdpQuV36nnswGtA== X-YMail-OSG: prDlHUoVM1kOww2zAf3gGm.JpiAui8OXRckEGcXorw6R9T1ov9.ffSb51UKwFz7 VVYc3mAfaSPobePJTSDYBn2g5YxoTZlb8wOue9i5W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3.5YIqU8.1mLpW Ch4ZIjfABmTVl8vDtkUHFmXOvCgNqgRtdh2VTMcd4UnY4_eC8oyxxbmMezBljOc.PbFSNeYEoZ.R uWI6Z.dzDZ1EkhfGuK5Q- X-Sonic-MF: X-Sonic-ID: 5946cb55-2381-4bb6-b3a6-8305a0b4e364 Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sun, 14 May 2023 12:55:04 +0000 Received: by hermes--production-ir2-7867f454fc-mmctx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 971468d8e911c4952f8a7901d6118ac3; Sun, 14 May 2023 12:54:59 +0000 (UTC) Message-ID: <200945d3-f4ca-9a73-f101-4fda96ab8b2c@rocketmail.com> Date: Sun, 14 May 2023 14:54:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v5 05/10] power: supply: rt5033_charger: Add RT5033 charger device driver To: Sebastian Reichel Cc: Lee Jones , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Beomho Seo , Chanwoo Choi , Stephan Gerhold , Raymond Hackley , Pavel Machek , Axel Lin , ChiYuan Huang , Linus Walleij , Henrik Grimler , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht References: <20230514123130.41172-1-jahau@rocketmail.com> <20230514123130.41172-6-jahau@rocketmail.com> Content-Language: en-US From: Jakob Hauser In-Reply-To: <20230514123130.41172-6-jahau@rocketmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.21471 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Sebastian, On 14.05.23 14:31, Jakob Hauser wrote: ... > +static struct rt5033_charger_data *rt5033_charger_dt_init( > + struct rt5033_charger *charger) > +{ > + struct rt5033_charger_data *chg; > + struct power_supply_battery_info *info; > + int ret; > + > + chg = devm_kzalloc(charger->dev, sizeof(*chg), GFP_KERNEL); > + if (!chg) > + return ERR_PTR(-ENOMEM); > + > + ret = power_supply_get_battery_info(charger->psy, &info); > + if (ret) > + return ERR_PTR(dev_err_probe(charger->dev, -EINVAL, > + "missing battery info\n")); Here you suggested to use: "info = charger->psy->battery_info;". This didn't work. The supply type of the rt5033-charger is set as POWER_SUPPLY_TYPE_USB. The one of rt5033-battery is POWER_SUPPLY_TYPE_BATTERY. Which makes sense because if both of them are POWER_SUPPLY_TYPE_BATTERY, userspace sees two batteries reported, one of which with 0% capacity (the charger doesn't report capacity). The ...->psy->battery_info, however, gets populated only for a power supply device that is supply type POWER_SUPPLY_TYPE_BATTERY [1]. [1] https://github.com/torvalds/linux/blob/v6.4-rc1/drivers/power/supply/power_supply_core.c#L1390-L1399 > + > + /* Assign data. Validity will be checked in the init functions. */ > + chg->pre_uamp = info->precharge_current_ua; > + chg->fast_uamp = info->constant_charge_current_max_ua; > + chg->eoc_uamp = info->charge_term_current_ua; > + chg->pre_uvolt = info->precharge_voltage_max_uv; > + chg->const_uvolt = info->constant_charge_voltage_max_uv; > + > + return chg; > +} ... Kind regards, Jakob