pwm: Changes for v4.18-rc1
This contains a couple of fixes and cleanups for the Meson and ACPI/LPSS drivers as well as capture support for STM32. Note that given the cross- subsystem changes, the STM32 patches were merged through the MFD and PWM trees, both sharing an immutable branch. -----BEGIN PGP SIGNATURE----- iQJNBAABCAA3FiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlseQMIZHHRoaWVycnku cmVkaW5nQGdtYWlsLmNvbQAKCRDdI6zXfz6zoZ+8D/9XLQhQqW+pbI28JB0Jwe22 StuPNymo4wdED9Ga1ZPsVePKouQWW9D+NFjp80zqH26M4c+B235OvUljRDPnwTMH edJBUmGO2LMil8xtKYdF98WusLT33Q/k5alDmS11gEd/1h5xOH5kORc9pHuTIwhN dq5hy5OZWHHhlvlI4tCbqLuPrj/ucNourBJaLsMTwsGjdROtaakpyBbDX6ytMZ3c VIV78GFeszWhLfi/mkQlxQ6SzfEX8D+xfNRgYZkmklsJ+K7ztvK5qcnZQgv3yoTL s9xaZJY/Ei5IIyUFK6hraWTgIBkyZ9LpEPQHnGdkp8R1WpskcNWMgQup7FUm7U2u gwHiijZvj6hLjjxFS+bje2xoBTUB5KhCcC9COMUAktigm5mtLzXdoeVUQivqZerm plISAMo9UQMeO+wYZCMY5E9lWrsCGYSYWno5aHxAu6SaSvYUDIcD49LM6JMkt9Ek 5VLirs6b53pBNKZHH2+t67GMz/8GkzlZl19sQfRhv3uYJHHn+3VuOY4wQsqBLIk8 PoMzzWuzUgvcb+pZBisGHk92DCEXR1/9mgbNBNHXm+uuQ+YvXjvltY5osaIV1aI4 eBskscme1YGYEBJbhJpKEON6UFpUc4QD9HNXfAHQ/vyf7IShUdNk7zDnKBm9O42e SfX8AtcmV4KoVHi/Sw9DbQ== =ZED5 -----END PGP SIGNATURE----- Merge tag 'pwm/for-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm Pull pwm updates from Thierry Reding: "This contains a couple of fixes and cleanups for the Meson and ACPI/LPSS drivers as well as capture support for STM32. Note that given the cross- subsystem changes, the STM32 patches were merged through the MFD and PWM trees, both sharing an immutable branch" * tag 'pwm/for-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: stm32: Fix build warning with CONFIG_DMA_ENGINE disabled pwm: stm32: Enforce dependency on CONFIG_MFD_STM32_TIMERS ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume dt-bindings: mfd: stm32-timers: Add support for dmas pwm: simplify getting .drvdata pwm: meson: Fix allocation of PWM channel array
This commit is contained in:
Коммит
4b4bb99b62
|
@ -19,6 +19,11 @@ Required parameters:
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
- resets: Phandle to the parent reset controller.
|
- resets: Phandle to the parent reset controller.
|
||||||
See ../reset/st,stm32-rcc.txt
|
See ../reset/st,stm32-rcc.txt
|
||||||
|
- dmas: List of phandle to dma channels that can be used for
|
||||||
|
this timer instance. There may be up to 7 dma channels.
|
||||||
|
- dma-names: List of dma names. Must match 'dmas' property. Valid
|
||||||
|
names are: "ch1", "ch2", "ch3", "ch4", "up", "trig",
|
||||||
|
"com".
|
||||||
|
|
||||||
Optional subnodes:
|
Optional subnodes:
|
||||||
- pwm: See ../pwm/pwm-stm32.txt
|
- pwm: See ../pwm/pwm-stm32.txt
|
||||||
|
@ -44,3 +49,18 @@ Example:
|
||||||
reg = <0>;
|
reg = <0>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Example with all dmas:
|
||||||
|
timer@40010000 {
|
||||||
|
...
|
||||||
|
dmas = <&dmamux1 11 0x400 0x0>,
|
||||||
|
<&dmamux1 12 0x400 0x0>,
|
||||||
|
<&dmamux1 13 0x400 0x0>,
|
||||||
|
<&dmamux1 14 0x400 0x0>,
|
||||||
|
<&dmamux1 15 0x400 0x0>,
|
||||||
|
<&dmamux1 16 0x400 0x0>,
|
||||||
|
<&dmamux1 17 0x400 0x0>;
|
||||||
|
dma-names = "ch1", "ch2", "ch3", "ch4", "up", "trig", "com";
|
||||||
|
...
|
||||||
|
child nodes...
|
||||||
|
};
|
||||||
|
|
|
@ -233,11 +233,13 @@ static const struct lpss_device_desc lpt_sdio_dev_desc = {
|
||||||
|
|
||||||
static const struct lpss_device_desc byt_pwm_dev_desc = {
|
static const struct lpss_device_desc byt_pwm_dev_desc = {
|
||||||
.flags = LPSS_SAVE_CTX,
|
.flags = LPSS_SAVE_CTX,
|
||||||
|
.prv_offset = 0x800,
|
||||||
.setup = byt_pwm_setup,
|
.setup = byt_pwm_setup,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct lpss_device_desc bsw_pwm_dev_desc = {
|
static const struct lpss_device_desc bsw_pwm_dev_desc = {
|
||||||
.flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY,
|
.flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY,
|
||||||
|
.prv_offset = 0x800,
|
||||||
.setup = bsw_pwm_setup,
|
.setup = bsw_pwm_setup,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ config PWM_STI
|
||||||
|
|
||||||
config PWM_STM32
|
config PWM_STM32
|
||||||
tristate "STMicroelectronics STM32 PWM"
|
tristate "STMicroelectronics STM32 PWM"
|
||||||
depends on MFD_STM32_TIMERS || COMPILE_TEST
|
depends on MFD_STM32_TIMERS
|
||||||
help
|
help
|
||||||
Generic PWM framework driver for STM32 SoCs.
|
Generic PWM framework driver for STM32 SoCs.
|
||||||
|
|
||||||
|
|
|
@ -460,8 +460,7 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids);
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int atmel_tcb_pwm_suspend(struct device *dev)
|
static int atmel_tcb_pwm_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
|
||||||
struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
|
|
||||||
void __iomem *base = tcbpwm->tc->regs;
|
void __iomem *base = tcbpwm->tc->regs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -478,8 +477,7 @@ static int atmel_tcb_pwm_suspend(struct device *dev)
|
||||||
|
|
||||||
static int atmel_tcb_pwm_resume(struct device *dev)
|
static int atmel_tcb_pwm_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
|
||||||
struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
|
|
||||||
void __iomem *base = tcbpwm->tc->regs;
|
void __iomem *base = tcbpwm->tc->regs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,10 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev)
|
||||||
return pwm_lpss_remove(lpwm);
|
return pwm_lpss_remove(lpwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops,
|
||||||
|
pwm_lpss_suspend,
|
||||||
|
pwm_lpss_resume);
|
||||||
|
|
||||||
static const struct acpi_device_id pwm_lpss_acpi_match[] = {
|
static const struct acpi_device_id pwm_lpss_acpi_match[] = {
|
||||||
{ "80860F09", (unsigned long)&pwm_lpss_byt_info },
|
{ "80860F09", (unsigned long)&pwm_lpss_byt_info },
|
||||||
{ "80862288", (unsigned long)&pwm_lpss_bsw_info },
|
{ "80862288", (unsigned long)&pwm_lpss_bsw_info },
|
||||||
|
@ -86,6 +90,7 @@ static struct platform_driver pwm_lpss_driver_platform = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "pwm-lpss",
|
.name = "pwm-lpss",
|
||||||
.acpi_match_table = pwm_lpss_acpi_match,
|
.acpi_match_table = pwm_lpss_acpi_match,
|
||||||
|
.pm = &pwm_lpss_platform_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = pwm_lpss_probe_platform,
|
.probe = pwm_lpss_probe_platform,
|
||||||
.remove = pwm_lpss_remove_platform,
|
.remove = pwm_lpss_remove_platform,
|
||||||
|
|
|
@ -32,10 +32,13 @@
|
||||||
/* Size of each PWM register space if multiple */
|
/* Size of each PWM register space if multiple */
|
||||||
#define PWM_SIZE 0x400
|
#define PWM_SIZE 0x400
|
||||||
|
|
||||||
|
#define MAX_PWMS 4
|
||||||
|
|
||||||
struct pwm_lpss_chip {
|
struct pwm_lpss_chip {
|
||||||
struct pwm_chip chip;
|
struct pwm_chip chip;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
const struct pwm_lpss_boardinfo *info;
|
const struct pwm_lpss_boardinfo *info;
|
||||||
|
u32 saved_ctrl[MAX_PWMS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)
|
static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)
|
||||||
|
@ -177,6 +180,9 @@ struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
|
||||||
unsigned long c;
|
unsigned long c;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (WARN_ON(info->npwm > MAX_PWMS))
|
||||||
|
return ERR_PTR(-ENODEV);
|
||||||
|
|
||||||
lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL);
|
lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL);
|
||||||
if (!lpwm)
|
if (!lpwm)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
@ -212,6 +218,30 @@ int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pwm_lpss_remove);
|
EXPORT_SYMBOL_GPL(pwm_lpss_remove);
|
||||||
|
|
||||||
|
int pwm_lpss_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < lpwm->info->npwm; i++)
|
||||||
|
lpwm->saved_ctrl[i] = readl(lpwm->regs + i * PWM_SIZE + PWM);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pwm_lpss_suspend);
|
||||||
|
|
||||||
|
int pwm_lpss_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < lpwm->info->npwm; i++)
|
||||||
|
writel(lpwm->saved_ctrl[i], lpwm->regs + i * PWM_SIZE + PWM);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pwm_lpss_resume);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("PWM driver for Intel LPSS");
|
MODULE_DESCRIPTION("PWM driver for Intel LPSS");
|
||||||
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
|
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
|
|
@ -28,5 +28,7 @@ struct pwm_lpss_boardinfo {
|
||||||
struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
|
struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
|
||||||
const struct pwm_lpss_boardinfo *info);
|
const struct pwm_lpss_boardinfo *info);
|
||||||
int pwm_lpss_remove(struct pwm_lpss_chip *lpwm);
|
int pwm_lpss_remove(struct pwm_lpss_chip *lpwm);
|
||||||
|
int pwm_lpss_suspend(struct device *dev);
|
||||||
|
int pwm_lpss_resume(struct device *dev);
|
||||||
|
|
||||||
#endif /* __PWM_LPSS_H */
|
#endif /* __PWM_LPSS_H */
|
||||||
|
|
|
@ -541,8 +541,8 @@ static int meson_pwm_probe(struct platform_device *pdev)
|
||||||
meson->data = of_device_get_match_data(&pdev->dev);
|
meson->data = of_device_get_match_data(&pdev->dev);
|
||||||
meson->inverter_mask = BIT(meson->chip.npwm) - 1;
|
meson->inverter_mask = BIT(meson->chip.npwm) - 1;
|
||||||
|
|
||||||
channels = devm_kcalloc(&pdev->dev, meson->chip.npwm, sizeof(*meson),
|
channels = devm_kcalloc(&pdev->dev, meson->chip.npwm,
|
||||||
GFP_KERNEL);
|
sizeof(*channels), GFP_KERNEL);
|
||||||
if (!channels)
|
if (!channels)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
|
static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev);
|
||||||
struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
|
|
||||||
struct pwm_chip *chip = &rcar_pwm->chip;
|
struct pwm_chip *chip = &rcar_pwm->chip;
|
||||||
|
|
||||||
return &chip->pwms[0];
|
return &chip->pwms[0];
|
||||||
|
|
|
@ -484,9 +484,7 @@ static int stm32_pwm_apply_locked(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
static const struct pwm_ops stm32pwm_ops = {
|
static const struct pwm_ops stm32pwm_ops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.apply = stm32_pwm_apply_locked,
|
.apply = stm32_pwm_apply_locked,
|
||||||
#if IS_ENABLED(CONFIG_DMA_ENGINE)
|
.capture = IS_ENABLED(CONFIG_DMA_ENGINE) ? stm32_pwm_capture : NULL,
|
||||||
.capture = stm32_pwm_capture,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int stm32_pwm_set_breakinput(struct stm32_pwm *priv,
|
static int stm32_pwm_set_breakinput(struct stm32_pwm *priv,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче