From patchwork Thu Dec 1 19:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061758 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 CC6A0C4321E for ; Thu, 1 Dec 2022 19:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbiLATbP (ORCPT ); Thu, 1 Dec 2022 14:31:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbiLATak (ORCPT ); Thu, 1 Dec 2022 14:30:40 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44627C8D20 for ; Thu, 1 Dec 2022 11:30:32 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id td2so6625997ejc.5 for ; Thu, 01 Dec 2022 11:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9fKvZImztyAGYKm8N5WHEv0DzFDUrZgSaslqn8pXCp4=; b=EnlxFW2of+UDwHxryW+kMpzqGXuxTDwAoNmcTHslWecr9SBkZJdHuMHWFI08pKCaug 1vntP/acflKa9IY5WkpTy7G5Mcv2izHZGHe6BPpGPSxCG/+eyzE8f3wJEoXjNZ/QsSr+ VEtbfeSCQYFJwxPkqbb8gOICofHTknEtCusDwm6YpYDoy48e/MInC2BPOF4oNQ8dSvzw SG+q4W/qWaSoqaadUcg51bK6Ba1y6+PtskkmmZ1ujxihHD8Q42mMektfENTMx9PrMyUk cBgMwyLOauec7NlPc7jnpoUJQr7RUytiE+/uaBM0AN1VRsjJfzqgeW2qj0SSd8xBePRn pv7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9fKvZImztyAGYKm8N5WHEv0DzFDUrZgSaslqn8pXCp4=; b=r8ZQes3fjfUky0fkvwN+N0b1zn89vgV7AcySm72QRtW2vx1YJy7YK2R8Rk1qNCuQ7D I6YRHCRJfjbxohE5MZMbmDtnRNjAVlVlJXBHxKCNZFjRouwZLxt42FyeG0dP8ymI/4tj bDO62QDG9S1CzDTsUEduWyOIsbtYZ6gbAiugXzvpfirLTKdUijWZjeSd3XLd6EeXy6dz p3KlZJ+p+fGZecKjxyU86f0N3vOP8fI3k9lNNGsNrc8omOF7nSro9qGmHpK72LRcOtK6 5MK7X0O2+WskDkyw5yj0LJWm267XMZS1M7MutcAOkZ3Scw0qTfgUymV9yDsCFhqSCT/d e8/g== X-Gm-Message-State: ANoB5pkMB1WxGVhOmPdv5y1lupQdCdkzIRskakFZh4joH/3UsRPE2fL2 XXueDTqWdFO4A31UR4cJNr+2cA== X-Google-Smtp-Source: AA0mqf4koTAajDL3O33f8A2i615xXP/JTt7Jmfrroko8lEHAPS5WgC+T5WvGS6IO0M31Ogsh1ZKGWg== X-Received: by 2002:a17:906:f8cc:b0:7ad:92fa:589e with SMTP id lh12-20020a170906f8cc00b007ad92fa589emr40140822ejb.668.1669923030836; Thu, 01 Dec 2022 11:30:30 -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 g15-20020aa7c84f000000b004619f024864sm2054110edt.81.2022.12.01.11.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:30:30 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: devicetree@vger.kernel.org, Guenter Roeck , Jean Delvare , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Naresh Solanki Subject: [PATCH v5 1/5] hwmon: (pmbus/core): Add rdev in pmbus_data struct Date: Thu, 1 Dec 2022 20:30:20 +0100 Message-Id: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add regulator device in pmbus_data & initialize the same during PMBus regulator register. Signed-off-by: Naresh Solanki --- Change in V5: - Fix error check for rdev --- drivers/hwmon/pmbus/pmbus_core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) base-commit: 9494c53e1389b120ba461899207ac8a3aab2632c diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 95e95783972a..a95f998ca247 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -81,6 +81,7 @@ struct pmbus_label { struct pmbus_data { struct device *dev; struct device *hwmon_dev; + struct regulator_dev **rdevs; u32 flags; /* from platform data */ @@ -3050,9 +3051,13 @@ static int pmbus_regulator_register(struct pmbus_data *data) struct device *dev = data->dev; const struct pmbus_driver_info *info = data->info; const struct pmbus_platform_data *pdata = dev_get_platdata(dev); - struct regulator_dev *rdev; int i; + data->rdevs = devm_kzalloc(dev, sizeof(struct regulator_dev *) * info->num_regulators, + GFP_KERNEL); + if (!data->rdevs) + return -ENOMEM; + for (i = 0; i < info->num_regulators; i++) { struct regulator_config config = { }; @@ -3062,10 +3067,10 @@ static int pmbus_regulator_register(struct pmbus_data *data) if (pdata && pdata->reg_init_data) config.init_data = &pdata->reg_init_data[i]; - rdev = devm_regulator_register(dev, &info->reg_desc[i], + data->rdevs[i] = devm_regulator_register(dev, &info->reg_desc[i], &config); - if (IS_ERR(rdev)) - return dev_err_probe(dev, PTR_ERR(rdev), + if (IS_ERR(data->rdevs[i])) + return dev_err_probe(dev, PTR_ERR(data->rdevs[i]), "Failed to register %s regulator\n", info->reg_desc[i].name); } From patchwork Thu Dec 1 19:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061759 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 4FFEEC43217 for ; Thu, 1 Dec 2022 19:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231253AbiLATbR (ORCPT ); Thu, 1 Dec 2022 14:31:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbiLATak (ORCPT ); Thu, 1 Dec 2022 14:30:40 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF9BC82EC for ; Thu, 1 Dec 2022 11:30:33 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id ml11so6617418ejb.6 for ; Thu, 01 Dec 2022 11:30:33 -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=O0CtKLNMhWrok1R+TOMY2EUaClmC34YMD2M3K60n2nM=; b=F1pPgi7Uhwoarw955/oDAtxbz42b53K8lIGgjZVnemqfuG8jAOEG9F7KdRks0/ic/b +O4s03AAjPn2XY3Y3O5J7cr/rSoFkagood2sy+VxJL6q3mkZvsai33XWw2E22DQ6sYnr QL8BCkS2f3EInBlKGTL47tCTpbDWMuiSpaSZHR5DhOM4W9c4BcNiIhcD45FWYNtwLEU9 02U1UFVZRanSGlxr57rvmGcoMCOmsNfPw9BtwJJUcoZWdrpJhq4KOKHv4vod5903v80s 67wq2bxcM9RryATSqS2XxwZCeNUYVJCxKwqt4ZsKmO3Gxf2ubUw5d6gqLYJ2klyhMt6+ ivhA== 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=O0CtKLNMhWrok1R+TOMY2EUaClmC34YMD2M3K60n2nM=; b=kjdp38GZ5RZ5u9Fc78pPhNQFUdFh9iOfkDuqaHUKLEdQg1aq5Y/w2RTA8i4XDr3LJ/ /znmYXfZJBMp0j4Smciy/q0wIezOlLYI5mTkkcitZdfGTUcYqnujenSjTdEcLioK41jr 7WGmIoJaWIenXOc6arGsMr1FEoSrfkBUoIpk5d8m5a3ps2mDFVGHwzXNKqWX1q9Uv0Sr BxSVU3X63+Hl3qAb53xyDai3pDeA8VSZ0GXr1sHwoR55oURCzvWY3aZmdmee4yXljOkY nyUiaONGlDqvJegkWk+C0VcM1ATVdIoG3j4qcqI2Qa7SSesSK3SuoItxkeaJMbSn2hH/ PJJQ== X-Gm-Message-State: ANoB5pkdnrxrYsd4PuL42motgVWkjt2dNJwxPdYwFhTTfrfRW//rKtvi a12pJDLJE9llkO+oyoqu8Su5ow== X-Google-Smtp-Source: AA0mqf7IYUExaxNInjQBy/z4TNmEsmh6cN2qK7pozMPn0trUO9I6q55Rpno0fDdfnt9NImp4xQYh4g== X-Received: by 2002:a17:906:9c89:b0:7c0:7ab4:3715 with SMTP id fj9-20020a1709069c8900b007c07ab43715mr8634863ejc.343.1669923031914; Thu, 01 Dec 2022 11:30:31 -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 g15-20020aa7c84f000000b004619f024864sm2054110edt.81.2022.12.01.11.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:30:31 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: devicetree@vger.kernel.org, Guenter Roeck , Jean Delvare , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Naresh Solanki Subject: [PATCH v5 2/5] hwmon: (pmbus/core): Add interrupt support Date: Thu, 1 Dec 2022 20:30:21 +0100 Message-Id: <20221201193025.1584365-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> References: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Patrick Rudolph Implement PMBUS irq handler. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus.h | 2 +- drivers/hwmon/pmbus/pmbus_core.c | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 10fb17879f8e..6b2e6cf93b19 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h @@ -26,7 +26,7 @@ enum pmbus_regs { PMBUS_CAPABILITY = 0x19, PMBUS_QUERY = 0x1A, - + PMBUS_SMBALERT_MASK = 0x1B, PMBUS_VOUT_MODE = 0x20, PMBUS_VOUT_COMMAND = 0x21, PMBUS_VOUT_TRIM = 0x22, diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index a95f998ca247..6a3a3fd59b8e 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3077,11 +3077,94 @@ static int pmbus_regulator_register(struct pmbus_data *data) return 0; } + +static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val) +{ + return pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8)); +} + +static irqreturn_t pmbus_fault_handler(int irq, void *pdata) +{ + struct pmbus_data *data = pdata; + struct i2c_client *client = to_i2c_client(data->dev); + int i, status; + u8 page; + + for (i = 0; i < data->info->num_regulators; i++) { + + if (!data->rdevs[i]) + continue; + + page = rdev_get_id(data->rdevs[i]); + mutex_lock(&data->update_lock); + status = pmbus_read_status_word(client, page); + if (status < 0) { + mutex_unlock(&data->update_lock); + return status; + } + + if (status & ~(PB_STATUS_OFF | PB_STATUS_BUSY | PB_STATUS_POWER_GOOD_N)) + pmbus_clear_fault_page(client, page); + + mutex_unlock(&data->update_lock); + } + + return IRQ_HANDLED; +} + +static int pmbus_irq_setup(struct i2c_client *client, struct pmbus_data *data) +{ + struct device *dev = &client->dev; + const struct pmbus_regulator_status_category *cat; + const struct pmbus_regulator_status_assoc *bit; + int i, j, err, ret, func; + u8 mask; + + for (i = 0; i < data->info->pages; i++) { + func = data->info->func[i]; + + for (j = 0; j < ARRAY_SIZE(pmbus_regulator_flag_map); j++) { + cat = &pmbus_regulator_flag_map[j]; + if (!(func & cat->func)) + continue; + mask = 0; + for (bit = cat->bits; bit->pflag; bit++) + mask |= bit->pflag; + + err = pmbus_write_smbalert_mask(client, i, cat->reg, ~mask); + if (err) + dev_err(dev, "Failed to set smbalert for reg 0x%02x\n", cat->reg); + } + + pmbus_write_smbalert_mask(client, i, PMBUS_STATUS_CML, 0xff); + pmbus_write_smbalert_mask(client, i, PMBUS_STATUS_OTHER, 0xff); + pmbus_write_smbalert_mask(client, i, PMBUS_STATUS_MFR_SPECIFIC, 0xff); + if (data->info->func[i] & PMBUS_HAVE_FAN12) + pmbus_write_smbalert_mask(client, i, PMBUS_STATUS_FAN_12, 0xff); + if (data->info->func[i] & PMBUS_HAVE_FAN34) + pmbus_write_smbalert_mask(client, i, PMBUS_STATUS_FAN_34, 0xff); + } + + /* Register notifiers - can fail if IRQ is not given */ + ret = devm_request_threaded_irq(dev, client->irq, NULL, pmbus_fault_handler, + 0, "pmbus-irq", data); + if (ret) { + dev_warn(dev, "IRQ disabled %d\n", ret); + return ret; + } + + return 0; +} + #else static int pmbus_regulator_register(struct pmbus_data *data) { return 0; } +static int pmbus_irq_setup(struct i2c_client *client, struct pmbus_data *data) +{ + return 0; +} #endif static struct dentry *pmbus_debugfs_dir; /* pmbus debugfs directory */ @@ -3446,6 +3529,12 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info) if (ret) return ret; + if (client->irq > 0) { + ret = pmbus_irq_setup(client, data); + if (ret) + return ret; + } + ret = pmbus_init_debugfs(client, data); if (ret) dev_warn(dev, "Failed to register debugfs\n"); From patchwork Thu Dec 1 19:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061760 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 8EA0BC47088 for ; Thu, 1 Dec 2022 19:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbiLATbT (ORCPT ); Thu, 1 Dec 2022 14:31:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbiLATam (ORCPT ); Thu, 1 Dec 2022 14:30:42 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C44CA16F for ; Thu, 1 Dec 2022 11:30:34 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id n20so6711412ejh.0 for ; Thu, 01 Dec 2022 11:30:34 -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=/RnyrrQe9Eok5DqIvUFEy0a61qYm6BHFyKDyCC1oYjg=; b=e+bLOFonetP2HdOnP8n/c6Gm+QqVqCobaEemCltMt4hyrSppEym5opqSZWjSrB98HO jEZSTNd1YtCWlfMCrTm9ARtqrrvc8U7tu7lgiCT5ITLd0eCw74M+5EZ4wjCrq4EStIfQ TGJrUEkZhbfttV255uU/UK3mkt2OGcnopFdjtpdJhhwFSVWIEfglhbUCtanOPQ/scqG3 qoSb3KhFWAUMf9O7xRq3LbeARzzNY2C8jZBkuVOfkgAIijxNZz/VHLk3oNqOfTy1t37B mTsWU+Kq2LJyrU5bn/YGN7QqAkSYspqx9ps43Yq5z0ZVQnHB4KLB22ch/wV0Cpj4iaan D3fA== 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=/RnyrrQe9Eok5DqIvUFEy0a61qYm6BHFyKDyCC1oYjg=; b=JwodqipKrUkE7uQzbyeGBdbIk+1+VWiRIOjPUvn9Nh0Fhl34M1hRQHnu8aNv0uq9yM 8o8e4Vb+2CsgPBJD3f9QxqGmrPqDZ9c8uczcG5DA1bVrZzKErlx4X2UqvGXR4v61ugJi 8SgIsT6SYfHUmaH4fSu114GpDfHi2RRaHBJnRsStsVbTq7CRKUA5NjdWeySyn0pX4zTA SVchRQNNup1G7ETlWQ7M+iDf4bk+jMQuoyiwrG1er7h/MLB5Yu1Jn0byds4LyaMK3lft o1np4J5vrxLJqmCHwsiyHkNOzA5woCWHJxQWtgdpr7/67woUcMr+mRQyES+jht7YSdbw Jsjw== X-Gm-Message-State: ANoB5pm3x23bsjHiN3Hy2Jaeu2vFp3YMQerxLQqtP+dAgo8HFoh6ykrR jDaFGPbdqsnZ3KLZXpW7QSfrdw== X-Google-Smtp-Source: AA0mqf55uiA9d/tZ5QiIxxOqG9g7PCCBwt3ASYo3UsVHG+4RIqcDmQ84vM3oJUeyxP9KnK+Xne8wQQ== X-Received: by 2002:a17:906:6c86:b0:78d:4ba6:f65a with SMTP id s6-20020a1709066c8600b0078d4ba6f65amr58210840ejr.186.1669923032873; Thu, 01 Dec 2022 11:30:32 -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 g15-20020aa7c84f000000b004619f024864sm2054110edt.81.2022.12.01.11.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:30:32 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: devicetree@vger.kernel.org, Guenter Roeck , Jean Delvare , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Naresh Solanki Subject: [PATCH v5 3/5] hwmon: (pmbus/core): Notify hwmon events Date: Thu, 1 Dec 2022 20:30:22 +0100 Message-Id: <20221201193025.1584365-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> References: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Notify hwmon events using the pmbus irq handler. Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 6a3a3fd59b8e..ad3c0cc884a4 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2782,7 +2782,35 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] = }, }; -static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned int *flags) +#define to_dev_attr(_dev_attr) \ + container_of(_dev_attr, struct device_attribute, attr) + +static void pmbus_notify(struct pmbus_data *data, int page, int reg, int flags) +{ + int i; + + for (i = 0; i < data->num_attributes; i++) { + struct device_attribute *da = to_dev_attr(data->group.attrs[i]); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int index = attr->index; + u16 smask = pb_index_to_mask(index); + u8 spage = pb_index_to_page(index); + u16 sreg = pb_index_to_reg(index); + + if (reg == sreg && page == spage && (smask & flags)) { + dev_dbg(data->dev, "sysfs notify: %s", da->attr.name); + sysfs_notify(&data->dev->kobj, NULL, da->attr.name); + kobject_uevent(&data->dev->kobj, KOBJ_CHANGE); + flags &= ~smask; + } + + if (!flags) + break; + } +} + +static int pmbus_regulator_get_flags(struct regulator_dev *rdev, unsigned int *error, + bool notify) { int i, status; const struct pmbus_regulator_status_category *cat; @@ -2812,6 +2840,9 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned if (status & bit->pflag) *flags |= bit->rflag; } + + if (notify && status) + pmbus_notify(data, page, cat->reg, status); } /* @@ -2856,6 +2887,11 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned return 0; } +static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned int *flags) +{ + return pmbus_regulator_get_flags(rdev, flags, false); +} + static int pmbus_regulator_get_status(struct regulator_dev *rdev) { struct device *dev = rdev_get_dev(rdev); @@ -3087,7 +3123,7 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) { struct pmbus_data *data = pdata; struct i2c_client *client = to_i2c_client(data->dev); - int i, status; + int i, ret = IRQ_NONE, status; u8 page; for (i = 0; i < data->info->num_regulators; i++) { @@ -3095,6 +3131,10 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) if (!data->rdevs[i]) continue; + ret = pmbus_regulator_get_flags(data->rdevs[i], &status, true); + if (ret) + return ret; + page = rdev_get_id(data->rdevs[i]); mutex_lock(&data->update_lock); status = pmbus_read_status_word(client, page); @@ -3109,7 +3149,7 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) mutex_unlock(&data->update_lock); } - return IRQ_HANDLED; + return ret; } static int pmbus_irq_setup(struct i2c_client *client, struct pmbus_data *data) From patchwork Thu Dec 1 19:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061761 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 AD99EC636F8 for ; Thu, 1 Dec 2022 19:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiLATbU (ORCPT ); Thu, 1 Dec 2022 14:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231152AbiLATao (ORCPT ); Thu, 1 Dec 2022 14:30:44 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48944CAB43 for ; Thu, 1 Dec 2022 11:30:35 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id d20so3804206edn.0 for ; Thu, 01 Dec 2022 11:30:35 -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=MyxbmFSxj/AXTjphRUVPQX24S9JjJw2tXi7TXeZi100=; b=UzwyrrYptELQKDXnQO+KEb6NKg7boJ3UHfqukBvz6WtDqK66R+BhnXI+ppaZSHmWKv fe4rZ2+N02mGkWsRN+4Q5CeT3mgVcK48TV2VICSygn9FU1iHMM1x97BAwsUCK7wpJ1Bp MwaHF3aP/F5UDpTv+uwACOf33TZ27CcDMUi7hK+yo+dhQTawl2s+x91ZohtRWklZ80Ql JWHeCNpqFn7GojHIHRwb8N7C1j3779hiwywc0rAO/k0UMPo+4x1JpveEa07I5W1d09tD ZDmH+CTA2pe/ZF4e2BtF+DG8pvFI5WqeVnrrAH3GWmS7qMLW+VG4UhdGUsI1DFC0jEJp 2uZw== 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=MyxbmFSxj/AXTjphRUVPQX24S9JjJw2tXi7TXeZi100=; b=j2w32l6VmWCaRCHLpL52J9KsxszIWXIoHe/ZzX2OVI+bemKjteGFCREP4vDefiSGvZ yOG/hD00QPTgIv7J4Ptq3oJqAuekSNzc/O5Cv4fNQhXylqtVCguAyJ9oPbeIoKpcYdxL fMcCWHgxV1p726F6ff/p9DYG+6FhN2ZOQdqQcEczKj/c8clCtSEueNpRuxnD+bHKoMRT HAJ8JEN9qptucgFFmW/xBwCk9HLMV86SRLC25v2Y6TkMw7lOU6gFwixG/JNRTLWTm5za rDx4iUM11clYtt4vpUGmc/sC+hZw7R9wXALJrYZWgunobjDxts+TVtH5m0cGHR2x6otp SE5Q== X-Gm-Message-State: ANoB5pmBaQ075mPR3n4uyRozUIqG1NplYHqe+XCRuGadSS4yhFdQLLVs a8fzbPo+d0VLq8VIl2f1ghKcY0brXlRwVITJ X-Google-Smtp-Source: AA0mqf4od7pCm3HHhVqlovUxwxz14Y99mK3tuKUsqvC7OGS8un6l5OMt6z0VQ8MS28YEp9BgOd+GiA== X-Received: by 2002:aa7:c756:0:b0:46b:7038:b1f9 with SMTP id c22-20020aa7c756000000b0046b7038b1f9mr13754809eds.306.1669923033839; Thu, 01 Dec 2022 11:30:33 -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 g15-20020aa7c84f000000b004619f024864sm2054110edt.81.2022.12.01.11.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:30:33 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: devicetree@vger.kernel.org, Guenter Roeck , Jean Delvare , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Naresh Solanki Subject: [PATCH v5 4/5] hwmon: (pmbus/core): Add regulator event support Date: Thu, 1 Dec 2022 20:30:23 +0100 Message-Id: <20221201193025.1584365-4-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> References: <20221201193025.1584365-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. Also capture the same in pmbus_regulator_get_flags. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 85 ++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index ad3c0cc884a4..caefcb99aadf 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -2739,9 +2739,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 */ @@ -2756,27 +2756,36 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] = .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_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 }, { }, }, }, { .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 }, { }, }, }, @@ -2810,7 +2819,7 @@ static void pmbus_notify(struct pmbus_data *data, int page, int reg, int flags) } static int pmbus_regulator_get_flags(struct regulator_dev *rdev, unsigned int *error, - bool notify) + unsigned int *event, bool notify) { int i, status; const struct pmbus_regulator_status_category *cat; @@ -2821,7 +2830,8 @@ static int pmbus_regulator_get_flags(struct regulator_dev *rdev, unsigned int *e u8 page = rdev_get_id(rdev); int func = data->info->func[page]; - *flags = 0; + *error = 0; + *event = 0; mutex_lock(&data->update_lock); @@ -2836,10 +2846,11 @@ static int pmbus_regulator_get_flags(struct regulator_dev *rdev, unsigned int *e return status; } - for (bit = cat->bits; bit->pflag; bit++) { - if (status & bit->pflag) - *flags |= bit->rflag; - } + for (bit = cat->bits; bit->pflag; bit++) + if (status & bit->pflag) { + *error |= bit->rflag; + *event |= bit->eflag; + } if (notify && status) pmbus_notify(data, page, cat->reg, status); @@ -2860,36 +2871,48 @@ static int pmbus_regulator_get_flags(struct regulator_dev *rdev, unsigned int *e return status; if (pmbus_regulator_is_enabled(rdev)) { - if (status & PB_STATUS_OFF) - *flags |= REGULATOR_ERROR_FAIL; + if (status & PB_STATUS_OFF) { + *error |= REGULATOR_ERROR_FAIL; + *event |= REGULATOR_EVENT_FAIL; + } - if (status & PB_STATUS_POWER_GOOD_N) - *flags |= REGULATOR_ERROR_REGULATION_OUT; + if (status & PB_STATUS_POWER_GOOD_N) { + *error |= REGULATOR_ERROR_REGULATION_OUT; + *event |= REGULATOR_EVENT_REGULATION_OUT; + } } /* * Unlike most other status bits, PB_STATUS_{IOUT_OC,VOUT_OV} are * defined strictly as fault indicators (not warnings). */ - if (status & PB_STATUS_IOUT_OC) - *flags |= REGULATOR_ERROR_OVER_CURRENT; - if (status & PB_STATUS_VOUT_OV) - *flags |= REGULATOR_ERROR_REGULATION_OUT; + if (status & PB_STATUS_IOUT_OC) { + *error |= REGULATOR_ERROR_OVER_CURRENT; + *event |= REGULATOR_EVENT_OVER_CURRENT; + } + if (status & PB_STATUS_VOUT_OV) { + *error |= REGULATOR_ERROR_REGULATION_OUT; + *event |= REGULATOR_EVENT_FAIL; + } /* * If we haven't discovered any thermal faults or warnings via * PMBUS_STATUS_TEMPERATURE, map PB_STATUS_TEMPERATURE to a warning as * a (conservative) best-effort interpretation. */ - if (!(*flags & (REGULATOR_ERROR_OVER_TEMP | REGULATOR_ERROR_OVER_TEMP_WARN)) && - (status & PB_STATUS_TEMPERATURE)) - *flags |= REGULATOR_ERROR_OVER_TEMP_WARN; + if (!(*error & (REGULATOR_ERROR_OVER_TEMP | REGULATOR_ERROR_OVER_TEMP_WARN)) && + (status & PB_STATUS_TEMPERATURE)) { + *error |= REGULATOR_ERROR_OVER_TEMP_WARN; + *event |= REGULATOR_EVENT_OVER_TEMP_WARN; + } return 0; } static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned int *flags) { - return pmbus_regulator_get_flags(rdev, flags, false); + int event; + + return pmbus_regulator_get_flags(rdev, flags, &event, false); } static int pmbus_regulator_get_status(struct regulator_dev *rdev) @@ -3123,7 +3146,7 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) { struct pmbus_data *data = pdata; struct i2c_client *client = to_i2c_client(data->dev); - int i, ret = IRQ_NONE, status; + int i, ret = IRQ_NONE, status, event; u8 page; for (i = 0; i < data->info->num_regulators; i++) { @@ -3131,7 +3154,7 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) if (!data->rdevs[i]) continue; - ret = pmbus_regulator_get_flags(data->rdevs[i], &status, true); + ret = pmbus_regulator_get_flags(data->rdevs[i], &status, &event, true); if (ret) return ret; From patchwork Thu Dec 1 19:30:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061762 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 1A27FC4321E for ; Thu, 1 Dec 2022 19:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbiLATbV (ORCPT ); Thu, 1 Dec 2022 14:31:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbiLATao (ORCPT ); Thu, 1 Dec 2022 14:30:44 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35755CAB58 for ; Thu, 1 Dec 2022 11:30:36 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id o13so6652862ejm.1 for ; Thu, 01 Dec 2022 11:30:36 -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=JHC6ytZAHLrNLiHuUN2hc1jXap++ZHEcJiLjtBPhfto=; b=AUxf8Xm6UpCWhAeGDcR+3W5Z4SnIFEAv3fiL9oHqUJoa5WoxIlahHfcmR9mvTQCvZ0 MlvtW/BT2XFgh4zIhtnqE+P3QGK1LZrWRLAWuey+2v/ozgM9UmK15XA09InVz968DA1F kT7FMPmrydaUJcVh/AKcj5HbAMRaK9NyoDKXhAS792EyNFsK2D2UA39aKXmifavWBdnm 6aOlCGYV7P/sdQGEXYj8JBDtAk0aJSnSBW2DeD8ycmiGmITghzLW7rFRl5ur9GtNrLku rbCusZH9cwlRfbGeKpTG+rw7aAWE8/e27NPrO9MuW4vLQIu2veBTwc6E45+umqQE4IhO Cc4A== 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=JHC6ytZAHLrNLiHuUN2hc1jXap++ZHEcJiLjtBPhfto=; b=vZx06sXvbo6L/hLpASIhszyv9oGJ0vL8WQEZzmqSPnvCfcnYT8QgDykOZBb8kZa1oU 5CPjxR13pWEb9bHTNjIrEvWA4QzLuE6XawEB0ZQsYxXVmnh6D8IczjTNVZcy4uC29FDu /QMJTbpjj2Sgw3F5X2rsOg4DtvlqAABI7QBzMSC06BEkEKrwYo+tJ/XZm+QA1EQwzFOX Ex02ymTvHrTTE2mF13hVj4UqSrAbdDa1f/JCv/TDvQzL9iCP8/xEY6FGVM+Nb1Em+QiK MaWerQJ+3yIYN0a99rv2MKIbGUsZvcc7tE4Mftf8+vE4Ms40LaS5LBu18X0zgGdanfDP 3hZQ== X-Gm-Message-State: ANoB5pkf7OecL5DWPIjadDWVfkm2zSurn/ScP4h1e/mWznpEvzqvImua bMXAT+dDyI9TfvICtS6qvz8LGw== X-Google-Smtp-Source: AA0mqf4FN2LlAcctT2gQ+2sI+0CRqoL0SJP2GLj//yvst5I/C/b7mWqa3qMoHOBWeC5EOA3kCTVgdQ== X-Received: by 2002:a17:906:cc8f:b0:78b:8ce7:fe3c with SMTP id oq15-20020a170906cc8f00b0078b8ce7fe3cmr57197229ejb.557.1669923034733; Thu, 01 Dec 2022 11:30:34 -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 g15-20020aa7c84f000000b004619f024864sm2054110edt.81.2022.12.01.11.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:30:34 -0800 (PST) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: devicetree@vger.kernel.org, Guenter Roeck , Jean Delvare , Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Naresh Solanki Subject: [PATCH v5 5/5] hwmon: (pmbus/core): Notify regulator events Date: Thu, 1 Dec 2022 20:30:24 +0100 Message-Id: <20221201193025.1584365-5-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> References: <20221201193025.1584365-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Notify regulator events in PMBus irq handler. Signed-off-by: Naresh Solanki --- drivers/hwmon/pmbus/pmbus_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index caefcb99aadf..5241a3c9bd21 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3158,6 +3158,11 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata) if (ret) return ret; + if (event) { + regulator_notifier_call_chain(data->rdevs[i], event, NULL); + ret = IRQ_HANDLED; + } + page = rdev_get_id(data->rdevs[i]); mutex_lock(&data->update_lock); status = pmbus_read_status_word(client, page);