Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pwm/for-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm

Pull pwm updates from Thierry Reding:
"The ZTE ZX platform is being removed, so the PWM driver is no longer
needed and removed as well.

Other than that this contains a small set of fixes and cleanups across
a couple of drivers"

* tag 'pwm/for-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
pwm: lpc18xx-sct: remove unneeded semicolon
pwm: iqs620a: Correct a stale state variable
pwm: iqs620a: Fix overflow and optimize calculations
pwm: rockchip: Enable clock before calling clk_get_rate()
pwm: rockchip: Eliminate potential race condition when probing
pwm: rockchip: Replace "bus clk" with "PWM clk"
pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare()
pwm: rockchip: Enable APB clock during register access while probing
pwm: Remove ZTE ZX driver

+65 -374
-22
Documentation/devicetree/bindings/pwm/pwm-zx.txt
··· 1 - ZTE ZX PWM controller 2 - 3 - Required properties: 4 - - compatible: Should be "zte,zx296718-pwm". 5 - - reg: Physical base address and length of the controller's registers. 6 - - clocks : The phandle and specifier referencing the controller's clocks. 7 - - clock-names: "pclk" for PCLK, "wclk" for WCLK to the PWM controller. The 8 - PCLK is for register access, while WCLK is the reference clock for 9 - calculating period and duty cycles. 10 - - #pwm-cells: Should be 3. See pwm.yaml in this directory for a description of 11 - the cells format. 12 - 13 - Example: 14 - 15 - pwm: pwm@1439000 { 16 - compatible = "zte,zx296718-pwm"; 17 - reg = <0x1439000 0x1000>; 18 - clocks = <&lsp1crm LSP1_PWM_PCLK>, 19 - <&lsp1crm LSP1_PWM_WCLK>; 20 - clock-names = "pclk", "wclk"; 21 - #pwm-cells = <3>; 22 - };
-10
drivers/pwm/Kconfig
··· 611 611 To compile this driver as a module, choose M here: the module 612 612 will be called pwm-vt8500. 613 613 614 - config PWM_ZX 615 - tristate "ZTE ZX PWM support" 616 - depends on ARCH_ZX || COMPILE_TEST 617 - depends on HAS_IOMEM 618 - help 619 - Generic PWM framework driver for ZTE ZX family SoCs. 620 - 621 - To compile this driver as a module, choose M here: the module 622 - will be called pwm-zx. 623 - 624 614 endif
-1
drivers/pwm/Makefile
··· 57 57 obj-$(CONFIG_PWM_TWL) += pwm-twl.o 58 58 obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o 59 59 obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o 60 - obj-$(CONFIG_PWM_ZX) += pwm-zx.o
+41 -53
drivers/pwm/pwm-iqs620a.c
··· 37 37 struct pwm_chip chip; 38 38 struct notifier_block notifier; 39 39 struct mutex lock; 40 - bool out_en; 41 - u8 duty_val; 40 + unsigned int duty_scale; 42 41 }; 42 + 43 + static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm, 44 + unsigned int duty_scale) 45 + { 46 + struct iqs62x_core *iqs62x = iqs620_pwm->iqs62x; 47 + int ret; 48 + 49 + if (!duty_scale) 50 + return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS, 51 + IQS620_PWR_SETTINGS_PWM_OUT, 0); 52 + 53 + ret = regmap_write(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE, 54 + duty_scale - 1); 55 + if (ret) 56 + return ret; 57 + 58 + return regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS, 59 + IQS620_PWR_SETTINGS_PWM_OUT, 0xff); 60 + } 43 61 44 62 static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, 45 63 const struct pwm_state *state) 46 64 { 47 65 struct iqs620_pwm_private *iqs620_pwm; 48 - struct iqs62x_core *iqs62x; 49 - u64 duty_scale; 66 + unsigned int duty_cycle; 67 + unsigned int duty_scale; 50 68 int ret; 51 69 52 70 if (state->polarity != PWM_POLARITY_NORMAL) ··· 74 56 return -EINVAL; 75 57 76 58 iqs620_pwm = container_of(chip, struct iqs620_pwm_private, chip); 77 - iqs62x = iqs620_pwm->iqs62x; 78 59 79 60 /* 80 61 * The duty cycle generated by the device is calculated as follows: ··· 87 70 * For lower duty cycles (e.g. 0), the PWM output is simply disabled to 88 71 * allow an external pull-down resistor to hold the GPIO3/LTX pin low. 89 72 */ 90 - duty_scale = div_u64(state->duty_cycle * 256, IQS620_PWM_PERIOD_NS); 73 + duty_cycle = min_t(u64, state->duty_cycle, IQS620_PWM_PERIOD_NS); 74 + duty_scale = duty_cycle * 256 / IQS620_PWM_PERIOD_NS; 75 + 76 + if (!state->enabled) 77 + duty_scale = 0; 91 78 92 79 mutex_lock(&iqs620_pwm->lock); 93 80 94 - if (!state->enabled || !duty_scale) { 95 - ret = regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS, 96 - IQS620_PWR_SETTINGS_PWM_OUT, 0); 97 - if (ret) 98 - goto err_mutex; 99 - } 81 + ret = iqs620_pwm_init(iqs620_pwm, duty_scale); 82 + if (!ret) 83 + iqs620_pwm->duty_scale = duty_scale; 100 84 101 - if (duty_scale) { 102 - u8 duty_val = min_t(u64, duty_scale - 1, 0xff); 103 - 104 - ret = regmap_write(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE, 105 - duty_val); 106 - if (ret) 107 - goto err_mutex; 108 - 109 - iqs620_pwm->duty_val = duty_val; 110 - } 111 - 112 - if (state->enabled && duty_scale) { 113 - ret = regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS, 114 - IQS620_PWR_SETTINGS_PWM_OUT, 0xff); 115 - if (ret) 116 - goto err_mutex; 117 - } 118 - 119 - iqs620_pwm->out_en = state->enabled; 120 - 121 - err_mutex: 122 85 mutex_unlock(&iqs620_pwm->lock); 123 86 124 87 return ret; ··· 116 119 /* 117 120 * Since the device cannot generate a 0% duty cycle, requests to do so 118 121 * cause subsequent calls to iqs620_pwm_get_state to report the output 119 - * as disabled with duty cycle equal to that which was in use prior to 120 - * the request. This is not ideal, but is the best compromise based on 122 + * as disabled. This is not ideal, but is the best compromise based on 121 123 * the capabilities of the device. 122 124 */ 123 - state->enabled = iqs620_pwm->out_en; 124 - state->duty_cycle = DIV_ROUND_UP((iqs620_pwm->duty_val + 1) * 125 + state->enabled = iqs620_pwm->duty_scale > 0; 126 + state->duty_cycle = DIV_ROUND_UP(iqs620_pwm->duty_scale * 125 127 IQS620_PWM_PERIOD_NS, 256); 126 128 127 129 mutex_unlock(&iqs620_pwm->lock); ··· 132 136 unsigned long event_flags, void *context) 133 137 { 134 138 struct iqs620_pwm_private *iqs620_pwm; 135 - struct iqs62x_core *iqs62x; 136 139 int ret; 137 140 138 141 if (!(event_flags & BIT(IQS62X_EVENT_SYS_RESET))) ··· 139 144 140 145 iqs620_pwm = container_of(notifier, struct iqs620_pwm_private, 141 146 notifier); 142 - iqs62x = iqs620_pwm->iqs62x; 143 147 144 148 mutex_lock(&iqs620_pwm->lock); 145 149 ··· 147 153 * of a device reset, so nothing else is printed here unless there is 148 154 * an additional failure. 149 155 */ 150 - ret = regmap_write(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE, 151 - iqs620_pwm->duty_val); 152 - if (ret) 153 - goto err_mutex; 156 + ret = iqs620_pwm_init(iqs620_pwm, iqs620_pwm->duty_scale); 154 157 155 - ret = regmap_update_bits(iqs62x->regmap, IQS620_PWR_SETTINGS, 156 - IQS620_PWR_SETTINGS_PWM_OUT, 157 - iqs620_pwm->out_en ? 0xff : 0); 158 - 159 - err_mutex: 160 158 mutex_unlock(&iqs620_pwm->lock); 161 159 162 160 if (ret) { ··· 195 209 ret = regmap_read(iqs62x->regmap, IQS620_PWR_SETTINGS, &val); 196 210 if (ret) 197 211 return ret; 198 - iqs620_pwm->out_en = val & IQS620_PWR_SETTINGS_PWM_OUT; 199 212 200 - ret = regmap_read(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE, &val); 201 - if (ret) 202 - return ret; 203 - iqs620_pwm->duty_val = val; 213 + if (val & IQS620_PWR_SETTINGS_PWM_OUT) { 214 + ret = regmap_read(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE, &val); 215 + if (ret) 216 + return ret; 217 + 218 + iqs620_pwm->duty_scale = val + 1; 219 + } 204 220 205 221 iqs620_pwm->chip.dev = &pdev->dev; 206 222 iqs620_pwm->chip.ops = &iqs620_pwm_ops;
+1 -1
drivers/pwm/pwm-lpc18xx-sct.c
··· 289 289 dev_err(lpc18xx_pwm->dev, 290 290 "maximum number of simultaneous channels reached\n"); 291 291 return -EBUSY; 292 - }; 292 + } 293 293 294 294 set_bit(event, &lpc18xx_pwm->event_map); 295 295 lpc18xx_data->duty_event = event;
+23 -9
drivers/pwm/pwm-rockchip.c
··· 72 72 if (ret) 73 73 return; 74 74 75 + ret = clk_enable(pc->clk); 76 + if (ret) 77 + return; 78 + 75 79 clk_rate = clk_get_rate(pc->clk); 76 80 77 81 tmp = readl_relaxed(pc->base + pc->data->regs.period); ··· 94 90 else 95 91 state->polarity = PWM_POLARITY_NORMAL; 96 92 93 + clk_disable(pc->clk); 97 94 clk_disable(pc->pclk); 98 95 } 99 96 ··· 194 189 if (ret) 195 190 return ret; 196 191 192 + ret = clk_enable(pc->clk); 193 + if (ret) 194 + return ret; 195 + 197 196 pwm_get_state(pwm, &curstate); 198 197 enabled = curstate.enabled; 199 198 ··· 217 208 } 218 209 219 210 out: 211 + clk_disable(pc->clk); 220 212 clk_disable(pc->pclk); 221 213 222 214 return ret; ··· 298 288 const struct of_device_id *id; 299 289 struct rockchip_pwm_chip *pc; 300 290 u32 enable_conf, ctrl; 291 + bool enabled; 301 292 int ret, count; 302 293 303 294 id = of_match_device(rockchip_pwm_dt_ids, &pdev->dev); ··· 318 307 pc->clk = devm_clk_get(&pdev->dev, NULL); 319 308 if (IS_ERR(pc->clk)) 320 309 return dev_err_probe(&pdev->dev, PTR_ERR(pc->clk), 321 - "Can't get bus clk\n"); 310 + "Can't get PWM clk\n"); 322 311 } 323 312 324 313 count = of_count_phandle_with_args(pdev->dev.of_node, ··· 337 326 338 327 ret = clk_prepare_enable(pc->clk); 339 328 if (ret) { 340 - dev_err(&pdev->dev, "Can't prepare enable bus clk: %d\n", ret); 329 + dev_err(&pdev->dev, "Can't prepare enable PWM clk: %d\n", ret); 341 330 return ret; 342 331 } 343 332 344 - ret = clk_prepare(pc->pclk); 333 + ret = clk_prepare_enable(pc->pclk); 345 334 if (ret) { 346 - dev_err(&pdev->dev, "Can't prepare APB clk: %d\n", ret); 335 + dev_err(&pdev->dev, "Can't prepare enable APB clk: %d\n", ret); 347 336 goto err_clk; 348 337 } 349 338 ··· 360 349 pc->chip.of_pwm_n_cells = 3; 361 350 } 362 351 352 + enable_conf = pc->data->enable_conf; 353 + ctrl = readl_relaxed(pc->base + pc->data->regs.ctrl); 354 + enabled = (ctrl & enable_conf) == enable_conf; 355 + 363 356 ret = pwmchip_add(&pc->chip); 364 357 if (ret < 0) { 365 - clk_unprepare(pc->clk); 366 358 dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret); 367 359 goto err_pclk; 368 360 } 369 361 370 362 /* Keep the PWM clk enabled if the PWM appears to be up and running. */ 371 - enable_conf = pc->data->enable_conf; 372 - ctrl = readl_relaxed(pc->base + pc->data->regs.ctrl); 373 - if ((ctrl & enable_conf) != enable_conf) 363 + if (!enabled) 374 364 clk_disable(pc->clk); 365 + 366 + clk_disable(pc->pclk); 375 367 376 368 return 0; 377 369 378 370 err_pclk: 379 - clk_unprepare(pc->pclk); 371 + clk_disable_unprepare(pc->pclk); 380 372 err_clk: 381 373 clk_disable_unprepare(pc->clk); 382 374
-278
drivers/pwm/pwm-zx.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 2017 Sanechips Technology Co., Ltd. 4 - * Copyright 2017 Linaro Ltd. 5 - */ 6 - 7 - #include <linux/clk.h> 8 - #include <linux/err.h> 9 - #include <linux/io.h> 10 - #include <linux/kernel.h> 11 - #include <linux/module.h> 12 - #include <linux/platform_device.h> 13 - #include <linux/pwm.h> 14 - #include <linux/slab.h> 15 - 16 - #define ZX_PWM_MODE 0x0 17 - #define ZX_PWM_CLKDIV_SHIFT 2 18 - #define ZX_PWM_CLKDIV_MASK GENMASK(11, 2) 19 - #define ZX_PWM_CLKDIV(x) (((x) << ZX_PWM_CLKDIV_SHIFT) & \ 20 - ZX_PWM_CLKDIV_MASK) 21 - #define ZX_PWM_POLAR BIT(1) 22 - #define ZX_PWM_EN BIT(0) 23 - #define ZX_PWM_PERIOD 0x4 24 - #define ZX_PWM_DUTY 0x8 25 - 26 - #define ZX_PWM_CLKDIV_MAX 1023 27 - #define ZX_PWM_PERIOD_MAX 65535 28 - 29 - struct zx_pwm_chip { 30 - struct pwm_chip chip; 31 - struct clk *pclk; 32 - struct clk *wclk; 33 - void __iomem *base; 34 - }; 35 - 36 - static inline struct zx_pwm_chip *to_zx_pwm_chip(struct pwm_chip *chip) 37 - { 38 - return container_of(chip, struct zx_pwm_chip, chip); 39 - } 40 - 41 - static inline u32 zx_pwm_readl(struct zx_pwm_chip *zpc, unsigned int hwpwm, 42 - unsigned int offset) 43 - { 44 - return readl(zpc->base + (hwpwm + 1) * 0x10 + offset); 45 - } 46 - 47 - static inline void zx_pwm_writel(struct zx_pwm_chip *zpc, unsigned int hwpwm, 48 - unsigned int offset, u32 value) 49 - { 50 - writel(value, zpc->base + (hwpwm + 1) * 0x10 + offset); 51 - } 52 - 53 - static void zx_pwm_set_mask(struct zx_pwm_chip *zpc, unsigned int hwpwm, 54 - unsigned int offset, u32 mask, u32 value) 55 - { 56 - u32 data; 57 - 58 - data = zx_pwm_readl(zpc, hwpwm, offset); 59 - data &= ~mask; 60 - data |= value & mask; 61 - zx_pwm_writel(zpc, hwpwm, offset, data); 62 - } 63 - 64 - static void zx_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, 65 - struct pwm_state *state) 66 - { 67 - struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); 68 - unsigned long rate; 69 - unsigned int div; 70 - u32 value; 71 - u64 tmp; 72 - 73 - value = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_MODE); 74 - 75 - if (value & ZX_PWM_POLAR) 76 - state->polarity = PWM_POLARITY_NORMAL; 77 - else 78 - state->polarity = PWM_POLARITY_INVERSED; 79 - 80 - if (value & ZX_PWM_EN) 81 - state->enabled = true; 82 - else 83 - state->enabled = false; 84 - 85 - div = (value & ZX_PWM_CLKDIV_MASK) >> ZX_PWM_CLKDIV_SHIFT; 86 - rate = clk_get_rate(zpc->wclk); 87 - 88 - tmp = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_PERIOD); 89 - tmp *= div * NSEC_PER_SEC; 90 - state->period = DIV_ROUND_CLOSEST_ULL(tmp, rate); 91 - 92 - tmp = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_DUTY); 93 - tmp *= div * NSEC_PER_SEC; 94 - state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, rate); 95 - } 96 - 97 - static int zx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, 98 - unsigned int duty_ns, unsigned int period_ns) 99 - { 100 - struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); 101 - unsigned int period_cycles, duty_cycles; 102 - unsigned long long c; 103 - unsigned int div = 1; 104 - unsigned long rate; 105 - 106 - /* Find out the best divider */ 107 - rate = clk_get_rate(zpc->wclk); 108 - 109 - while (1) { 110 - c = rate / div; 111 - c = c * period_ns; 112 - do_div(c, NSEC_PER_SEC); 113 - 114 - if (c < ZX_PWM_PERIOD_MAX) 115 - break; 116 - 117 - div++; 118 - 119 - if (div > ZX_PWM_CLKDIV_MAX) 120 - return -ERANGE; 121 - } 122 - 123 - /* Calculate duty cycles */ 124 - period_cycles = c; 125 - c *= duty_ns; 126 - do_div(c, period_ns); 127 - duty_cycles = c; 128 - 129 - /* 130 - * If the PWM is being enabled, we have to temporarily disable it 131 - * before configuring the registers. 132 - */ 133 - if (pwm_is_enabled(pwm)) 134 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_EN, 0); 135 - 136 - /* Set up registers */ 137 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_CLKDIV_MASK, 138 - ZX_PWM_CLKDIV(div)); 139 - zx_pwm_writel(zpc, pwm->hwpwm, ZX_PWM_PERIOD, period_cycles); 140 - zx_pwm_writel(zpc, pwm->hwpwm, ZX_PWM_DUTY, duty_cycles); 141 - 142 - /* Re-enable the PWM if needed */ 143 - if (pwm_is_enabled(pwm)) 144 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, 145 - ZX_PWM_EN, ZX_PWM_EN); 146 - 147 - return 0; 148 - } 149 - 150 - static int zx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, 151 - const struct pwm_state *state) 152 - { 153 - struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); 154 - struct pwm_state cstate; 155 - int ret; 156 - 157 - pwm_get_state(pwm, &cstate); 158 - 159 - if (state->polarity != cstate.polarity) 160 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_POLAR, 161 - (state->polarity == PWM_POLARITY_INVERSED) ? 162 - 0 : ZX_PWM_POLAR); 163 - 164 - if (state->period != cstate.period || 165 - state->duty_cycle != cstate.duty_cycle) { 166 - ret = zx_pwm_config(chip, pwm, state->duty_cycle, 167 - state->period); 168 - if (ret) 169 - return ret; 170 - } 171 - 172 - if (state->enabled != cstate.enabled) { 173 - if (state->enabled) { 174 - ret = clk_prepare_enable(zpc->wclk); 175 - if (ret) 176 - return ret; 177 - 178 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, 179 - ZX_PWM_EN, ZX_PWM_EN); 180 - } else { 181 - zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, 182 - ZX_PWM_EN, 0); 183 - clk_disable_unprepare(zpc->wclk); 184 - } 185 - } 186 - 187 - return 0; 188 - } 189 - 190 - static const struct pwm_ops zx_pwm_ops = { 191 - .apply = zx_pwm_apply, 192 - .get_state = zx_pwm_get_state, 193 - .owner = THIS_MODULE, 194 - }; 195 - 196 - static int zx_pwm_probe(struct platform_device *pdev) 197 - { 198 - struct zx_pwm_chip *zpc; 199 - unsigned int i; 200 - int ret; 201 - 202 - zpc = devm_kzalloc(&pdev->dev, sizeof(*zpc), GFP_KERNEL); 203 - if (!zpc) 204 - return -ENOMEM; 205 - 206 - zpc->base = devm_platform_ioremap_resource(pdev, 0); 207 - if (IS_ERR(zpc->base)) 208 - return PTR_ERR(zpc->base); 209 - 210 - zpc->pclk = devm_clk_get(&pdev->dev, "pclk"); 211 - if (IS_ERR(zpc->pclk)) 212 - return PTR_ERR(zpc->pclk); 213 - 214 - zpc->wclk = devm_clk_get(&pdev->dev, "wclk"); 215 - if (IS_ERR(zpc->wclk)) 216 - return PTR_ERR(zpc->wclk); 217 - 218 - ret = clk_prepare_enable(zpc->pclk); 219 - if (ret) 220 - return ret; 221 - 222 - zpc->chip.dev = &pdev->dev; 223 - zpc->chip.ops = &zx_pwm_ops; 224 - zpc->chip.base = -1; 225 - zpc->chip.npwm = 4; 226 - zpc->chip.of_xlate = of_pwm_xlate_with_flags; 227 - zpc->chip.of_pwm_n_cells = 3; 228 - 229 - /* 230 - * PWM devices may be enabled by firmware, and let's disable all of 231 - * them initially to save power. 232 - */ 233 - for (i = 0; i < zpc->chip.npwm; i++) 234 - zx_pwm_set_mask(zpc, i, ZX_PWM_MODE, ZX_PWM_EN, 0); 235 - 236 - ret = pwmchip_add(&zpc->chip); 237 - if (ret < 0) { 238 - dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret); 239 - clk_disable_unprepare(zpc->pclk); 240 - return ret; 241 - } 242 - 243 - platform_set_drvdata(pdev, zpc); 244 - 245 - return 0; 246 - } 247 - 248 - static int zx_pwm_remove(struct platform_device *pdev) 249 - { 250 - struct zx_pwm_chip *zpc = platform_get_drvdata(pdev); 251 - int ret; 252 - 253 - ret = pwmchip_remove(&zpc->chip); 254 - clk_disable_unprepare(zpc->pclk); 255 - 256 - return ret; 257 - } 258 - 259 - static const struct of_device_id zx_pwm_dt_ids[] = { 260 - { .compatible = "zte,zx296718-pwm", }, 261 - { /* sentinel */ } 262 - }; 263 - MODULE_DEVICE_TABLE(of, zx_pwm_dt_ids); 264 - 265 - static struct platform_driver zx_pwm_driver = { 266 - .driver = { 267 - .name = "zx-pwm", 268 - .of_match_table = zx_pwm_dt_ids, 269 - }, 270 - .probe = zx_pwm_probe, 271 - .remove = zx_pwm_remove, 272 - }; 273 - module_platform_driver(zx_pwm_driver); 274 - 275 - MODULE_ALIAS("platform:zx-pwm"); 276 - MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>"); 277 - MODULE_DESCRIPTION("ZTE ZX PWM Driver"); 278 - MODULE_LICENSE("GPL v2");