From: "Philip, Avinash" <avinashphilip@ti.com>
To: thierry.reding@avionic-design.de, paul@pwsan.com,
tony@atomide.com, linux@arm.linux.org.uk, b-cousson@ti.com
Cc: hvaibhav@ti.com, anilkumar@ti.com, linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
nsekhar@ti.com, gururaja.hebbar@ti.com, "Philip,
Avinash" <avinashphilip@ti.com>
Subject: [PATCH 6/8] pwm: pwm-tiehrpwm: Adding TBCLK gating support.
Date: Mon, 5 Nov 2012 14:42:27 +0530 [thread overview]
Message-ID: <1352106749-9437-7-git-send-email-avinashphilip@ti.com> (raw)
In-Reply-To: <1352106749-9437-1-git-send-email-avinashphilip@ti.com>
Some platforms (like AM33XX) requires clock gating from control module
explicitly. So adding optional TBCLK handling if DT node populated with
tbclkgating. This helps the driver can coexist for Davinci platforms.
Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
---
:100644 100644 1e63652... cf69da3... M drivers/pwm/pwm-tiehrpwm.c
drivers/pwm/pwm-tiehrpwm.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 1e63652..cf69da3 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -123,6 +123,7 @@ struct ehrpwm_pwm_chip {
void __iomem *mmio_base;
unsigned long period_cycles[NUM_PWM_CHANNEL];
enum pwm_polarity polarity[NUM_PWM_CHANNEL];
+ struct clk *tbclk;
};
static inline struct ehrpwm_pwm_chip *to_ehrpwm_pwm_chip(struct pwm_chip *chip)
@@ -461,6 +462,20 @@ static int __devinit ehrpwm_pwm_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
return ret;
}
+
+ /* Some platforms require explicit tbclk gating */
+ if (of_property_read_bool(pdev->dev.of_node, "tbclkgating")) {
+ pc->tbclk = clk_get(&pdev->dev, "tbclk");
+ if (IS_ERR(pc->tbclk)) {
+ dev_err(&pdev->dev, "Could not get EHRPWM TBCLK\n");
+ return PTR_ERR(pc->tbclk);
+ }
+ }
+
+ /* Enable tbclk & leave */
+ if (pc->tbclk)
+ clk_enable(pc->tbclk);
+
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
pwmss_submodule_state_change(pdev->dev.parent, EPWMCLK_EN_SHIFT, true);
@@ -478,6 +493,8 @@ static int __devexit ehrpwm_pwm_remove(struct platform_device *pdev)
pwmss_submodule_state_change(pdev->dev.parent, EPWMCLK_EN_SHIFT, false);
pm_runtime_put_sync(&pdev->dev);
+ if (pc->tbclk)
+ clk_disable(pc->tbclk);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return pwmchip_remove(&pc->chip);
--
1.7.0.4
next prev parent reply other threads:[~2012-11-05 9:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 9:12 [PATCH 0/8] Support for AM33xx PWM Susbsytem Philip, Avinash
2012-11-05 9:12 ` [PATCH 1/8] PWMSS: Add PWM Subsystem driver for parent<->child relationship Philip, Avinash
2012-11-06 6:35 ` Bedia, Vaibhav
[not found] ` <B5906170F1614E41A8A28DE3B8D121433EC0444A-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-07 15:20 ` Philip, Avinash
2012-11-05 9:12 ` [PATCH 2/8] ARM: am33xx: clk: Add optional clock for EHRPWM Philip, Avinash
2012-11-05 9:12 ` [PATCH 3/8] ARM: OMAP: AM33xx hwmod: Add parent-child relationship for PWM subsystem Philip, Avinash
2012-11-06 10:09 ` Bedia, Vaibhav
2012-11-06 13:06 ` Hiremath, Vaibhav
2012-11-05 9:12 ` [PATCH 4/8] pwm: pwm-tiecap: Add device-tree binding support for APWM driver Philip, Avinash
2012-11-05 9:12 ` [PATCH 5/8] pwm: pwm-tiehrpwm: Add device-tree binding support for EHRPWM driver Philip, Avinash
2012-11-06 6:46 ` Bedia, Vaibhav
[not found] ` <B5906170F1614E41A8A28DE3B8D121433EC0447E-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-07 15:20 ` Philip, Avinash
2012-11-05 9:12 ` Philip, Avinash [this message]
2012-11-06 6:46 ` [PATCH 6/8] pwm: pwm-tiehrpwm: Adding TBCLK gating support Bedia, Vaibhav
2012-11-07 15:20 ` Philip, Avinash
2012-11-05 9:12 ` [PATCH 7/8] ARM: dts: AM33XX: Add PWMSS device tree nodes Philip, Avinash
2012-11-05 9:12 ` [PATCH 8/8] ARM: dts: AM33XX: Add PWM backlight DT data to am335x-evm Philip, Avinash
2012-11-06 6:46 ` Bedia, Vaibhav
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=1352106749-9437-7-git-send-email-avinashphilip@ti.com \
--to=avinashphilip@ti.com \
--cc=anilkumar@ti.com \
--cc=b-cousson@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gururaja.hebbar@ti.com \
--cc=hvaibhav@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nsekhar@ti.com \
--cc=paul@pwsan.com \
--cc=thierry.reding@avionic-design.de \
--cc=tony@atomide.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).