Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8307758rwd; Tue, 20 Jun 2023 13:14:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62xJOruz3JnC9aKGuaB299PM3+x1QtpBFFkj4HlOH1CVBXRJDGfawffy4GVlagWCcfsox5 X-Received: by 2002:a05:6a20:a416:b0:10b:e88f:5983 with SMTP id z22-20020a056a20a41600b0010be88f5983mr11947081pzk.43.1687292059385; Tue, 20 Jun 2023 13:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687292059; cv=none; d=google.com; s=arc-20160816; b=nSXFxUkSunGiIzuetwmvl7IvJnWSyqyKKFnkQ7zjo9QB2Eo7aS8TVlY9UOMpRFpZhI 5W5DQKKRwp5vPYzzTlL/JujvK2AVSvpS9qZRYf5eA2Ng7gsxzn9eXe2iRdOyyS44x1nt dmcUg1hHlhiOHVV3peD6bRKMb2qZ7914tRDTFl+F9pvyvVw9qOSYxHl5dTI26XecX5ck +XSjTe/FR7/G22zwPkBV6eVWJfDOOG0xSTII+ThJsuSQlA+VlMG9qonR6+jUcIhRMldm fLDIeqMAR5aYS41XyiBs7/sVRvM5oRDKqIqgFDEOalmLvjfQeUn2F1yBGybXbIQ6eq5U 3GNQ== 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=bhgdg4E3TDsPGYojFdzrWAXjpzqjE4U2T6j3QbwzmRg=; b=CEH6M3ZOVT5Ui+rVUbz9KaqXNxuE/spedTvKZ9dA9F266UfsrRH2oEPedoOAe7nAfZ 0fNNbpC6+nqmaiXpt5nJkfcntRGgN9eDps4r+qeH5nLzIG0Csj7IeAYfY1J97cQNjtkN mW30FZF6pPrIYLWOglPLZgJYBH8K2subCklg3ELa7X3DEtRFFRVHvkncvGDqLBV5EXeV lPSSumTvJrSZPJGVDKCOyG08O5kVZ/24aBRRDS5MEYlox5CKFhie2nyEOFy4sRfi2w/O u+DPtPlSKBu0IHX1AjmOqzoFCHq9/Rhp8Rb1Bh+hPkmnJ6i/zx4hH3a5DOEkDt5VFWbf YpiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=BUdPTgPQ; 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 im16-20020a170902bb1000b001b3daec4478si2820291plb.299.2023.06.20.13.13.52; Tue, 20 Jun 2023 13:14:19 -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=BUdPTgPQ; 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 S229930AbjFTUER (ORCPT + 99 others); Tue, 20 Jun 2023 16:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjFTUDr (ORCPT ); Tue, 20 Jun 2023 16:03:47 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251EB1985 for ; Tue, 20 Jun 2023 13:03:44 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51a5eec783cso2940474a12.3 for ; Tue, 20 Jun 2023 13:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687291422; x=1689883422; 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=bhgdg4E3TDsPGYojFdzrWAXjpzqjE4U2T6j3QbwzmRg=; b=BUdPTgPQ9aBRs7OgBGVW3mzGqrEDBrZd9omeMyypo9a6JXXCaFbCPz1bM82876+1xh IdDHeEGb1aL6at9MG4e5u8VewpP6jh0aumkA31H8fNLSmxo/f/u9gi5bdh7FVva6sRw7 FhoLZFh5kn2FABmEGnVpBNhCFx21+Is2EQhh6kMSoqrgUqKYTv5Z1v6WqAdkouo+X43T 0ev5vLpuy6KrT4Wq95jL+Uvfa/NYGKmoWEV5K2rg/zClW53vPpsntfjkwpRQSouZB0Md O4aO22oz8JvsKeAPjdsMxMXMWGiXj+seC1WT5pbh3A63TaFbl7rm791ZE2PLWFvm8Bm7 Wwjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687291422; x=1689883422; 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=bhgdg4E3TDsPGYojFdzrWAXjpzqjE4U2T6j3QbwzmRg=; b=b6yXaNo36D4WIG/0Rl75AeYROFoxdIfTpDPYo4C4YthCj9RyQ9GhN4NPNt3xGUKI1S B+Nk59jWvIGtPWUtP7PbGqlU1gZWCUldRCNxzN2nppH5kPlWR1wDVOUQulo1pphlvLyp 64050THUVM8X3hJvC1DiNU5pPOW11XosHxcbk4BNJvp4ASdUN/4GtZG+cMZN8l5801G3 BP/EHMjHIzT/xO3om1bh3vFOtDQIW3B1dH8lNMzKWRemwqw4p/HHP+i3eQOFHPBoB3jJ HezjQqvvXkT83uU8qLbfVk3bwz+ST3PEo2flVszlgNhjkbHB49JhAIwLcI8grMLscEG+ pr8Q== X-Gm-Message-State: AC+VfDwH+JvC4izyAB/O9VQ8tFGtORyCHPcliAKu+5nUJvRqRSwMHExS WeCYpTNuatkzvuxPK0ADEJI= X-Received: by 2002:a17:907:728b:b0:988:e0cd:99c4 with SMTP id dt11-20020a170907728b00b00988e0cd99c4mr4431959ejc.31.1687291422599; Tue, 20 Jun 2023 13:03:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 13:03:42 -0700 (PDT) From: Benjamin Bara Date: Tue, 20 Jun 2023 22:03:04 +0200 Subject: [PATCH RFC v4 11/13] regulator: implement mon_unsupported_reg_modes MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230419-dynamic-vmon-v4-11-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 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 The mon_unsupported_reg_modes property disables all dt-enabled monitors when the mode of the regulator is changed to an "unsupported" one. Signed-off-by: Benjamin Bara --- drivers/regulator/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 74b9c12d38e9..ca768d0ddb1e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4816,8 +4816,21 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode) if (ret < 0) goto out; + if (mode & rdev->desc->mon_unsupported_reg_modes) { + ret = monitors_disable(rdev, REGULATOR_MONITOR_ALL); + if (ret) + goto out; + } + ret = rdev->desc->ops->set_mode(rdev, mode); + out: + /* if changing mode failed, ignore monitoring error. */ + if (ret) + monitors_reenable(rdev, REGULATOR_MONITOR_ALL); + else + ret = monitors_reenable(rdev, REGULATOR_MONITOR_ALL); + regulator_unlock(rdev); return ret; } -- 2.34.1