forked from luck/tmp_suning_uos_patched
pwm: Changes for v3.10-rc1
Nothing very exciting this time around. A couple of bug fixes and a lot of cleanup across the board. The DaVinci 8xx family of SoCs now use the same driver as the AM33xx family. Many thanks to Axel Lin and Jingoo Han who have done a great job fixing various bugs and inconsistencies. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJRh4d9AAoJEN0jrNd/PrOhuN4P/3lAzscIkLhEqtJWlnrdvd4p uykggdqCgm7+tsUbXy8wICE4eSthDAoI48RTTfa/AP2KWIaF067r+HQXCqm/Stfs fKaoViplF5flRmbZQytkN1Ou9LKDvjtnmFrDN5+VU5Y15Dqxjk5dQz0OrfqL9a3f P8mH8EstjF9aoi2dd2hGft3nmsP4L4C6gNTkVim3K/jHwwh6elxn2ooBLhhKdcFB W7wQkvi8N190rnGlWUI1Y/uNbdxIE6VZdH56rxFIR9f9oHQPAU1wElnv/amuSYOe FSsJ/GAbYUXrgPWsTTd3drJrOS6BQ/2Q2fPY3ZcnfNlnSaWAy0pigVMC4Tc2MTIO yScrAyh7pMRtmFxsyJpW9lV0r3DMhEY97pjiSpF08tbrx6nCq8aBGvv5jrCGFUcD t8GkwSpDQcIRY0L/W+kJH6q0hteu2cz8khVrOvwlgNwPs9yDUSwPDB/0OT+zmXOD FFR350B0uZcg7Oi58JAKvKzZJmYa1LN3cbe5pznjIMf9bouO2hhGbPvvqxgRI96x iNV5ldGHjaLygyCnWeI/s85OQKHjUQBmrfmQotHzRPQTuGoy+/z5rSAjyOUbx2Sn AuZYY5haZdw5wacLJ7HuFoSZWjs37D9/YH8VlWXsEDpSPgt/2JgWCVpNa+1dP/pP atYCTNmfyC7QsbnysrTM =vWg1 -----END PGP SIGNATURE----- Merge tag 'for-3.10-rc1' of git://gitorious.org/linux-pwm/linux-pwm Pull pwm changes from Thierry Reding: "Nothing very exciting this time around. A couple of bug fixes and a lot of cleanup across the board. The DaVinci 8xx family of SoCs now use the same driver as the AM33xx family. Many thanks to Axel Lin and Jingoo Han who have done a great job fixing various bugs and inconsistencies." * tag 'for-3.10-rc1' of git://gitorious.org/linux-pwm/linux-pwm: (27 commits) pwm: lpc32xx: Don't change PWM_ENABLE bit in lpc32xx_pwm_config pwm: lpc32xx: Properly set PWM_ENABLE bit in lpc32xx_pwm_[enable|disable] pwm: Constify OF match tables pwm: pwm-tiehrpwm: Update device-tree binding document pwm: pwm-tiecap: Update device-tree binding document pwm: puv3: Remove unused enabled filed from struct puv3_pwm_chip pwm: pxa: Remove PWM_ID_BASE macro pwm: spear: Remove unused *dev from struct spear_pwm_chip pwm: mxs: Remove unused *dev from struct mxs_pwm_chip pwm: twl: Return proper error if twl6030_pwm_enable() fails pwm: pxa: Remove clk_enabled field from struct pxa_pwm_chip pwm: imx: Remove enabled field from struct imx_chip pwm: twl: Add .owner to struct pwm_ops pwm: twl-led: Add .owner to struct pwm_ops pwm: atmel-tcb: Add .owner to struct pwm_ops pwm: ab8500: Add .owner to struct pwm_ops pwm: spear: Fix checking return value of clk_enable() and clk_prepare() pwm: tiehrpwm: Staticize non-exported symbols pwm: tiecap: Staticize non-exported symbols pwm: ab8500: Fix trivial typo in dev_err message ...
This commit is contained in:
commit
f87bb9ee62
|
@ -1,7 +1,9 @@
|
|||
TI SOC ECAP based APWM controller
|
||||
|
||||
Required properties:
|
||||
- compatible: Must be "ti,am33xx-ecap"
|
||||
- compatible: Must be "ti,<soc>-ecap".
|
||||
for am33xx - compatible = "ti,am33xx-ecap";
|
||||
for da850 - compatible = "ti,da850-ecap", "ti,am33xx-ecap";
|
||||
- #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
|
||||
First cell specifies the per-chip index of the PWM to use, the second
|
||||
cell is the period in nanoseconds and bit 0 in the third cell is used to
|
||||
|
@ -15,9 +17,15 @@ Optional properties:
|
|||
|
||||
Example:
|
||||
|
||||
ecap0: ecap@0 {
|
||||
ecap0: ecap@0 { /* ECAP on am33xx */
|
||||
compatible = "ti,am33xx-ecap";
|
||||
#pwm-cells = <3>;
|
||||
reg = <0x48300100 0x80>;
|
||||
ti,hwmods = "ecap0";
|
||||
};
|
||||
|
||||
ecap0: ecap@0 { /* ECAP on da850 */
|
||||
compatible = "ti,da850-ecap", "ti,am33xx-ecap";
|
||||
#pwm-cells = <3>;
|
||||
reg = <0x306000 0x80>;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
TI SOC EHRPWM based PWM controller
|
||||
|
||||
Required properties:
|
||||
- compatible : Must be "ti,am33xx-ehrpwm"
|
||||
- compatible: Must be "ti,<soc>-ehrpwm".
|
||||
for am33xx - compatible = "ti,am33xx-ehrpwm";
|
||||
for da850 - compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
|
||||
- #pwm-cells: Should be 3. Number of cells being used to specify PWM property.
|
||||
First cell specifies the per-chip index of the PWM to use, the second
|
||||
cell is the period in nanoseconds and bit 0 in the third cell is used to
|
||||
|
@ -15,9 +17,15 @@ Optional properties:
|
|||
|
||||
Example:
|
||||
|
||||
ehrpwm0: ehrpwm@0 {
|
||||
ehrpwm0: ehrpwm@0 { /* EHRPWM on am33xx */
|
||||
compatible = "ti,am33xx-ehrpwm";
|
||||
#pwm-cells = <3>;
|
||||
reg = <0x48300200 0x100>;
|
||||
ti,hwmods = "ehrpwm0";
|
||||
};
|
||||
|
||||
ehrpwm0: ehrpwm@0 { /* EHRPWM on da850 */
|
||||
compatible = "ti,da850-ehrpwm", "ti,am33xx-ehrpwm";
|
||||
#pwm-cells = <3>;
|
||||
reg = <0x300000 0x2000>;
|
||||
};
|
||||
|
|
|
@ -147,8 +147,7 @@ config PWM_TEGRA
|
|||
|
||||
config PWM_TIECAP
|
||||
tristate "ECAP PWM support"
|
||||
depends on SOC_AM33XX
|
||||
select PWM_TIPWMSS
|
||||
depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
|
||||
help
|
||||
PWM driver support for the ECAP APWM controller found on AM33XX
|
||||
TI SOC
|
||||
|
@ -158,8 +157,7 @@ config PWM_TIECAP
|
|||
|
||||
config PWM_TIEHRPWM
|
||||
tristate "EHRPWM PWM support"
|
||||
depends on SOC_AM33XX
|
||||
select PWM_TIPWMSS
|
||||
depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
|
||||
help
|
||||
PWM driver support for the EHRPWM controller found on AM33XX
|
||||
TI SOC
|
||||
|
@ -169,7 +167,7 @@ config PWM_TIEHRPWM
|
|||
|
||||
config PWM_TIPWMSS
|
||||
bool
|
||||
depends on SOC_AM33XX && (PWM_TIEHRPWM || PWM_TIECAP)
|
||||
default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM)
|
||||
help
|
||||
PWM Subsystem driver support for AM33xx SOC.
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ static int ab8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
|||
AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
|
||||
1 << (chip->base - 1), ENABLE_PWM);
|
||||
if (ret < 0)
|
||||
dev_err(chip->dev, "%s: Failed to disable PWM, Error %d\n",
|
||||
dev_err(chip->dev, "%s: Failed to enable PWM, Error %d\n",
|
||||
pwm->label, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ static const struct pwm_ops ab8500_pwm_ops = {
|
|||
.config = ab8500_pwm_config,
|
||||
.enable = ab8500_pwm_enable,
|
||||
.disable = ab8500_pwm_disable,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int ab8500_pwm_probe(struct platform_device *pdev)
|
||||
|
@ -99,7 +100,7 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
|
|||
* Nothing to be done in probe, this is required to get the
|
||||
* device which is required for ab8500 read and write
|
||||
*/
|
||||
ab8500 = kzalloc(sizeof(*ab8500), GFP_KERNEL);
|
||||
ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
|
||||
if (ab8500 == NULL) {
|
||||
dev_err(&pdev->dev, "failed to allocate memory\n");
|
||||
return -ENOMEM;
|
||||
|
@ -111,10 +112,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
|
|||
ab8500->chip.npwm = 1;
|
||||
|
||||
err = pwmchip_add(&ab8500->chip);
|
||||
if (err < 0) {
|
||||
kfree(ab8500);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
dev_dbg(&pdev->dev, "pwm probe successful\n");
|
||||
platform_set_drvdata(pdev, ab8500);
|
||||
|
@ -132,7 +131,6 @@ static int ab8500_pwm_remove(struct platform_device *pdev)
|
|||
return err;
|
||||
|
||||
dev_dbg(&pdev->dev, "pwm driver removed\n");
|
||||
kfree(ab8500);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -358,6 +358,7 @@ static const struct pwm_ops atmel_tcb_pwm_ops = {
|
|||
.set_polarity = atmel_tcb_pwm_set_polarity,
|
||||
.enable = atmel_tcb_pwm_enable,
|
||||
.disable = atmel_tcb_pwm_disable,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int atmel_tcb_pwm_probe(struct platform_device *pdev)
|
||||
|
|
|
@ -43,7 +43,6 @@ struct imx_chip {
|
|||
struct clk *clk_per;
|
||||
struct clk *clk_ipg;
|
||||
|
||||
int enabled;
|
||||
void __iomem *mmio_base;
|
||||
|
||||
struct pwm_chip chip;
|
||||
|
@ -135,7 +134,7 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
|
|||
MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
|
||||
MX3_PWMCR_DBGEN | MX3_PWMCR_CLKSRC_IPG_HIGH;
|
||||
|
||||
if (imx->enabled)
|
||||
if (test_bit(PWMF_ENABLED, &pwm->flags))
|
||||
cr |= MX3_PWMCR_EN;
|
||||
|
||||
writel(cr, imx->mmio_base + MX3_PWMCR);
|
||||
|
@ -186,8 +185,6 @@ static int imx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
|||
|
||||
imx->set_enable(chip, true);
|
||||
|
||||
imx->enabled = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -198,7 +195,6 @@ static void imx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
|
|||
imx->set_enable(chip, false);
|
||||
|
||||
clk_disable_unprepare(imx->clk_per);
|
||||
imx->enabled = 0;
|
||||
}
|
||||
|
||||
static struct pwm_ops imx_pwm_ops = {
|
||||
|
|
|
@ -37,6 +37,7 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
|
||||
unsigned long long c;
|
||||
int period_cycles, duty_cycles;
|
||||
u32 val;
|
||||
|
||||
c = clk_get_rate(lpc32xx->clk) / 256;
|
||||
c = c * period_ns;
|
||||
|
@ -68,8 +69,10 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
c = 255;
|
||||
duty_cycles = 256 - c;
|
||||
|
||||
writel(PWM_ENABLE | PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles),
|
||||
lpc32xx->base + (pwm->hwpwm << 2));
|
||||
val = readl(lpc32xx->base + (pwm->hwpwm << 2));
|
||||
val &= ~0xFFFF;
|
||||
val |= PWM_RELOADV(period_cycles) | PWM_DUTY(duty_cycles);
|
||||
writel(val, lpc32xx->base + (pwm->hwpwm << 2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,15 +80,29 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
static int lpc32xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
{
|
||||
struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
|
||||
u32 val;
|
||||
int ret;
|
||||
|
||||
return clk_enable(lpc32xx->clk);
|
||||
ret = clk_enable(lpc32xx->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
val = readl(lpc32xx->base + (pwm->hwpwm << 2));
|
||||
val |= PWM_ENABLE;
|
||||
writel(val, lpc32xx->base + (pwm->hwpwm << 2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lpc32xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
{
|
||||
struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip);
|
||||
u32 val;
|
||||
|
||||
val = readl(lpc32xx->base + (pwm->hwpwm << 2));
|
||||
val &= ~PWM_ENABLE;
|
||||
writel(val, lpc32xx->base + (pwm->hwpwm << 2));
|
||||
|
||||
writel(0, lpc32xx->base + (pwm->hwpwm << 2));
|
||||
clk_disable(lpc32xx->clk);
|
||||
}
|
||||
|
||||
|
@ -145,7 +162,7 @@ static int lpc32xx_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&lpc32xx->chip);
|
||||
}
|
||||
|
||||
static struct of_device_id lpc32xx_pwm_dt_ids[] = {
|
||||
static const struct of_device_id lpc32xx_pwm_dt_ids[] = {
|
||||
{ .compatible = "nxp,lpc3220-pwm", },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
struct mxs_pwm_chip {
|
||||
struct pwm_chip chip;
|
||||
struct device *dev;
|
||||
struct clk *clk;
|
||||
void __iomem *base;
|
||||
};
|
||||
|
@ -166,7 +165,6 @@ static int mxs_pwm_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
mxs->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, mxs);
|
||||
|
||||
stmp_reset_block(mxs->base);
|
||||
|
@ -181,7 +179,7 @@ static int mxs_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&mxs->chip);
|
||||
}
|
||||
|
||||
static struct of_device_id mxs_pwm_dt_ids[] = {
|
||||
static const struct of_device_id mxs_pwm_dt_ids[] = {
|
||||
{ .compatible = "fsl,imx23-pwm", },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
|
@ -27,7 +27,6 @@ struct puv3_pwm_chip {
|
|||
struct pwm_chip chip;
|
||||
void __iomem *base;
|
||||
struct clk *clk;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
static inline struct puv3_pwm_chip *to_puv3(struct pwm_chip *chip)
|
||||
|
|
|
@ -23,14 +23,13 @@
|
|||
#include <asm/div64.h>
|
||||
|
||||
#define HAS_SECONDARY_PWM 0x10
|
||||
#define PWM_ID_BASE(d) ((d) & 0xf)
|
||||
|
||||
static const struct platform_device_id pwm_id_table[] = {
|
||||
/* PWM has_secondary_pwm? */
|
||||
{ "pxa25x-pwm", 0 },
|
||||
{ "pxa27x-pwm", 0 | HAS_SECONDARY_PWM },
|
||||
{ "pxa168-pwm", 1 },
|
||||
{ "pxa910-pwm", 1 },
|
||||
{ "pxa27x-pwm", HAS_SECONDARY_PWM },
|
||||
{ "pxa168-pwm", 0 },
|
||||
{ "pxa910-pwm", 0 },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, pwm_id_table);
|
||||
|
@ -48,7 +47,6 @@ struct pxa_pwm_chip {
|
|||
struct device *dev;
|
||||
|
||||
struct clk *clk;
|
||||
int clk_enabled;
|
||||
void __iomem *mmio_base;
|
||||
};
|
||||
|
||||
|
@ -108,24 +106,15 @@ static int pxa_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||
static int pxa_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
{
|
||||
struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip);
|
||||
int rc = 0;
|
||||
|
||||
if (!pc->clk_enabled) {
|
||||
rc = clk_prepare_enable(pc->clk);
|
||||
if (!rc)
|
||||
pc->clk_enabled++;
|
||||
}
|
||||
return rc;
|
||||
return clk_prepare_enable(pc->clk);
|
||||
}
|
||||
|
||||
static void pxa_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
{
|
||||
struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip);
|
||||
|
||||
if (pc->clk_enabled) {
|
||||
clk_disable_unprepare(pc->clk);
|
||||
pc->clk_enabled--;
|
||||
}
|
||||
clk_disable_unprepare(pc->clk);
|
||||
}
|
||||
|
||||
static struct pwm_ops pxa_pwm_ops = {
|
||||
|
@ -152,8 +141,6 @@ static int pwm_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(pwm->clk))
|
||||
return PTR_ERR(pwm->clk);
|
||||
|
||||
pwm->clk_enabled = 0;
|
||||
|
||||
pwm->chip.dev = &pdev->dev;
|
||||
pwm->chip.ops = &pxa_pwm_ops;
|
||||
pwm->chip.base = -1;
|
||||
|
|
|
@ -289,10 +289,10 @@ static int s3c_pwm_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int s3c_pwm_suspend(struct device *dev)
|
||||
{
|
||||
struct s3c_chip *s3c = platform_get_drvdata(pdev);
|
||||
struct s3c_chip *s3c = dev_get_drvdata(dev);
|
||||
|
||||
/* No one preserve these values during suspend so reset them
|
||||
* Otherwise driver leaves PWM unconfigured if same values
|
||||
|
@ -304,9 +304,9 @@ static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int s3c_pwm_resume(struct platform_device *pdev)
|
||||
static int s3c_pwm_resume(struct device *dev)
|
||||
{
|
||||
struct s3c_chip *s3c = platform_get_drvdata(pdev);
|
||||
struct s3c_chip *s3c = dev_get_drvdata(dev);
|
||||
unsigned long tcon;
|
||||
|
||||
/* Restore invertion */
|
||||
|
@ -316,21 +316,19 @@ static int s3c_pwm_resume(struct platform_device *pdev)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#define s3c_pwm_suspend NULL
|
||||
#define s3c_pwm_resume NULL
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(s3c_pwm_pm_ops, s3c_pwm_suspend,
|
||||
s3c_pwm_resume);
|
||||
|
||||
static struct platform_driver s3c_pwm_driver = {
|
||||
.driver = {
|
||||
.name = "s3c24xx-pwm",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &s3c_pwm_pm_ops,
|
||||
},
|
||||
.probe = s3c_pwm_probe,
|
||||
.remove = s3c_pwm_remove,
|
||||
.suspend = s3c_pwm_suspend,
|
||||
.resume = s3c_pwm_resume,
|
||||
};
|
||||
|
||||
static int __init pwm_init(void)
|
||||
|
|
|
@ -49,13 +49,11 @@
|
|||
* @mmio_base: base address of pwm chip
|
||||
* @clk: pointer to clk structure of pwm chip
|
||||
* @chip: linux pwm chip representation
|
||||
* @dev: pointer to device structure of pwm chip
|
||||
*/
|
||||
struct spear_pwm_chip {
|
||||
void __iomem *mmio_base;
|
||||
struct clk *clk;
|
||||
struct pwm_chip chip;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
static inline struct spear_pwm_chip *to_spear_pwm_chip(struct pwm_chip *chip)
|
||||
|
@ -143,7 +141,7 @@ static int spear_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
|||
u32 val;
|
||||
|
||||
rc = clk_enable(pc->clk);
|
||||
if (!rc)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
val = spear_pwm_readl(pc, pwm->hwpwm, PWMCR);
|
||||
|
@ -200,7 +198,6 @@ static int spear_pwm_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(pc->clk))
|
||||
return PTR_ERR(pc->clk);
|
||||
|
||||
pc->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, pc);
|
||||
|
||||
pc->chip.dev = &pdev->dev;
|
||||
|
@ -209,12 +206,12 @@ static int spear_pwm_probe(struct platform_device *pdev)
|
|||
pc->chip.npwm = NUM_PWM;
|
||||
|
||||
ret = clk_prepare(pc->clk);
|
||||
if (!ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (of_device_is_compatible(np, "st,spear1340-pwm")) {
|
||||
ret = clk_enable(pc->clk);
|
||||
if (!ret) {
|
||||
if (ret) {
|
||||
clk_unprepare(pc->clk);
|
||||
return ret;
|
||||
}
|
||||
|
@ -251,7 +248,7 @@ static int spear_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&pc->chip);
|
||||
}
|
||||
|
||||
static struct of_device_id spear_pwm_of_match[] = {
|
||||
static const struct of_device_id spear_pwm_of_match[] = {
|
||||
{ .compatible = "st,spear320-pwm" },
|
||||
{ .compatible = "st,spear1340-pwm" },
|
||||
{ }
|
||||
|
|
|
@ -233,7 +233,7 @@ static int tegra_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&pc->chip);
|
||||
}
|
||||
|
||||
static struct of_device_id tegra_pwm_of_match[] = {
|
||||
static const struct of_device_id tegra_pwm_of_match[] = {
|
||||
{ .compatible = "nvidia,tegra20-pwm" },
|
||||
{ .compatible = "nvidia,tegra30-pwm" },
|
||||
{ }
|
||||
|
|
|
@ -295,7 +295,7 @@ static int ecap_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&pc->chip);
|
||||
}
|
||||
|
||||
void ecap_pwm_save_context(struct ecap_pwm_chip *pc)
|
||||
static 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);
|
||||
|
@ -304,13 +304,14 @@ void ecap_pwm_save_context(struct ecap_pwm_chip *pc)
|
|||
pm_runtime_put_sync(pc->chip.dev);
|
||||
}
|
||||
|
||||
void ecap_pwm_restore_context(struct ecap_pwm_chip *pc)
|
||||
static 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);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int ecap_pwm_suspend(struct device *dev)
|
||||
{
|
||||
struct ecap_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
|
@ -337,6 +338,7 @@ static int ecap_pwm_resume(struct device *dev)
|
|||
ecap_pwm_restore_context(pc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ecap_pwm_pm_ops, ecap_pwm_suspend, ecap_pwm_resume);
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ static int ehrpwm_pwm_remove(struct platform_device *pdev)
|
|||
return pwmchip_remove(&pc->chip);
|
||||
}
|
||||
|
||||
void ehrpwm_pwm_save_context(struct ehrpwm_pwm_chip *pc)
|
||||
static void ehrpwm_pwm_save_context(struct ehrpwm_pwm_chip *pc)
|
||||
{
|
||||
pm_runtime_get_sync(pc->chip.dev);
|
||||
pc->ctx.tbctl = ehrpwm_read(pc->mmio_base, TBCTL);
|
||||
|
@ -547,7 +547,7 @@ void ehrpwm_pwm_save_context(struct ehrpwm_pwm_chip *pc)
|
|||
pm_runtime_put_sync(pc->chip.dev);
|
||||
}
|
||||
|
||||
void ehrpwm_pwm_restore_context(struct ehrpwm_pwm_chip *pc)
|
||||
static void ehrpwm_pwm_restore_context(struct ehrpwm_pwm_chip *pc)
|
||||
{
|
||||
ehrpwm_write(pc->mmio_base, TBPRD, pc->ctx.tbprd);
|
||||
ehrpwm_write(pc->mmio_base, CMPA, pc->ctx.cmpa);
|
||||
|
@ -559,6 +559,7 @@ void ehrpwm_pwm_restore_context(struct ehrpwm_pwm_chip *pc)
|
|||
ehrpwm_write(pc->mmio_base, TBCTL, pc->ctx.tbctl);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int ehrpwm_pwm_suspend(struct device *dev)
|
||||
{
|
||||
struct ehrpwm_pwm_chip *pc = dev_get_drvdata(dev);
|
||||
|
@ -594,6 +595,7 @@ static int ehrpwm_pwm_resume(struct device *dev)
|
|||
ehrpwm_pwm_restore_context(pc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ehrpwm_pwm_pm_ops, ehrpwm_pwm_suspend,
|
||||
ehrpwm_pwm_resume);
|
||||
|
|
|
@ -101,6 +101,7 @@ static int pwmss_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int pwmss_suspend(struct device *dev)
|
||||
{
|
||||
struct pwmss_info *info = dev_get_drvdata(dev);
|
||||
|
@ -118,6 +119,7 @@ static int pwmss_resume(struct device *dev)
|
|||
writew(info->pwmss_clkconfig, info->mmio_base + PWMSS_CLKCONFIG);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(pwmss_pm_ops, pwmss_suspend, pwmss_resume);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#ifndef __TIPWMSS_H
|
||||
#define __TIPWMSS_H
|
||||
|
||||
#ifdef CONFIG_PWM_TIPWMSS
|
||||
/* PWM substem clock gating */
|
||||
#define PWMSS_ECAPCLK_EN BIT(0)
|
||||
#define PWMSS_ECAPCLK_STOP_REQ BIT(1)
|
||||
|
@ -28,6 +27,7 @@
|
|||
#define PWMSS_ECAPCLK_EN_ACK BIT(0)
|
||||
#define PWMSS_EPWMCLK_EN_ACK BIT(8)
|
||||
|
||||
#ifdef CONFIG_PWM_TIPWMSS
|
||||
extern u16 pwmss_submodule_state_change(struct device *dev, int set);
|
||||
#else
|
||||
static inline u16 pwmss_submodule_state_change(struct device *dev, int set)
|
||||
|
|
|
@ -271,6 +271,7 @@ static const struct pwm_ops twl4030_pwmled_ops = {
|
|||
.enable = twl4030_pwmled_enable,
|
||||
.disable = twl4030_pwmled_disable,
|
||||
.config = twl4030_pwmled_config,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct pwm_ops twl6030_pwmled_ops = {
|
||||
|
@ -279,6 +280,7 @@ static const struct pwm_ops twl6030_pwmled_ops = {
|
|||
.config = twl6030_pwmled_config,
|
||||
.request = twl6030_pwmled_request,
|
||||
.free = twl6030_pwmled_free,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int twl_pwmled_probe(struct platform_device *pdev)
|
||||
|
@ -321,7 +323,7 @@ static int twl_pwmled_remove(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id twl_pwmled_of_match[] = {
|
||||
static const struct of_device_id twl_pwmled_of_match[] = {
|
||||
{ .compatible = "ti,twl4030-pwmled" },
|
||||
{ .compatible = "ti,twl6030-pwmled" },
|
||||
{ },
|
||||
|
|
|
@ -248,7 +248,7 @@ static int twl6030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
|
|||
twl->twl6030_toggle3 = val;
|
||||
out:
|
||||
mutex_unlock(&twl->mutex);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void twl6030_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
|
@ -287,12 +287,14 @@ static const struct pwm_ops twl4030_pwm_ops = {
|
|||
.disable = twl4030_pwm_disable,
|
||||
.request = twl4030_pwm_request,
|
||||
.free = twl4030_pwm_free,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static const struct pwm_ops twl6030_pwm_ops = {
|
||||
.config = twl_pwm_config,
|
||||
.enable = twl6030_pwm_enable,
|
||||
.disable = twl6030_pwm_disable,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int twl_pwm_probe(struct platform_device *pdev)
|
||||
|
@ -333,7 +335,7 @@ static int twl_pwm_remove(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id twl_pwm_of_match[] = {
|
||||
static const struct of_device_id twl_pwm_of_match[] = {
|
||||
{ .compatible = "ti,twl4030-pwm" },
|
||||
{ .compatible = "ti,twl6030-pwm" },
|
||||
{ },
|
||||
|
|
|
@ -274,7 +274,7 @@ static int pwm_backlight_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int pwm_backlight_suspend(struct device *dev)
|
||||
{
|
||||
struct backlight_device *bl = dev_get_drvdata(dev);
|
||||
|
@ -296,19 +296,16 @@ static int pwm_backlight_resume(struct device *dev)
|
|||
backlight_update_status(bl);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(pwm_backlight_pm_ops, pwm_backlight_suspend,
|
||||
pwm_backlight_resume);
|
||||
|
||||
#endif
|
||||
|
||||
static struct platform_driver pwm_backlight_driver = {
|
||||
.driver = {
|
||||
.name = "pwm-backlight",
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &pwm_backlight_pm_ops,
|
||||
#endif
|
||||
.of_match_table = of_match_ptr(pwm_backlight_of_match),
|
||||
},
|
||||
.probe = pwm_backlight_probe,
|
||||
|
|
Loading…
Reference in New Issue
Block a user