From patchwork Tue Apr 6 07:12:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 416120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DAA0C433ED for ; Tue, 6 Apr 2021 07:13:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1999161242 for ; Tue, 6 Apr 2021 07:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238916AbhDFHNH (ORCPT ); Tue, 6 Apr 2021 03:13:07 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:40808 "EHLO mail-lf1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238014AbhDFHNH (ORCPT ); Tue, 6 Apr 2021 03:13:07 -0400 Received: by mail-lf1-f50.google.com with SMTP id d13so21099960lfg.7; Tue, 06 Apr 2021 00:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lanXWWkCnnUsQptzren1s2UcTiYH4GtjBPSv5+mLE5s=; b=TC9BCxAxIqggVrxgRcOZjU0o3AYUDAS2akWNZHAJ6IOMb8FG/3PUS0iN/41BCM5LBM tMrnH0L1XnWrEhDEjA950nPkQSuSwEkGdJ3YD2VcdpAUyLHfRdvfo8COXxx+Xb4zh5T3 mecuhYh8jk0bQjqzdvp73oTGFevW4twEfucsvi8qREalvFmlbS0SxQmiHFWghAr7iv9n XG6BymaOIgluekmqUpsCzrK+uRK++bQlOruudJbVcSSK8qNXXZacWYkDgbiBEM8l65wM iGlYqBj7mqMerIJ31oroUWR2WivLTYCiPNCV80wJqp7aBRHCiUsTyeOUASMwHYn+H9WB lEqg== X-Gm-Message-State: AOAM533PxvAJ3foUw6qBFa3Kv8fTlaA79zdfpn9/q9HKa/ItWFwj8U5x YyL85MpYYf/q+h5VWo9FxB8= X-Google-Smtp-Source: ABdhPJwkKor2U8v1XGz/n6/xsTsBut0qMKA0iIYDFnogjWQRbZ2EHNs/OCQWcRPaxknc90/L2QQitA== X-Received: by 2002:a05:6512:1102:: with SMTP id l2mr19916621lfg.501.1617693178101; Tue, 06 Apr 2021 00:12:58 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyydy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::6]) by smtp.gmail.com with ESMTPSA id u9sm2093291ljd.130.2021.04.06.00.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 00:12:57 -0700 (PDT) Date: Tue, 6 Apr 2021 10:12:51 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Liam Girdwood , Mark Brown , Rob Herring , Matti Vaittinen , Andy Gross , Bjorn Andersson , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-power@fi.rohmeurope.com, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH v4 2/7] regulator: add warning flags Message-ID: <250150928643e2cd4b4fa39d08f6596cd2829c1b.1617690965.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add 'warning' level events and error flags to regulator core. Current regulator core notifications are used to inform consumers about errors where HW is misbehaving in such way it is assumed to be broken/unrecoverable. There are PMICs which are designed for system(s) that may have use for regulator indications sent before HW is damaged so that some board/consumer specific recovery-event can be performed while continuing most of the normal operations. Add new WARNING level events and notifications to be used for that purpose. Signed-off-by: Matti Vaittinen --- No changes since RFC-v2 include/linux/regulator/consumer.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 20e84a84fb77..f72ca73631be 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -119,6 +119,16 @@ struct regulator_dev; #define REGULATOR_EVENT_PRE_DISABLE 0x400 #define REGULATOR_EVENT_ABORT_DISABLE 0x800 #define REGULATOR_EVENT_ENABLE 0x1000 +/* + * Following notifications should be emitted only if detected condition + * is such that the HW is likely to still be working but consumers should + * take a recovery action to prevent problems esacalating into errors. + */ +#define REGULATOR_EVENT_UNDER_VOLTAGE_WARN 0x2000 +#define REGULATOR_EVENT_OVER_CURRENT_WARN 0x4000 +#define REGULATOR_EVENT_OVER_VOLTAGE_WARN 0x8000 +#define REGULATOR_EVENT_OVER_TEMP_WARN 0x10000 +#define REGULATOR_EVENT_WARN_MASK 0x1E000 /* * Regulator errors that can be queried using regulator_get_error_flags @@ -138,6 +148,10 @@ struct regulator_dev; #define REGULATOR_ERROR_FAIL BIT(4) #define REGULATOR_ERROR_OVER_TEMP BIT(5) +#define REGULATOR_ERROR_UNDER_VOLTAGE_WARN BIT(6) +#define REGULATOR_ERROR_OVER_CURRENT_WARN BIT(7) +#define REGULATOR_ERROR_OVER_VOLTAGE_WARN BIT(8) +#define REGULATOR_ERROR_OVER_TEMP_WARN BIT(9) /** * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event