From patchwork Mon Nov 28 17:47:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13057842 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 143F3C4332F for ; Mon, 28 Nov 2022 18:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233908AbiK1SAi (ORCPT ); Mon, 28 Nov 2022 13:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233927AbiK1SAW (ORCPT ); Mon, 28 Nov 2022 13:00:22 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 254B242191 for ; Mon, 28 Nov 2022 09:47:29 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id t25-20020a1c7719000000b003cfa34ea516so9845066wmi.1 for ; Mon, 28 Nov 2022 09:47:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zldnW5rJOk7M0l3yWgxmGNQjXevQdi/Iqfoi9nBlAx0=; b=HrTD3WXu/Al7qExPlPzwtZirW4zpkJcJqhbIDJd1ZNyw6J2NVU0Y+zfJ4LHng4uWpd i3Yjprv9ZPGrwTdUjDtnyP+xFndZM6JkhOj8SzbXXJexsBfXIkYGanFx6zF+6+/UUoqo kgOFwoNyPuSa5ZxlDEdKxT8Ovhs08umFtalEPwOXODvimNaigNTsmCUrL8bvNY48ZPC5 UtF1DjNGcbrbH7A8EuB8/jnl62d+ovGPTAFcM1ulffOscuX7/Xih97aiPNECCEuyPyHC q5hPPz6LoJH0LGU8aUXg/ueEKglcyszhpITyAe2HwR7aAyU0ciidHI9pweWLizQa+Vej Pjzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zldnW5rJOk7M0l3yWgxmGNQjXevQdi/Iqfoi9nBlAx0=; b=tpdDzjvRzTzVGejK40se9GWSEKYfEQLyZvw+pTJpJIALMc0vKlDAy5GbFgXypxRse5 i1iEf0s4gG8A/A7BN8ircaSF9XzRumRPHrFE8V8x/s8AE23W/cY4udrY1ysEZ3o/yHAC QMsX7tK2+JTFw4u0Owh43vg0FK9mpwtJbjdqBmWrn8PRijOz1dCOXsBVofWsaTwKHqOs x79optugV8ES89922A4iqTNVu7G09jfCnPu+TKC06QqeMXr+Ej7leJw+LOIGeBhSwLwc ai2ZOsBTpHXfT++xybHYkeK8yaIXwFOkvpYIv1aIs6g2hGn6VNNyBrUqHlWgT1fICGQy h3JA== X-Gm-Message-State: ANoB5pmnOFExmhqGG5RjFSg0QQWCGDUM7OkEPW9PEDBh56M4mXyDtibX k6l4smiSZgEMFI9D1yZlFhaErg== X-Google-Smtp-Source: AA0mqf45JYunsYGGZgjSURmXcNikMn57TuKiyaxNXEofVAoeo+m9nGr0sRXuEjibQnMmTfBMK3Km+A== X-Received: by 2002:a05:600c:35cf:b0:3cf:aa11:93a8 with SMTP id r15-20020a05600c35cf00b003cfaa1193a8mr42423628wmq.31.1669657643354; Mon, 28 Nov 2022 09:47:23 -0800 (PST) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id p13-20020a05600c358d00b003c6b9749505sm21090045wmq.30.2022.11.28.09.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 09:47:23 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare Cc: Patrick Rudolph , Naresh Solanki , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] hwmon: (pmbus/core): Add events to regulator flag map Date: Mon, 28 Nov 2022 18:47:13 +0100 Message-Id: <20221128174715.1969957-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221128174715.1969957-1-Naresh.Solanki@9elements.com> References: <20221128174715.1969957-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Patrick Rudolph Add regulator events corresponding to regulator error in regulator flag map. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 62 +++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index f5caceaaef2a..060e9d0a55bd 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2738,9 +2738,9 @@ static int pmbus_regulator_disable(struct regulator_dev *rdev) return _pmbus_regulator_on_off(rdev, 0); } -/* A PMBus status flag and the corresponding REGULATOR_ERROR_* flag */ +/* A PMBus status flag and the corresponding REGULATOR_ERROR_* and REGULATOR_EVENTS_* flag */ struct pmbus_regulator_status_assoc { - int pflag, rflag; + int pflag, rflag, eflag; }; /* PMBus->regulator bit mappings for a PMBus status register */ @@ -2755,51 +2755,71 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] = .func = -1, .reg = PMBUS_STATUS_BYTE, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT }, - { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT }, - { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE }, + { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, { }, }, }, { .func = PMBUS_HAVE_STATUS_VOUT, .reg = PMBUS_STATUS_VOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN }, - { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, - { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT }, + { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN, + REGULATOR_EVENT_UNDER_VOLTAGE_WARN }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, + { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT, + REGULATOR_EVENT_OVER_VOLTAGE_WARN }, { }, }, }, { .func = PMBUS_HAVE_STATUS_IOUT, .reg = PMBUS_STATUS_IOUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN }, - { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT }, + { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN, + REGULATOR_EVENT_OVER_CURRENT_WARN }, + { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, { }, }, }, { .func = PMBUS_HAVE_STATUS_TEMP, .reg = PMBUS_STATUS_TEMPERATURE, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN }, - { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP }, + { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN, + REGULATOR_EVENT_OVER_TEMP_WARN }, + { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP, + REGULATOR_EVENT_OVER_TEMP }, { }, }, }, { .func = PMBUS_HAVE_STATUS_INPUT, .reg = PMBUS_STATUS_INPUT, .bits = (const struct pmbus_regulator_status_assoc[]) { - { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT }, - { PB_IIN_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN }, - { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE }, - { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, - { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN }, + { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT, + REGULATOR_EVENT_OVER_CURRENT }, + { PB_IIN_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN, + REGULATOR_EVENT_OVER_CURRENT_WARN }, + { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE, + REGULATOR_EVENT_UNDER_VOLTAGE }, + { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN, + REGULATOR_EVENT_UNDER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_ERROR_OVER_VOLTAGE_WARN }, + { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN, + REGULATOR_ERROR_OVER_VOLTAGE_WARN }, { }, }, + }, };