diff options
| -rw-r--r-- | Documentation/devicetree/bindings/pwm/pwm-meson.txt | 23 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/pwm/pwm-mtk-disp.txt | 3 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/pwm/pwm-st.txt | 8 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | 1 | ||||
| -rw-r--r-- | drivers/pwm/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/pwm/Makefile | 1 | ||||
| -rw-r--r-- | drivers/pwm/core.c | 2 | ||||
| -rw-r--r-- | drivers/pwm/pwm-berlin.c | 84 | ||||
| -rw-r--r-- | drivers/pwm/pwm-cros-ec.c | 4 | ||||
| -rw-r--r-- | drivers/pwm/pwm-lpc18xx-sct.c | 12 | ||||
| -rw-r--r-- | drivers/pwm/pwm-meson.c | 529 | ||||
| -rw-r--r-- | drivers/pwm/pwm-mtk-disp.c | 87 | ||||
| -rw-r--r-- | drivers/pwm/pwm-samsung.c | 15 | ||||
| -rw-r--r-- | drivers/pwm/pwm-sti.c | 483 | ||||
| -rw-r--r-- | drivers/pwm/pwm-sun4i.c | 9 | ||||
| -rw-r--r-- | drivers/pwm/pwm-tipwmss.c | 19 | ||||
| -rw-r--r-- | drivers/pwm/pwm-twl.c | 16 | ||||
| -rw-r--r-- | drivers/pwm/sysfs.c | 18 | ||||
| -rw-r--r-- | include/linux/pwm.h | 5 |
19 files changed, 1183 insertions, 145 deletions
diff --git a/Documentation/devicetree/bindings/pwm/pwm-meson.txt b/Documentation/devicetree/bindings/pwm/pwm-meson.txt new file mode 100644 index 000000000000..5376a4468cb6 --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/pwm-meson.txt | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | Amlogic Meson PWM Controller | ||
| 2 | ============================ | ||
| 3 | |||
| 4 | Required properties: | ||
| 5 | - compatible: Shall contain "amlogic,meson8b-pwm" or "amlogic,meson-gxbb-pwm". | ||
| 6 | - #pwm-cells: Should be 3. See pwm.txt in this directory for a description of | ||
| 7 | the cells format. | ||
| 8 | |||
| 9 | Optional properties: | ||
| 10 | - clocks: Could contain one or two parents clocks phandle for each of the two | ||
| 11 | PWM channels. | ||
| 12 | - clock-names: Could contain at least the "clkin0" and/or "clkin1" names. | ||
| 13 | |||
| 14 | Example: | ||
| 15 | |||
| 16 | pwm_ab: pwm@8550 { | ||
| 17 | compatible = "amlogic,meson-gxbb-pwm"; | ||
| 18 | reg = <0x0 0x08550 0x0 0x10>; | ||
| 19 | #pwm-cells = <3>; | ||
| 20 | status = "disabled"; | ||
| 21 | clocks = <&xtal>, <&xtal>; | ||
| 22 | clock-names = "clkin0", "clkin1"; | ||
| 23 | } | ||
diff --git a/Documentation/devicetree/bindings/pwm/pwm-mtk-disp.txt b/Documentation/devicetree/bindings/pwm/pwm-mtk-disp.txt index f8f59baf6b67..6f8af2bcc7b7 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-mtk-disp.txt +++ b/Documentation/devicetree/bindings/pwm/pwm-mtk-disp.txt | |||
| @@ -2,8 +2,9 @@ MediaTek display PWM controller | |||
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: should be "mediatek,<name>-disp-pwm": | 4 | - compatible: should be "mediatek,<name>-disp-pwm": |
| 5 | - "mediatek,mt8173-disp-pwm": found on mt8173 SoC. | 5 | - "mediatek,mt2701-disp-pwm": found on mt2701 SoC. |
| 6 | - "mediatek,mt6595-disp-pwm": found on mt6595 SoC. | 6 | - "mediatek,mt6595-disp-pwm": found on mt6595 SoC. |
| 7 | - "mediatek,mt8173-disp-pwm": found on mt8173 SoC. | ||
| 7 | - reg: physical base address and length of the controller's registers. | 8 | - reg: physical base address and length of the controller's registers. |
| 8 | - #pwm-cells: must be 2. See pwm.txt in this directory for a description of | 9 | - #pwm-cells: must be 2. See pwm.txt in this directory for a description of |
| 9 | the cell format. | 10 | the cell format. |
diff --git a/Documentation/devicetree/bindings/pwm/pwm-st.txt b/Documentation/devicetree/bindings/pwm/pwm-st.txt index 84d2fb807d3c..19fce774cafa 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-st.txt +++ b/Documentation/devicetree/bindings/pwm/pwm-st.txt | |||
| @@ -13,13 +13,14 @@ Required parameters: | |||
| 13 | - pinctrl-0: List of phandles pointing to pin configuration nodes | 13 | - pinctrl-0: List of phandles pointing to pin configuration nodes |
| 14 | for PWM module. | 14 | for PWM module. |
| 15 | For Pinctrl properties, please refer to [1]. | 15 | For Pinctrl properties, please refer to [1]. |
| 16 | - clock-names: Set to "pwm". | 16 | - clock-names: Valid entries are "pwm" and/or "capture". |
| 17 | - clocks: phandle of the clock used by the PWM module. | 17 | - clocks: phandle of the clock used by the PWM module. |
| 18 | For Clk properties, please refer to [2]. | 18 | For Clk properties, please refer to [2]. |
| 19 | - interrupts: IRQ for the Capture device | ||
| 19 | 20 | ||
| 20 | Optional properties: | 21 | Optional properties: |
| 21 | - st,pwm-num-chan: Number of available channels. If not passed, the driver | 22 | - st,pwm-num-chan: Number of available PWM channels. Default is 0. |
| 22 | will consider single channel by default. | 23 | - st,capture-num-chan: Number of available Capture channels. Default is 0. |
| 23 | 24 | ||
| 24 | [1] Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt | 25 | [1] Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt |
| 25 | [2] Documentation/devicetree/bindings/clock/clock-bindings.txt | 26 | [2] Documentation/devicetree/bindings/clock/clock-bindings.txt |
| @@ -38,4 +39,5 @@ pwm1: pwm@fe510000 { | |||
| 38 | clocks = <&clk_sysin>; | 39 | clocks = <&clk_sysin>; |
| 39 | clock-names = "pwm"; | 40 | clock-names = "pwm"; |
| 40 | st,pwm-num-chan = <4>; | 41 | st,pwm-num-chan = <4>; |
| 42 | st,capture-num-chan = <2>; | ||
| 41 | }; | 43 | }; |
diff --git a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt index cf6068b8e974..f1cbeefb3087 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt +++ b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | |||
| @@ -6,6 +6,7 @@ Required properties: | |||
| 6 | - "allwinner,sun5i-a10s-pwm" | 6 | - "allwinner,sun5i-a10s-pwm" |
| 7 | - "allwinner,sun5i-a13-pwm" | 7 | - "allwinner,sun5i-a13-pwm" |
| 8 | - "allwinner,sun7i-a20-pwm" | 8 | - "allwinner,sun7i-a20-pwm" |
| 9 | - "allwinner,sun8i-h3-pwm" | ||
| 9 | - reg: physical base address and length of the controller's registers | 10 | - reg: physical base address and length of the controller's registers |
| 10 | - #pwm-cells: should be 3. See pwm.txt in this directory for a description of | 11 | - #pwm-cells: should be 3. See pwm.txt in this directory for a description of |
| 11 | the cells format. | 12 | the cells format. |
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 80a566a00d04..bf0128899c09 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig | |||
| @@ -262,6 +262,15 @@ config PWM_LPSS_PLATFORM | |||
| 262 | To compile this driver as a module, choose M here: the module | 262 | To compile this driver as a module, choose M here: the module |
| 263 | will be called pwm-lpss-platform. | 263 | will be called pwm-lpss-platform. |
| 264 | 264 | ||
| 265 | config PWM_MESON | ||
| 266 | tristate "Amlogic Meson PWM driver" | ||
| 267 | depends on ARCH_MESON | ||
| 268 | help | ||
| 269 | The platform driver for Amlogic Meson PWM controller. | ||
| 270 | |||
| 271 | To compile this driver as a module, choose M here: the module | ||
| 272 | will be called pwm-meson. | ||
| 273 | |||
| 265 | config PWM_MTK_DISP | 274 | config PWM_MTK_DISP |
| 266 | tristate "MediaTek display PWM driver" | 275 | tristate "MediaTek display PWM driver" |
| 267 | depends on ARCH_MEDIATEK || COMPILE_TEST | 276 | depends on ARCH_MEDIATEK || COMPILE_TEST |
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index feef1dd29f73..1194c54efcc2 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile | |||
| @@ -24,6 +24,7 @@ obj-$(CONFIG_PWM_LPC32XX) += pwm-lpc32xx.o | |||
| 24 | obj-$(CONFIG_PWM_LPSS) += pwm-lpss.o | 24 | obj-$(CONFIG_PWM_LPSS) += pwm-lpss.o |
| 25 | obj-$(CONFIG_PWM_LPSS_PCI) += pwm-lpss-pci.o | 25 | obj-$(CONFIG_PWM_LPSS_PCI) += pwm-lpss-pci.o |
| 26 | obj-$(CONFIG_PWM_LPSS_PLATFORM) += pwm-lpss-platform.o | 26 | obj-$(CONFIG_PWM_LPSS_PLATFORM) += pwm-lpss-platform.o |
| 27 | obj-$(CONFIG_PWM_MESON) += pwm-meson.o | ||
| 27 | obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o | 28 | obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o |
| 28 | obj-$(CONFIG_PWM_MXS) += pwm-mxs.o | 29 | obj-$(CONFIG_PWM_MXS) += pwm-mxs.o |
| 29 | obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o | 30 | obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o |
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 0dbd29e287db..172ef8245811 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
| @@ -339,6 +339,8 @@ int pwmchip_remove(struct pwm_chip *chip) | |||
| 339 | unsigned int i; | 339 | unsigned int i; |
| 340 | int ret = 0; | 340 | int ret = 0; |
| 341 | 341 | ||
| 342 | pwmchip_sysfs_unexport_children(chip); | ||
| 343 | |||
| 342 | mutex_lock(&pwm_lock); | 344 | mutex_lock(&pwm_lock); |
| 343 | 345 | ||
| 344 | for (i = 0; i < chip->npwm; i++) { | 346 | for (i = 0; i < chip->npwm; i++) { |
diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c index 65108129d505..01339c152ab0 100644 --- a/drivers/pwm/pwm-berlin.c +++ b/drivers/pwm/pwm-berlin.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/pwm.h> | 18 | #include <linux/pwm.h> |
| 19 | #include <linux/slab.h> | ||
| 19 | 20 | ||
| 20 | #define BERLIN_PWM_EN 0x0 | 21 | #define BERLIN_PWM_EN 0x0 |
| 21 | #define BERLIN_PWM_ENABLE BIT(0) | 22 | #define BERLIN_PWM_ENABLE BIT(0) |
| @@ -27,6 +28,13 @@ | |||
| 27 | #define BERLIN_PWM_TCNT 0xc | 28 | #define BERLIN_PWM_TCNT 0xc |
| 28 | #define BERLIN_PWM_MAX_TCNT 65535 | 29 | #define BERLIN_PWM_MAX_TCNT 65535 |
| 29 | 30 | ||
| 31 | struct berlin_pwm_channel { | ||
| 32 | u32 enable; | ||
| 33 | u32 ctrl; | ||
| 34 | u32 duty; | ||
| 35 | u32 tcnt; | ||
| 36 | }; | ||
| 37 | |||
| 30 | struct berlin_pwm_chip { | 38 | struct berlin_pwm_chip { |
| 31 | struct pwm_chip chip; | 39 | struct pwm_chip chip; |
| 32 | struct clk *clk; | 40 | struct clk *clk; |
| @@ -55,6 +63,25 @@ static inline void berlin_pwm_writel(struct berlin_pwm_chip *chip, | |||
| 55 | writel_relaxed(value, chip->base + channel * 0x10 + offset); | 63 | writel_relaxed(value, chip->base + channel * 0x10 + offset); |
| 56 | } | 64 | } |
| 57 | 65 | ||
| 66 | static int berlin_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) | ||
| 67 | { | ||
| 68 | struct berlin_pwm_channel *channel; | ||
| 69 | |||
| 70 | channel = kzalloc(sizeof(*channel), GFP_KERNEL); | ||
| 71 | if (!channel) | ||
| 72 | return -ENOMEM; | ||
| 73 | |||
| < | |||
