Commit b1a55c0a authored by Saravanan Sekar's avatar Saravanan Sekar Committed by Guenter Roeck

hwmon: (pmbus/mpq7932) Get page count based on chip info

Get page count using compatible match to support the series of chipsets
which differs in number of regualator/page.
Signed-off-by: default avatarSaravanan Sekar <saravanan@linumiz.com>
Link: https://lore.kernel.org/r/20231011164754.449399-2-saravanan@linumiz.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 6632b456
...@@ -105,7 +105,7 @@ static int mpq7932_probe(struct i2c_client *client) ...@@ -105,7 +105,7 @@ static int mpq7932_probe(struct i2c_client *client)
return -ENOMEM; return -ENOMEM;
info = &data->info; info = &data->info;
info->pages = MPQ7932_NUM_PAGES; info->pages = (int)(unsigned long)device_get_match_data(&client->dev);
info->format[PSC_VOLTAGE_OUT] = direct; info->format[PSC_VOLTAGE_OUT] = direct;
info->m[PSC_VOLTAGE_OUT] = 160; info->m[PSC_VOLTAGE_OUT] = 160;
info->b[PSC_VOLTAGE_OUT] = -33; info->b[PSC_VOLTAGE_OUT] = -33;
...@@ -115,7 +115,7 @@ static int mpq7932_probe(struct i2c_client *client) ...@@ -115,7 +115,7 @@ static int mpq7932_probe(struct i2c_client *client)
} }
#if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR) #if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc); info->num_regulators = info->pages;
info->reg_desc = mpq7932_regulators_desc; info->reg_desc = mpq7932_regulators_desc;
#endif #endif
...@@ -129,7 +129,7 @@ static int mpq7932_probe(struct i2c_client *client) ...@@ -129,7 +129,7 @@ static int mpq7932_probe(struct i2c_client *client)
} }
static const struct of_device_id mpq7932_of_match[] = { static const struct of_device_id mpq7932_of_match[] = {
{ .compatible = "mps,mpq7932"}, { .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, mpq7932_of_match); MODULE_DEVICE_TABLE(of, mpq7932_of_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment