Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333092
b: refs/heads/master
c: 140827c
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer authored and Thierry Reding committed Sep 12, 2012
1 parent fed626d commit b5c3af0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 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: 19e73333236a6115617f8ffb4cc290bdb6f2865a
refs/heads/master: 140827c148f2f3a95fdcec5310f6cd980139b383
25 changes: 11 additions & 14 deletions trunk/drivers/pwm/pwm-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
struct imx_chip {
struct clk *clk;

int clk_enabled;
int enabled;
void __iomem *mmio_base;

struct pwm_chip chip;
Expand Down Expand Up @@ -139,14 +139,15 @@ static int imx_pwm_config(struct pwm_chip *chip,
static int imx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
{
struct imx_chip *imx = to_imx_chip(chip);
int rc = 0;
int ret;

if (!imx->clk_enabled) {
rc = clk_prepare_enable(imx->clk);
if (!rc)
imx->clk_enabled = 1;
}
return rc;
ret = clk_prepare_enable(imx->clk);
if (ret)
return ret;

imx->enabled = 1;

return 0;
}

static void imx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
Expand All @@ -155,10 +156,8 @@ static void imx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)

writel(0, imx->mmio_base + MX3_PWMCR);

if (imx->clk_enabled) {
clk_disable_unprepare(imx->clk);
imx->clk_enabled = 0;
}
clk_disable_unprepare(imx->clk);
imx->enabled = 0;
}

static struct pwm_ops imx_pwm_ops = {
Expand Down Expand Up @@ -190,8 +189,6 @@ static int __devinit imx_pwm_probe(struct platform_device *pdev)
imx->chip.base = -1;
imx->chip.npwm = 1;

imx->clk_enabled = 0;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) {
dev_err(&pdev->dev, "no memory resource defined\n");
Expand Down

0 comments on commit b5c3af0

Please sign in to comment.