Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16216035rwd; Mon, 26 Jun 2023 07:14:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MMSGZ9GEzmKIJvz0MWmHgXCTXjM+1Ikk7YbvMshw5I7JUUu2hB/I7KjIgOq/VP/8Wmn0n X-Received: by 2002:a17:902:ed11:b0:1b7:f24c:3b9a with SMTP id b17-20020a170902ed1100b001b7f24c3b9amr4632272pld.47.1687788881587; Mon, 26 Jun 2023 07:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687788881; cv=none; d=google.com; s=arc-20160816; b=zCbVkPj9fTaZbuXys0CNm2HVjNwZ+n6hp/p0yrGUCKILy7g+4GobJl+t/UuW/+2YqG KqFtIlEG0AcBa/QPiVAIdbU+Q8zoPAyObZnVI2yLLMkYHktWkGz395gKQqev92uHcMaI oyyJFcaIYTT8Jek/kzy7Y0x+HrJibXh6CVObXYtbJf4BkpmYgS7jQAIA35qzcGJ5NsbR a7GpoSyHMEQ42h9xZvTLB8piUvPYtwJyS0ruZzePHVzgKr3EEAJbBWC4ClKio4m4aa91 gcoxvVTYyiGAgrQp69QJV5wCrSloa84fxTCpefpIb8T/0kGqxqIpiEMmeAhtHi6TpbgE CJHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=dzDlve5/NsqkSu1s/yZ2DWXi6Pe8+asZ2Rh+Bil9dzw=; fh=0Ba6w5iydT4MJ+f43C3NRzdcj72PiAT9MEVizdcht4k=; b=SWoJXoL146Z6wjmxnZb4Jfr1fEjKbOYlIuek2WqaW/WAScE2mg0zsMCEcIuf/yLRJ7 EJTC+UFHY5JRHHQ1jkYuD+nsabS8aAanIoBoWRn85giPsP+GCfTPyXN91NDamc51lpST jH/vVs+bCTxWtYXJGj7mBSivZfS3ydl6GHYTdKif3eaVxgJ4Z0Mcm+l09noSxW4jVJ2B 3DB6gwF6mqsKTlmzRF3ihiZ4kZHBrlGREkcEN2aDclwpBIzPm5uzLKixzZKWdl6vCqVS U3mDh7PSHI5oWOToD0+u34CcjYHvnAMpQ9XtEwukUn5OJXK6pA+1QUqkFjyIuS7DLNiI p+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=JgY4p5UL; 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 a4-20020a1709027d8400b001b046acc851si4927599plm.358.2023.06.26.07.14.29; Mon, 26 Jun 2023 07:14:41 -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=JgY4p5UL; 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 S229910AbjFZNnz (ORCPT + 99 others); Mon, 26 Jun 2023 09:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjFZNny (ORCPT ); Mon, 26 Jun 2023 09:43:54 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD569134 for ; Mon, 26 Jun 2023 06:43:52 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-51a52a7d859so7900930a12.0 for ; Mon, 26 Jun 2023 06:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687787031; x=1690379031; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=dzDlve5/NsqkSu1s/yZ2DWXi6Pe8+asZ2Rh+Bil9dzw=; b=JgY4p5ULOGzMOwNQ7O8imoMdUpnnTJbfdEr5WH9ME5Sai+sfTK8TxrfPR+kFKKdJyq rhdFNsac8YWGWNi3Fzurt2FQeBdrrJ6U5ZC70879a2Ftv+BHb8MUd3gY1khX07mAIGkH s8Jw/DzTwwbEfDRwo1c2V53myhIAOYtWalhTJ0cPDi5lWdRlhbWUL2cHUgldRAklvxnD 29xs6Jhs/FGQmgbnZbI5uLWQfwm4HqDFPCwDR0Go/fYhNsx8kT/YZHjlc+pMSlNWX+O+ YBdZvz3nayILgpU5YUkA3ln/HLVGAltTRoMoMa23PIlPPJ5z1yDknpzxK14sh35FdmYD 5Rzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687787031; x=1690379031; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dzDlve5/NsqkSu1s/yZ2DWXi6Pe8+asZ2Rh+Bil9dzw=; b=TkqrZpP334FpHgWafiaJXb5pjfmmsGUFQ43nRbdOM9/PosUSndNkb1ELEDaqG5HX4N mQYpH9m2WOgGzMFgQQu1vyVQw1eHfNSfOU50bkjML0Na6ifZ4luLa1PFNlwLFNKTSiKR jTtRNgIjMudinGWcCA4wduffVkJNjKYtdolpThLMOPWdxIGfZnVplUE0nMYHYe7nE4GH 9iPITYAyCsYsRGrYObGh1C07Y8csnb+tfbdW1c72Lcbbk45iL5Xz5K6ahk5eQWjm7ncd 9VeFbByOv4qvDv21ZV7GDpnQh8BrFQMRu4cPNRf63UMXUOq3vwojucTxFxBGLxGfJXAs k+zw== X-Gm-Message-State: AC+VfDyl7GrF4lmNk1NH0xmA6r+AXuCqhn+gRY3MtrgKbxwRxezbmM7x srgn1QJuZXDswNtL3FaeTAo= X-Received: by 2002:a05:6402:5112:b0:514:387c:930 with SMTP id m18-20020a056402511200b00514387c0930mr34023894edd.5.1687787031013; Mon, 26 Jun 2023 06:43:51 -0700 (PDT) Received: from [10.100.102.18] ([83.136.201.74]) by smtp.gmail.com with ESMTPSA id v14-20020aa7d80e000000b0051a59d81c4dsm2878520edq.3.2023.06.26.06.43.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Jun 2023 06:43:50 -0700 (PDT) Message-ID: <4a71b08e-0c0d-a378-7a3a-0cd12912d4d4@gmail.com> Date: Mon, 26 Jun 2023 16:43:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US, en-GB To: Benjamin Bara , Liam Girdwood , Mark Brown Cc: support.opensource@diasemi.com, DLG-Adam.Ward.opensource@dm.renesas.com, Martin Fuzzey , linux-kernel@vger.kernel.org, Benjamin Bara References: <20230419-dynamic-vmon-v4-0-4d3734e62ada@skidata.com> <20230419-dynamic-vmon-v4-2-4d3734e62ada@skidata.com> From: Matti Vaittinen Subject: Re: [PATCH RFC v4 02/13] regulator: add getter for active monitors In-Reply-To: <20230419-dynamic-vmon-v4-2-4d3734e62ada@skidata.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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 On 6/20/23 23:02, Benjamin Bara wrote: > 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 Just a couple of minor remarks. Feel free to change those if you end up respinning. 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/driver.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; > > +#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 Not a big thing but maybe use BIT() to underline this is a bitmask? > + > 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_*. I think it wouldn't hurt to have doc stating in which case populating this call-back is needed? I haven't read rest of the patches yet but I guess this callback is going to be used internally by the regulator core and maybe it is not obvious for driver author that this is needed by core to be able to support automatic protection handling. > * > * @set_active_discharge: Set active discharge enable/disable of regulators. > * > @@ -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 *state); > int (*set_active_discharge)(struct regulator_dev *, bool enable); > > /* enable/disable regulator */ > -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~