devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: bcm-kernel-feedback-list@broadcom.com,
	Thierry Reding <thierry.reding@gmail.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	PWM SUBSYSTEM <linux-pwm@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND..." <devicetree@vger.kernel.org>
Subject: Re: [PATCH 2/2] pwm: Add Broadcom BCM7038 PWM controller support
Date: Fri, 14 Aug 2015 10:40:45 -0700	[thread overview]
Message-ID: <55CE281D.8090104@gmail.com> (raw)
In-Reply-To: <1438908959-1578-3-git-send-email-f.fainelli@gmail.com>

On 06/08/15 17:55, Florian Fainelli wrote:
> Add support for the BCM7038-style PWM controller found in all BCM7xxx STB SoCs.
> This controller has a hardcoded 2 channels per controller, and cascades a
> variable frequency generator on top of a fixed frequency generator which offers
> a range of a 148ns period all the way to ~622ms periods.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

[snip]

> +	/* Try to grab the clock and its rate, if not available, default
> +	 * to the base 27Mhz clock domain this block comes from.
> +	 */
> +	p->clk = devm_clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(p->clk)) {
> +		p->clk = NULL;
> +		p->rate = (unsigned long)of_id->data;
> +	} else {
> +		clk_prepare_enable(p->clk);
> +		p->rate = clk_get_rate(p->clk);
> +	}

Replying to myself here, I have reworked that part to use a helper
function which uses either clk_get_rate() or p->rate because even though
the backing clock for that core is fixed, we could have a variable rate
clock in the future, so fetching an accurate rate would be necessary.

[snip]

> +
> +#ifdef CONFIG_PM_SLEEP
> +static int brcmstb_pwm_suspend(struct device *d)
> +{

And here, we should disable the clock

> +	return 0;
> +}
> +
> +static int brcmstb_pwm_resume(struct device *d)
> +{

And enable it here.

I would still appreciate some feedback on the DT binding and this driver
in general before submitting a v2.

Thanks!
-- 
Florian

  reply	other threads:[~2015-08-14 17:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  0:55 [PATCH 0/2] pwm: Broadcom BCM7xxx PWM support Florian Fainelli
2015-08-07  0:55 ` [PATCH 1/2] Documentation: dt: add Broadcom BCM7038 PWM controller binding Florian Fainelli
2015-08-17 14:49   ` Thierry Reding
2015-08-07  0:55 ` [PATCH 2/2] pwm: Add Broadcom BCM7038 PWM controller support Florian Fainelli
2015-08-14 17:40   ` Florian Fainelli [this message]
2015-08-19  9:52   ` Thierry Reding
2015-08-19 15:18     ` Florian Fainelli

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=55CE281D.8090104@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@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).