From patchwork Mon Jul 31 07:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 12851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1867565vqg; Mon, 31 Jul 2023 01:15:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgTpKLfmfh9/tQcJIx+XP7YDURym94dFZY9+IO/6dMC+iN/B7oNp7GIL4DS0jWSBqb/a4C X-Received: by 2002:a05:6a21:35c9:b0:137:40ba:d91f with SMTP id ba9-20020a056a2135c900b0013740bad91fmr9725764pzc.10.1690791307294; Mon, 31 Jul 2023 01:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690791307; cv=none; d=google.com; s=arc-20160816; b=iZ2SUCy6EsqkLtolfRsyuv3PsiVG81mU2tDt/j6prxGAj3TYmy7VZV3y/cDS+5VrBs HZjjoEwlhjU9V0Bw07k1i8FAgi/J8UVzTAngTxy4ZuY6+AbvDQmjdJtAwJh9aHJi5ylM 8CkTEOL81mOD5V2IllQpMBglm1E40nJHJxzTxffWcphSqpuT0/6XX0vaaePMyvFDUQ8U af0satEsdXzD+fOah9naS1FKz/s9gV5Q4tOufTjBvnUueLOPZOzImBbGmsUsCkAhyTp+ H9BWvOal72COe/GPHuCMPxcax46IwV6zQLl3P0K9fOnugehW5rm4AeibOmkbehvlw7wM laRQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Hzdhk0ebkmUYoCBKRbfkR1Q6pt7LGGJe4r7tXcUet/c=; fh=BYYxYocqtJiC/MlqHuXF0UZXhvoN/4a0Xtp0KZwYhQ0=; b=WRhllFjC+b6P4P96lBeCXg6bXz09ilUtCAN+ucOwUu4gP+F6D2thdmKMRzgs2k55Xd klfM5R6qlSxITEVK/OpWWeHMYm3fI+vR3yq/zUxWyeQ82PR7PTdhakgev+vniAsczpxH h07CRSW4tOPlxXxWHgznx2Jl2Oxm7Y/bnYJjK2cEbSrjFPkSRPU7TbuG+nTCNVLbKbrz J3Q44fro11nBoF7rvphVnTp07fwuOGu86gkUlxjdtrT7hW8WvyYv37Gde4c4XPUU/vtB gE4Sdw6FHOPR1zqLXFeBN2lrY4H9SAa3z4qed9j8WCsVI0/nPJpcVq2mJy+QCWKJ+diu CDcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iJ0JqDQ2; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020aa7874f000000b00686f6b4ccf1si6732781pfo.389.2023.07.31.01.14.54; Mon, 31 Jul 2023 01:15:07 -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=20221208 header.b=iJ0JqDQ2; 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 S230174AbjGaHgz (ORCPT + 99 others); Mon, 31 Jul 2023 03:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjGaHgo (ORCPT ); Mon, 31 Jul 2023 03:36:44 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E164125; Mon, 31 Jul 2023 00:36:43 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4fe1c285690so5479764e87.3; Mon, 31 Jul 2023 00:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690789001; x=1691393801; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Hzdhk0ebkmUYoCBKRbfkR1Q6pt7LGGJe4r7tXcUet/c=; b=iJ0JqDQ2ZTYnDGgCpqod//O7osZfnEJjrci3V2uPBJtWfFZPKvuqjiC91NbBXJyMVl q/tfgo0fxfA/G5Rdj1xuT5MaPIXBYLR/WIuYLQQlQN3Jz4WOagSn/vWncm6jOsge6fVc php93bVT/QUqXoFGMRePafILv6slXWUVnEztCdx+HBm709w8+Fq9IzrCUun7/N2JFnZQ wo6yXZhAJxRzfAGma2wpk3NMq0GES8wj7u6zXfaau3fi3V0/Fz4+oRQVVr/lIJIAUXX/ G7Dh6V+EncRp+g10/GVbWCBkA+m3XhVME5KGKW06+2GTdk+VMxrY9iIdf60ZzKySauJw 8m6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690789001; x=1691393801; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Hzdhk0ebkmUYoCBKRbfkR1Q6pt7LGGJe4r7tXcUet/c=; b=ZRiM0/bA4dxnqei0tIN1UXpVBkpruPOZKebjMpPTZG+8ozjHuigY7b0FiDQ3l8EsIk esoCykZexMdJnKjIefImEL+hkUhhNEuIjRmleGFH6wtEXh+LuiZsGCjAX8ru/wB+2HCv j7xvJDjzxi7BHJlyPyHFfU7GcHDQV5AU523+2CQT0ksvKqSknq5ZoYRF7X4z8h9D1S9p rbfoyqfwtjubz+AfMqgakf14Dnool38g7da5waAwP5JNm8+Fw1HlhFLvdQlFqhtjQg6d wNFAhLiXTbSMqP5W3jKcPgD5F5im+65rtT4Xt54g9krP45XA8IgtLLyojRInsprXBF8N H3Yw== X-Gm-Message-State: ABy/qLZ0YVC3M4J33MDAItMV7NSfzy2fcKDjtfuxjs7+lxAd2ACBBtCg m8Cy4AUR+qYQCprTmpcbano= X-Received: by 2002:a05:6512:3b13:b0:4fb:cab9:ddf with SMTP id f19-20020a0565123b1300b004fbcab90ddfmr7209989lfv.57.1690789001106; Mon, 31 Jul 2023 00:36:41 -0700 (PDT) Received: from xeon.. ([188.163.112.48]) by smtp.gmail.com with ESMTPSA id m14-20020a056512014e00b004fe3229e584sm586898lfo.270.2023.07.31.00.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 00:36:40 -0700 (PDT) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Conor Dooley , Russell King , Alim Akhtar , Arnd Bergmann , Jernej Skrabec , Svyatoslav Ryhel , Claudiu Beznea , Stefan Hansson Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 0/4] Add optional properties to MAX17040 Date: Mon, 31 Jul 2023 10:36:09 +0300 Message-Id: <20230731073613.10394-1-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772923185819177269 X-GMAIL-MSGID: 1772923185819177269 Extend properties supported by max17040 fuel gauge if it is accompanied by different devices. If max17040 is coupled with a charger, pass charger status since it should match and max17040 has no dedicated status detection ability. max17040_get_online can be reused for PRESENT property since if it is online it must be present. Finally, max17040 may be coupled with a dedicated thermal sensor which monitors battery temperature so lets add support for iio channel to match hw setup. With that said, the driver got dependency on CONFIG_IIO which was added to Kconfig. All defconfigs apart s5pv210_defconfig have IIO already enabled so only s5pv210_defconfig needed adjustment. --- Changes from v2: - documentation: fixed typo i2c0 > i2c - added dependency on CONFIG_IIO - enabled CONFIG_IIO for s5pv210_defconfig to avoid regressions (all other defconfigs which include max17040 already have IIO enabled) Changes from v1: - documentation: dropped monitored-battery and power-supplies (inherited from inclusion) - dropped passing charger health as battery health - dropped patch for simple battery cell support - switched iio_read_channel_raw to iio_read_channel_processed_scale - switched iio_channel_get to devm_iio_channel_get - re-organized implementation of temp channel (implemented in way *_get_optional functions usually act) --- Svyatoslav Ryhel (4): dt-bindings: power: supply: maxim,max17040: update properties power: max17040: pass status property from supplier power: max17040: get thermal data from adc if available ARM: configs: s5pv210_defconfig: enable IIO required by MAX17040 .../bindings/power/supply/maxim,max17040.yaml | 31 +++++++++++++++++++ arch/arm/configs/s5pv210_defconfig | 1 + drivers/power/supply/Kconfig | 2 +- drivers/power/supply/max17040_battery.c | 27 ++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-)