Skip to content

Commit ccbfd1d

Browse files
Sylwester NawrockiMauro Carvalho Chehab
authored andcommitted
[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>
1 parent eabe7b0 commit ccbfd1d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

drivers/media/platform/s5p-fimc/mipi-csis.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct csis_pktbuf {
160160
* protecting @format and @flags members
161161
* @pads: CSIS pads array
162162
* @sd: v4l2_subdev associated with CSIS device instance
163+
* @index: the hardware instance index
163164
* @pdev: CSIS platform device
164165
* @regs: mmaped I/O registers memory
165166
* @supplies: CSIS regulator supplies
@@ -176,6 +177,7 @@ struct csis_state {
176177
struct mutex lock;
177178
struct media_pad pads[CSIS_PADS_NUM];
178179
struct v4l2_subdev sd;
180+
u8 index;
179181
struct platform_device *pdev;
180182
void __iomem *regs;
181183
struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
@@ -666,14 +668,15 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
666668
spin_lock_init(&state->slock);
667669

668670
state->pdev = pdev;
671+
state->index = max(0, pdev->id);
669672

670673
pdata = pdev->dev.platform_data;
671-
if (pdata == NULL || pdata->phy_enable == NULL) {
674+
if (pdata == NULL) {
672675
dev_err(&pdev->dev, "Platform data not fully specified\n");
673676
return -EINVAL;
674677
}
675678

676-
if ((pdev->id == 1 && pdata->lanes > CSIS1_MAX_LANES) ||
679+
if ((state->index == 1 && pdata->lanes > CSIS1_MAX_LANES) ||
677680
pdata->lanes > CSIS0_MAX_LANES) {
678681
dev_err(&pdev->dev, "Unsupported number of data lanes: %d\n",
679682
pdata->lanes);
@@ -756,7 +759,6 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
756759

757760
static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
758761
{
759-
struct s5p_platform_mipi_csis *pdata = dev->platform_data;
760762
struct platform_device *pdev = to_platform_device(dev);
761763
struct v4l2_subdev *sd = platform_get_drvdata(pdev);
762764
struct csis_state *state = sd_to_csis_state(sd);
@@ -768,7 +770,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
768770
mutex_lock(&state->lock);
769771
if (state->flags & ST_POWERED) {
770772
s5pcsis_stop_stream(state);
771-
ret = pdata->phy_enable(state->pdev, false);
773+
ret = s5p_csis_phy_enable(state->index, false);
772774
if (ret)
773775
goto unlock;
774776
ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
@@ -787,7 +789,6 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
787789

788790
static int s5pcsis_pm_resume(struct device *dev, bool runtime)
789791
{
790-
struct s5p_platform_mipi_csis *pdata = dev->platform_data;
791792
struct platform_device *pdev = to_platform_device(dev);
792793
struct v4l2_subdev *sd = platform_get_drvdata(pdev);
793794
struct csis_state *state = sd_to_csis_state(sd);
@@ -805,7 +806,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime)
805806
state->supplies);
806807
if (ret)
807808
goto unlock;
808-
ret = pdata->phy_enable(state->pdev, true);
809+
ret = s5p_csis_phy_enable(state->index, true);
809810
if (!ret) {
810811
state->flags |= ST_POWERED;
811812
} else {

include/linux/platform_data/mipi-csis.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_
1212
#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
1313

14-
struct platform_device;
15-
1614
/**
1715
* struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
1816
* @clk_rate: bus clock frequency
@@ -34,10 +32,11 @@ struct s5p_platform_mipi_csis {
3432

3533
/**
3634
* s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
37-
* @pdev: MIPI-CSIS platform device
38-
* @on: true to enable D-PHY and deassert its reset
39-
* false to disable D-PHY
35+
* @id: MIPI-CSIS harware instance index (0...1)
36+
* @on: true to enable D-PHY and deassert its reset
37+
* false to disable D-PHY
38+
* @return: 0 on success, or negative error code on failure
4039
*/
41-
int s5p_csis_phy_enable(struct platform_device *pdev, bool on);
40+
int s5p_csis_phy_enable(int id, bool on);
4241

4342
#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */

0 commit comments

Comments
 (0)