summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2015-05-11 16:46:35 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:47:32 +0900
commita8c42be2540897319894ac402f5b253fa472abb0 (patch)
treea1a03835d10522876a471bfad8164f3d9146461e /drivers
parent7425a85118c5810261b351126ea8c3580881023a (diff)
fimc-is: Add support for MIPI PHY power/reset control
Change-Id: Id7afb8b99a87a664a16f74ff0d3e6c28904cce1b Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/exynos/fimc-is/exynos5-mipiphy.h17
-rw-r--r--drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c27
-rw-r--r--drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.h2
3 files changed, 20 insertions, 26 deletions
diff --git a/drivers/media/platform/exynos/fimc-is/exynos5-mipiphy.h b/drivers/media/platform/exynos/fimc-is/exynos5-mipiphy.h
deleted file mode 100644
index b56ea6fe553d..000000000000
--- a/drivers/media/platform/exynos/fimc-is/exynos5-mipiphy.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2013 Samsung Electronics Co., Ltd.
- *
- * EXYNOS5 - Helper functions for MIPI-CSIS control
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __PLAT_MIPI_PHY_H
-#define __PLAT_MIPI_PHY_H __FILE__
-
-static int exynos5_csis_phy_enable(int id, bool on) { return 0; };
-static int exynos5_dism_phy_enable(int id, bool on) { return 0 };
-
-#endif /* __PLAT_MIPI_PHY_H */
diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c
index 384859488268..23469ce287af 100644
--- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c
+++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c
@@ -17,8 +17,8 @@
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/phy/phy.h>
-#include "exynos5-mipiphy.h"
#include "fimc-is-config.h"
#include "fimc-is-regs.h"
#include "fimc-is-hw.h"
@@ -30,7 +30,6 @@ extern void s5pcsis_set_hsync_settle(unsigned long __iomem *base_reg, int settle
extern void s5pcsis_set_params(unsigned long __iomem *base_reg, struct fimc_is_image *image, u32 lanes);
extern void s5pcsis_reset(unsigned long __iomem *base_reg);
extern void s5pcsis_system_enable(unsigned long __iomem *base_reg, int on, u32 lanes);
-
static u32 get_hsync_settle(struct fimc_is_sensor_cfg *cfg,
const u32 cfgs, u32 width, u32 height, u32 framerate)
{
@@ -138,11 +137,10 @@ p_err:
return ret;
}
-static int csi_s_power(struct v4l2_subdev *subdev,
- int on)
+static int csi_s_power(struct v4l2_subdev *subdev, int on)
{
- int ret = 0;
struct fimc_is_device_csi *csi;
+ int ret;
BUG_ON(!subdev);
@@ -153,13 +151,18 @@ static int csi_s_power(struct v4l2_subdev *subdev,
}
/* HACK: CSI #1 phy should be enabled when CSI #2 phy is eanbled. */
- if (csi->instance == CSI_ID_C) {
- ret = exynos5_csis_phy_enable(CSI_ID_B, on);
+ if (WARN_ON(csi->instance == CSI_ID_C)) {
+ /* FIXME: add equivalent of the commented out code below */
+ /* ret = exynos5_csis_phy_enable(CSI_ID_B, on); */
}
- ret = exynos5_csis_phy_enable(csi->instance, on);
+ if (on)
+ ret = phy_power_on(csi->phy);
+ else
+ ret = phy_power_off(csi->phy);
+
if (ret) {
- err("fail to csi%d power on", csi->instance);
+ err("failed to power on/off csi%d", csi->instance);
goto p_err;
}
@@ -362,6 +365,12 @@ int fimc_is_csi_probe(void *parent, u32 instance)
goto p_err_free1;
}
+ csi->phy = devm_phy_get(&device->pdev->dev, "csis");
+ if (IS_ERR(csi->phy)) {
+ ret = PTR_ERR(csi->phy);
+ goto p_err_free1;
+ }
+
csi->instance = instance;
csi->base_reg = of_iomap(core->csis_np[instance], 0);
diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.h b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.h
index dcae741348fe..9f90d5ce9f34 100644
--- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.h
+++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.h
@@ -1,6 +1,7 @@
#ifndef FIMC_IS_DEVICE_CSI_H
#define FIMC_IS_DEVICE_CSI_H
+#include <linux/phy/phy.h>
#include <media/v4l2-device.h>
#include "fimc-is-type.h"
@@ -8,6 +9,7 @@ struct fimc_is_device_csi {
/* channel information */
u32 instance;
unsigned long __iomem *base_reg;
+ struct phy *phy;
/* for settle time */
u32 sensor_cfgs;