pwm: lpss: split driver to core and probe drivers
Subsystems (2)
Andy Shevchenko
reviewerv4 cover pwm: lpss: split driver to core and probe drivers
This small series makes the architecture of pwm-lpss driver cleaner.
Since v3:
- rebased on top of recent linux-next
- rebased on top of Alan's patch for Braswell
Since v2:
- fix one more typo in Kconfig (tested with one line removed in my config now)
Since v1:
- hide struct definition in the core part
- rename pwm-lpss-plat to pwm-lpss-platform
- fix Kconfig dependencies and other typos
- add Mika's Reviewed-by tag
- fix spelling in the commit messages
Andy Shevchenko (2):
pwm: lpss: properly split driver to parts
pwm: lpss: pci: move to use pcim_enable_device()
drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 65 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 198 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
Signature · 1 line
2.1.0
Andy Shevchenko
reviewerPATCH v4 1/2 pwm: lpss: properly split driver to parts
The driver consists core, PCI, and platform parts. It would better to split them into separate files.
The platform driver is now called pwm-lpss-platform. Thus, prevously set CONFIG_PWM_LPSS=m is not enough to build it. But we are on the safe side since it seems no one from outside Intel is using it for now.
While here, move to use macros module_pci_driver() and module_platform_driver().
--- drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 66 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 199 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
drivers/pwm/Kconfig +20 -1
@@ -149,7 +149,6 @@ config PWM_LPC32XX config PWM_LPSS tristate "Intel LPSS PWM support" - depends on ACPI help Generic PWM framework driver for Intel Low Power Subsystem PWM controller.
@@ -157,6 +156,26 @@ config PWM_LPSS To compile this driver as a module, choose M here: the module will be called pwm-lpss. +config PWM_LPSS_PCI + tristate "Intel LPSS PWM PCI driver" + depends on PCI + select PWM_LPSS + help + The PCI driver for Intel Low Power Subsystem PWM controller. + + To compile this driver as a module, choose M here: the module + will be called pwm-lpss-pci. + +config PWM_LPSS_PLATFORM + tristate "Intel LPSS PWM platform driver" + depends on ACPI + select PWM_LPSS + help + The platform driver for Intel Low Power Subsystem PWM controller. + + To compile this driver as a module, choose M here: the module + will be called pwm-lpss-platform. + config PWM_MXS tristate "Freescale MXS PWM support" depends on ARCH_MXS && OF
drivers/pwm/Makefile +2 -0
@@ -13,6 +13,8 @@ obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o obj-$(CONFIG_PWM_LP3943) += pwm-lp3943.o obj-$(CONFIG_PWM_LPC32XX) += pwm-lpc32xx.o obj-$(CONFIG_PWM_LPSS) += pwm-lpss.o +obj-$(CONFIG_PWM_LPSS_PCI) += pwm-lpss-pci.o +obj-$(CONFIG_PWM_LPSS_PLATFORM) += pwm-lpss-platform.o obj-$(CONFIG_PWM_MXS) += pwm-mxs.o obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o
drivers/pwm/pwm-lpss-pci.c new file +66 -0
66 lines not on this page · raw message
drivers/pwm/pwm-lpss-platform.c new file +69 -0
69 lines not on this page · raw message
drivers/pwm/pwm-lpss.c +10 -126
178 lines not on this page · raw message
drivers/pwm/pwm-lpss.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Intel Low Power Subsystem PWM controller driver +* +* Copyright (C) 2014, Intel Corporation +* +* Derived from the original pwm-lpss.c +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PWM_LPSS_H +#define __PWM_LPSS_H + +#include <linux/pwm.h> +#include <linux/device.h> + +struct pwm_lpss_chip ; + +struct pwm_lpss_boardinfo { +unsigned long clk_rate; +}; + +extern const struct pwm_lpss_boardinfo pwm_lpss_byt_info; +extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info; + +extern struct pwm_lpss_chip *pwm_lpss_probe (struct device *dev, +struct resource *r,const struct pwm_lpss_boardinfo *info); +extern int pwm_lpss_remove (struct pwm_lpss_chip *lpwm); + +#endif /* __PWM_LPSS_H */
Signature · 1 line
2.1.0
Re: [PATCH v4 1/2] pwm: lpss: properly split driver to parts
On Tue, Aug 19, 2014 at 07:17:35PM +0300, Andy Shevchenko wrote:
[...]
Quoted 1 line
drivers/pwm/Kconfig +0
-0
[...]
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PCI + tristate "Intel LPSS PWM PCI driver" + depends on PCI + select PWM_LPSS
[...]
drivers/pwm/Kconfig config PWM_LPSS · line 172
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PLATFORM + tristate "Intel LPSS PWM platform driver" + depends on ACPI + select PWM_LPSS
I changed both of the above select PWM_LPSS to depends on PWM_LPSS because that makes them show up in a more meaningful way in menuconfig and otherwise it looks weird if the PWM_LPSS shows up as automatically selected without being useful in itself. This way the PWM_LPSS is sort of a common core that PWM_LPSS_PLATFORM and PWM_LPSS_PCI use.
An alternative that's commonly used for this would be to hide PWM_LPSS from users and keep the select within PWM_LPSS_PLATFORM and PWM_LPSS_PCI. That would be okay with me too.
Let me know if you have any objections to this change.
Thierry
Andy Shevchenko
reviewerRe: [PATCH v4 1/2] pwm: lpss: properly split driver to parts
Quoted 20 lines · Thierry Reding
On Tue, Aug 19, 2014 at 07:17:35PM +0300, Andy Shevchenko wrote:
[...]Quoted 1 line
drivers/pwm/Kconfig +0
-0[...]
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PCI + tristate "Intel LPSS PWM PCI driver" + depends on PCI + select PWM_LPSS[...]
drivers/pwm/Kconfig config PWM_LPSS · line 172
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PLATFORM + tristate "Intel LPSS PWM platform driver" + depends on ACPI + select PWM_LPSSI changed both of the above select
PWM_LPSSto depends onPWM_LPSSbecause that makes them show up in a more meaningful way in menuconfig and otherwise it looks weird if thePWM_LPSSshows up as automatically selected without being useful in itself. This way thePWM_LPSSis sort of a common core thatPWM_LPSS_PLATFORMandPWM_LPSS_PCIuse.
Quoted 5 lines
An alternative that's commonly used for this would be to hide
PWM_LPSSfrom users and keep the select withinPWM_LPSS_PLATFORMandPWM_LPSS_PCI. That would be okay with me too.Let me know if you have any objections to this change.
Didn't notice your message before.
Regarding to this one I think the way to hide PWM_LPSS from user would be preferred, though I'm okay if it keeps visible.
In addition to compile error you get from Stephen, thanks for quick fix, though I think we have to make PWM_LPSS dependent to X86 for now. I don't believe we will have same IP on other architectures.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH v4 1/2] pwm: lpss: properly split driver to parts
Quoted 28 lines · Andy Shevchenko
Quoted 20 lines · Thierry Reding
On Tue, Aug 19, 2014 at 07:17:35PM +0300, Andy Shevchenko wrote:
[...]Quoted 1 line
drivers/pwm/Kconfig +0
-0[...]
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PCI + tristate "Intel LPSS PWM PCI driver" + depends on PCI + select PWM_LPSS[...]
drivers/pwm/Kconfig config PWM_LPSS · line 172
Quoted 4 lines
drivers/pwm/Kconfig +4
-0+config PWM_LPSS_PLATFORM + tristate "Intel LPSS PWM platform driver" + depends on ACPI + select PWM_LPSSI changed both of the above select
PWM_LPSSto depends onPWM_LPSSbecause that makes them show up in a more meaningful way in menuconfig and otherwise it looks weird if thePWM_LPSSshows up as automatically selected without being useful in itself. This way thePWM_LPSSis sort of a common core thatPWM_LPSS_PLATFORMandPWM_LPSS_PCIuse.Quoted 5 lines
An alternative that's commonly used for this would be to hide
PWM_LPSSfrom users and keep the select withinPWM_LPSS_PLATFORMandPWM_LPSS_PCI. That would be okay with me too.Let me know if you have any objections to this change.
Quoted 7 lines
Didn't notice your message before.
Regarding to this one I think the way to hidePWM_LPSSfrom user would be preferred, though I'm okay if it keeps visible.In addition to compile error you get from Stephen, thanks for quick fix, though I think we have to make
PWM_LPSSdependent to X86 for now. I don't believe we will have same IP on other architectures.
I does seem to build fine for other architectures, so I'm fine with keeping it available for non-x86. But I don't have a strong opinion either way, so if you'd rather make it x86-specific, feel free to send a patch.
Thierry
Andy Shevchenko
reviewerPATCH v4 2/2 pwm: lpss: pci: move to use pcim_enable_device()
In reply to Andy ShevchenkoLet's use managed functions for this driver.
--- drivers/pwm/pwm-lpss-pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pwm/pwm-lpss-pci.c +1 -2
@@ -23,7 +23,7 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,struct pwm_lpss_chip *lpwm;int err; - err =pci_enable_device (pdev); + err =pcim_enable_device (pdev);if (err <0 )return err;
@@ -41,7 +41,6 @@ static void pwm_lpss_remove_pci(struct pci_dev *pdev)struct pwm_lpss_chip *lpwm =pci_get_drvdata (pdev);pwm_lpss_remove (lpwm); -pci_disable_device (pdev); }static struct pci_device_id pwm_lpss_pci_ids[] = {
Signature · 1 line
2.1.0
Quoted 20 lines · Andy Shevchenko
This small series makes the architecture of pwm-lpss driver cleaner.
Since v3:
- rebased on top of recent linux-next
- rebased on top of Alan's patch for BraswellSince v2:
- fix one more typo inKconfig(tested with one line removed in my config now)Since v1:
- hide struct definition in the core part
- rename pwm-lpss-plat to pwm-lpss-platform
- fixKconfigdependencies and other typos
- add Mika's Reviewed-by tag
- fix spelling in the commit messagesAndy Shevchenko (2):
pwm: lpss: properly split driver to parts
pwm: lpss: pci: move to usepcim_enable_device()
Quoted 10 lines
drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 65 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 198 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
Yea or nay, Alan?
Thierry
Quoted 32 lines · Thierry Reding
Quoted 20 lines · Andy Shevchenko
This small series makes the architecture of pwm-lpss driver cleaner.
Since v3:
- rebased on top of recent linux-next
- rebased on top of Alan's patch for BraswellSince v2:
- fix one more typo inKconfig(tested with one line removed in my config now)Since v1:
- hide struct definition in the core part
- rename pwm-lpss-plat to pwm-lpss-platform
- fixKconfigdependencies and other typos
- add Mika's Reviewed-by tag
- fix spelling in the commit messagesAndy Shevchenko (2):
pwm: lpss: properly split driver to parts
pwm: lpss: pci: move to usepcim_enable_device()Quoted 10 lines
drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 65 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 198 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
Quoted 1 line
Yea or nay, Alan?
Context ?
Quoted 33 lines · Alan Cox
Quoted 32 lines · Thierry Reding
Quoted 30 lines · Andy Shevchenko
This small series makes the architecture of pwm-lpss driver cleaner.
Since v3:
- rebased on top of recent linux-next
- rebased on top of Alan's patch for BraswellSince v2:
- fix one more typo inKconfig(tested with one line removed in my config now)Since v1:
- hide struct definition in the core part
- rename pwm-lpss-plat to pwm-lpss-platform
- fixKconfigdependencies and other typos
- add Mika's Reviewed-by tag
- fix spelling in the commit messagesAndy Shevchenko (2):
pwm: lpss: properly split driver to parts
pwm: lpss: pci: move to usepcim_enable_device()drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 65 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 198 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
Quoted 3 lines
Quoted 1 line
Yea or nay, Alan?
Context ?
Back when the LPSS PWM driver was first submitted I suggested that it could be split up in this way (core + PCI and ACPI/platform drivers). You had objections to doing that. Now Andy's doing exactly that, so I would like your Acked-by (or NAK) on this change.
Thierry
Quoted 34 lines · Thierry Reding
Quoted 33 lines · Alan Cox
Quoted 32 lines · Thierry Reding
Quoted 30 lines · Andy Shevchenko
This small series makes the architecture of pwm-lpss driver cleaner.
Since v3:
- rebased on top of recent linux-next
- rebased on top of Alan's patch for BraswellSince v2:
- fix one more typo inKconfig(tested with one line removed in my config now)Since v1:
- hide struct definition in the core part
- rename pwm-lpss-plat to pwm-lpss-platform
- fixKconfigdependencies and other typos
- add Mika's Reviewed-by tag
- fix spelling in the commit messagesAndy Shevchenko (2):
pwm: lpss: properly split driver to parts
pwm: lpss: pci: move to usepcim_enable_device()drivers/pwm/Kconfig | 21 ++++++- drivers/pwm/Makefile | 2 + drivers/pwm/pwm-lpss-pci.c | 65 +++++++++++++++++++ drivers/pwm/pwm-lpss-platform.c | 69 ++++++++++++++++++++ drivers/pwm/pwm-lpss.c | 136 +++------------------------------------- drivers/pwm/pwm-lpss.h | 32 ++++++++++ 6 files changed, 198 insertions(+), 127 deletions(-) create mode 100644 drivers/pwm/pwm-lpss-pci.c create mode 100644 drivers/pwm/pwm-lpss-platform.c create mode 100644 drivers/pwm/pwm-lpss.h
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Yea or nay, Alan?
Context ?
Back when the LPSS PWM driver was first submitted I suggested that it could be split up in this way (core + PCI and ACPI/platform drivers). You had objections to doing that. Now Andy's doing exactly that, so I would like your Acked-by (or NAK) on this change.
I think Andy proved you were right 8)
Ack from me
Alan