Commit d3162b06 authored by Robby Cai's avatar Robby Cai

ENGR00227726 csi: Disable csi clock when it's inactive

Disable csi clock when inactive, otherwise this prevents system from
entering low power mode.
Signed-off-by: default avatarRobby Cai <R63905@freescale.com>
parent e170d8a4
......@@ -1536,7 +1536,8 @@ static int csi_v4l2_suspend(struct platform_device *pdev, pm_message_t state)
if (cam->overlay_on == true)
stop_preview(cam);
camera_power(cam, false);
if (cam->capture_on == true || cam->overlay_on == true)
camera_power(cam, false);
return 0;
}
......@@ -1561,7 +1562,8 @@ static int csi_v4l2_resume(struct platform_device *pdev)
cam->low_power = false;
wake_up_interruptible(&cam->power_queue);
camera_power(cam, true);
if (cam->capture_on == true || cam->overlay_on == true)
camera_power(cam, true);
if (cam->overlay_on == true)
start_preview(cam);
......
......@@ -250,12 +250,14 @@ static void csi_mclk_recalc(struct clk *clk)
void csi_mclk_enable(void)
{
clk_enable(&csi_mclk);
__raw_writel(__raw_readl(CSI_CSICR1) | BIT_MCLKEN, CSI_CSICR1);
}
void csi_mclk_disable(void)
{
__raw_writel(__raw_readl(CSI_CSICR1) & ~BIT_MCLKEN, CSI_CSICR1);
clk_disable(&csi_mclk);
}
static int __devinit csi_probe(struct platform_device *pdev)
......@@ -293,8 +295,13 @@ static int __devinit csi_probe(struct platform_device *pdev)
return PTR_ERR(per_clk);
clk_put(per_clk);
/*
* On mx6sl, there's no divider in CSI module(BIT_MCLKDIV in CSI_CSICR1
* is marked as reserved). We use CSI clock in CCM.
* However, the value read from BIT_MCLKDIV bits are 0, which is
* equivalent to "divider=1". The code works for mx6sl without change.
*/
csi_mclk.parent = per_clk;
clk_enable(per_clk);
csi_mclk_recalc(&csi_mclk);
err:
......@@ -303,7 +310,6 @@ err:
static int __devexit csi_remove(struct platform_device *pdev)
{
clk_disable(&csi_mclk);
iounmap(csi_regbase);
return 0;
......
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