From patchwork Thu Dec 1 19:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061753 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 0C0F9C4321E for ; Thu, 1 Dec 2022 19:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbiLAT3t (ORCPT ); Thu, 1 Dec 2022 14:29:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbiLAT3r (ORCPT ); Thu, 1 Dec 2022 14:29:47 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A627C7D27 for ; Thu, 1 Dec 2022 11:29:45 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id fy37so6578089ejc.11 for ; Thu, 01 Dec 2022 11:29:45 -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=0qJrq6T31sJxCZwbEqlMuOvpG+K/8IjspbhkPV4Km1Q=; b=SW4hPI2FWGG5GORQJIKeGvk2XQDV1l97gRAeUy/zp0bPfQG+7YaA27wepYjA1VUz4r 1Fs5VsvuJXwBT8zLILOuVuMwRBdW62A0rYGCA0xRUNHUpLY0vM+ZqL6mh/jedm2YLJKs EALqED0lwsJ3sPhN6JzokkOkIKOjce1luQW+M0cr1orEKw5BQSqF33AWQvuHI2Y0BYyL xd2DG7nAxySWAe5Vgh3Vl6Ps4EGSnPZuFnmDjSTVfFtSJKY8K56yQXdDOpyYnppsmect Q0wQK7MotT6N6mitUJBeKqgBf/gGlRno7q7ty6IPzihc2i9TL3kmU+lk6WVerTBObG9v ti0w== 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=0qJrq6T31sJxCZwbEqlMuOvpG+K/8IjspbhkPV4Km1Q=; b=mA9RrToeJLeLItZSkMPrhqweNmkXgzLpG0m7oYYkZ8TPFaV14NWAcmxa5WW1DyYBT4 xsVgG+LADLTP0veP/svKOQJ+HsoE6xrzdnIzBO1zRebwbOnQ7heKKJ1ehfxZuCVyG48A hBeYJhzUp/6tcGiAEuHr6EJB+nZBYmlXMYE44U5xrWBwWtsjCL/l/gDTmlQx7nyfDluA sE/i878nC7m/niM7r6JAm7ljOWJM231BqFWfzfCvTNi6XWa0CjUMlF2r7Euo+oeuQ8YF LZvxPnaP4VVhsU9N1mbjT3P+6iRBdiih9wHLxglQow/KXuL4FZEt0wTJ5ulbUsEqER8P nmkw== X-Gm-Message-State: ANoB5pl49rnT9dOLImVo7TIejEd9RVQRS31GkNYgsIM51Ag+alZU1riK PBdGmAW2MPPOnmgUpYlfdhrafQ== X-Google-Smtp-Source: AA0mqf7EwjwgFhq93o7jjqG184PyjylC2BYPAldcbmB9lhs2VJLvcPjq0Ietj3jPFwiFUjW5sX68Hw== X-Received: by 2002:a17:906:ee1:b0:78a:efde:b84a with SMTP id x1-20020a1709060ee100b0078aefdeb84amr57442318eji.744.1669922983691; Thu, 01 Dec 2022 11:29:43 -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 i13-20020a17090639cd00b0073022b796a7sm2141380eje.93.2022.12.01.11.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:29:43 -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 v4 1/5] hwmon: (pmbus/core): Add rdev in pmbus_data struct Date: Thu, 1 Dec 2022 20:29:35 +0100 Message-Id: <20221201192940.1584012-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 --- drivers/hwmon/pmbus/pmbus_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) base-commit: 9494c53e1389b120ba461899207ac8a3aab2632c diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 95e95783972a..7a23794c0b93 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 */ @@ -3053,6 +3054,11 @@ static int pmbus_regulator_register(struct pmbus_data *data) 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,7 +3068,7 @@ 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), From patchwork Thu Dec 1 19:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061755 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 07ABEC4708D for ; Thu, 1 Dec 2022 19:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbiLAT3u (ORCPT ); Thu, 1 Dec 2022 14:29:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbiLAT3r (ORCPT ); Thu, 1 Dec 2022 14:29:47 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38D67C82D8 for ; Thu, 1 Dec 2022 11:29:46 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id vp12so6598244ejc.8 for ; Thu, 01 Dec 2022 11:29:46 -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=qE6FZaBNq2c3NfrJBONCVhF9AJEc6RhOGgZ53GWa0kQ=; b=PYPbm8YsPmPBwh7fyWjJ7Flv8gZPIJnRII67vgrv4YMvc8UqBpdvLcS8H8fVzNe33+ j6P9LF96PLtXpTi7uXj3SWgxP6MgBqfwkpUzwBfe84MxrGW2HalW9HA8MpHFDHuDOiT5 jAUb/mGsT9S7jKol8pbrlRraQJRTcM8H+lrbMlQGn6J6HWVbzc7nyoLtaZTBpQgoLitJ VG9wyv0U1M0zh0GTX9yvE6n94tOq4yoO/+86foSOXOQNLDXfoleyrC37P+HrVB12fFuK SFERgVFZE+oxxspwiEpv38Fr4bEByoOIX1I+h85NL5EV5F/nDcj09pkzOsWKV6bDlMhC AVrg== 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=qE6FZaBNq2c3NfrJBONCVhF9AJEc6RhOGgZ53GWa0kQ=; b=dr1CKVPOy7bwTxTJT14kuFrDk8bBdmgLMaxn2yKQwH/bigeOx0mmtWQKJr13s4+IXD GxPWH23lTlSz9mZeGFGELOn2Z4GN5YBtrJlZSyPfwSNQbVgNlrqY+JLNR6Os2QYfPLoJ OJ24yxeOmS+fvzJx4eff5mxQAt4sEmjDj5jIPeScIJdVjetXtjp6GIDrPS6QVaPtWzV3 zA7WDa1Q8NK3f+smRjtsjrLsQmP4tESBxjyGBrbpdcwuxRfkASdGRmTlRMuu150uO73J dj93P/Eno/rzzxLNIAJND5jCALLTvdrgfUjL5m1/YhpzFNRt31vVk4opMpTbXAJIFudd UIWw== X-Gm-Message-State: ANoB5pm5c+P5qrlhYXXywlHj+rfeYgz/ilk+Yxcg67/QlCVWb7aUnRbo U5kxomqO3nSSVIrOMLogjfv6Ew== X-Google-Smtp-Source: AA0mqf7fYLZmd+nPPGnPykcARm/uK358a3sZC7+D0wLsMUpqC/y9oskTER0drquNLpquy2DGM6greQ== X-Received: by 2002:a17:906:3a41:b0:78d:9caa:31b7 with SMTP id a1-20020a1709063a4100b0078d9caa31b7mr44238984ejf.263.1669922984811; Thu, 01 Dec 2022 11:29:44 -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 i13-20020a17090639cd00b0073022b796a7sm2141380eje.93.2022.12.01.11.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:29:44 -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 v4 2/5] hwmon: (pmbus/core): Add interrupt support Date: Thu, 1 Dec 2022 20:29:36 +0100 Message-Id: <20221201192940.1584012-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201192940.1584012-1-Naresh.Solanki@9elements.com> References: <20221201192940.1584012-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 7a23794c0b93..bdcbc216b0cc 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3078,11 +3078,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 */ @@ -3447,6 +3530,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:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061756 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 D897DC47090 for ; Thu, 1 Dec 2022 19:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbiLAT3v (ORCPT ); Thu, 1 Dec 2022 14:29:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230151AbiLAT3t (ORCPT ); Thu, 1 Dec 2022 14:29:49 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD93C82E0 for ; Thu, 1 Dec 2022 11:29:47 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id e27so6571400ejc.12 for ; Thu, 01 Dec 2022 11:29:47 -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=bAA6BwbBaAZOfPoWU8hKGND5fHQgQCgW9VzqG/UGn2Y=; b=ZkxLBb407lw5roeqTrwRGvPCKsojHFoAe3OqINsHXW5+ST/OpPG97AWzOZW+sQJxJj TS5Qg4pvd4vm2gMDg4GeXMw9v1MewYMZZ87YLWahxSMKVvqCOtZO5YdhDHf4ZunJ5xb5 c2OV0kCElDSbMMHs2vXXd523aLXlGtEH4/t1M/cng2cEN3eTyDk3547XVaQyrTBrGvHD wr+UdDN60A5WIyC7TcJ6JB0sjfNqhqFdjdrB4PczTy1r7GEn6g53wv25hIpk8j59Yx9O zcLnnPbPG4qUp9ajDvWQMVIF7Eun2IjvlTkYG3l6y53sSINCIDRTwT7URk2aXAVKH36D DkNg== 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=bAA6BwbBaAZOfPoWU8hKGND5fHQgQCgW9VzqG/UGn2Y=; b=HMKg+0z/NtCehQmbo0jRxg3oLZoeCAV2dggUIUi1tAO0vKXLFxfoXjcXH5engMTPjv 6O/IaF6leW6bGDhQacAxA0z4tlY/DjvUcMBYoehBwbqM5qTj3CMvM/uPyGp54H7N46oL 8sIqhaGGUK0KpRfrBwfOuCd/vL7Yj3UJvqrUftbbirbaQ3B46zYnUZQxr880aYZVo87K WC2Oh2iQ7FDHR3QGGv9Cd7M1lBcx3a2DvlBuy+BHyTeSojCqVMohxAKyKSBot+Yjo0dV +Gg3Q5SmgxAWeNS8jrYKdzkPxKMtgXn3RcNF2gv6GjFrloOy/LWdIOwsu6ASLcIsjyhv Y3Fw== X-Gm-Message-State: ANoB5pl93MwNwJ7ohgEgek4Kh3UJUeJOGaQQE7UgfwJMxJGyJpSWdd1M 2GXjhqr/wyu5e4WeR6N3nzgaQg== X-Google-Smtp-Source: AA0mqf4KaQ/PZhqP2NZNstCWqrU2vspheNrEaD/1GAbdYX5+A2TcBGQf6jzE7m09NtYT4W3CNB9ccg== X-Received: by 2002:a17:906:597:b0:7a8:fd1a:c073 with SMTP id 23-20020a170906059700b007a8fd1ac073mr49267924ejn.4.1669922985727; Thu, 01 Dec 2022 11:29:45 -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 i13-20020a17090639cd00b0073022b796a7sm2141380eje.93.2022.12.01.11.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:29:45 -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 v4 3/5] hwmon: (pmbus/core): Notify hwmon events Date: Thu, 1 Dec 2022 20:29:37 +0100 Message-Id: <20221201192940.1584012-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201192940.1584012-1-Naresh.Solanki@9elements.com> References: <20221201192940.1584012-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 bdcbc216b0cc..78c401412c4d 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); @@ -3088,7 +3124,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++) { @@ -3096,6 +3132,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); @@ -3110,7 +3150,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:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061757 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 5C209C636F8 for ; Thu, 1 Dec 2022 19:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbiLAT3w (ORCPT ); Thu, 1 Dec 2022 14:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbiLAT3t (ORCPT ); Thu, 1 Dec 2022 14:29:49 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33876C82E9 for ; Thu, 1 Dec 2022 11:29:48 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id vp12so6598465ejc.8 for ; Thu, 01 Dec 2022 11:29:48 -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=uPhmSuxm5X88P2ytZiq5oi3P9IuH3y0y7Ct9vba+7Q8=; b=RgCCXCDL+LvV+kjpT3Z/wjKLaTJNSw3Vjok/FVUaYVwJ+SvnH+K9NlFn5ZL/uSxXVJ M4UwHHlzzdj4x2CPTzAb7rPjBmAuj7+nU4rUA0cv3I8qiQv40IaaMsNyHOkflESixRf9 qrrqCjBf69z5k0FGc1XYA0eQXFudjYktvbRxh0a//JLZUUbV05UNpUEbyv2lYtldqlsB L3DiRDXUwkRU4QboswtiTsAqQedXBx3jsfSd571B8Uq3xVrMVyJCwzcdoaLdVef55Bre vDVYJAhGK07X3iEB/5Z/6C++xN68F+H6xOYwJWj2WQ66pKsHm4xi43muM8nW3VZ2kzrf tUvw== 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=uPhmSuxm5X88P2ytZiq5oi3P9IuH3y0y7Ct9vba+7Q8=; b=CBu6Gi9pwJmz0UO7cFdh6UhXK8Nz+y8pkVzhu2JgFeGvikdcel+zT/+VqqXLdzgrPs fZeXpFosyzHXFLLgtE/w84ZzKN3Lzrwf4eKVr64GlXkRsxWVQdNgC2EhAmmF+ThcJdwT zSH4CVd4p9fqE0QHcqYjvwoPiqTrNHJrtjFInzsyOMWSp2kc+tfH8tD92L/lzPMttzs4 b2J1fmgyGatu7QX1feltb8vpjlMFQYrKi0bdmdGB3ZQsR6sZWJ3QIovQc/yQfp60LBX5 r0L0Yw2MdH04WjXcIPDEP29G2pEy+2/JCSr88MrVaSyTExmnSoeQsrqGK0FreKFpCVth B2sg== X-Gm-Message-State: ANoB5pmfjwHLxDBXhv8nAQpRESYe1YVGFqkrhr0sjFmrDRsx6ktE85me T1LgknRV7zuF/HSybrugyJEUEw== X-Google-Smtp-Source: AA0mqf6KYlmkUVmFs4iFV4lcDly5AggHC1RfjmTH29K9FzACFQj6xdRGvRYuZuKVn0dAjfbHy8TmXQ== X-Received: by 2002:a17:906:d281:b0:782:7790:f132 with SMTP id ay1-20020a170906d28100b007827790f132mr41426307ejb.649.1669922986787; Thu, 01 Dec 2022 11:29:46 -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 i13-20020a17090639cd00b0073022b796a7sm2141380eje.93.2022.12.01.11.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:29:46 -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 v4 4/5] hwmon: (pmbus/core): Add regulator event support Date: Thu, 1 Dec 2022 20:29:38 +0100 Message-Id: <20221201192940.1584012-4-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201192940.1584012-1-Naresh.Solanki@9elements.com> References: <20221201192940.1584012-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 78c401412c4d..daf700210c68 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) @@ -3124,7 +3147,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++) { @@ -3132,7 +3155,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:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13061754 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 24A95C4708E for ; Thu, 1 Dec 2022 19:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiLAT3w (ORCPT ); Thu, 1 Dec 2022 14:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbiLAT3t (ORCPT ); Thu, 1 Dec 2022 14:29:49 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15844C82E8 for ; Thu, 1 Dec 2022 11:29:49 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id b2so6610646eja.7 for ; Thu, 01 Dec 2022 11:29:49 -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=7p4ZRoKY8KyAbeLZ3D9FFno3zQClogoAoc0aT3MOswk=; b=cmKp5+osxcEKb3tLLjX5pcnFM5ol/fAQnZO4HPmZBJJzl0r8kVyCNT/d9/wiRLPgnR 80vh9xs1IGdIvR61A03RKhTL8jlZ3bQRWCAWgF4C++Etw+u+eFH0dBZo34pp2Prtzccq zcsPUfNnHLHl5JDlxhSJenqQtFCU6UVADMotPapVRkIrv+jGSvGyuiJqFIybgavAE5dT xA1lxEi/f+1Zb7yEulIgSaPBBLbL57ElIiwUSt0nETKM1WyyZXxUjen8RuYherN6QjYo VF7e31ZTseFdg+2zPJgcv83oYFY0etQ4O8ZMa1jQPAMwCOEiSf9e78OT32ZjS8l+NvwG o45Q== 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=7p4ZRoKY8KyAbeLZ3D9FFno3zQClogoAoc0aT3MOswk=; b=h5mBS9BZObTPRdqVb9kqoSZ9JHxvjrIfE4N9bcevWj8QEqrZa4kNGHnGqt3FHDvlzn D2la8fd+nbdDCWr02wnjCgek6WKavhl/BIpoNwaVGSfqiFen8YW0+PiAXh78aJg8uROJ a+fR+fg1Dai1Lp5F5yNsXN2QQhxtr43LnspECDnmQ3DjhOpab0+elNlukt8/DUVae84P Cf4FmyvGVuwwujOTXXG9ayQjWhtgvBvRg5LVSB0484RaVm8Jr9ITh9EymTq67oCT9NM2 MA/FmZ7XxOOoqxRFtwTl5+b2EGJGXGf75K3iV7YLE0lFUg29HMbFUUgZybtdh+Ynl8JV bnzA== X-Gm-Message-State: ANoB5pkYKnwE/855t2dsCcO69D38T5LVz1l73iIH8TpHFtmj/wJlewxw 97lrWL6U/jc+loq0jgCWwBwbWg== X-Google-Smtp-Source: AA0mqf6wJMguBRZ+3RDQjOzLIrbL3+wV5RnCVYcQsQFAXhVegf130StesPXX9DTehUn93DFb09aOCA== X-Received: by 2002:a17:906:c259:b0:7b5:9670:ae0 with SMTP id bl25-20020a170906c25900b007b596700ae0mr42906077ejb.321.1669922987667; Thu, 01 Dec 2022 11:29:47 -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 i13-20020a17090639cd00b0073022b796a7sm2141380eje.93.2022.12.01.11.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 11:29:47 -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 v4 5/5] hwmon: (pmbus/core): Notify regulator events Date: Thu, 1 Dec 2022 20:29:39 +0100 Message-Id: <20221201192940.1584012-5-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221201192940.1584012-1-Naresh.Solanki@9elements.com> References: <20221201192940.1584012-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 daf700210c68..dbdf8c8187db 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3159,6 +3159,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);