pwm: Broadcom BCM7038 PWM controller (v4)
Subsystems (3)
v4 cover pwm: Broadcom BCM7038 PWM controller (v4)
Hi,
This patch series add PWM support for the Broadcom BCM7xxx chips which feature one or more PWM controllers capable of output periods from 148ns to ~622ms using a combination of variable and fixed frequency settings.
The controller does not support setting a polarity.
This is based on Thierry's pwm/next branch.
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller support
.../devicetree/bindings/pwm/brcm,bcm7038-pwm.txt | 20 ++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-brcmstb.c | 345 +++++++++++++++++++++ 4 files changed, 376 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.txt create mode 100644 drivers/pwm/pwm-brcmstb.c
Signature · 1 line
2.1.0
PATCH v4 1/2 Documentation: dt: add Broadcom BCM7038 PWM controller binding
Add a binding documentation for the Broadcom BCM7038 PWM controller found in BCM7xxx chips.
---
Changes in v3:
- list 'clocks' property as mandatory
.../devicetree/bindings/pwm/brcm,bcm7038-pwm.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.txt
Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.txt new file +20 -0
@@ -0,0 +1,20 @@ +Broadcom BCM7038 PWM controller (BCM7xxx Set Top Box PWM controller) + +Required properties: + +- compatible: must be "brcm,bcm7038-pwm" +- reg: physical base address and length for this controller +- #pwm-cells: should be 2. See pwm.txt in this directory for a description + of the cells format +- clocks: a phandle to the reference clock for this block which is fed through + its internal variable clock frequency generator + + +Example: + + pwm: pwm@f0408000 { + compatible = "brcm,bcm7038-pwm"; + reg = <0xf0408000 0x28>; + #pwm-cells = <2>; + clocks = <&upg_fixed>; + };
Signature · 1 line
2.1.0
PATCH v4 2/2 pwm: Add Broadcom BCM7038 PWM controller support
In reply to Florian FainelliAdd support for the BCM7038-style PWM controller found in all BCM7xxx STB SoCs. This controller has a hardcoded 2 channels per controller, and cascades a variable frequency generator on top of a fixed frequency generator which offers a range of a 148ns period all the way to ~622ms periods.
---
Changes in v4:
- address Ariel's feedback:
- add locking around HW manipulation registers
- rename I/O accessors to be less generic
- remove excessive parenthesis
- add proper error path cleanup code
- re-arrange remove function to call pwmchip_remove() first
- make the CWORD register offsets take a "ch" argument for consistency
- consistently use 'p' when referring to brcmstb_pwm_dev in code
- remove unecessary break lines
Changes in v3:
- make clock mandatory
- removed a remaining div64_u64 use
hanges in v2:
- properly format comments
- utilize do_div instead of div64_u64
- avoid using a "done" variable for the while loop
- utilize a parameterized register accessor
- remove a bunch of unnecessary assignments
- provide a module author
- update depends to build on BMIPS_GENERIC (the other user)
- removed artificial padding
- removed used only once variable: dn
- utilize devm_ioremap_resource
- do not print success message
- removed THIS_MODULE from platform_driver structure
drivers/pwm/Kconfig | 10 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-brcmstb.c | 345 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 356 insertions(+) create mode 100644 drivers/pwm/pwm-brcmstb.c
drivers/pwm/Kconfig +10 -0
@@ -111,6 +111,16 @@ config PWM_CLPS711X To compile this driver as a module, choose M here: the module will be called pwm-clps711x. +config PWM_BRCMSTB + tristate "Broadcom STB PWM support" + depends on ARCH_BRCMSTB || BMIPS_GENERIC + help + Generic PWM framework driver for the Broadcom Set-top-Box + SoCs (BCM7xxx). + + To compile this driver as a module, choose M Here: the module + will be called pwm-brcmstb.c. + config PWM_EP93XX tristate "Cirrus Logic EP93xx PWM support" depends on ARCH_EP93XX
drivers/pwm/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o obj-$(CONFIG_PWM_BCM_KONA) += pwm-bcm-kona.o obj-$(CONFIG_PWM_BCM2835) += pwm-bcm2835.o obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o +obj-$(CONFIG_PWM_BRCMSTB) += pwm-brcmstb.o obj-$(CONFIG_PWM_CLPS711X) += pwm-clps711x.o obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o
drivers/pwm/pwm-brcmstb.c new file +345 -0
345 lines not on this page · raw message
Signature · 6 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Florian Fainelli
Hi,
This patch series add PWM support for the Broadcom BCM7xxx chips which feature one or more PWM controllers capable of output periods from 148ns to ~622ms using a combination of variable and fixed frequency settings.
Thierry, are you happy with this version of the patches? Thanks.
Quoted 17 lines
The controller does not support setting a polarity.
This is based on Thierry's pwm/next branch.
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller support.../devicetree/bindings/pwm/brcm,bcm7038-pwm.txt | 20 ++ drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-brcmstb.c | 345 +++++++++++++++++++++ 4 files changed, 376 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.txt create mode 100644 drivers/pwm/pwm-brcmstb.c
Signature · 1 line
Florian
Quoted 7 lines · Florian Fainelli
Hi,
This patch series add PWM support for the Broadcom BCM7xxx chips which feature one or more PWM controllers capable of output periods from 148ns to ~622ms using a combination of variable and fixed frequency settings.
Quoted 7 lines
The controller does not support setting a polarity.
This is based on Thierry's pwm/next branch.
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller support
I've applied both of these patches with a couple of stylistic changes.
Thanks,
Thierry
Quoted 10 lines · Thierry Reding
Quoted 9 lines · Florian Fainelli
Hi,
This patch series add PWM support for the Broadcom BCM7xxx chips which feature one or more PWM controllers capable of output periods from 148ns to ~622ms using a combination of variable and fixed frequency settings.
The controller does not support setting a polarity.
Quoted 7 lines
Quoted 5 lines
This is based on Thierry's pwm/next branch.
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller supportI've applied both of these patches with a couple of stylistic changes.
Thanks but:
1) you dropped the MODULE_DEVICE_TABLE while doing so which is useful for auto-loading OF modules
2) you introduced a build failure in the CONFIG_PM_SLEEP
There was a patch just submitted for 2), but I can submit an incremental for 1) maybe?
Signature · 1 line
Florian
Quoted 19 lines · Florian Fainelli
Quoted 10 lines · Thierry Reding
Quoted 9 lines · Florian Fainelli
Hi,
This patch series add PWM support for the Broadcom BCM7xxx chips which feature one or more PWM controllers capable of output periods from 148ns to ~622ms using a combination of variable and fixed frequency settings.
The controller does not support setting a polarity.
Quoted 7 lines
Quoted 5 lines
This is based on Thierry's pwm/next branch.
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller supportI've applied both of these patches with a couple of stylistic changes.
Quoted 8 lines
Thanks but:
1) you dropped the
MODULE_DEVICE_TABLEwhile doing so which is useful for auto-loading OF modules
2) you introduced a build failure in theCONFIG_PM_SLEEPThere was a patch just submitted for 2), but I can submit an incremental for 1) maybe?
Disregard that, brainfart on my side, was diffing branches backwards... oh well.
Signature · 1 line
Florian
PATCH 1/1 pwm: fix Broadcom BCM7038 PWM driver
In reply to Thierry RedingThe newly added pwm-brcmstb driver fails to build if CONFIG_PM_SLEEP is enabled:
drivers/pwm/pwm-brcmstb.c: In function 'brcmstb_pwm_suspend':drivers/pwm/pwm-brcmstb.c:309:42: error: 'dev' undeclared (first use in this function)
struct brcmstb_pwm *p = dev_get_drvdata(dev);
This changes the name of the function argument to match its user.
---
Quoted 6 lines · On Monday 05 October 2015 17:14:15 Thierry Reding wrote:
Quoted 3 lines · Florian Fainelli
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller supportI've applied both of these patches with a couple of stylistic changes.
As in the pwm-berlin driver, one of the fixups was broken.
drivers/pwm/pwm-brcmstb.c +2 -2
@@ -304,7 +304,7 @@ static int brcmstb_pwm_remove(struct platform_device *pdev) }#ifdef CONFIG_PM_SLEEP -static int brcmstb_pwm_suspend (struct device *d) +static int brcmstb_pwm_suspend (struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev);
@@ -313,7 +313,7 @@ static int brcmstb_pwm_suspend(struct device *d)return 0 ; } -static int brcmstb_pwm_resume (struct device *d) +static int brcmstb_pwm_resume (struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev);
Re: [PATCH] pwm: fix Broadcom BCM7038 PWM driver
Quoted 8 lines · Arnd Bergmann
The newly added pwm-brcmstb driver fails to build if
CONFIG_PM_SLEEPis enabled:
drivers/pwm/pwm-brcmstb.c: In function 'brcmstb_pwm_suspend':drivers/pwm/pwm-brcmstb.c:309:42: error: 'dev' undeclared (first use in this function)
structbrcmstb_pwm*p =dev_get_drvdata(dev);This changes the name of the function argument to match its user.
Thanks, maybe, to avoid similar issues in the future, we should start removing the ifdef CONFIG_PM_SLEEP and instead annotate such functions with __maybe_unused. I wonder if we could magically make that happen with a coccinelle script that looks for SIMPLE_DEV_PM_OPS to know which functions to annotate... humm.
Quoted 36 lines
Signed-off-by Arnd Bergmann <[email protected]>---
Quoted 6 lines · On Monday 05 October 2015 17:14:15 Thierry Reding wrote:
Quoted 3 lines · Florian Fainelli
Florian Fainelli (2):
Documentation: dt: add Broadcom BCM7038 PWM controller binding
pwm: Add Broadcom BCM7038 PWM controller supportI've applied both of these patches with a couple of stylistic changes.
As in the pwm-berlin driver, one of the fixups was broken.
drivers/pwm/pwm-brcmstb.c +2
-2@@ -304,7 +304,7 @@ static int brcmstb_pwm_remove(struct platform_device *pdev) }#ifdef CONFIG_PM_SLEEP -static int brcmstb_pwm_suspend (struct device *d) +static int brcmstb_pwm_suspend (struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev);@@ -313,7 +313,7 @@ static int brcmstb_pwm_suspend(struct device *d)return 0 ; } -static int brcmstb_pwm_resume (struct device *d) +static int brcmstb_pwm_resume (struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev);
Signature · 1 line
Florian
Re: [PATCH] pwm: fix Broadcom BCM7038 PWM driver
Quoted 8 lines · On Tuesday 06 October 2015 17:51:30 Florian Fainelli wrote:
Quoted 7 lines · Arnd Bergmann
The newly added pwm-brcmstb driver fails to build if
CONFIG_PM_SLEEPis enabled:
drivers/pwm/pwm-brcmstb.c: In function 'brcmstb_pwm_suspend':drivers/pwm/pwm-brcmstb.c:309:42: error: 'dev' undeclared (first use in this function)
structbrcmstb_pwm*p =dev_get_drvdata(dev);
Quoted 7 lines
Quoted 1 line
This changes the name of the function argument to match its user.
Thanks, maybe, to avoid similar issues in the future, we should start removing the ifdef
CONFIG_PM_SLEEPand instead annotate such functions with__maybe_unused. I wonder if we could magically make that happen with a coccinelle script that looks forSIMPLE_DEV_PM_OPSto know which functions to annotate... humm.
I think the best solution would be to replace SIMPLE_DEV_PM_OPS with a macro that creates an unused reference to the functions. That way, we could remove all the #ifdef CONFIG_PM_SLEEP from the kernel, but we'd still have to use coccinelle to replace all the current instances with the new macro.
Arnd