From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: Ezequiel Garcia <ezequiel.garcia@imgtec.com>,
Andrew Bresticker <abrestic@chromium.org>,
Thierry Reding <thierry.reding@gmail.com>,
James Hartley <james.hartley@imgtec.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org,
Naidu Tellapati <Naidu.Tellapati@imgtec.com>,
Sai Masarapu <Sai.Masarapu@imgtec.com>
Subject: Re: [PATCH v7 1/4] pwm: Imagination Technologies PWM DAC driver
Date: Thu, 8 Jan 2015 17:49:59 +0200 [thread overview]
Message-ID: <54AEA727.40100@mentor.com> (raw)
In-Reply-To: <1420651215-3836-2-git-send-email-ezequiel.garcia@imgtec.com>
Hi Ezequiel,
On 07.01.2015 19:20, Ezequiel Garcia wrote:
> From: Naidu Tellapati <Naidu.Tellapati@imgtec.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@chromium.org>
> Signed-off-by: Naidu Tellapati <Naidu.Tellapati@imgtec.com>
> Signed-off-by: Sai Masarapu <Sai.Masarapu@imgtec.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.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?
> +}
> +
--
With best wishes,
Vladimir
next prev parent reply other threads:[~2015-01-08 15:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-07 17:20 [PATCH v7 0/4] Imagination Technologies PWM and PDM DACs support Ezequiel Garcia
2015-01-07 17:20 ` [PATCH v7 1/4] pwm: Imagination Technologies PWM DAC driver Ezequiel Garcia
2015-01-08 15:49 ` Vladimir Zapolskiy [this message]
2015-01-08 17:41 ` Ezequiel Garcia
2015-01-07 17:20 ` [PATCH v7 2/4] DT: pwm: Add binding document for IMG PWM DAC Ezequiel Garcia
[not found] ` <1420651215-3836-1-git-send-email-ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-01-07 17:20 ` [PATCH v7 3/4] pdm: Imagination Technologies PDM DAC driver Ezequiel Garcia
2015-01-08 14:21 ` One Thousand Gnomes
2015-01-08 14:25 ` Ezequiel Garcia
2015-01-07 17:20 ` [PATCH v7 4/4] DT: pdm: Add binding document for IMG PDM DAC Ezequiel Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54AEA727.40100@mentor.com \
--to=vladimir_zapolskiy@mentor.com \
--cc=Naidu.Tellapati@imgtec.com \
--cc=Sai.Masarapu@imgtec.com \
--cc=abrestic@chromium.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=ezequiel.garcia@imgtec.com \
--cc=gregkh@linuxfoundation.org \
--cc=james.hartley@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).