From: Naresh Solanki <naresh.solanki@9elements.com>
To: Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, Jean Delvare <jdelvare@suse.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>,
Naresh Solanki <Naresh.Solanki@9elements.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] hwmon: (pmbus/core): Notify regulator events
Date: Tue, 28 Mar 2023 17:03:35 +0200 [thread overview]
Message-ID: <20230328150335.90238-3-Naresh.Solanki@9elements.com> (raw)
In-Reply-To: <20230328150335.90238-1-Naresh.Solanki@9elements.com>
Notify regulator events in PMBus irq handler.
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
drivers/hwmon/pmbus/pmbus_core.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 509bc0ef1706..86cc8001a788 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3159,11 +3159,29 @@ static int pmbus_regulator_register(struct pmbus_data *data)
return 0;
}
+
+static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event)
+{
+ int j;
+
+ for (j = 0; j < data->info->num_regulators; j++) {
+ if (page == rdev_get_id(data->rdevs[j])) {
+ regulator_notifier_call_chain(data->rdevs[j], event, NULL);
+ break;
+ }
+ }
+ return 0;
+}
#else
static int pmbus_regulator_register(struct pmbus_data *data)
{
return 0;
}
+
+static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event)
+{
+ return 0;
+}
#endif
static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val)
@@ -3178,9 +3196,13 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
int i, status, event;
mutex_lock(&data->update_lock);
- for (i = 0; i < data->info->pages; i++)
+ for (i = 0; i < data->info->pages; i++) {
_pmbus_get_flags(data, i, &status, &event, true);
+ if (event)
+ pmbus_regulator_notify(data, i, event);
+ }
+
pmbus_clear_faults(client);
mutex_unlock(&data->update_lock);
--
2.39.1
next prev parent reply other threads:[~2023-03-28 15:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 15:03 [PATCH v2 1/3] hwmon: (pmbus/core): Add rdev in pmbus_data struct Naresh Solanki
2023-03-28 15:03 ` [PATCH v2 2/3] hwmon: (pmbus/core): Add regulator event support Naresh Solanki
2023-03-29 6:48 ` Matti Vaittinen
2023-04-05 13:15 ` Guenter Roeck
2023-04-05 13:57 ` Matti Vaittinen
2023-04-05 14:18 ` Guenter Roeck
2023-04-05 15:19 ` Mark Brown
2023-04-06 8:00 ` Matti Vaittinen
2023-04-06 13:43 ` Mark Brown
2023-04-10 8:19 ` Matti Vaittinen
2023-04-10 14:40 ` Guenter Roeck
2023-04-10 16:53 ` Matti Vaittinen
2023-04-10 17:47 ` Guenter Roeck
2023-04-11 6:10 ` Matti Vaittinen
2023-04-11 11:08 ` Mark Brown
2023-04-11 12:07 ` Mark Brown
2023-04-12 8:12 ` Matti Vaittinen
2023-04-11 9:12 ` Matti Vaittinen
2023-04-12 15:13 ` Guenter Roeck
2023-03-28 15:03 ` Naresh Solanki [this message]
2023-04-12 15:16 ` [PATCH v2 3/3] hwmon: (pmbus/core): Notify regulator events Guenter Roeck
2023-04-12 15:12 ` [PATCH v2 1/3] hwmon: (pmbus/core): Add rdev in pmbus_data struct Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230328150335.90238-3-Naresh.Solanki@9elements.com \
--to=naresh.solanki@9elements.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=patrick.rudolph@9elements.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox