Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1747304rwd; Sun, 21 May 2023 05:37:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Xkr1pQzkrNOHqiMK8oL/uL+aY2Og5NC3ool9Xjbmpc/p7vmfG564SQPNjWYPSvriPmO86 X-Received: by 2002:a05:6a20:3d95:b0:101:4c8c:d1ee with SMTP id s21-20020a056a203d9500b001014c8cd1eemr7692139pzi.50.1684672628690; Sun, 21 May 2023 05:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684672628; cv=none; d=google.com; s=arc-20160816; b=F+RQJOMn9YSkFs32eLLSy374KvqYDQfcTXm+r2cXn/W7a+uNZjSO7lK1mq7E/Co42T Mohqh+6PlQGH27rdbkt2d7tZCXXHOXCkaACje1JUAUUQsJv3mCngjk1eUPfaC/WhQa1e oFy0vVVH6rn9RR70YZiTGpkzLqh7T8OrnCrRIxUZbeEjhA+xL9/i6AttDpZLEZNcEF1O 0xFzvFka5aTAwfWNdBTtlkzq+mXFYG6soo5wy3JbciNGyenEGwUrYj3Fkn7rBGiyUHcJ /b41ouko0R5z0uBEriX0BE7QmhbrkVrV7EOpp/5jABwcaWOys+dQdcbxyhokUNyKyHA4 Yqqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Z5+cmzLz6/sx+KBZ1IqAfTTXRmFup3O6Bm7K5a68gJk=; b=gkzShX95qmByVtzVHe1aojWeiyUr8M688kZVLTYOTnUQI5M86QgvwlsFauwYHehvKs fTQbrUZy8SZJVsRRQFFHr70rGyiBxwPHmmdvqUUXmsb2p493UOdJGr1lkut1EcJ09gmN B9r6zHuejEun0FX9cLbKcneUc25lIwgiPGbZgCwPfP/trPOHxvJ+5FPqatZTaDUN5SD8 nMGoY+FtWElf4LnPhlo62OnDOs88aym3Q5SSHA0ggl3H0b5iApdcT/BWt8k9x66Q6GTx A7cgE114Q/jhSKvfAichUqdnQsDlb8fFqsal0hP1WoNh8MNqrMoJ65WQ2hs6+y1s+fDM Fq4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=V2sBcJR6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a656a95000000b005303c3dedc2si3209648pgu.419.2023.05.21.05.36.56; Sun, 21 May 2023 05:37:08 -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=V2sBcJR6; 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 S231354AbjEULrX (ORCPT + 99 others); Sun, 21 May 2023 07:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjEULqF (ORCPT ); Sun, 21 May 2023 07:46:05 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E21E3E49 for ; Sun, 21 May 2023 04:40:08 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-96f53c06babso549932266b.3 for ; Sun, 21 May 2023 04:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684669207; x=1687261207; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Z5+cmzLz6/sx+KBZ1IqAfTTXRmFup3O6Bm7K5a68gJk=; b=V2sBcJR6gvj5KaqfKFqHmKHM4+SeAw+djCQInECpMzgh1JxJpHjdWNR+hJciioEJuU sgnNpkEMv7NDqqP/HWAVCZCwBaZTwLm93dGZHodMgXCNFMNVdyZuWU243m70lnFjssB+ KV77DUbQPYIg910BHGSrz6Dx234i6cjhXYtArIvE9wSm9AqOS90A2KDsObAVUPoXkWlK lxCBRL+uYvOZUwHipb7WPin4gsa/0uc4Cj8djAxF2jiXOVvnxR/UVZOEUr3dZ3+yST6W 0aBbIZ3CtmsjYliDMhwR8Hv4myj2xJcfrcwoBYMNEhZVBuCxBM2ynZKK44bdskSSnRzK ax9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684669207; x=1687261207; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z5+cmzLz6/sx+KBZ1IqAfTTXRmFup3O6Bm7K5a68gJk=; b=QDpJIZKLyUxDnPbqxzq46IvXMWVaVVLlfPT5wQuMin50FhtyoVT08xePIAzA0QRHRk DVQJe2D4KEQN+iAO8UyJocFkWfbG16WBZ/LAanwlHQCo+gLp7E8eKnf+3H3JgtTDshNA bbsfoCkex3GwDcqVPv2SCHusVWCvv7J+4xyrCB+rqXw9J6fXDCdBNH7bSa+tIS5QzdDT JogL+RgxyfJpcDlH8tBN99apcZ3ZO/sPhDCA09pz0cMFJebKsBRv9UacmlLXuxqwEPHo jxQAfpwusg8Q9TSL3yfae2cBsVx53J9p29cjhMogGT8PuUlTqLoGdHtcU0ON38hn7v+j /5jA== X-Gm-Message-State: AC+VfDxUoTp9Uvr6CNyoUvvkrKya0l4gxV/NzxRX7AvDFyUSm2i1ZoOp Q/+VGSEKBE9eNktdUNAYMUM= X-Received: by 2002:a17:907:31ce:b0:96a:6723:da48 with SMTP id xf14-20020a17090731ce00b0096a6723da48mr5845547ejb.75.1684669207146; Sun, 21 May 2023 04:40:07 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id h25-20020a1709070b1900b0096f7996d59csm1833911ejl.184.2023.05.21.04.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 May 2023 04:40:06 -0700 (PDT) From: Benjamin Bara Date: Sun, 21 May 2023 13:39:52 +0200 Subject: [PATCH RFC v3 3/5] regulator: add getter for active monitors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230419-dynamic-vmon-v3-3-4179b586d8a1@skidata.com> References: <20230419-dynamic-vmon-v3-0-4179b586d8a1@skidata.com> In-Reply-To: <20230419-dynamic-vmon-v3-0-4179b586d8a1@skidata.com> To: Liam Girdwood , Mark Brown Cc: support.opensource@diasemi.com, DLG-Adam.Ward.opensource@dm.renesas.com, linux-kernel@vger.kernel.org, Matti Vaittinen , Benjamin Bara X-Mailer: b4 0.12.2 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 From: Benjamin Bara Add an op to get all active monitors of a regulator. Signed-off-by: Benjamin Bara --- include/linux/regulator/driver.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index d3b4a3d4514a..35547e9eca48 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -25,6 +25,12 @@ struct regulator_config; struct regulator_init_data; struct regulator_enable_gpio; +#define REGULATOR_MONITOR_INVALID 0x0 +#define REGULATOR_MONITOR_OVER_CURRENT 0x1 +#define REGULATOR_MONITOR_OVER_VOLTAGE 0x2 +#define REGULATOR_MONITOR_UNDER_VOLTAGE 0x4 +#define REGULATOR_MONITOR_OVER_TEMPERATURE 0x8 + enum regulator_status { REGULATOR_STATUS_OFF, REGULATOR_STATUS_ON, @@ -112,6 +118,8 @@ enum regulator_detection_severity { * @set_thermal_protection: Support enabling of and setting limits for over * temperature situation detection.Detection can be configured for same * severities as over current protection. Units of degree Kelvin. + * @get_active_protections: Get all enabled monitors of a regulator. OR'ed val + * of REGULATOR_MONITOR_*. REGULATOR_MONITOR_INVALID means no one active. * * @set_active_discharge: Set active discharge enable/disable of regulators. * @@ -183,6 +191,7 @@ struct regulator_ops { int severity, bool enable); int (*set_thermal_protection)(struct regulator_dev *, int lim, int severity, bool enable); + int (*get_active_protections)(struct regulator_dev *dev, unsigned int *state); int (*set_active_discharge)(struct regulator_dev *, bool enable); /* enable/disable regulator */ -- 2.34.1