Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120047
b: refs/heads/master
c: a42b6dd
h: refs/heads/master
i:
  120045: e183565
  120043: de432d8
  120039: b554950
  120031: c76e93b
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Dec 22, 2008
1 parent 948c38c commit 029bcbc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 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: 090d951b69f29a8d5777c63570d4cd61d7efeb22
refs/heads/master: a42b6dd69cb1c61c5f5a24061a227c22071786de
2 changes: 1 addition & 1 deletion trunk/arch/sh/boards/board-ap325rxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ static struct resource ceu_resources[] = {

static struct platform_device ceu_device = {
.name = "sh_mobile_ceu",
.id = 0, /* "ceu0" clock */
.num_resources = ARRAY_SIZE(ceu_resources),
.resource = ceu_resources,
.dev = {
Expand Down Expand Up @@ -375,7 +376,6 @@ static int __init ap325rxa_devices_setup(void)
gpio_direction_output(GPIO_PTS3, 1);

/* CEU */
clk_always_enable("mstp203");
gpio_request(GPIO_FN_VIO_CLK2, NULL);
gpio_request(GPIO_FN_VIO_VD2, NULL);
gpio_request(GPIO_FN_VIO_HD2, NULL);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sh/boards/mach-migor/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ static struct resource migor_ceu_resources[] = {

static struct platform_device migor_ceu_device = {
.name = "sh_mobile_ceu",
.id = 0, /* "ceu0" clock */
.num_resources = ARRAY_SIZE(migor_ceu_resources),
.resource = migor_ceu_resources,
.dev = {
Expand Down Expand Up @@ -554,7 +555,6 @@ static int __init migor_devices_setup(void)
#endif

/* CEU */
clk_always_enable("mstp203"); /* CEU */
gpio_request(GPIO_FN_VIO_CLK2, NULL);
gpio_request(GPIO_FN_VIO_VD2, NULL);
gpio_request(GPIO_FN_VIO_HD2, NULL);
Expand Down
20 changes: 19 additions & 1 deletion trunk/drivers/media/video/sh_mobile_ceu_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/videodev2.h>
#include <linux/clk.h>

#include <media/v4l2-common.h>
#include <media/v4l2-dev.h>
Expand Down Expand Up @@ -89,6 +90,7 @@ struct sh_mobile_ceu_dev {

unsigned int irq;
void __iomem *base;
struct clk *clk;
unsigned long video_limit;

/* lock used to protect videobuf */
Expand Down Expand Up @@ -309,6 +311,8 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
if (ret)
goto err;

clk_enable(pcdev->clk);

ceu_write(pcdev, CAPSR, 1 << 16); /* reset */
while (ceu_read(pcdev, CSTSR) & 1)
msleep(1);
Expand Down Expand Up @@ -342,6 +346,8 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)
}
spin_unlock_irqrestore(&pcdev->lock, flags);

clk_disable(pcdev->clk);

icd->ops->release(icd);

dev_info(&icd->dev,
Expand Down Expand Up @@ -550,6 +556,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
struct sh_mobile_ceu_dev *pcdev;
struct resource *res;
void __iomem *base;
char clk_name[8];
unsigned int irq;
int err = 0;

Expand Down Expand Up @@ -615,6 +622,14 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
goto exit_release_mem;
}

snprintf(clk_name, sizeof(clk_name), "ceu%d", pdev->id);
pcdev->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(pcdev->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
err = PTR_ERR(pcdev->clk);
goto exit_free_irq;
}

pcdev->ici.priv = pcdev;
pcdev->ici.dev.parent = &pdev->dev;
pcdev->ici.nr = pdev->id;
Expand All @@ -623,10 +638,12 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)

err = soc_camera_host_register(&pcdev->ici);
if (err)
goto exit_free_irq;
goto exit_free_clk;

return 0;

exit_free_clk:
clk_put(pcdev->clk);
exit_free_irq:
free_irq(pcdev->irq, pcdev);
exit_release_mem:
Expand All @@ -645,6 +662,7 @@ static int sh_mobile_ceu_remove(struct platform_device *pdev)
struct sh_mobile_ceu_dev *pcdev = platform_get_drvdata(pdev);

soc_camera_host_unregister(&pcdev->ici);
clk_put(pcdev->clk);
free_irq(pcdev->irq, pcdev);
if (platform_get_resource(pdev, IORESOURCE_MEM, 1))
dma_release_declared_memory(&pdev->dev);
Expand Down

0 comments on commit 029bcbc

Please sign in to comment.