[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54AEC158.5070109@imgtec.com>
Date: Thu, 8 Jan 2015 14:41:44 -0300
From: Ezequiel Garcia <ezequiel.garcia@...tec.com>
To: Vladimir Zapolskiy <vladimir_zapolskiy@...tor.com>,
Andrew Bresticker <abrestic@...omium.org>,
Thierry Reding <thierry.reding@...il.com>,
"James Hartley" <james.hartley@...tec.com>,
Arnd Bergmann <arnd@...db.de>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
CC: <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pwm@...r.kernel.org>,
Naidu Tellapati <Naidu.Tellapati@...tec.com>,
Sai Masarapu <Sai.Masarapu@...tec.com>
Subject: Re: [PATCH v7 1/4] pwm: Imagination Technologies PWM DAC driver
On 01/08/2015 12:49 PM, Vladimir Zapolskiy wrote:
> Hi Ezequiel,
>
> On 07.01.2015 19:20, Ezequiel Garcia wrote:
>> From: Naidu Tellapati <Naidu.Tellapati@...tec.com>
>>
>> The Pistachio SOC from Imagination Technologies includes a Pulse Width
>> Modulation DAC which produces 1 to 4 digital bit-outputs which represent
>> digital waveforms. These PWM outputs are primarily in charge of controlling
>> backlight LED devices.
>>
>> Reviewed-by: Andrew Bresticker <abrestic@...omium.org>
>> Signed-off-by: Naidu Tellapati <Naidu.Tellapati@...tec.com>
>> Signed-off-by: Sai Masarapu <Sai.Masarapu@...tec.com>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@...tec.com>
>> ---
>> drivers/pwm/Kconfig | 13 +++
>> drivers/pwm/Makefile | 1 +
>> drivers/pwm/pwm-img.c | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 264 insertions(+)
>> create mode 100644 drivers/pwm/pwm-img.c
>>
>
> [snip]
>
>> +static int img_pwm_probe(struct platform_device *pdev)
>> +{
>> + int ret;
>> + struct resource *res;
>> + struct img_pwm_chip *pwm;
>> +
>> + pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>> + if (!pwm)
>> + return -ENOMEM;
>> +
>> + pwm->dev = &pdev->dev;
>> +
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + pwm->base = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR(pwm->base))
>> + return PTR_ERR(pwm->base);
>> +
>> + pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>> + "img,cr-periph");
>> + if (IS_ERR(pwm->periph_regs))
>> + return PTR_ERR(pwm->periph_regs);
>> +
>> + pwm->sys_clk = devm_clk_get(&pdev->dev, "sys");
>> + if (IS_ERR(pwm->sys_clk)) {
>> + dev_err(&pdev->dev, "failed to get system clock\n");
>> + return PTR_ERR(pwm->sys_clk);
>> + }
>> +
>> + pwm->pwm_clk = devm_clk_get(&pdev->dev, "pwm");
>> + if (IS_ERR(pwm->pwm_clk)) {
>> + dev_err(&pdev->dev, "failed to get pwm clock\n");
>> + return PTR_ERR(pwm->pwm_clk);
>> + }
>> +
>> + ret = clk_prepare_enable(pwm->sys_clk);
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "could not prepare or enable sys clock\n");
>> + return ret;
>> + }
>> +
>> + ret = clk_prepare_enable(pwm->pwm_clk);
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "could not prepare or enable pwm clock\n");
>> + goto disable_sysclk;
>> + }
>> +
>> + pwm->chip.dev = &pdev->dev;
>> + pwm->chip.ops = &img_pwm_ops;
>> + pwm->chip.base = -1;
>> + pwm->chip.npwm = 4;
>> +
>> + ret = pwmchip_add(&pwm->chip);
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "pwmchip_add failed: %d\n", ret);
>> + goto disable_pwmclk;
>> + }
>> +
>> + platform_set_drvdata(pdev, pwm);
>> +
>> +disable_pwmclk:
>> + clk_disable_unprepare(pwm->pwm_clk);
>> +disable_sysclk:
>> + clk_disable_unprepare(pwm->sys_clk);
>> +
>> + return 0;
>
> return ret on error paths?
>
> Also should you reenable sys and pwm clocks after successful driver
> registration?
>
Argh, that's definitely bogus. I must have missed it.
Thanks for the catch!
--
Ezequiel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists