summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2014-03-13 20:02:34 +0800
committerRobby Cai <R63905@freescale.com>2014-03-14 16:20:14 +0800
commit109f7ee66fb8721dfca70d5f0e61509b106d20ea (patch)
tree38bf3642011221fb4d36dd82d8d1ebd6f32fcf1b
parent5d728eb76f217753d4f6e942b9f0fe2af8646ef7 (diff)
ENGR00302869-2 ARM: imx: imx6qdl: enable cfg_clk to make MIPI CSI2 work
The following error was reported. ----------------------------------------------------------- root@imx6qdlsolo:~# /unit_tests/mxc_v4l2_capture.out -d /dev/video1 1.yuv in_width = 176, in_height = 144 out_width = 176, out_height = 144 top = 0, left = 0 mipi csi2 can not receive sensor clk! sensor chip is ov5640_mipi_camera sensor supported frame size: 640x480 320x240 720x480 720x576 1280x720 1920x1080 2592x1944 176x144 1024x768 sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY sensor frame format: UYVY mipi csi2 can not receive sensor clk! mxc_v4l2_s_param: vidioc_int_s_parm returned an error -1 VIDIOC_S_PARM failed get format failed ----------------------------------------------------------- Root cause analysis: It only happens when HDMI is not used/enabled. There is a clock named video_27m which are needed by HDMI (as isfrclk's parent) and MIPI-CSI2 (as cfg_clk's parent). MIPI-CSI2 driver is lack of enabling this clock before start to work and only happen to work when HDMI driver enables this clock. Signed-off-by: Robby Cai <R63905@freescale.com> (cherry picked from commit a6bbc7d56f261ab84e04071487264c6a519df758)
-rw-r--r--drivers/mxc/mipi/mxc_mipi_csi2.c11
-rw-r--r--drivers/mxc/mipi/mxc_mipi_csi2.h3
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mxc/mipi/mxc_mipi_csi2.c b/drivers/mxc/mipi/mxc_mipi_csi2.c
index 2f5cb0219a88..df45c364f144 100644
--- a/drivers/mxc/mipi/mxc_mipi_csi2.c
+++ b/drivers/mxc/mipi/mxc_mipi_csi2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -77,6 +77,7 @@ bool mipi_csi2_enable(struct mipi_csi2_info *info)
if (!info->mipi_en) {
info->mipi_en = true;
+ clk_prepare_enable(info->cfg_clk);
clk_prepare_enable(info->dphy_clk);
} else
mipi_dbg("mipi csi2 already enabled!\n");
@@ -104,6 +105,7 @@ bool mipi_csi2_disable(struct mipi_csi2_info *info)
if (info->mipi_en) {
info->mipi_en = false;
clk_disable_unprepare(info->dphy_clk);
+ clk_disable_unprepare(info->cfg_clk);
} else
mipi_dbg("mipi csi2 already disabled!\n");
@@ -426,6 +428,13 @@ static int mipi_csi2_probe(struct platform_device *pdev)
gmipi_csi2->pdev = pdev;
gmipi_csi2->mipi_en = false;
+ gmipi_csi2->cfg_clk = devm_clk_get(dev, "cfg_clk");
+ if (IS_ERR(gmipi_csi2->cfg_clk)) {
+ dev_err(&pdev->dev, "failed to get cfg_clk\n");
+ ret = PTR_ERR(gmipi_csi2->cfg_clk);
+ goto err;
+ }
+
/* get mipi dphy clk */
gmipi_csi2->dphy_clk = devm_clk_get(dev, "dphy_clk");
if (IS_ERR(gmipi_csi2->dphy_clk)) {
diff --git a/drivers/mxc/mipi/mxc_mipi_csi2.h b/drivers/mxc/mipi/mxc_mipi_csi2.h
index 31379357cf95..291d7e891e09 100644
--- a/drivers/mxc/mipi/mxc_mipi_csi2.h
+++ b/drivers/mxc/mipi/mxc_mipi_csi2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ struct mipi_csi2_info {
unsigned int v_channel;
unsigned int lanes;
unsigned int datatype;
+ struct clk *cfg_clk;
struct clk *dphy_clk;
struct clk *pixel_clk;
void __iomem *mipi_csi2_base;