Skip to content

Commit b1a55c0

Browse files
ssekar15groeck
authored andcommitted
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: Saravanan Sekar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 6632b45 commit b1a55c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hwmon/pmbus/mpq7932.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int mpq7932_probe(struct i2c_client *client)
105105
return -ENOMEM;
106106

107107
info = &data->info;
108-
info->pages = MPQ7932_NUM_PAGES;
108+
info->pages = (int)(unsigned long)device_get_match_data(&client->dev);
109109
info->format[PSC_VOLTAGE_OUT] = direct;
110110
info->m[PSC_VOLTAGE_OUT] = 160;
111111
info->b[PSC_VOLTAGE_OUT] = -33;
@@ -115,7 +115,7 @@ static int mpq7932_probe(struct i2c_client *client)
115115
}
116116

117117
#if IS_ENABLED(CONFIG_SENSORS_MPQ7932_REGULATOR)
118-
info->num_regulators = ARRAY_SIZE(mpq7932_regulators_desc);
118+
info->num_regulators = info->pages;
119119
info->reg_desc = mpq7932_regulators_desc;
120120
#endif
121121

@@ -129,7 +129,7 @@ static int mpq7932_probe(struct i2c_client *client)
129129
}
130130

131131
static const struct of_device_id mpq7932_of_match[] = {
132-
{ .compatible = "mps,mpq7932"},
132+
{ .compatible = "mps,mpq7932", .data = (void *)MPQ7932_NUM_PAGES },
133133
{},
134134
};
135135
MODULE_DEVICE_TABLE(of, mpq7932_of_match);

0 commit comments

Comments
 (0)