diff options
| author | Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | 2013-10-16 12:28:11 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-16 16:48:08 -0400 |
| commit | f1468a2077e8c00fddb6cecec41b356637195ca3 (patch) | |
| tree | b2d3f66c22e0dbca8ba6ca98fe72c0e2e963e836 | |
| parent | 069d2e26e9d64ba7e04c2c255efdfd1238789ca6 (diff) | |
exynos4-is: Use the generic MIPI CSIS PHY driver
Use the generic PHY API instead of the platform callback
to control the MIPI CSIS DPHY.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/media/platform/exynos4-is/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/media/platform/exynos4-is/mipi-csis.c | 13 | ||||
| -rw-r--r-- | include/linux/platform_data/mipi-csis.h | 9 |
3 files changed, 11 insertions, 13 deletions
diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index 53ad0f080179..d2d3b4b61435 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig | |||
| @@ -29,7 +29,7 @@ config VIDEO_S5P_FIMC | |||
| 29 | config VIDEO_S5P_MIPI_CSIS | 29 | config VIDEO_S5P_MIPI_CSIS |
| 30 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" | 30 | tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" |
| 31 | depends on REGULATOR | 31 | depends on REGULATOR |
| 32 | select S5P_SETUP_MIPIPHY | 32 | select GENERIC_PHY |
| 33 | help | 33 | help |
| 34 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 | 34 | This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 |
| 35 | receiver (MIPI-CSIS) devices. | 35 | receiver (MIPI-CSIS) devices. |
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index 0914230b42de..9fc2af6a0446 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/memory.h> | 20 | #include <linux/memory.h> |
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
| 23 | #include <linux/phy/phy.h> | ||
| 23 | #include <linux/platform_data/mipi-csis.h> | 24 | #include <linux/platform_data/mipi-csis.h> |
| 24 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 25 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
| @@ -180,6 +181,7 @@ struct csis_drvdata { | |||
| 180 | * @sd: v4l2_subdev associated with CSIS device instance | 181 | * @sd: v4l2_subdev associated with CSIS device instance |
| 181 | * @index: the hardware instance index | 182 | * @index: the hardware instance index |
| 182 | * @pdev: CSIS platform device | 183 | * @pdev: CSIS platform device |
| 184 | * @phy: pointer to the CSIS generic PHY | ||
| 183 | * @regs: mmaped I/O registers memory | 185 | * @regs: mmaped I/O registers memory |
| 184 | * @supplies: CSIS regulator supplies | 186 | * @supplies: CSIS regulator supplies |
| 185 | * @clock: CSIS clocks | 187 | * @clock: CSIS clocks |
| @@ -203,6 +205,7 @@ struct csis_state { | |||
| 203 | struct v4l2_subdev sd; | 205 | struct v4l2_subdev sd; |
| 204 | u8 index; | 206 | u8 index; |
| 205 | struct platform_device *pdev; | 207 | struct platform_device *pdev; |
| 208 | struct phy *phy; | ||
| 206 | void __iomem *regs; | 209 | void __iomem *regs; |
| 207 | struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES]; | 210 | struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES]; |
| 208 | struct clk *clock[NUM_CSIS_CLOCKS]; | 211 | struct clk *clock[NUM_CSIS_CLOCKS]; |
| @@ -779,8 +782,8 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, | |||
| 779 | "samsung,csis-wclk"); | 782 | "samsung,csis-wclk"); |
| 780 | 783 | ||
| 781 | state->num_lanes = endpoint.bus.mipi_csi2.num_data_lanes; | 784 | state->num_lanes = endpoint.bus.mipi_csi2.num_data_lanes; |
| 782 | |||
| 783 | of_node_put(node); | 785 | of_node_put(node); |
| 786 | |||
| 784 | return 0; | 787 | return 0; |
| 785 | } | 788 | } |
| 786 | #else | 789 | #else |
| @@ -829,6 +832,10 @@ static int s5pcsis_probe(struct platform_device *pdev) | |||
| 829 | return -EINVAL; | 832 | return -EINVAL; |
| 830 | } | 833 | } |
| 831 | 834 | ||
| 835 | state->phy = devm_phy_get(dev, "csis"); | ||
| 836 | if (IS_ERR(state->phy)) | ||
| 837 | return PTR_ERR(state->phy); | ||
| 838 | |||
| 832 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 839 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 833 | state->regs = devm_ioremap_resource(dev, mem_res); | 840 | state->regs = devm_ioremap_resource(dev, mem_res); |
| 834 | if (IS_ERR(state->regs)) | 841 | if (IS_ERR(state->regs)) |
| @@ -922,7 +929,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime) | |||
| 922 | mutex_lock(&state->lock); | 929 | mutex_lock(&state->lock); |
| 923 | if (state->flags & ST_POWERED) { | 930 | if (state->flags & ST_POWERED) { |
| 924 | s5pcsis_stop_stream(state); | 931 | s5pcsis_stop_stream(state); |
| 925 | ret = s5p_csis_phy_enable(state->index, false); | 932 | ret = phy_power_off(state->phy); |
| 926 | if (ret) | 933 | if (ret) |
| 927 | goto unlock; | 934 | goto unlock; |
| 928 | ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES, | 935 | ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES, |
| @@ -958,7 +965,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) | |||
| 958 | state->supplies); | 965 | state->supplies); |
| 959 | if (ret) | 966 | if (ret) |
| 960 | goto unlock; | 967 | goto unlock; |
| 961 | ret = s5p_csis_phy_enable(state->index, true); | 968 | ret = phy_power_on(state->phy); |
| 962 | if (!ret) { | 969 | if (!ret) { |
| 963 | state->flags |= ST_POWERED; | 970 | state->flags |= ST_POWERED; |
| 964 | } else { | 971 | } else { |
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h index bf34e17cee7f..c2fd9024717c 100644 --- a/include/linux/platform_data/mipi-csis.h +++ b/include/linux/platform_data/mipi-csis.h | |||
| @@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis { | |||
| 25 | u8 hs_settle; | 25 | u8 hs_settle; |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /** | ||
| 29 | * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control | ||
| 30 | * @id: MIPI-CSIS harware instance index (0...1) | ||
| 31 | * @on: true to enable D-PHY and deassert its reset | ||
| 32 | * false to disable D-PHY | ||
| 33 | * @return: 0 on success, or negative error code on failure | ||
| 34 | */ | ||
| 35 | int s5p_csis_phy_enable(int id, bool on); | ||
| 36 | |||
| 37 | #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ | 28 | #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ |
