From patchwork Wed Mar 8 08:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp214938wrd; Wed, 8 Mar 2023 00:50:25 -0800 (PST) X-Google-Smtp-Source: AK7set8CIwOEIBUiH/Kne7X6YbLbfAwQ0qg3LFgCzHUd/oT5/yi7gavFdRf5NyHuzyV/8F+I5gCv X-Received: by 2002:a17:906:601:b0:885:d02f:d4ad with SMTP id s1-20020a170906060100b00885d02fd4admr16671914ejb.43.1678265425185; Wed, 08 Mar 2023 00:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678265425; cv=none; d=google.com; s=arc-20160816; b=NGEMcsAGYyVKar5D4SGHP+evCQKGIRgFHt/sKkbPnPeFtD11qms8uI6NjIfRpSL171 NZrowdPN3uO7y3e6bNPFjf1dq9PQBSyffuMp7gHmHmOkig1y+2K+QXovBLtJiGb1rMFO +YWLDUCNGWPF/gnqFR1UuScIBCKLYc9Olt3QR2/PbhcHqXFJHwbxcL4yjSstf/jxn6Vw YVPxRy1Z/+fOKhlLZO30ps3UZ6Vx5FfrF/E0Glzc5qDMYvvd41Ex95S1gwwy+YXqh2uk 3qFDN9De2otrfgL9ek01yJIdYZCQ46XkV6wLuq7a+XS1Q5eqQMpN6JbzF565tnpMdfK8 ZzZA== 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:date:subject:cc:to:from :dkim-signature; bh=b5IozmuJmXlRY443E7JFFDmGdlSvIWCIn/5kCoULQys=; b=Vpd5JzCQgNbGVTg7p1nXOA7DWKQ7uLVWyNX820Z7T+z/rdJEIvapcoJGnJUm28pJb5 7U1mBSAyP/GAUst5hx+ZK64MI3/PsD5JoFcWxAoYf3ilsI58tQgL3gRKyHvPy0422b98 h/5kP1EqZAUf16LzRO0idVdfLqOpr76M2SXIgn99VhrxXb81aLai7RbKYjDKZ/d2a42C 5eQ9OldLr91mB4f7DajeTJHoN/FsD0KKj16Ez1SizkyxuQpkxJJXM+9MyigG7hj6rgrf u4a6AleJKS0P6BQM9h5y4EqvBuvohBT+ZYPr+383j/cukC+UsJQn9cEUwJ923Els481c FKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FhNheA1D; 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 m24-20020a1709062ad800b008dd8491f9f8si11916610eje.118.2023.03.08.00.50.01; Wed, 08 Mar 2023 00:50:25 -0800 (PST) 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=20210112 header.b=FhNheA1D; 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 S229973AbjCHIom (ORCPT + 99 others); Wed, 8 Mar 2023 03:44:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbjCHIok (ORCPT ); Wed, 8 Mar 2023 03:44:40 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980369AFDB; Wed, 8 Mar 2023 00:44:36 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id a25so62836838edb.0; Wed, 08 Mar 2023 00:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678265075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b5IozmuJmXlRY443E7JFFDmGdlSvIWCIn/5kCoULQys=; b=FhNheA1Drib+iW621iwSkZPmuZjhpTJBbX+a1a/Ky6IwAFAyfJAM5z1PKLakD1BJ4O Vlty+HaKv7xP8yO5adj8hz/5AYILa6UBfeJKoVAanUBwrXRF1s96PmlVmzGLi1Y7+LsM hyfM7vMeA6eNcZKxSmS/oX4IR1U4z8SsJqr8R2gpHXcsVjRCLCaYGiMdlHi7qqLh1+ce RVev3VQSGS1WtTjhc412Q2jToWZBg0MajsTOY9InERPoXEOFqHHdNKlNJ8Uz6LP8moqq I3bHS4BL9vF0ZPfq9NY7EvzA3ytCez7SPtq9G8gLNL/PZIlt9sVzNrKebokZWxOjSdTQ 3w7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678265075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b5IozmuJmXlRY443E7JFFDmGdlSvIWCIn/5kCoULQys=; b=X2nKCBQAsyyXLddDkQm+BCTxRh97I/LkkAz4fx9eDA9jRPHGk03o/g1DGIKOWy30lC mSmhmUadQPLrk7u58B2zKdnEZNWRa5xj34tJO0T60QFyo5p7AMR54VptqLPfpchKKVuK YZaULTl+KmkXRjUhPL4NzWB1wShxqXn6TannQkl6+/aVKVEMus3VU/JGN4iviVbegO8z xFFtEX3zrN0WUeXd8RaL/e5aXMVs8hQP/ocKH6VRNShRAqP6yK4S8fyVo2xHH3Q3et2j HByX/HgnJZFnioW2QfgfKsuGnqfKkQ4HQgwcvTosOhluKcPLa4oemHGHdo/5PdbBjnBW feWg== X-Gm-Message-State: AO0yUKVZTox+vvZrkxH/5ASxjJ2LWKjg3zN8oN92S1OXqAO6wBQNk0Os aHua80RpyWLltiX8I3fzwLg= X-Received: by 2002:a17:906:b14f:b0:8b1:7de9:b38c with SMTP id bt15-20020a170906b14f00b008b17de9b38cmr16535901ejb.52.1678265075045; Wed, 08 Mar 2023 00:44:35 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170906838800b008ee95ccfe06sm7163891ejx.119.2023.03.08.00.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 00:44:34 -0800 (PST) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Svyatoslav Ryhel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] dt-bindings: power: supply: maxim,max17040: update properties Date: Wed, 8 Mar 2023 10:44:16 +0200 Message-Id: <20230308084419.11934-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308084419.11934-1-clamor95@gmail.com> References: <20230308084419.11934-1-clamor95@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 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 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759788846204060730?= X-GMAIL-MSGID: =?utf-8?q?1759788846204060730?= Add simple cell, status, health and temperature properties. Signed-off-by: Svyatoslav Ryhel --- .../bindings/power/supply/maxim,max17040.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml index 3a529326ecbd..6f1c25b4729f 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml @@ -55,6 +55,20 @@ properties: interrupts: maxItems: 1 + monitored-battery: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle to the battery node being monitored + + power-supplies: true + + io-channels: + items: + - description: battery temperature + + io-channel-names: + items: + - const: temp + wakeup-source: type: boolean description: | @@ -95,3 +109,26 @@ examples: wakeup-source; }; }; + - | + #include + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + fuel-gauge@36 { + compatible = "maxim,max17043"; + reg = <0x36>; + + interrupt-parent = <&gpio>; + interrupts = <144 IRQ_TYPE_EDGE_FALLING>; + + monitored-battery = <&battery>; + power-supplies = <&charger>; + + io-channels = <&adc 8>; + io-channel-names = "temp"; + + maxim,alert-low-soc-level = <10>; + wakeup-source; + }; + }; From patchwork Wed Mar 8 08:44:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp219959wrd; Wed, 8 Mar 2023 01:03:50 -0800 (PST) X-Google-Smtp-Source: AK7set/QtvOBGAdzJ7sVDuCHyVeZFXbEE8ImuaxB3q9q3nj6p2p/iF8GDneTrkmrv/Y9MlUJ/gMO X-Received: by 2002:a17:902:c24c:b0:19c:92f5:ab4e with SMTP id 12-20020a170902c24c00b0019c92f5ab4emr16724946plg.18.1678266230409; Wed, 08 Mar 2023 01:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678266230; cv=none; d=google.com; s=arc-20160816; b=OO2JD+Kevcmd/LiiwaYcjxpmw1nIR+1FNOQFa2LV6Mcbx0PINJ9EQltGfwR78SGKv1 FDsW4f1l1Qv++e4QWBxlk/vBgwhF+9lg7rK+t+qxUj/IS1IxNJ9mmLasy7N6tBefVVMR CwJLSZix4HBm7Z5pEFQgr/juFE2e0o2iNzAEXdfi0yHHKz36k59HW+TtlkREIOmK+Sjm 56BjQ3sC4i3bNRNSEmcMicxn7dGaFW10J2jRQyH6fBuAG522FJGfrKCiHSiS4Kk+qZli wt7wQPJJaqRppV4gX+mQYD0mkxIFVRrB2sc7MDMmKHoLn8+MwwXHyx8uwhnNNu9fID7x 07ug== 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:date:subject:cc:to:from :dkim-signature; bh=E2l9GniXbIObtfjCfu9eYVESux7iZ+E2zlwf2Uly32g=; b=R3gZ8GqEOYLOfhspvCt/hj3Epd5vmy4fCHKo2A7MkL4ZvRCpCBXDGU4DkeW701d6AQ fzQ2wqVLmKdi9Z14TzLpMuDsJ9flt1uIgXcplAb8l23EIEgyy/XeiztQMTwJlhe51j9b IhNsoKZR6yz8KwSmRPtGSsw5uTessJgm7tmM02HBOx8uljwUj6SO4yoK9/cJNWZLQalD Xm6pApPYNK1qgipPWP+OP19vhru9dl5eQo4cY8d0cCbmSYVUssGb572/65sf8+ln2dNe /hNIZX4K4b2fsefQptJ6jQVEVsyxygZDiJoVMVNQeZLu14sbcGzRugxyql3+57dV7JJd Fhdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TKjsZuaX; 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 4-20020a170902c10400b0019e6185116esi13398723pli.274.2023.03.08.01.03.21; Wed, 08 Mar 2023 01:03:50 -0800 (PST) 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=20210112 header.b=TKjsZuaX; 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 S230022AbjCHIoq (ORCPT + 99 others); Wed, 8 Mar 2023 03:44:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbjCHIok (ORCPT ); Wed, 8 Mar 2023 03:44:40 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9474E9E67A; Wed, 8 Mar 2023 00:44:37 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id ec29so31767002edb.6; Wed, 08 Mar 2023 00:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678265076; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E2l9GniXbIObtfjCfu9eYVESux7iZ+E2zlwf2Uly32g=; b=TKjsZuaXBCSYomo6F0IqS68FnNt9dCKTEBnuPPYn8pHMZU/q2jpA9rqmzCmJ2EgHxZ mb4dAQ1fAI1cDUph43gD20kYtBfjthKnw2cvub+Cf23VwFBzT7NILACVbGKe6ZTBm4kt fwyo+ZO2I7ugpQUEZrJOdCpNICYVVDDpn+g3YTT5ACkpWSPfgJu3Dge0LjXZBftGnTSk Cn7o2j1RGgUhs8XJvMwoiTk7traCetguRESZyptgRgmUFWrOps4Pfe+oObxo6I2zOoDV 7i1wQVaczBtA37AODdaSS3wxYVg8yLwdQVQlmZewpLbt/4m/kdIL2TbgyXi3gxUzofYi N66Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678265076; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E2l9GniXbIObtfjCfu9eYVESux7iZ+E2zlwf2Uly32g=; b=rygeqB0aeMFO0vKFMacpz1N6Cl6/lDJSCDzbPi+5O/Ah5+ipnfi6R7yMhzAthbh4yW pHo8MdSGKpuPPdn/Sl5pVO5w7IPdidXn/99f+oK2SJh0BW6bUjMzli0vvVPdrinxnpiN sutF+S5T3W+iU3RTW1XklmlsdCk3aHY+CbTJe7V5gqW/qWW/tK67eLcXOxTQsFyfwjiY H4tqYHfVsPtX5vX08P46GJQFbRySOwH6qOs5ItU0LtMGx+y2WTjDsUAHuUkBUMQTHOCN NJfK4GJs0fH/KVwY6S64iiep3iJmeeNKLleCWA4DGLNBuWOOOMbJgbjHKRM0GzUeNtot /MJg== X-Gm-Message-State: AO0yUKX1Ns0Uxyxm4nNn4QbC9UsMC41Fzz1h6HzMU8emMX63GWO6bnas M9wpsIG1iY7bgWmAPK7Rc6w= X-Received: by 2002:a17:907:8686:b0:8f7:5038:9896 with SMTP id qa6-20020a170907868600b008f750389896mr21227842ejc.70.1678265075961; Wed, 08 Mar 2023 00:44:35 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170906838800b008ee95ccfe06sm7163891ejx.119.2023.03.08.00.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 00:44:35 -0800 (PST) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Svyatoslav Ryhel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] power: max17040: add simple battery cell support Date: Wed, 8 Mar 2023 10:44:17 +0200 Message-Id: <20230308084419.11934-3-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308084419.11934-1-clamor95@gmail.com> References: <20230308084419.11934-1-clamor95@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 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 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759789691205370949?= X-GMAIL-MSGID: =?utf-8?q?1759789691205370949?= Simple battery cell allows to pass some constant data about battery controlled by this fuel gauge. Signed-off-by: Svyatoslav Ryhel --- drivers/power/supply/max17040_battery.c | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index d1075959dd46..2778ed5b5c14 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -141,6 +141,7 @@ struct max17040_chip { struct regmap *regmap; struct delayed_work work; struct power_supply *battery; + struct power_supply_battery_info *batt_info; struct chip_data data; /* battery capacity */ @@ -400,6 +401,28 @@ static int max17040_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN: val->intval = chip->low_soc_alert; break; + + case POWER_SUPPLY_PROP_TECHNOLOGY: + val->intval = chip->batt_info->technology; + break; + case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: + val->intval = chip->batt_info->energy_full_design_uwh; + break; + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + val->intval = chip->batt_info->charge_full_design_uah; + break; + case POWER_SUPPLY_PROP_TEMP_MIN: + if (chip->batt_info->temp_min == INT_MIN) + return -ENODATA; + + val->intval = chip->batt_info->temp_min * 10; + break; + case POWER_SUPPLY_PROP_TEMP_MAX: + if (chip->batt_info->temp_max == INT_MAX) + return -ENODATA; + + val->intval = chip->batt_info->temp_max * 10; + break; default: return -EINVAL; } @@ -418,6 +441,11 @@ static enum power_supply_property max17040_battery_props[] = { POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, + POWER_SUPPLY_PROP_TECHNOLOGY, + POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_TEMP_MIN, + POWER_SUPPLY_PROP_TEMP_MAX, }; static const struct power_supply_desc max17040_battery_desc = { @@ -470,6 +498,12 @@ static int max17040_probe(struct i2c_client *client) return PTR_ERR(chip->battery); } + if (client->dev.of_node) { + if (power_supply_get_battery_info(chip->battery, &chip->batt_info)) + dev_warn(&client->dev, + "No monitored battery, some properties will be missing\n"); + } + ret = max17040_get_version(chip); if (ret < 0) return ret; From patchwork Wed Mar 8 08:44:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp220598wrd; Wed, 8 Mar 2023 01:05:17 -0800 (PST) X-Google-Smtp-Source: AK7set8cFmD1uSPf0qIi3e6HtlpQ/MZ7NgFwM1zZPy+gKaDnkXp2PCl+n64kaE28pgdvyi6LLOkf X-Received: by 2002:a17:90a:db92:b0:237:44ad:5124 with SMTP id h18-20020a17090adb9200b0023744ad5124mr18023756pjv.42.1678266317305; Wed, 08 Mar 2023 01:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678266317; cv=none; d=google.com; s=arc-20160816; b=X00bBlE+PdXEm+qnKl+esfE5br/dC1FJsOMDwM5pZG9lvsk4ltRty/o9NDi/kLOHNT /oZgpKd/Be0c6GDFv7fcouOftaD0UgoQ/mzXg+dcxVfU/5xx8OBxdipBCNHPJkSW9W9t lNf+i/tF9S3ttt4I1sJmGFC4M+CuJ/4tj4O7/E8b3ZiqXqoqAQtLpD8EG6YHNYDHP4kb ifJelusumHxUaZXf1gVYuaI5HT06oSd//V0UPC4wSd3zgmxeme6YE87L/GHKty3Dy6qD OjxHwrz+KLaXw8vZ26uSkxKyE0tlA6iVSbygVrPh4W5i29jeYr9b9JlquIfqGk1rmLoj HZ+g== 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:date:subject:cc:to:from :dkim-signature; bh=Cd+3/vfpnAi2wix3cLcUzdEe2v0MfPYk0B4J1TVbZ5E=; b=NRPOI1wSsCZUActHgqJ3BnSoS+DTJdPNt2cSoCxuvy+KxnggNhav4uIRAn7vk0ZJJP VFWqjz+QvZ6RDM0rSx+M/pBwIzapAvG9zyMj8Z5QZ7impvqBGe7PCbUZskAkTSJU1np9 PkqI2eFFpwwHCWmSMnwiTp9DSUeIfKw/U4POS8EeHCBR9JXDDVcZ2qAv/i677Lgp/CIj L/JbOuBvS1JQf4+Ee//yyEwAP3qzrLfZehf/XrapQmsNCrastmWIK360n9IdtOAU4oFp s5SvPncE7R8F+9bkWZJS3ZgWni9VXQIR6EFRMfRwf19KNI1415rlRB+v8yNQ0qBy6WJ4 IXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=j2gy6Za7; 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 fa21-20020a17090af0d500b00233b32fdf1csi16789178pjb.77.2023.03.08.01.05.03; Wed, 08 Mar 2023 01:05:17 -0800 (PST) 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=20210112 header.b=j2gy6Za7; 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 S230018AbjCHIpJ (ORCPT + 99 others); Wed, 8 Mar 2023 03:45:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbjCHIom (ORCPT ); Wed, 8 Mar 2023 03:44:42 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C4E584A9; Wed, 8 Mar 2023 00:44:38 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id x3so62514056edb.10; Wed, 08 Mar 2023 00:44:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678265077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Cd+3/vfpnAi2wix3cLcUzdEe2v0MfPYk0B4J1TVbZ5E=; b=j2gy6Za7s2PA99ZzZIvnsTUjn9VZlKoUqB6HzZY/eOJMxGX7GHyu291VpYGBxw9EKc 8b17kXynX/xHC1Baiz0dNBN5zErZLRf4l/msDUGrfIbjyGzQ6w+czvSVCiXetIj6HHxF SFqI9PQsBucMu8siD528JIxbpJJlglh+WKWbbfEZpFqXDp8UQPfldi5BR5qAKk0Ot3jm BXhcVvONBPotNQJl37LdI2ByX+9Y0DgX9pAzwF+Zz0cqERc+7+G/TGA+hrHrbhhT4swF SCzQ5Nr94nB44Zi2i8YroGQPQJvdMJto98mvSw7F389xfM7DojdrIkizTMtH4FQkaEee l4kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678265077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cd+3/vfpnAi2wix3cLcUzdEe2v0MfPYk0B4J1TVbZ5E=; b=yPjI+kiyKQ+XRWDucniMfgz4vGnTDB7tbRKDq4xpQi+MF2frWtWd5Se/mJpGv6dONg k2hCN6rrUSME6EAHJ036Q93v1L55TojqrCxZKEa+dmyL+5hrnGgVtVAs82N+OSut6xr9 0vXQgG/E3YRFqO6XiMu/sHpVqclb1AtAjDw/MKS4KbqyE4JvJKhs/xmdjtMuEgpq08VR FjDOHql6xYAZJKf/RZyUbEqk2Cfwi9x2yBBLKg58+C228USQh+rwbyiZuGXsNF/5GV6x 99I+K+knfMZEdhAGpX1LWFvHaIg0iBeTE36viCVL7S2MgIdCsBRurHrp84r78I8AYh9i vuWg== X-Gm-Message-State: AO0yUKWcCZoSnC7hGU30h8Tgz8/H0PEHJPCF1XXPGcriWFrSFWexb2hH xF33VG1B9pVJC+uY1WO/C8A= X-Received: by 2002:a17:906:bfc9:b0:88d:ba89:1837 with SMTP id us9-20020a170906bfc900b0088dba891837mr19294522ejb.8.1678265076869; Wed, 08 Mar 2023 00:44:36 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170906838800b008ee95ccfe06sm7163891ejx.119.2023.03.08.00.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 00:44:36 -0800 (PST) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Svyatoslav Ryhel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/4] power: max17040: add passing props from supplier Date: Wed, 8 Mar 2023 10:44:18 +0200 Message-Id: <20230308084419.11934-4-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308084419.11934-1-clamor95@gmail.com> References: <20230308084419.11934-1-clamor95@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 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 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759789781756444336?= X-GMAIL-MSGID: =?utf-8?q?1759789781756444336?= Optionally pass status and health from supplier if it supports those props. If cell is online assume it is present as well. Signed-off-by: Svyatoslav Ryhel --- drivers/power/supply/max17040_battery.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 2778ed5b5c14..6dfce7b1309e 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -390,6 +390,7 @@ static int max17040_get_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_ONLINE: + case POWER_SUPPLY_PROP_PRESENT: val->intval = max17040_get_online(chip); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: @@ -402,6 +403,10 @@ static int max17040_get_property(struct power_supply *psy, val->intval = chip->low_soc_alert; break; + case POWER_SUPPLY_PROP_STATUS: + case POWER_SUPPLY_PROP_HEALTH: + power_supply_get_property_from_supplier(psy, psp, val); + break; case POWER_SUPPLY_PROP_TECHNOLOGY: val->intval = chip->batt_info->technology; break; @@ -438,10 +443,13 @@ static const struct regmap_config max17040_regmap = { static enum power_supply_property max17040_battery_props[] = { POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, POWER_SUPPLY_PROP_TECHNOLOGY, + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, POWER_SUPPLY_PROP_TEMP_MIN, From patchwork Wed Mar 8 08:44:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp221742wrd; Wed, 8 Mar 2023 01:08:04 -0800 (PST) X-Google-Smtp-Source: AK7set+N40wQ0SK6wxYGliiP/mC1vIMfPeV50Vg7qUD7VM3NhUdK929DbyEuXLlNt2xfqHcdgzl5 X-Received: by 2002:a05:6a21:6d9f:b0:cd:a334:a531 with SMTP id wl31-20020a056a216d9f00b000cda334a531mr22558897pzb.62.1678266484227; Wed, 08 Mar 2023 01:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678266484; cv=none; d=google.com; s=arc-20160816; b=P6VjBlVVoBEmIivUzukjOMphHhiabkHrMSRRsUTq2iFNFQ1HaATWa82DH7PjyNLAhj Hy0GuErykY17whaoljcqYoX943tzJG0MVOJ2faQOv4eOE6D45qGlkAeFJfXiOW3VnEVa F5PbMGz6I/ZAEK4MKwD/wMlQ+jiLlJQTwbvReNRK2LlBtGPz5P09r/xtgs152V/c1JcQ gV35hWeeGCMkvh7E/nM/NN/S3KPQpC6HnkmMBmRpWOG3MV5iYTeGoQQhHF0qK5m52d2Q M1Frg0RIjFHDxuhyNZvkH8ZvKNzmcRf0ln6SFsCbYrKPBrQTSGKabJfKB+UqDUfR/fEQ LkYQ== 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:date:subject:cc:to:from :dkim-signature; bh=bt0rP56ZVICJXZOyWcT1Og4PPdYTw7SSYjSP/fByF9w=; b=X4TkMWWXqerWKOUUwXpkDbCQStshFmrieHHSoJU6tzG6YPbBCFXG1ASUkQ77o/BN/K VfE74TaEMqz9zCLoUSOQGoVOWo8AGNp/UYziiHFqChahv5Y3yshTctSFV02ZRGYWeUE5 q2UWMY0wDFQcWBKD0zUiEtGgE/eOLAJVpHpTt0zZdQ8iwfYpzAPJ4aVXUEXyl511nl4U oXQZczZBqWakhoPf+DbEdHzvbCF40I+LMBSILPqYh9qrxxJ6SR8e8LbmEO7Lv/QX9LWS HHdzcDZcptBxuBhot8wlZd/XeAyZQ+mV7C03JxpPt+eKd7ZF3n7rlD8TOtODDUQcsVIj S1Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q4jDMXjb; 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 190-20020a6302c7000000b005031231026fsi14394697pgc.543.2023.03.08.01.07.51; Wed, 08 Mar 2023 01:08:04 -0800 (PST) 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=20210112 header.b=q4jDMXjb; 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 S230368AbjCHIoz (ORCPT + 99 others); Wed, 8 Mar 2023 03:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjCHIok (ORCPT ); Wed, 8 Mar 2023 03:44:40 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6219F067; Wed, 8 Mar 2023 00:44:39 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id ec29so31767239edb.6; Wed, 08 Mar 2023 00:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678265077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bt0rP56ZVICJXZOyWcT1Og4PPdYTw7SSYjSP/fByF9w=; b=q4jDMXjbnN11ZJAbkD1K3MPkAEmb7KJT9Syk3m40F8SthEU/wy5ivzobAFc7jLuLdn Sp+76WjLsufxK8FxW+bqXlr59Us4r3k3qqRIkdxMaeuKQkYHbOP8PfvTxFgns4CYHR3T w5SIXGD7hpHTE6oDLsSSMAn6oZj0pmOtcNboOUr2NAroAWYdDjgxGmd+KnI4WOj4zQyq uHj1w4Y8orQ9y6T28/gMEZAq3SBdZeEKijZ3Qiiv0Zmd4X+w3zb/xGgK8oKgvwz4/Z30 VYb6S2UubuL1DicrTTsXYmYCS7TF8kagHYV1DwC/KlxEbqdRb6BV9Og8RX0vBOIcKM1m bkvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678265077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bt0rP56ZVICJXZOyWcT1Og4PPdYTw7SSYjSP/fByF9w=; b=i3eZLC4EyV1S1gd93D/47vKxE0Nffe5oNugDMOFDhIugtN2Ydsol+TjaDSzeuaOXHT w42nIMHRjQJU3PrKdeQzyXdbvaYLYJhuVWkKc/fUbHLykM42+ATVPHVbgOjXOykn01qv hVocWgKQXrAb6lBfF72Nur5bCZEdI7Ft31S0PJ9NxW2X09f19fLZDl+89WDvU4rj1/Zq VszEWhlikDnS5FSNoMQ1zrtQh+Gp3gFQRa6w1olNwrvdt/iWILHexMGyulvMm2ZtNO0B vyn8mdxQxTvGmp9UmiODY9MYx+uSsY4LciA94X5I5sYUbaYeDNw+k/KUEwF2ahH6KbUp fdEA== X-Gm-Message-State: AO0yUKXKQankySWoL82fhbLiu2jM++0Swe0MIge8CPvTbTLQzIhedcx/ 2WP87kugxTjUJ9HTIscFToE= X-Received: by 2002:a17:906:b1cc:b0:8b1:7684:dfab with SMTP id bv12-20020a170906b1cc00b008b17684dfabmr19005757ejb.38.1678265077771; Wed, 08 Mar 2023 00:44:37 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id p8-20020a170906838800b008ee95ccfe06sm7163891ejx.119.2023.03.08.00.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 00:44:37 -0800 (PST) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Svyatoslav Ryhel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/4] power: max17040: get thermal data from adc if available Date: Wed, 8 Mar 2023 10:44:19 +0200 Message-Id: <20230308084419.11934-5-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308084419.11934-1-clamor95@gmail.com> References: <20230308084419.11934-1-clamor95@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 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 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759789956788708793?= X-GMAIL-MSGID: =?utf-8?q?1759789956788708793?= Since fuel gauge does not support thermal monitoring, some vendors may couple this fuel gauge with thermal/adc sensor to monitor battery cell exact temperature. Add this feature by adding optional iio thermal channel. Signed-off-by: Svyatoslav Ryhel --- drivers/power/supply/max17040_battery.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 6dfce7b1309e..8c743c26dc6e 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -18,6 +18,7 @@ #include #include #include +#include #define MAX17040_VCELL 0x02 #define MAX17040_SOC 0x04 @@ -143,6 +144,7 @@ struct max17040_chip { struct power_supply *battery; struct power_supply_battery_info *batt_info; struct chip_data data; + struct iio_channel *channel_temp; /* battery capacity */ int soc; @@ -416,6 +418,11 @@ static int max17040_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: val->intval = chip->batt_info->charge_full_design_uah; break; + case POWER_SUPPLY_PROP_TEMP: + iio_read_channel_raw(chip->channel_temp, + &val->intval); + val->intval *= 10; + break; case POWER_SUPPLY_PROP_TEMP_MIN: if (chip->batt_info->temp_min == INT_MIN) return -ENODATA; @@ -452,6 +459,7 @@ static enum power_supply_property max17040_battery_props[] = { POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TEMP_MIN, POWER_SUPPLY_PROP_TEMP_MAX, }; @@ -560,9 +568,24 @@ static int max17040_probe(struct i2c_client *client) } } + if (of_property_read_bool(client->dev.of_node, "io-channels")) { + chip->channel_temp = iio_channel_get(&client->dev, "temp"); + if (IS_ERR(chip->channel_temp)) + return dev_err_probe(&client->dev, PTR_ERR(chip->channel_temp), + "failed to get temp\n"); + }; + return 0; } +static void max17040_remove(struct i2c_client *client) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + if (chip->channel_temp) + iio_channel_release(chip->channel_temp); +} + #ifdef CONFIG_PM_SLEEP static int max17040_suspend(struct device *dev) @@ -642,6 +665,7 @@ static struct i2c_driver max17040_i2c_driver = { .pm = MAX17040_PM_OPS, }, .probe_new = max17040_probe, + .remove = max17040_remove, .id_table = max17040_id, }; module_i2c_driver(max17040_i2c_driver);