Skip to content

Commit 375fc90

Browse files
jwrdegoedehverkuil
authored andcommitted
media: hi556: Support full range of power rails
Use regulator_bulk_* to get the array of potential power rails for the hi556. Previously the driver only supported avdd as only avdd is used on IPU6 designs. But other designs may also need the driver to control the other power rails and the new INT3472 handshake support also makes use of dvdd on IPU6 designs. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2368506 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
1 parent 99f2211 commit 375fc90

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

drivers/media/i2c/hi556.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@ static const struct hi556_mode supported_modes[] = {
624624
},
625625
};
626626

627+
static const char * const hi556_supply_names[] = {
628+
"dovdd", /* Digital I/O power */
629+
"avdd", /* Analog power */
630+
"dvdd", /* Digital core power */
631+
};
632+
627633
struct hi556 {
628634
struct v4l2_subdev sd;
629635
struct media_pad pad;
@@ -639,7 +645,7 @@ struct hi556 {
639645
/* GPIOs, clocks, etc. */
640646
struct gpio_desc *reset_gpio;
641647
struct clk *clk;
642-
struct regulator *avdd;
648+
struct regulator_bulk_data supplies[ARRAY_SIZE(hi556_supply_names)];
643649

644650
/* Current mode */
645651
const struct hi556_mode *cur_mode;
@@ -1289,17 +1295,10 @@ static int hi556_suspend(struct device *dev)
12891295
{
12901296
struct v4l2_subdev *sd = dev_get_drvdata(dev);
12911297
struct hi556 *hi556 = to_hi556(sd);
1292-
int ret;
12931298

12941299
gpiod_set_value_cansleep(hi556->reset_gpio, 1);
1295-
1296-
ret = regulator_disable(hi556->avdd);
1297-
if (ret) {
1298-
dev_err(dev, "failed to disable avdd: %d\n", ret);
1299-
gpiod_set_value_cansleep(hi556->reset_gpio, 0);
1300-
return ret;
1301-
}
1302-
1300+
regulator_bulk_disable(ARRAY_SIZE(hi556_supply_names),
1301+
hi556->supplies);
13031302
clk_disable_unprepare(hi556->clk);
13041303
return 0;
13051304
}
@@ -1314,9 +1313,10 @@ static int hi556_resume(struct device *dev)
13141313
if (ret)
13151314
return ret;
13161315

1317-
ret = regulator_enable(hi556->avdd);
1316+
ret = regulator_bulk_enable(ARRAY_SIZE(hi556_supply_names),
1317+
hi556->supplies);
13181318
if (ret) {
1319-
dev_err(dev, "failed to enable avdd: %d\n", ret);
1319+
dev_err(dev, "failed to enable regulators: %d", ret);
13201320
clk_disable_unprepare(hi556->clk);
13211321
return ret;
13221322
}
@@ -1335,7 +1335,7 @@ static int hi556_probe(struct i2c_client *client)
13351335
{
13361336
struct hi556 *hi556;
13371337
bool full_power;
1338-
int ret;
1338+
int i, ret;
13391339

13401340
ret = hi556_check_hwcfg(&client->dev);
13411341
if (ret)
@@ -1358,11 +1358,15 @@ static int hi556_probe(struct i2c_client *client)
13581358
return dev_err_probe(&client->dev, PTR_ERR(hi556->clk),
13591359
"failed to get clock\n");
13601360

1361-
/* The regulator core will provide a "dummy" regulator if necessary */
1362-
hi556->avdd = devm_regulator_get(&client->dev, "avdd");
1363-
if (IS_ERR(hi556->avdd))
1364-
return dev_err_probe(&client->dev, PTR_ERR(hi556->avdd),
1365-
"failed to get avdd regulator\n");
1361+
for (i = 0; i < ARRAY_SIZE(hi556_supply_names); i++)
1362+
hi556->supplies[i].supply = hi556_supply_names[i];
1363+
1364+
ret = devm_regulator_bulk_get(&client->dev,
1365+
ARRAY_SIZE(hi556_supply_names),
1366+
hi556->supplies);
1367+
if (ret)
1368+
return dev_err_probe(&client->dev, ret,
1369+
"failed to get regulators\n");
13661370

13671371
full_power = acpi_dev_state_d0(&client->dev);
13681372
if (full_power) {

0 commit comments

Comments
 (0)