From patchwork Wed Mar 8 09:40:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp234299wrd; Wed, 8 Mar 2023 01:44:43 -0800 (PST) X-Google-Smtp-Source: AK7set9NYI/TZXavmAlAA1fpsC6miFyqxQBPv7N8I3t15DTUH2zC0KBK05bkxAeHmiwwUjdjtrzk X-Received: by 2002:a17:906:5857:b0:878:81d7:9f77 with SMTP id h23-20020a170906585700b0087881d79f77mr16039203ejs.34.1678268683318; Wed, 08 Mar 2023 01:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678268683; cv=none; d=google.com; s=arc-20160816; b=flZPLPfvqzYcOUOwYndwBKr7gDSXIWqO+vT+8kwPqtJhk4Pdjt4znqHiB38KsiWCkS qgqotDPlpPbY/MjDIt7ioOVHN96TRCAmfGUiW6VM82BBDrB3DrO140NaLq2XciMn2yR2 UtGcxSVobBARyPK4iQxcD/xYXuGwVj3eizw5SgTE7d4TXg4L59zHPuqctI4D7hZ359RL owy+sgcjfAEX7z82/3l5LOgqOK8HoT/u6LCo04wEKGhsdbABLklxCQaenH57v+D9qHYa 9UO+hndwUvrDygem91ciJGSAnNZkcV4GjRLCyI1gTuezFovLtPDegjZ7aLpfjcuzu5ef nhIw== 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=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=sTWQ87J03GdRgPf/onc1bhNsrNz2mS4T3p+yWhRUpI2xe8J8xSNCVBSJq8nHACgK0A WGPf/cWHFyNDpK5D+3ApWAoxmfCQx82Uincy0KLLFOlU2REOKkSwYG1nGd+/Mgr72lTd /XhYcGYgrai6/vYc3Jg8CoJqxjsLMNBKPq8oQWJW1uFCD5p9QaYSCQI7oEQHy6+WoNsH RZwzZHUHtVYKaVi+1M5gid5bpvYxfsWVOIMaVIlC8WJ1zSUuZpmXqO36QrGWR0wPqbRr eY5aMpBtpb8v0zBrM2OUOd5OmNt85BXssgVcceg+PJSdYWme2fApgAopzAT2HTu85KJF V5RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Vi49vQhL; 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 p18-20020a17090653d200b008d02052ed2asi14823140ejo.637.2023.03.08.01.44.19; Wed, 08 Mar 2023 01:44:43 -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=Vi49vQhL; 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 S229939AbjCHJkz (ORCPT + 99 others); Wed, 8 Mar 2023 04:40:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjCHJko (ORCPT ); Wed, 8 Mar 2023 04:40:44 -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 3856FB2571; Wed, 8 Mar 2023 01:40:39 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id u9so63282103edd.2; Wed, 08 Mar 2023 01:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678268438; 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=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=Vi49vQhL808PneaoEQRvf+35yFIL9IOBVqMM69KJ6d/R7TpBDCVKvGJ3rfslt2QLWh aStXDUfJs2EqfkRzSZiJ7JrVDBJcMKOqSzi1/6sxk4temsPjdRddBmfJlmGqEQqWPlNZ 2moGM5WOTHi0RVGG+FaT99c9lz77olCBXIdPSFn3g0OS0c+mcsWug1EkhSAisURKpJ2R NyNFV7sQVwS+JuaBeca4BZvDVOV1z1v1cdIeSqzmUjTc8paEINAHSjrS+pX86N+i3WJu 7rUW7OhpktEsNtYE3lXGf07TNho0kIL+xLCoCtxYMupm7oH/r0bBV9PMhS7znlond90j rKyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678268438; 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=sBRXPiMTjUXngf7UPU3ji30MSYizruFj0On8LBzCAgs=; b=hCeHAfbF8T86WmvINO62mGpSqScZodFIsVzXr/qywCB7nPZT00kQwds5FTASDdkNAX xnmGTB0JAtQgd23qsngeYp3eQfZiPqfhrIUxB2bGMIoVlaa2B/BKfIhSbzLWKfRCZyW1 9XRN0lNsWcbIEL8xJK9+zd2DIwztY6bU8dyGmFnD7HWWNsyBVMFez4hrHQKRGMKVE9yi v43C4buUSxQ/KiUD1lXIXUD+6YphYtLd819TqTZg9k8nNU0J0qX40pPVWMjXZEVe/p6x H59EvQ4JQjAlr23YuPM2ruQpP/mGqpx+QmmxnRvzu7OSwAaNLcRDYROVQbJHz3yVxu+A TWKQ== X-Gm-Message-State: AO0yUKXm8d0mHBD5CpjGqFNgEXccKa/axpsFb9kx+mCiMLjWQ5ddzV0h JJKGYXcoKLS/qlhxxowzeZo= X-Received: by 2002:a17:907:94c5:b0:8b1:3821:1406 with SMTP id dn5-20020a17090794c500b008b138211406mr22570420ejc.45.1678268437669; Wed, 08 Mar 2023 01:40:37 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id h17-20020a17090634d100b008ee5356801dsm7240014ejb.187.2023.03.08.01.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 01:40:37 -0800 (PST) From: Svyatoslav Ryhel To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/2] dt-bindings: hwmon: ina2xx: add supply property Date: Wed, 8 Mar 2023 11:40:23 +0200 Message-Id: <20230308094024.14115-2-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308094024.14115-1-clamor95@gmail.com> References: <20230308094024.14115-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?1759792263295987246?= X-GMAIL-MSGID: =?utf-8?q?1759792263295987246?= Add supply property. Signed-off-by: Svyatoslav Ryhel --- Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml index 47af97bb4ced..0f494131fa05 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml @@ -57,6 +57,8 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 enum: [1, 2, 4, 8] + vdd-supply: true + required: - compatible - reg @@ -73,5 +75,7 @@ examples: compatible = "ti,ina220"; reg = <0x44>; shunt-resistor = <1000>; + + vdd-supply = <&vdd_3v0_sen>; }; }; From patchwork Wed Mar 8 09:40:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 66132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp238248wrd; Wed, 8 Mar 2023 01:58:21 -0800 (PST) X-Google-Smtp-Source: AK7set+hS9Hwjl75SQuuAMmE/vmQm9EFA4ldrMp/4emFnC2iRzGngaay0fDYKcPkeMKfTadJiQnm X-Received: by 2002:a17:90a:53:b0:234:d1c:f112 with SMTP id 19-20020a17090a005300b002340d1cf112mr18592515pjb.0.1678269501676; Wed, 08 Mar 2023 01:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678269501; cv=none; d=google.com; s=arc-20160816; b=BTk2K90YLcMOHuw2jUwJTRV3BoiEu1vQttUbYzug0zj8dBkXFW+fcMQOuivvAPQ1rJ phQ8ybrvHL1j/05XOeDnkCIAUnI99rO60QBO5JPMF3RVdeyI5N/Efv6SBF0R7dBEPoMU slTyTy20tcJ0VCau8h/B72gFu1LP/Ze0jjCjK/wJpTR1tFNLmejGo7bcJpBgXAoZU4gd IXsFKHel68l29rEYCiGJPyYllsPh3Ay+92yRgxlEVv6tSA35d6B9EWimZqgLjP0CD0iH FsCB3/CBhrg2AEcYwz79ZavEq7UyYq7FdNUWVNN4f/HOuN+nsocqc9xk24M3f7xYhsmA f3Zw== 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=Z7A7ncxskY+Crxu5hf4wRrmUlrJ73jGGH1lawChBwQk=; b=piAnH+ILnhv61rgLlRWupN9uJXOf8qtml4ZnAU1WbqeUkbK+CNbX1XhQxq8lv1cPYR FLoATYpDpU38wEYoKaDlTyDgF6SQ5SCDHA1vJMOUH2JYra2HKl/K32ur76+FLbBiPEIw Vwd0f9vxfxKKtLRVh9BkelnkNDkYkXULQz6pSotsncwgJXscZaxGBzwPFACl6xhmRmYF AEWHOET38mVMAAP0+OL0goZO/vyTO7BhC9bXHCdBO22VQL2m5snK4Xd181el35JSZLwS Geq/AXDrqwIZfqlEoMlNs5bnQvL7yFdaIXXaJgAs+/nMIKJskkqtQZEhPPs1I4vuj6xi nDkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O3LGEKkH; 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 a12-20020a17090a8c0c00b002340ba8a402si13697916pjo.54.2023.03.08.01.58.08; Wed, 08 Mar 2023 01:58:21 -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=O3LGEKkH; 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 S229947AbjCHJkv (ORCPT + 99 others); Wed, 8 Mar 2023 04:40:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjCHJko (ORCPT ); Wed, 8 Mar 2023 04:40:44 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB28B1B15; Wed, 8 Mar 2023 01:40:39 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id j11so43650413edq.4; Wed, 08 Mar 2023 01:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678268438; 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=Z7A7ncxskY+Crxu5hf4wRrmUlrJ73jGGH1lawChBwQk=; b=O3LGEKkH6fFEw+/snzPC4P8/QhOhtUN5oxoQjgXnsPfjvU2V3SJvvUUsymPK2zQ3QL PA4jzopDlVRSQg7O0UyU6eTrZC0nzWfpZncJ0PSzVjo6phyIRdOK8fS2qLdylSM5jq38 v+jAHuk2a3kd74oocwONf3birziI0N7+Nj7UgNZm3HvRZununWwq5M81arPhdNh56UoI SDzQAzJ9tbC7bzY/j3mO8FuylJO371JEBDc4JNY+w9QJKSpBLQCoIkthZe+vtuOTzIQL Qlnmuynk8qWAZ1MK9GrglFmFX3uu6Q1rRy4WKNYrcL27ssyj0gctg4+DbHkNEx85ITJ9 JUkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678268438; 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=Z7A7ncxskY+Crxu5hf4wRrmUlrJ73jGGH1lawChBwQk=; b=nAAvY+06QllyixNVmXwLd1h2AD4NM9CXPMygW35GF6gElU/oA3yD892FccxpNmgmpo I1jeYj3QjulyVP9HoQG//dE5wGpPYgWifrKzvD2jal1iSwM2jSTcDyyAkqtJDPsASwen E7E2wtnUeQI57AidK7zFLD+ZtCLKS6iVkbOlKnDCMGHzw1iInlR5+yHJOizOcG/4IP0t X1sx6+kB3rS3czAtFpL96QzU/huvyQNglunfTHYgUUkJHJGr7tFZno/+qwN6kOAbrUEO igZHq30TGMO2OOl3ImbsYiEmR4axH50rkZvXxaMsfAcTC//fO0lI2+E8EQT+fH70Jd78 figw== X-Gm-Message-State: AO0yUKXog6l5ObNCBjcKcBKK70opnuqzYizdgltrW+Wr/fSxxXPbSeL5 wnLS1GPv9bq1hqTjHdCYOcs= X-Received: by 2002:aa7:d60b:0:b0:4bd:94b9:b8a8 with SMTP id c11-20020aa7d60b000000b004bd94b9b8a8mr14864191edr.26.1678268438466; Wed, 08 Mar 2023 01:40:38 -0800 (PST) Received: from xeon.. ([188.163.112.76]) by smtp.gmail.com with ESMTPSA id h17-20020a17090634d100b008ee5356801dsm7240014ejb.187.2023.03.08.01.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 01:40:38 -0800 (PST) From: Svyatoslav Ryhel To: Guenter Roeck , Jean Delvare , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] hwmon: ina2xx: add optional regulator support Date: Wed, 8 Mar 2023 11:40:24 +0200 Message-Id: <20230308094024.14115-3-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230308094024.14115-1-clamor95@gmail.com> References: <20230308094024.14115-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?1759793121203414267?= X-GMAIL-MSGID: =?utf-8?q?1759793121203414267?= Some devices may need a specific supply provided for this sensor to work properly, like p895 does. Signed-off-by: Svyatoslav Ryhel --- drivers/hwmon/ina2xx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index 00fc70305a89..4a3e2b1bbe8b 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -119,6 +119,7 @@ struct ina2xx_data { long power_lsb_uW; struct mutex config_lock; struct regmap *regmap; + struct regulator *vdd_supply; const struct attribute_group *groups[INA2XX_MAX_ATTRIBUTE_GROUPS]; }; @@ -656,6 +657,17 @@ static int ina2xx_probe(struct i2c_client *client) return PTR_ERR(data->regmap); } + data->vdd_supply = devm_regulator_get_optional(dev, "vdd"); + if (IS_ERR(data->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(data->vdd_supply), + "failed to get vdd regulator\n"); + + ret = regulator_enable(data->vdd_supply); + if (ret < 0) { + dev_err(dev, "failed to enable vdd power supply\n"); + return ret; + } + ret = ina2xx_init(data); if (ret < 0) { dev_err(dev, "error configuring the device: %d\n", ret);