mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
pwm: Changes for v3.9-rc1
A new driver has been added to support the PWM mode of the timer counter blocks found on Atmel AT91 SoCs. The VT8500 driver now supports changing the PWM signal polarity and the TI drivers (EHRPWM and ECAP) gained suspend and resume functionality. User drivers can now query the core for whether access to a PWM device will sleep (if the PWM chip is on a slow bus such as I2C or SPI). The pwm-backlight driver now handles the backlight BL_CORE_FBBLANK state in addition to the FB layer's blanking states. To round things off, a few fixes and cleanups are also included. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJRKxfbAAoJEN0jrNd/PrOhcwEP/0plVf30QDMhcan1GR3l+jmK 3Q/cCNIWEZ75mRu+FtVYKUOduxkCOHR6LM4C2ScGnnpsS/X5oitc45FrblIwQaEI UeWVxDqI+pEp+rCdYVCND4lih60FJU0Cct0zZL2db4D4idF+8FRChhzwzSXhajnj ZZqz782Y2ig3YTLHtVGT1pp61DKxdu1Gz4U+fxo4G1/fnkquCYDzbCQovcmPSnnF gYB8hfxgT9JIt2cHrK6eKCHBF/4GToU+x5zDV2Ub15C2K/UQ+qgw82yl8MNd/ZS5 rFA06iW3icnJRRc8u6hu9WVjNVNTBrUqUlFhctNB01d5jF4R6uR6aEvovT9xe8NW Wa5v5WrjnL6SWpZVwb/3kwwJmkeU9zKESQt5KUw3VKnT8yr2BfxcH1gJIiuW6wK7 uYqknAvt2rwMEGzaKZJmQH682wNMxpJirs8hG9VjJc/v7AOnk6586HbRupAq8wWZ qK4n1Fto9RCg+b6e/hDId7+mN1GEcA5B8BOotPQ6ud+cinDZBKSbCSHhQG2LQ++F m81BbL82H2R2ICRoYNA74/bKq5OVOFFqHLHg5bUrG7ikdNbYOTK/4dF9qSS7DnT3 Bi6WnKpOtfpWbHBnDunP2vBFo3f+gXmbLJdgarxk7mneV8wp0GY6TYI1awWn0hI9 82JP3yiK5kW2JZv92o0H =Fcxi -----END PGP SIGNATURE----- Merge tag 'for-3.9-rc1' of git://gitorious.org/linux-pwm/linux-pwm Pull PWM changes from Thierry Reding: "A new driver has been added to support the PWM mode of the timer counter blocks found on Atmel AT91 SoCs. The VT8500 driver now supports changing the PWM signal polarity and the TI drivers (EHRPWM and ECAP) gained suspend and resume functionality. User drivers can now query the core for whether access to a PWM device will sleep (if the PWM chip is on a slow bus such as I2C or SPI). The pwm-backlight driver now handles the backlight BL_CORE_FBBLANK state in addition to the FB layer's blanking states. To round things off, a few fixes and cleanups are also included" * tag 'for-3.9-rc1' of git://gitorious.org/linux-pwm/linux-pwm: pwm: twl: Use to_twl() instead of container_of() pwm: tegra: assume CONFIG_OF pwm_backlight: Validate dft_brightness in main probe function pwm: Export pwm_{set,get}_chip_data() pwm: Make Kconfig entries more consistent pwm: Add can_sleep property to drivers pwm: Add pwm_can_sleep() as exported API to users pwm-backlight: handle BL_CORE_FBBLANK state pwm: pwm-tiecap: Low power sleep support pwm: pwm-tiehrpwm: Low power sleep support pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver pwm: vt8500: Add polarity support pwm: vt8500: Register write busy test performed incorrectly pwm: atmel: add Timer Counter Block PWM driver
This commit is contained in:
commit
3eb05225ee
14 changed files with 741 additions and 42 deletions
|
@ -41,10 +41,17 @@
|
|||
#define ECCTL2_SYNC_SEL_DISA (BIT(7) | BIT(6))
|
||||
#define ECCTL2_TSCTR_FREERUN BIT(4)
|
||||
|
||||
struct ecap_context {
|
||||
u32 cap3;
|
||||
u32 cap4;
|
||||
u16 ecctl2;
|
||||
};
|
||||
|
||||
struct ecap_pwm_chip {
|
||||
struct pwm_chip chip;
|
||||
unsigned int clk_rate;
|
||||
void __iomem *mmio_base;
|
||||
struct ecap_context ctx;
|
||||
};
|
||||
|
||||
static inline struct ecap_pwm_chip *to_ecap_pwm_chip(struct pwm_chip *chip)
|
||||
|
@ -288,11 +295,57 @@ static int ecap_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&pc->chip);
|
||||
}
|
||||
|
||||
void ecap_pwm_save_context(struct ecap_pwm_chip *pc)
|
||||
{
|
||||
pm_runtime_get_sync(pc->chip.dev);
|
||||
pc->ctx.ecctl2 = readw(pc->mmio_base + ECCTL2);
|
||||
pc->ctx.cap4 = readl(pc->mmio_base + CAP4);
|
||||
pc->ctx.cap3 = readl(pc->mmio_base + CAP3);
|
||||
pm_runtime_put_sync(pc->chip.dev);
|
||||
}
|
||||
|
||||
void ecap_pwm_restore_context(struct ecap_pwm_chip *pc)
|
||||
{
|
||||
writel(pc->ctx.cap3, pc->mmio_base + CAP3);
|
||||
writel(pc->ctx.cap4, pc->mmio_base + CAP4);
|
||||
writew(pc->ctx.ecctl2, pc->mmio_base + ECCTL2);
|
||||
}
|
||||
|
||||
static int ecap_pwm_suspend(struct device *dev)
|
||||
{
|
||||
struct ecap_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
struct pwm_device *pwm = pc->chip.pwms;
|
||||
|
||||
ecap_pwm_save_context(pc);
|
||||
|
||||
/* Disable explicitly if PWM is running */
|
||||
if (test_bit(PWMF_ENABLED, &pwm->flags))
|
||||
pm_runtime_put_sync(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ecap_pwm_resume(struct device *dev)
|
||||
{
|
||||
struct ecap_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
struct pwm_device *pwm = pc->chip.pwms;
|
||||
|
||||
/* Enable explicitly if PWM was running */
|
||||
if (test_bit(PWMF_ENABLED, &pwm->flags))
|
||||
pm_runtime_get_sync(dev);
|
||||
|
||||
ecap_pwm_restore_context(pc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ecap_pwm_pm_ops, ecap_pwm_suspend, ecap_pwm_resume);
|
||||
|
||||
static struct platform_driver ecap_pwm_driver = {
|
||||
.driver = {
|
||||
.name = "ecap",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = ecap_of_match,
|
||||
.pm = &ecap_pwm_pm_ops,
|
||||
},
|
||||
.probe = ecap_pwm_probe,
|
||||
.remove = ecap_pwm_remove,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue