aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-09-17 05:03:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-05 21:33:39 -0400
commitccbfd1d49dc0d6a6edab827ab4888cf93348f249 (patch)
tree1c3efacbc618e1282e7e8102043766c42636514f
parenteabe7b01c249c9d8166a1a10bb6effce2b3de665 (diff)
[media] s5p-csis: Replace phy_enable platform data callback with direct call
The phy_enable callback is common for all Samsung SoC platforms, replace it with direct function call so the MIPI-CSI2 DPHY control is also possible on device tree instantiated platforms. 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>
-rw-r--r--drivers/media/platform/s5p-fimc/mipi-csis.c13
-rw-r--r--include/linux/platform_data/mipi-csis.h11
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
index 22bdf211a2ac..983e81f08cd6 100644
--- a/drivers/media/platform/s5p-fimc/mipi-csis.c
+++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
@@ -160,6 +160,7 @@ struct csis_pktbuf {
160 * protecting @format and @flags members 160 * protecting @format and @flags members
161 * @pads: CSIS pads array 161 * @pads: CSIS pads array
162 * @sd: v4l2_subdev associated with CSIS device instance 162 * @sd: v4l2_subdev associated with CSIS device instance
163 * @index: the hardware instance index
163 * @pdev: CSIS platform device 164 * @pdev: CSIS platform device
164 * @regs: mmaped I/O registers memory 165 * @regs: mmaped I/O registers memory
165 * @supplies: CSIS regulator supplies 166 * @supplies: CSIS regulator supplies
@@ -176,6 +177,7 @@ struct csis_state {
176 struct mutex lock; 177 struct mutex lock;
177 struct media_pad pads[CSIS_PADS_NUM]; 178 struct media_pad pads[CSIS_PADS_NUM];
178 struct v4l2_subdev sd; 179 struct v4l2_subdev sd;
180 u8 index;
179 struct platform_device *pdev; 181 struct platform_device *pdev;
180 void __iomem *regs; 182 void __iomem *regs;
181 struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES]; 183 struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
@@ -666,14 +668,15 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
666 spin_lock_init(&state->slock); 668 spin_lock_init(&state->slock);
667 669
668 state->pdev = pdev; 670 state->pdev = pdev;
671 state->index = max(0, pdev->id);
669 672
670 pdata = pdev->dev.platform_data; 673 pdata = pdev->dev.platform_data;
671 if (pdata == NULL || pdata->phy_enable == NULL) { 674 if (pdata == NULL) {
672 dev_err(&pdev->dev, "Platform data not fully specified\n"); 675 dev_err(&pdev->dev, "Platform data not fully specified\n");
673 return -EINVAL; 676 return -EINVAL;
674 } 677 }
675 678
676 if ((pdev->id == 1 && pdata->lanes > CSIS1_MAX_LANES) || 679 if ((state->index == 1 && pdata->lanes > CSIS1_MAX_LANES) ||
677 pdata->lanes > CSIS0_MAX_LANES) { 680 pdata->lanes > CSIS0_MAX_LANES) {
678 dev_err(&pdev->dev, "Unsupported number of data lanes: %d\n", 681 dev_err(&pdev->dev, "Unsupported number of data lanes: %d\n",
679 pdata->lanes); 682 pdata->lanes);
@@ -756,7 +759,6 @@ e_clkput:
756 759
757static int s5pcsis_pm_suspend(struct device *dev, bool runtime) 760static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
758{ 761{
759 struct s5p_platform_mipi_csis *pdata = dev->platform_data;
760 struct platform_device *pdev = to_platform_device(dev); 762 struct platform_device *pdev = to_platform_device(dev);
761 struct v4l2_subdev *sd = platform_get_drvdata(pdev); 763 struct v4l2_subdev *sd = platform_get_drvdata(pdev);
762 struct csis_state *state = sd_to_csis_state(sd); 764 struct csis_state *state = sd_to_csis_state(sd);
@@ -768,7 +770,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
768 mutex_lock(&state->lock); 770 mutex_lock(&state->lock);
769 if (state->flags & ST_POWERED) { 771 if (state->flags & ST_POWERED) {
770 s5pcsis_stop_stream(state); 772 s5pcsis_stop_stream(state);
771 ret = pdata->phy_enable(state->pdev, false); 773 ret = s5p_csis_phy_enable(state->index, false);
772 if (ret) 774 if (ret)
773 goto unlock; 775 goto unlock;
774 ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES, 776 ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
@@ -787,7 +789,6 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
787 789
788static int s5pcsis_pm_resume(struct device *dev, bool runtime) 790static int s5pcsis_pm_resume(struct device *dev, bool runtime)
789{ 791{
790 struct s5p_platform_mipi_csis *pdata = dev->platform_data;
791 struct platform_device *pdev = to_platform_device(dev); 792 struct platform_device *pdev = to_platform_device(dev);
792 struct v4l2_subdev *sd = platform_get_drvdata(pdev); 793 struct v4l2_subdev *sd = platform_get_drvdata(pdev);
793 struct csis_state *state = sd_to_csis_state(sd); 794 struct csis_state *state = sd_to_csis_state(sd);
@@ -805,7 +806,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime)
805 state->supplies); 806 state->supplies);
806 if (ret) 807 if (ret)
807 goto unlock; 808 goto unlock;
808 ret = pdata->phy_enable(state->pdev, true); 809 ret = s5p_csis_phy_enable(state->index, true);
809 if (!ret) { 810 if (!ret) {
810 state->flags |= ST_POWERED; 811 state->flags |= ST_POWERED;
811 } else { 812 } else {
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
index c45b1e8d4c2e..2e59e4306766 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -11,8 +11,6 @@
11#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_ 11#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_
12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__ 12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
13 13
14struct platform_device;
15
16/** 14/**
17 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver 15 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
18 * @clk_rate: bus clock frequency 16 * @clk_rate: bus clock frequency
@@ -34,10 +32,11 @@ struct s5p_platform_mipi_csis {
34 32
35/** 33/**
36 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control 34 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
37 * @pdev: MIPI-CSIS platform device 35 * @id: MIPI-CSIS harware instance index (0...1)
38 * @on: true to enable D-PHY and deassert its reset 36 * @on: true to enable D-PHY and deassert its reset
39 * false to disable D-PHY 37 * false to disable D-PHY
38 * @return: 0 on success, or negative error code on failure
40 */ 39 */
41int s5p_csis_phy_enable(struct platform_device *pdev, bool on); 40int s5p_csis_phy_enable(int id, bool on);
42 41
43#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ 42#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */