Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340010
b: refs/heads/master
c: 376aaac
h: refs/heads/master
v: v3
  • Loading branch information
Fabio Estevam authored and Sascha Hauer committed Nov 16, 2012
1 parent f595eab commit 120eeb2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6efc782362b4e869bfd71d801020c8641abdbd1f
refs/heads/master: 376aaac1837af8ed6c1014958396322c44306cbf
39 changes: 29 additions & 10 deletions trunk/drivers/media/platform/soc_camera/mx2_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ struct mx2_camera_dev {
struct device *dev;
struct soc_camera_host soc_host;
struct soc_camera_device *icd;
struct clk *clk_csi, *clk_emma_ahb, *clk_emma_ipg;
struct clk *clk_emma_ahb, *clk_emma_ipg;
struct clk *clk_csi_ahb, *clk_csi_per;

void __iomem *base_csi, *base_emma;

Expand Down Expand Up @@ -464,7 +465,8 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev)
{
unsigned long flags;

clk_disable_unprepare(pcdev->clk_csi);
clk_disable_unprepare(pcdev->clk_csi_ahb);
clk_disable_unprepare(pcdev->clk_csi_per);
writel(0, pcdev->base_csi + CSICR1);
if (is_imx27_camera(pcdev)) {
writel(0, pcdev->base_emma + PRP_CNTL);
Expand Down Expand Up @@ -492,10 +494,14 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
if (pcdev->icd)
return -EBUSY;

ret = clk_prepare_enable(pcdev->clk_csi);
ret = clk_prepare_enable(pcdev->clk_csi_ahb);
if (ret < 0)
return ret;

ret = clk_prepare_enable(pcdev->clk_csi_per);
if (ret < 0)
goto exit_csi_ahb;

csicr1 = CSICR1_MCLKEN;

if (is_imx27_camera(pcdev))
Expand All @@ -512,6 +518,11 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
icd->devnum);

return 0;

exit_csi_ahb:
clk_disable_unprepare(pcdev->clk_csi_ahb);

return ret;
}

static void mx2_camera_remove_device(struct soc_camera_device *icd)
Expand Down Expand Up @@ -1772,10 +1783,17 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
break;
}

pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(pcdev->clk_csi)) {
dev_err(&pdev->dev, "Could not get csi clock\n");
err = PTR_ERR(pcdev->clk_csi);
pcdev->clk_csi_ahb = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(pcdev->clk_csi_ahb)) {
dev_err(&pdev->dev, "Could not get csi ahb clock\n");
err = PTR_ERR(pcdev->clk_csi_ahb);
goto exit;
}

pcdev->clk_csi_per = devm_clk_get(&pdev->dev, "per");
if (IS_ERR(pcdev->clk_csi_per)) {
dev_err(&pdev->dev, "Could not get csi per clock\n");
err = PTR_ERR(pcdev->clk_csi_per);
goto exit;
}

Expand All @@ -1785,12 +1803,13 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)

pcdev->platform_flags = pcdev->pdata->flags;

rate = clk_round_rate(pcdev->clk_csi, pcdev->pdata->clk * 2);
rate = clk_round_rate(pcdev->clk_csi_per,
pcdev->pdata->clk * 2);
if (rate <= 0) {
err = -ENODEV;
goto exit;
}
err = clk_set_rate(pcdev->clk_csi, rate);
err = clk_set_rate(pcdev->clk_csi_per, rate);
if (err < 0)
goto exit;
}
Expand Down Expand Up @@ -1848,7 +1867,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
goto exit_free_emma;

dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n",
clk_get_rate(pcdev->clk_csi));
clk_get_rate(pcdev->clk_csi_per));

return 0;

Expand Down

0 comments on commit 120eeb2

Please sign in to comment.