Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271771
b: refs/heads/master
c: 438df3e
h: refs/heads/master
i:
  271769: 26516c7
  271767: f51fb7d
v: v3
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Sep 6, 2011
1 parent 270b7fd commit d60b62e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9e21083ef9361f89e19bb709eac441edc24ba02
refs/heads/master: 438df3ebe5f0ce408490a777a758d5905f0dd58f
49 changes: 26 additions & 23 deletions trunk/drivers/media/video/s5p-fimc/mipi-csis.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ static char *csi_clock_name[] = {
};
#define NUM_CSIS_CLOCKS ARRAY_SIZE(csi_clock_name)

static const char * const csis_supply_name[] = {
"vdd11", /* 1.1V or 1.2V (s5pc100) MIPI CSI suppply */
"vdd18", /* VDD 1.8V and MIPI CSI PLL supply */
};
#define CSIS_NUM_SUPPLIES ARRAY_SIZE(csis_supply_name)

enum {
ST_POWERED = 1,
ST_STREAMING = 2,
Expand Down Expand Up @@ -109,9 +115,9 @@ struct csis_state {
struct platform_device *pdev;
struct resource *regs_res;
void __iomem *regs;
struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
struct clk *clock[NUM_CSIS_CLOCKS];
int irq;
struct regulator *supply;
u32 flags;
const struct csis_pix_format *csis_fmt;
struct v4l2_mbus_framefmt format;
Expand Down Expand Up @@ -460,6 +466,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
struct resource *regs_res;
struct csis_state *state;
int ret = -ENOMEM;
int i;

state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state)
Expand Down Expand Up @@ -519,14 +526,13 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
goto e_clkput;
}

if (!pdata->fixed_phy_vdd) {
state->supply = regulator_get(&pdev->dev, "vdd");
if (IS_ERR(state->supply)) {
ret = PTR_ERR(state->supply);
state->supply = NULL;
goto e_clkput;
}
}
for (i = 0; i < CSIS_NUM_SUPPLIES; i++)
state->supplies[i].supply = csis_supply_name[i];

ret = regulator_bulk_get(&pdev->dev, CSIS_NUM_SUPPLIES,
state->supplies);
if (ret)
goto e_clkput;

ret = request_irq(state->irq, s5pcsis_irq_handler, 0,
dev_name(&pdev->dev), state);
Expand Down Expand Up @@ -561,8 +567,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
e_irqfree:
free_irq(state->irq, state);
e_regput:
if (state->supply)
regulator_put(state->supply);
regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
e_clkput:
clk_disable(state->clock[CSIS_CLK_MUX]);
s5pcsis_clk_put(state);
Expand Down Expand Up @@ -592,11 +597,10 @@ static int s5pcsis_suspend(struct device *dev)
ret = pdata->phy_enable(state->pdev, false);
if (ret)
goto unlock;
if (state->supply) {
ret = regulator_disable(state->supply);
if (ret)
goto unlock;
}
ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
state->supplies);
if (ret)
goto unlock;
clk_disable(state->clock[CSIS_CLK_GATE]);
state->flags &= ~ST_POWERED;
}
Expand All @@ -622,16 +626,16 @@ static int s5pcsis_resume(struct device *dev)
goto unlock;

if (!(state->flags & ST_POWERED)) {
if (state->supply)
ret = regulator_enable(state->supply);
ret = regulator_bulk_enable(CSIS_NUM_SUPPLIES,
state->supplies);
if (ret)
goto unlock;

ret = pdata->phy_enable(state->pdev, true);
if (!ret) {
state->flags |= ST_POWERED;
} else if (state->supply) {
regulator_disable(state->supply);
} else {
regulator_bulk_disable(CSIS_NUM_SUPPLIES,
state->supplies);
goto unlock;
}
clk_enable(state->clock[CSIS_CLK_GATE]);
Expand Down Expand Up @@ -679,8 +683,7 @@ static int __devexit s5pcsis_remove(struct platform_device *pdev)
pm_runtime_set_suspended(&pdev->dev);

s5pcsis_clk_put(state);
if (state->supply)
regulator_put(state->supply);
regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);

media_entity_cleanup(&state->sd.entity);
free_irq(state->irq, state);
Expand Down

0 comments on commit d60b62e

Please sign in to comment.