From nobody Wed Dec 17 10:03:15 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27042EB64D7 for ; Tue, 20 Jun 2023 20:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbjFTUDq (ORCPT ); Tue, 20 Jun 2023 16:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjFTUDh (ORCPT ); Tue, 20 Jun 2023 16:03:37 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F9D1716 for ; Tue, 20 Jun 2023 13:03:36 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9889952ed18so424970766b.3 for ; Tue, 20 Jun 2023 13:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687291414; x=1689883414; 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=3NURFoPzOpzPWAlV9sdcHGrSNeXHdcY9e57Q+SkpU0s=; b=QgWGEsbgpWllrg5VSzUBxjJ2pR7k0JX8MX5TF74RBzA4ImRC+S4vK8R/OqqbDS7t06 0xogVncHLgAYOXq60hXw2b5sAtXndJVw5+gnuD/pBbk1gHHxEB27R4STRIblWgC5ZsFn hXfT/oD/2VTExj07Zv+V5ZTZ2BJagyvD3GEubyn4gB68wmqpacsqPSZuEMYeg3qock58 Nc2qNglbdYRmRe35f5uVE2JU8dcTmD4qI53PBSOiT06Rp9ryvY9sO35U2ro2NmjEB+8w 94xcTd25Nu+JtB8H2HynJ7ZiHxG9tbrlm5jg73pl+Bo6XQuBSISYMYO82fceF7Q7jyGo mjZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687291414; x=1689883414; 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=3NURFoPzOpzPWAlV9sdcHGrSNeXHdcY9e57Q+SkpU0s=; b=DO5bk7O4Qzwubwq1LDnd9IUJIzxKc9t15zHjy6GcyHyaUtmBxD6oUR/a0+IXXi8kWK 2wuBfdjaCZ41EG9F5DWhtWSAuMsbnrz8E8pz4zsKH+lyfx8HmfxmZuej9jLkRNykJIoF kcrXwjMl0ko09By6v93sV2IQJ4VBHJoua1IfOV+MRKFeUgRs4Jqe8gBiY/yoJfwpEnTA a3LDf7XhkfiuRgdhZ7kSawRNSw0PQ1u+kf2TulCxHlC2RtLchRj1mdx4DsEQbVAbQFcv F9sq1NIxptEb9kt3MJhmIOK0yj3b2X9AP4ztNQjsyHInYs/gHEHn/2mItCOevqCKMH+p qQ7g== X-Gm-Message-State: AC+VfDzve+HfmwJ6QY2zlJky0mhSfHSjuHD6v96aJd13CAbznqzgC7Ta 0rjbC6jRL7YN8BQ6widXW3w= X-Google-Smtp-Source: ACHHUZ5x80xjwTf15LZ3yfmaApv6rMHkMnyFZVDBlWeWfwve8iE6aqaVoXg/qZvuRqXhaGGMyIaRxA== X-Received: by 2002:a17:907:844:b0:982:9dc1:a434 with SMTP id ww4-20020a170907084400b009829dc1a434mr12252052ejb.19.1687291414455; Tue, 20 Jun 2023 13:03:34 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id u21-20020a17090617d500b00977e0bcff1esm1947064eje.10.2023.06.20.13.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 13:03:34 -0700 (PDT) From: Benjamin Bara Date: Tue, 20 Jun 2023 22:02:55 +0200 Subject: [PATCH RFC v4 02/13] regulator: add getter for active monitors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230419-dynamic-vmon-v4-2-4d3734e62ada@skidata.com> References: <20230419-dynamic-vmon-v4-0-4d3734e62ada@skidata.com> In-Reply-To: <20230419-dynamic-vmon-v4-0-4d3734e62ada@skidata.com> To: Liam Girdwood , Mark Brown Cc: support.opensource@diasemi.com, DLG-Adam.Ward.opensource@dm.renesas.com, Martin Fuzzey , linux-kernel@vger.kernel.org, Matti Vaittinen , Benjamin Bara X-Mailer: b4 0.12.2 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. This is useful to find out if any monitor is turned on, of which the device-tree is not aware of (e.g. by bootloader or OTP). Signed-off-by: Benjamin Bara Reviewed-by: Matti Vaittinen --- include/linux/regulator/driver.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index d3b4a3d4514a..9a9163cae769 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -25,6 +25,13 @@ struct regulator_config; struct regulator_init_data; struct regulator_enable_gpio; =20 +#define REGULATOR_MONITOR_NONE 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 +#define REGULATOR_MONITOR_ALL 0xF + enum regulator_status { REGULATOR_STATUS_OFF, REGULATOR_STATUS_ON, @@ -112,6 +119,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_*. * * @set_active_discharge: Set active discharge enable/disable of regulator= s. * @@ -183,6 +192,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 *st= ate); int (*set_active_discharge)(struct regulator_dev *, bool enable); =20 /* enable/disable regulator */ --=20 2.34.1