aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2011-06-29 12:08:49 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-06 14:09:20 -0400
commit438df3ebe5f0ce408490a777a758d5905f0dd58f (patch)
treef87122e416fec333d20443e4e82b0d493e7248ab /drivers
parente9e21083ef9361f89e19bb709eac441edc24ba02 (diff)
[media] s5p-csis: Handle all available power supplies
On the SoCs this driver is intended to support the are three separate pins to supply the MIPI-CSIS subsystem: 1.1V or 1.2V, 1.8V and power supply for an internal PLL. This patch adds support for two separate voltage supplies to cover properly board configurations where PMIC requires to configure independently each external supply of the MIPI-CSI device. The 1.8V and PLL supply are assigned a single "vdd18" regulator supply name as it seems more reasonable than creating separate regulator supplies for them. While at here stop using the 'fixed_phy_vdd' platform_data field. It has been introduced for boards where the MIPI-CSIS supplies are not controllable. However it is not needed as those boards can use the dummy regulator. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/s5p-fimc/mipi-csis.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.c b/drivers/media/video/s5p-fimc/mipi-csis.c
index ef056d6605ca..e34d4ba031b7 100644
--- a/drivers/media/video/s5p-fimc/mipi-csis.c
+++ b/drivers/media/video/s5p-fimc/mipi-csis.c
@@ -81,6 +81,12 @@ static char *csi_clock_name[] = {
81}; 81};
82#define NUM_CSIS_CLOCKS ARRAY_SIZE(csi_clock_name) 82#define NUM_CSIS_CLOCKS ARRAY_SIZE(csi_clock_name)
83 83
84static const char * const csis_supply_name[] = {
85 "vdd11", /* 1.1V or 1.2V (s5pc100) MIPI CSI suppply */
86 "vdd18", /* VDD 1.8V and MIPI CSI PLL supply */
87};
88#define CSIS_NUM_SUPPLIES ARRAY_SIZE(csis_supply_name)
89
84enum { 90enum {
85 ST_POWERED = 1, 91 ST_POWERED = 1,
86 ST_STREAMING = 2, 92 ST_STREAMING = 2,
@@ -109,9 +115,9 @@ struct csis_state {
109 struct platform_device *pdev; 115 struct platform_device *pdev;
110 struct resource *regs_res; 116 struct resource *regs_res;
111 void __iomem *regs; 117 void __iomem *regs;
118 struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
112 struct clk *clock[NUM_CSIS_CLOCKS]; 119 struct clk *clock[NUM_CSIS_CLOCKS];
113 int irq; 120 int irq;
114 struct regulator *supply;
115 u32 flags; 121 u32 flags;
116 const struct csis_pix_format *csis_fmt; 122 const struct csis_pix_format *csis_fmt;
117 struct v4l2_mbus_framefmt format; 123 struct v4l2_mbus_framefmt format;
@@ -460,6 +466,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
460 struct resource *regs_res; 466 struct resource *regs_res;
461 struct csis_state *state; 467 struct csis_state *state;
462 int ret = -ENOMEM; 468 int ret = -ENOMEM;
469 int i;
463 470
464 state = kzalloc(sizeof(*state), GFP_KERNEL); 471 state = kzalloc(sizeof(*state), GFP_KERNEL);
465 if (!state) 472 if (!state)
@@ -519,14 +526,13 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
519 goto e_clkput; 526 goto e_clkput;
520 } 527 }
521 528
522 if (!pdata->fixed_phy_vdd) { 529 for (i = 0; i < CSIS_NUM_SUPPLIES; i++)
523 state->supply = regulator_get(&pdev->dev, "vdd"); 530 state->supplies[i].supply = csis_supply_name[i];
524 if (IS_ERR(state->supply)) { 531
525 ret = PTR_ERR(state->supply); 532 ret = regulator_bulk_get(&pdev->dev, CSIS_NUM_SUPPLIES,
526 state->supply = NULL; 533 state->supplies);
527 goto e_clkput; 534 if (ret)
528 } 535 goto e_clkput;
529 }
530 536
531 ret = request_irq(state->irq, s5pcsis_irq_handler, 0, 537 ret = request_irq(state->irq, s5pcsis_irq_handler, 0,
532 dev_name(&pdev->dev), state); 538 dev_name(&pdev->dev), state);
@@ -561,8 +567,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
561e_irqfree: 567e_irqfree:
562 free_irq(state->irq, state); 568 free_irq(state->irq, state);
563e_regput: 569e_regput:
564 if (state->supply) 570 regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
565 regulator_put(state->supply);
566e_clkput: 571e_clkput:
567 clk_disable(state->clock[CSIS_CLK_MUX]); 572 clk_disable(state->clock[CSIS_CLK_MUX]);
568 s5pcsis_clk_put(state); 573 s5pcsis_clk_put(state);
@@ -592,11 +597,10 @@ static int s5pcsis_suspend(struct device *dev)
592 ret = pdata->phy_enable(state->pdev, false); 597 ret = pdata->phy_enable(state->pdev, false);
593 if (ret) 598 if (ret)
594 goto unlock; 599 goto unlock;
595 if (state->supply) { 600 ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
596 ret = regulator_disable(state->supply); 601 state->supplies);
597 if (ret) 602 if (ret)
598 goto unlock; 603 goto unlock;
599 }
600 clk_disable(state->clock[CSIS_CLK_GATE]); 604 clk_disable(state->clock[CSIS_CLK_GATE]);
601 state->flags &= ~ST_POWERED; 605 state->flags &= ~ST_POWERED;
602 } 606 }
@@ -622,16 +626,16 @@ static int s5pcsis_resume(struct device *dev)
622 goto unlock; 626 goto unlock;
623 627
624 if (!(state->flags & ST_POWERED)) { 628 if (!(state->flags & ST_POWERED)) {
625 if (state->supply) 629 ret = regulator_bulk_enable(CSIS_NUM_SUPPLIES,
626 ret = regulator_enable(state->supply); 630 state->supplies);
627 if (ret) 631 if (ret)
628 goto unlock; 632 goto unlock;
629
630 ret = pdata->phy_enable(state->pdev, true); 633 ret = pdata->phy_enable(state->pdev, true);
631 if (!ret) { 634 if (!ret) {
632 state->flags |= ST_POWERED; 635 state->flags |= ST_POWERED;
633 } else if (state->supply) { 636 } else {
634 regulator_disable(state->supply); 637 regulator_bulk_disable(CSIS_NUM_SUPPLIES,
638 state->supplies);
635 goto unlock; 639 goto unlock;
636 } 640 }
637 clk_enable(state->clock[CSIS_CLK_GATE]); 641 clk_enable(state->clock[CSIS_CLK_GATE]);
@@ -679,8 +683,7 @@ static int __devexit s5pcsis_remove(struct platform_device *pdev)
679 pm_runtime_set_suspended(&pdev->dev); 683 pm_runtime_set_suspended(&pdev->dev);
680 684
681 s5pcsis_clk_put(state); 685 s5pcsis_clk_put(state);
682 if (state->supply) 686 regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
683 regulator_put(state->supply);
684 687
685 media_entity_cleanup(&state->sd.entity); 688 media_entity_cleanup(&state->sd.entity);
686 free_irq(state->irq, state); 689 free_irq(state->irq, state);