Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366993
b: refs/heads/master
c: 97f2127
h: refs/heads/master
i:
  366991: 398878f
v: v3
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Apr 14, 2013
1 parent 4f472b5 commit 77e7cc2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 37b9f2117f3b4b554315b0e7b357bfabb58a0204
refs/heads/master: 97f212767a4d0fbddbf4786ccedacb47fc210548
24 changes: 24 additions & 0 deletions trunk/drivers/media/i2c/mt9p031.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/i2c.h>
#include <linux/log2.h>
#include <linux/pm.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/videodev2.h>

Expand Down Expand Up @@ -121,6 +122,10 @@ struct mt9p031 {
struct mutex power_lock; /* lock to protect power_count */
int power_count;

struct regulator *vaa;
struct regulator *vdd;
struct regulator *vdd_io;

enum mt9p031_model model;
struct aptina_pll pll;
int reset;
Expand Down Expand Up @@ -264,6 +269,11 @@ static int mt9p031_power_on(struct mt9p031 *mt9p031)
usleep_range(1000, 2000);
}

/* Bring up the supplies */
regulator_enable(mt9p031->vdd);
regulator_enable(mt9p031->vdd_io);
regulator_enable(mt9p031->vaa);

/* Emable clock */
if (mt9p031->pdata->set_xclk)
mt9p031->pdata->set_xclk(&mt9p031->subdev,
Expand All @@ -285,6 +295,10 @@ static void mt9p031_power_off(struct mt9p031 *mt9p031)
usleep_range(1000, 2000);
}

regulator_disable(mt9p031->vaa);
regulator_disable(mt9p031->vdd_io);
regulator_disable(mt9p031->vdd);

if (mt9p031->pdata->set_xclk)
mt9p031->pdata->set_xclk(&mt9p031->subdev, 0);
}
Expand Down Expand Up @@ -937,6 +951,16 @@ static int mt9p031_probe(struct i2c_client *client,
mt9p031->model = did->driver_data;
mt9p031->reset = -1;

mt9p031->vaa = devm_regulator_get(&client->dev, "vaa");
mt9p031->vdd = devm_regulator_get(&client->dev, "vdd");
mt9p031->vdd_io = devm_regulator_get(&client->dev, "vdd_io");

if (IS_ERR(mt9p031->vaa) || IS_ERR(mt9p031->vdd) ||
IS_ERR(mt9p031->vdd_io)) {
dev_err(&client->dev, "Unable to get regulators\n");
return -ENODEV;
}

v4l2_ctrl_handler_init(&mt9p031->ctrls, ARRAY_SIZE(mt9p031_ctrls) + 6);

v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
Expand Down

0 comments on commit 77e7cc2

Please sign in to comment.