Commit f1468a20 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Greg Kroah-Hartman

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: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Acked-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 069d2e26
...@@ -29,7 +29,7 @@ config VIDEO_S5P_FIMC ...@@ -29,7 +29,7 @@ config VIDEO_S5P_FIMC
config VIDEO_S5P_MIPI_CSIS config VIDEO_S5P_MIPI_CSIS
tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver"
depends on REGULATOR depends on REGULATOR
select S5P_SETUP_MIPIPHY select GENERIC_PHY
help help
This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
receiver (MIPI-CSIS) devices. receiver (MIPI-CSIS) devices.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/memory.h> #include <linux/memory.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_data/mipi-csis.h> #include <linux/platform_data/mipi-csis.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -180,6 +181,7 @@ struct csis_drvdata { ...@@ -180,6 +181,7 @@ struct csis_drvdata {
* @sd: v4l2_subdev associated with CSIS device instance * @sd: v4l2_subdev associated with CSIS device instance
* @index: the hardware instance index * @index: the hardware instance index
* @pdev: CSIS platform device * @pdev: CSIS platform device
* @phy: pointer to the CSIS generic PHY
* @regs: mmaped I/O registers memory * @regs: mmaped I/O registers memory
* @supplies: CSIS regulator supplies * @supplies: CSIS regulator supplies
* @clock: CSIS clocks * @clock: CSIS clocks
...@@ -203,6 +205,7 @@ struct csis_state { ...@@ -203,6 +205,7 @@ struct csis_state {
struct v4l2_subdev sd; struct v4l2_subdev sd;
u8 index; u8 index;
struct platform_device *pdev; struct platform_device *pdev;
struct phy *phy;
void __iomem *regs; void __iomem *regs;
struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES]; struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
struct clk *clock[NUM_CSIS_CLOCKS]; struct clk *clock[NUM_CSIS_CLOCKS];
...@@ -779,8 +782,8 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, ...@@ -779,8 +782,8 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
"samsung,csis-wclk"); "samsung,csis-wclk");
state->num_lanes = endpoint.bus.mipi_csi2.num_data_lanes; state->num_lanes = endpoint.bus.mipi_csi2.num_data_lanes;
of_node_put(node); of_node_put(node);
return 0; return 0;
} }
#else #else
...@@ -829,6 +832,10 @@ static int s5pcsis_probe(struct platform_device *pdev) ...@@ -829,6 +832,10 @@ static int s5pcsis_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
state->phy = devm_phy_get(dev, "csis");
if (IS_ERR(state->phy))
return PTR_ERR(state->phy);
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
state->regs = devm_ioremap_resource(dev, mem_res); state->regs = devm_ioremap_resource(dev, mem_res);
if (IS_ERR(state->regs)) if (IS_ERR(state->regs))
...@@ -922,7 +929,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime) ...@@ -922,7 +929,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
mutex_lock(&state->lock); mutex_lock(&state->lock);
if (state->flags & ST_POWERED) { if (state->flags & ST_POWERED) {
s5pcsis_stop_stream(state); s5pcsis_stop_stream(state);
ret = s5p_csis_phy_enable(state->index, false); ret = phy_power_off(state->phy);
if (ret) if (ret)
goto unlock; goto unlock;
ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES, ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
...@@ -958,7 +965,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) ...@@ -958,7 +965,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime)
state->supplies); state->supplies);
if (ret) if (ret)
goto unlock; goto unlock;
ret = s5p_csis_phy_enable(state->index, true); ret = phy_power_on(state->phy);
if (!ret) { if (!ret) {
state->flags |= ST_POWERED; state->flags |= ST_POWERED;
} else { } else {
......
...@@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis { ...@@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis {
u8 hs_settle; u8 hs_settle;
}; };
/**
* s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
* @id: MIPI-CSIS harware instance index (0...1)
* @on: true to enable D-PHY and deassert its reset
* false to disable D-PHY
* @return: 0 on success, or negative error code on failure
*/
int s5p_csis_phy_enable(int id, bool on);
#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment