diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-19 22:07:07 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-19 22:07:07 +0800 |
commit | c0b59fafe31bf91f589736be304d739b13952fdd (patch) | |
tree | 0088a41c6b68132739294643be06734e3af67677 /drivers/media/rc/img-ir/img-ir-core.c | |
parent | 28bceeaaf81140d69647acd0eb7dc9312f27844a (diff) | |
parent | bfa1ce5f38938cc9e6c7f2d1011f88eba2b9e2b2 (diff) | |
download | blackbird-obmc-linux-c0b59fafe31bf91f589736be304d739b13952fdd.tar.gz blackbird-obmc-linux-c0b59fafe31bf91f589736be304d739b13952fdd.zip |
Merge branch 'mvebu/drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Merge the mvebu/drivers branch of the arm-soc tree which contains
just a single patch bfa1ce5f38938cc9e6c7f2d1011f88eba2b9e2b2 ("bus:
mvebu-mbus: add mv_mbus_dram_info_nooverlap()") that happens to be
a prerequisite of the new marvell/cesa crypto driver.
Diffstat (limited to 'drivers/media/rc/img-ir/img-ir-core.c')
-rw-r--r-- | drivers/media/rc/img-ir/img-ir-core.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c index 77c78de4f5bf..03fe080278df 100644 --- a/drivers/media/rc/img-ir/img-ir-core.c +++ b/drivers/media/rc/img-ir/img-ir-core.c @@ -110,16 +110,32 @@ static int img_ir_probe(struct platform_device *pdev) priv->clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(priv->clk)) dev_warn(&pdev->dev, "cannot get core clock resource\n"); + + /* Get sys clock */ + priv->sys_clk = devm_clk_get(&pdev->dev, "sys"); + if (IS_ERR(priv->sys_clk)) + dev_warn(&pdev->dev, "cannot get sys clock resource\n"); /* - * The driver doesn't need to know about the system ("sys") or power - * modulation ("mod") clocks yet + * Enabling the system clock before the register interface is + * accessed. ISR shouldn't get called with Sys Clock disabled, + * hence exiting probe with an error. */ + if (!IS_ERR(priv->sys_clk)) { + error = clk_prepare_enable(priv->sys_clk); + if (error) { + dev_err(&pdev->dev, "cannot enable sys clock\n"); + return error; + } + } /* Set up raw & hw decoder */ error = img_ir_probe_raw(priv); error2 = img_ir_probe_hw(priv); - if (error && error2) - return (error == -ENODEV) ? error2 : error; + if (error && error2) { + if (error == -ENODEV) + error = error2; + goto err_probe; + } /* Get the IRQ */ priv->irq = irq; @@ -139,6 +155,9 @@ static int img_ir_probe(struct platform_device *pdev) err_irq: img_ir_remove_hw(priv); img_ir_remove_raw(priv); +err_probe: + if (!IS_ERR(priv->sys_clk)) + clk_disable_unprepare(priv->sys_clk); return error; } @@ -146,12 +165,14 @@ static int img_ir_remove(struct platform_device *pdev) { struct img_ir_priv *priv = platform_get_drvdata(pdev); - free_irq(priv->irq, img_ir_isr); + free_irq(priv->irq, priv); img_ir_remove_hw(priv); img_ir_remove_raw(priv); if (!IS_ERR(priv->clk)) clk_disable_unprepare(priv->clk); + if (!IS_ERR(priv->sys_clk)) + clk_disable_unprepare(priv->sys_clk); return 0; } |