diff options
author | Robby Cai <R63905@freescale.com> | 2014-03-13 08:02:34 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:57:58 -0400 |
commit | 3f01eeb4cee00f3156e659434ee96e939fd9952d (patch) | |
tree | b1dbab04943c10dce36ba8d2fc04780ad1979c35 | |
parent | 0bbdbb89b92a70997d3a33075bc34e948eea8d9d (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>
-rw-r--r-- | drivers/mxc/mipi/mxc_mipi_csi2.c | 11 | ||||
-rw-r--r-- | drivers/mxc/mipi/mxc_mipi_csi2.h | 3 |
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 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * 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) | |||
77 | 77 | ||
78 | if (!info->mipi_en) { | 78 | if (!info->mipi_en) { |
79 | info->mipi_en = true; | 79 | info->mipi_en = true; |
80 | clk_prepare_enable(info->cfg_clk); | ||
80 | clk_prepare_enable(info->dphy_clk); | 81 | clk_prepare_enable(info->dphy_clk); |
81 | } else | 82 | } else |
82 | mipi_dbg("mipi csi2 already enabled!\n"); | 83 | mipi_dbg("mipi csi2 already enabled!\n"); |
@@ -104,6 +105,7 @@ bool mipi_csi2_disable(struct mipi_csi2_info *info) | |||
104 | if (info->mipi_en) { | 105 | if (info->mipi_en) { |
105 | info->mipi_en = false; | 106 | info->mipi_en = false; |
106 | clk_disable_unprepare(info->dphy_clk); | 107 | clk_disable_unprepare(info->dphy_clk); |
108 | clk_disable_unprepare(info->cfg_clk); | ||
107 | } else | 109 | } else |
108 | mipi_dbg("mipi csi2 already disabled!\n"); | 110 | mipi_dbg("mipi csi2 already disabled!\n"); |
109 | 111 | ||
@@ -426,6 +428,13 @@ static int mipi_csi2_probe(struct platform_device *pdev) | |||
426 | gmipi_csi2->pdev = pdev; | 428 | gmipi_csi2->pdev = pdev; |
427 | gmipi_csi2->mipi_en = false; | 429 | gmipi_csi2->mipi_en = false; |
428 | 430 | ||
431 | gmipi_csi2->cfg_clk = devm_clk_get(dev, "cfg_clk"); | ||
432 | if (IS_ERR(gmipi_csi2->cfg_clk)) { | ||
433 | dev_err(&pdev->dev, "failed to get cfg_clk\n"); | ||
434 | ret = PTR_ERR(gmipi_csi2->cfg_clk); | ||
435 | goto err; | ||
436 | } | ||
437 | |||
429 | /* get mipi dphy clk */ | 438 | /* get mipi dphy clk */ |
430 | gmipi_csi2->dphy_clk = devm_clk_get(dev, "dphy_clk"); | 439 | gmipi_csi2->dphy_clk = devm_clk_get(dev, "dphy_clk"); |
431 | if (IS_ERR(gmipi_csi2->dphy_clk)) { | 440 | 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 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -34,6 +34,7 @@ struct mipi_csi2_info { | |||
34 | unsigned int v_channel; | 34 | unsigned int v_channel; |
35 | unsigned int lanes; | 35 | unsigned int lanes; |
36 | unsigned int datatype; | 36 | unsigned int datatype; |
37 | struct clk *cfg_clk; | ||
37 | struct clk *dphy_clk; | 38 | struct clk *dphy_clk; |
38 | struct clk *pixel_clk; | 39 | struct clk *pixel_clk; |
39 | void __iomem *mipi_csi2_base; | 40 | void __iomem *mipi_csi2_base; |