From patchwork Thu Mar 11 10:22:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 398854 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 DC424C433DB for ; Thu, 11 Mar 2021 10:22:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F16364FB2 for ; Thu, 11 Mar 2021 10:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbhCKKWX (ORCPT ); Thu, 11 Mar 2021 05:22:23 -0500 Received: from mail-lf1-f53.google.com ([209.85.167.53]:46398 "EHLO mail-lf1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232335AbhCKKWU (ORCPT ); Thu, 11 Mar 2021 05:22:20 -0500 Received: by mail-lf1-f53.google.com with SMTP id r3so30679788lfc.13; Thu, 11 Mar 2021 02:22:19 -0800 (PST) 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=gDfcJMlGzdaL8e7w1T0lid6e1IBLGyWlrrtdqBUQaxA=; b=TpctEap5EgkvYEe0EqEITXxzumBCX1/2mP6Gsz6RYGgsqu1qxperrBFd4t6yf/8tT2 4HL/pC5BXOrjqOpUxNXQDcv/56wm5CaJVm36nZPFjFOqxjEh7tuZgPLkj28B6yU03h5I ofX+SirRYiXTTmBYTImpfWAC072HXkwt9Bhh7rnu7pnX++t9LvIQJB1sToTTF/gzEYXa TyLPV1ZDXWDkpEwRvQtpP6csvdg7iLcyJRovGr5fDe1snBxMQH1Ec0FwXAjHq/6v1w6N hJc0EpYwvmSGpCL12UPm2t4FZ3fEVQg0NiJ+cpjX6wZ2fiPuhtl692iU8c0PC2gVfcRX dkPQ== X-Gm-Message-State: AOAM530XT83CY+L6IbGR3cx36G4bhJnNJai49raU0t0SAcQZyWL8+Nog bW03SenZA92EI2VPjG9fjf4= X-Google-Smtp-Source: ABdhPJzUiNXG47v/An0lVFwBiGIBl6NjlR1pPUkbbtHv9qRd2h6ebpQFg02IG5B2oQvPsOUMWOga6A== X-Received: by 2002:a05:6512:3450:: with SMTP id j16mr1901532lfr.80.1615458138813; Thu, 11 Mar 2021 02:22:18 -0800 (PST) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyycy-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::4]) by smtp.gmail.com with ESMTPSA id w13sm840671ljw.2.2021.03.11.02.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 02:22:18 -0800 (PST) Date: Thu, 11 Mar 2021 12:22:11 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com 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: [RFC PATCH v3 2/7] regulator: add warning flags Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 --- v3: No changes v2: No changes 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