blob: 4e8ff9e04f77b196233885b280a902be2546b91a [file] [log] [blame]
Lee Jones378fe112014-07-14 15:33:27 +01001/*
2 * PWM device driver for ST SoCs.
3 * Author: Ajit Pal Singh <ajitpal.singh@st.com>
4 *
5 * Copyright (C) 2013-2014 STMicroelectronics (R&D) Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
Lee Jones378fe112014-07-14 15:33:27 +010013#include <linux/clk.h>
14#include <linux/math64.h>
15#include <linux/mfd/syscon.h>
16#include <linux/module.h>
17#include <linux/of.h>
18#include <linux/platform_device.h>
19#include <linux/pwm.h>
20#include <linux/regmap.h>
21#include <linux/slab.h>
22#include <linux/time.h>
23
Lee Jonesc5f94ae2016-08-16 10:34:59 +010024#define PWM_OUT_VAL(x) (0x00 + (4 * (x))) /* Device's Duty Cycle register */
Lee Jonesf66d78f2016-08-16 10:35:01 +010025#define PWM_CPT_VAL(x) (0x10 + (4 * (x))) /* Capture value */
26#define PWM_CPT_EDGE(x) (0x30 + (4 * (x))) /* Edge to capture on */
Lee Jonesc5f94ae2016-08-16 10:34:59 +010027
28#define STI_PWM_CTRL 0x50 /* Control/Config register */
29#define STI_INT_EN 0x54 /* Interrupt Enable/Disable register */
Lee Jonesf66d78f2016-08-16 10:35:01 +010030#define STI_INT_STA 0x58 /* Interrupt Status register */
31#define PWM_INT_ACK 0x5c
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +010032#define PWM_PRESCALE_LOW_MASK 0x0f
33#define PWM_PRESCALE_HIGH_MASK 0xf0
Lee Jonesf66d78f2016-08-16 10:35:01 +010034#define PWM_CPT_EDGE_MASK 0x03
35#define PWM_INT_ACK_MASK 0x1ff
36
37#define STI_MAX_CPT_DEVS 4
38#define CPT_DC_MAX 0xff
Lee Jones378fe112014-07-14 15:33:27 +010039
40/* Regfield IDs */
41enum {
Lee Jonesc5f94ae2016-08-16 10:34:59 +010042 /* Bits in PWM_CTRL*/
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +010043 PWMCLK_PRESCALE_LOW,
44 PWMCLK_PRESCALE_HIGH,
Lee Jonesf66d78f2016-08-16 10:35:01 +010045 CPTCLK_PRESCALE,
Lee Jonesc5f94ae2016-08-16 10:34:59 +010046
47 PWM_OUT_EN,
Lee Jonesf66d78f2016-08-16 10:35:01 +010048 PWM_CPT_EN,
Lee Jonesc5f94ae2016-08-16 10:34:59 +010049
50 PWM_CPT_INT_EN,
Lee Jonesf66d78f2016-08-16 10:35:01 +010051 PWM_CPT_INT_STAT,
Lee Jones378fe112014-07-14 15:33:27 +010052
53 /* Keep last */
54 MAX_REGFIELDS
55};
56
Lee Jonesf66d78f2016-08-16 10:35:01 +010057/* Each capture input can be programmed to detect rising-edge, falling-edge,
58 * either edge or neither egde
59 */
60enum sti_cpt_edge {
61 CPT_EDGE_DISABLED,
62 CPT_EDGE_RISING,
63 CPT_EDGE_FALLING,
64 CPT_EDGE_BOTH,
65};
66
Lee Jones378fe112014-07-14 15:33:27 +010067struct sti_pwm_compat_data {
68 const struct reg_field *reg_fields;
Lee Jones09022e62016-08-16 10:34:58 +010069 unsigned int num_devs;
Lee Jones378fe112014-07-14 15:33:27 +010070 unsigned int max_pwm_cnt;
71 unsigned int max_prescale;
72};
73
74struct sti_pwm_chip {
75 struct device *dev;
Lee Jonesc5f94ae2016-08-16 10:34:59 +010076 struct clk *pwm_clk;
Lee Jones378fe112014-07-14 15:33:27 +010077 struct regmap *regmap;
78 struct sti_pwm_compat_data *cdata;
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +010079 struct regmap_field *prescale_low;
80 struct regmap_field *prescale_high;
Lee Jonesc5f94ae2016-08-16 10:34:59 +010081 struct regmap_field *pwm_out_en;
82 struct regmap_field *pwm_cpt_int_en;
Lee Jones378fe112014-07-14 15:33:27 +010083 struct pwm_chip chip;
Ajit Pal Singh51651662014-07-14 15:33:30 +010084 struct pwm_device *cur;
Ajit Pal Singhcd264b62015-01-29 14:34:43 +053085 unsigned long configured;
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +010086 unsigned int en_count;
87 struct mutex sti_pwm_lock; /* To sync between enable/disable calls */
Lee Jones378fe112014-07-14 15:33:27 +010088 void __iomem *mmio;
89};
90
91static const struct reg_field sti_pwm_regfields[MAX_REGFIELDS] = {
Lee Jonesc5f94ae2016-08-16 10:34:59 +010092 [PWMCLK_PRESCALE_LOW] = REG_FIELD(STI_PWM_CTRL, 0, 3),
93 [PWMCLK_PRESCALE_HIGH] = REG_FIELD(STI_PWM_CTRL, 11, 14),
Lee Jonesf66d78f2016-08-16 10:35:01 +010094 [CPTCLK_PRESCALE] = REG_FIELD(STI_PWM_CTRL, 4, 8),
Lee Jonesc5f94ae2016-08-16 10:34:59 +010095 [PWM_OUT_EN] = REG_FIELD(STI_PWM_CTRL, 9, 9),
Lee Jonesf66d78f2016-08-16 10:35:01 +010096 [PWM_CPT_EN] = REG_FIELD(STI_PWM_CTRL, 10, 10),
Lee Jonesc5f94ae2016-08-16 10:34:59 +010097 [PWM_CPT_INT_EN] = REG_FIELD(STI_INT_EN, 1, 4),
Lee Jonesf66d78f2016-08-16 10:35:01 +010098 [PWM_CPT_INT_STAT] = REG_FIELD(STI_INT_STA, 1, 4),
Lee Jones378fe112014-07-14 15:33:27 +010099};
100
101static inline struct sti_pwm_chip *to_sti_pwmchip(struct pwm_chip *chip)
102{
103 return container_of(chip, struct sti_pwm_chip, chip);
104}
105
106/*
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100107 * Calculate the prescaler value corresponding to the period.
Lee Jones378fe112014-07-14 15:33:27 +0100108 */
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100109static int sti_pwm_get_prescale(struct sti_pwm_chip *pc, unsigned long period,
110 unsigned int *prescale)
Lee Jones378fe112014-07-14 15:33:27 +0100111{
112 struct sti_pwm_compat_data *cdata = pc->cdata;
Lee Jonesd81738b2016-08-16 10:35:00 +0100113 unsigned long clk_rate;
Lee Jones378fe112014-07-14 15:33:27 +0100114 unsigned long val;
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100115 unsigned int ps;
Lee Jones378fe112014-07-14 15:33:27 +0100116
Lee Jonesd81738b2016-08-16 10:35:00 +0100117 clk_rate = clk_get_rate(pc->pwm_clk);
118 if (!clk_rate) {
119 dev_err(pc->dev, "failed to get clock rate\n");
120 return -EINVAL;
121 }
122
Lee Jones378fe112014-07-14 15:33:27 +0100123 /*
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100124 * prescale = ((period_ns * clk_rate) / (10^9 * (max_pwm_count + 1)) - 1
Lee Jones378fe112014-07-14 15:33:27 +0100125 */
Lee Jonesd81738b2016-08-16 10:35:00 +0100126 val = NSEC_PER_SEC / clk_rate;
Lee Jones378fe112014-07-14 15:33:27 +0100127 val *= cdata->max_pwm_cnt + 1;
128
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100129 if (period % val) {
130 return -EINVAL;
131 } else {
132 ps = period / val - 1;
133 if (ps > cdata->max_prescale)
134 return -EINVAL;
Lee Jones378fe112014-07-14 15:33:27 +0100135 }
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100136 *prescale = ps;
137
138 return 0;
Lee Jones378fe112014-07-14 15:33:27 +0100139}
140
Lee Jones378fe112014-07-14 15:33:27 +0100141/*
142 * For STiH4xx PWM IP, the PWM period is fixed to 256 local clock cycles.
143 * The only way to change the period (apart from changing the PWM input clock)
144 * is to change the PWM clock prescaler.
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +0100145 * The prescaler is of 8 bits, so 256 prescaler values and hence
146 * 256 possible period values are supported (for a particular clock rate).
Lee Jones378fe112014-07-14 15:33:27 +0100147 * The requested period will be applied only if it matches one of these
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +0100148 * 256 values.
Lee Jones378fe112014-07-14 15:33:27 +0100149 */
150static int sti_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
151 int duty_ns, int period_ns)
152{
153 struct sti_pwm_chip *pc = to_sti_pwmchip(chip);
154 struct sti_pwm_compat_data *cdata = pc->cdata;
Ajit Pal Singh51651662014-07-14 15:33:30 +0100155 struct pwm_device *cur = pc->cur;
Lee Jones378fe112014-07-14 15:33:27 +0100156 struct device *dev = pc->dev;
Ajit Pal Singh51651662014-07-14 15:33:30 +0100157 unsigned int prescale = 0, pwmvalx;
Lee Jones378fe112014-07-14 15:33:27 +0100158 int ret;
Ajit Pal Singh51651662014-07-14 15:33:30 +0100159 unsigned int ncfg;
160 bool period_same = false;
Lee Jones378fe112014-07-14 15:33:27 +0100161
Ajit Pal Singhcd264b62015-01-29 14:34:43 +0530162 ncfg = hweight_long(pc->configured);
Ajit Pal Singh51651662014-07-14 15:33:30 +0100163 if (ncfg)
164 period_same = (period_ns == pwm_get_period(cur));
165
166 /* Allow configuration changes if one of the
167 * following conditions satisfy.
Lee Jones09022e62016-08-16 10:34:58 +0100168 * 1. No devices have been configured.
169 * 2. Only one device has been configured and the new request
170 * is for the same device.
171 * 3. Only one device has been configured and the new request is
172 * for a new device and period of the new device is same as
Ajit Pal Singh51651662014-07-14 15:33:30 +0100173 * the current configured period.
Lee Jones09022e62016-08-16 10:34:58 +0100174 * 4. More than one devices are configured and period of the new
Ajit Pal Singh51651662014-07-14 15:33:30 +0100175 * requestis the same as the current period.
Lee Jones378fe112014-07-14 15:33:27 +0100176 */
Ajit Pal Singh51651662014-07-14 15:33:30 +0100177 if (!ncfg ||
178 ((ncfg == 1) && (pwm->hwpwm == cur->hwpwm)) ||
179 ((ncfg == 1) && (pwm->hwpwm != cur->hwpwm) && period_same) ||
180 ((ncfg > 1) && period_same)) {
181 /* Enable clock before writing to PWM registers. */
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100182 ret = clk_enable(pc->pwm_clk);
Ajit Pal Singh51651662014-07-14 15:33:30 +0100183 if (ret)
184 return ret;
185
186 if (!period_same) {
Ajit Pal Singh3aacd3e2014-07-14 15:33:32 +0100187 ret = sti_pwm_get_prescale(pc, period_ns, &prescale);
188 if (ret)
Ajit Pal Singh51651662014-07-14 15:33:30 +0100189 goto clk_dis;
Ajit Pal Singh51651662014-07-14 15:33:30 +0100190
191 ret =
192 regmap_field_write(pc->prescale_low,
193 prescale & PWM_PRESCALE_LOW_MASK);
194 if (ret)
195 goto clk_dis;
196
197 ret =
198 regmap_field_write(pc->prescale_high,
199 (prescale & PWM_PRESCALE_HIGH_MASK) >> 4);
200 if (ret)
201 goto clk_dis;
202 }
203
204 /*
205 * When PWMVal == 0, PWM pulse = 1 local clock cycle.
206 * When PWMVal == max_pwm_count,
207 * PWM pulse = (max_pwm_count + 1) local cycles,
208 * that is continuous pulse: signal never goes low.
209 */
210 pwmvalx = cdata->max_pwm_cnt * duty_ns / period_ns;
211
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100212 ret = regmap_write(pc->regmap,
213 PWM_OUT_VAL(pwm->hwpwm), pwmvalx);
Ajit Pal Singh51651662014-07-14 15:33:30 +0100214 if (ret)
215 goto clk_dis;
216
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100217 ret = regmap_field_write(pc->pwm_cpt_int_en, 0);
Ajit Pal Singh51651662014-07-14 15:33:30 +0100218
Ajit Pal Singhcd264b62015-01-29 14:34:43 +0530219 set_bit(pwm->hwpwm, &pc->configured);
Ajit Pal Singh51651662014-07-14 15:33:30 +0100220 pc->cur = pwm;
221
222 dev_dbg(dev, "prescale:%u, period:%i, duty:%i, pwmvalx:%u\n",
223 prescale, period_ns, duty_ns, pwmvalx);
224 } else {
Lee Jones378fe112014-07-14 15:33:27 +0100225 return -EINVAL;
226 }
227
Lee Jones378fe112014-07-14 15:33:27 +0100228clk_dis:
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100229 clk_disable(pc->pwm_clk);
Lee Jones378fe112014-07-14 15:33:27 +0100230 return ret;
231}
232
233static int sti_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
234{
235 struct sti_pwm_chip *pc = to_sti_pwmchip(chip);
236 struct device *dev = pc->dev;
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100237 int ret = 0;
Lee Jones378fe112014-07-14 15:33:27 +0100238
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100239 /*
Lee Jones09022e62016-08-16 10:34:58 +0100240 * Since we have a common enable for all PWM devices,
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100241 * do not enable if already enabled.
242 */
243 mutex_lock(&pc->sti_pwm_lock);
244 if (!pc->en_count) {
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100245 ret = clk_enable(pc->pwm_clk);
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100246 if (ret)
247 goto out;
Lee Jones378fe112014-07-14 15:33:27 +0100248
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100249 ret = regmap_field_write(pc->pwm_out_en, 1);
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100250 if (ret) {
251 dev_err(dev, "failed to enable PWM device:%d\n",
252 pwm->hwpwm);
253 goto out;
254 }
255 }
256 pc->en_count++;
257out:
258 mutex_unlock(&pc->sti_pwm_lock);
Lee Jones378fe112014-07-14 15:33:27 +0100259 return ret;
260}
261
262static void sti_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
263{
264 struct sti_pwm_chip *pc = to_sti_pwmchip(chip);
Lee Jones378fe112014-07-14 15:33:27 +0100265
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100266 mutex_lock(&pc->sti_pwm_lock);
267 if (--pc->en_count) {
268 mutex_unlock(&pc->sti_pwm_lock);
269 return;
270 }
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100271 regmap_field_write(pc->pwm_out_en, 0);
Lee Jones378fe112014-07-14 15:33:27 +0100272
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100273 clk_disable(pc->pwm_clk);
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100274 mutex_unlock(&pc->sti_pwm_lock);
Lee Jones378fe112014-07-14 15:33:27 +0100275}
276
Ajit Pal Singhcd264b62015-01-29 14:34:43 +0530277static void sti_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
278{
279 struct sti_pwm_chip *pc = to_sti_pwmchip(chip);
280
281 clear_bit(pwm->hwpwm, &pc->configured);
282}
283
Lee Jones378fe112014-07-14 15:33:27 +0100284static const struct pwm_ops sti_pwm_ops = {
285 .config = sti_pwm_config,
286 .enable = sti_pwm_enable,
287 .disable = sti_pwm_disable,
Ajit Pal Singhcd264b62015-01-29 14:34:43 +0530288 .free = sti_pwm_free,
Lee Jones378fe112014-07-14 15:33:27 +0100289 .owner = THIS_MODULE,
290};
291
292static int sti_pwm_probe_dt(struct sti_pwm_chip *pc)
293{
294 struct device *dev = pc->dev;
295 const struct reg_field *reg_fields;
296 struct device_node *np = dev->of_node;
297 struct sti_pwm_compat_data *cdata = pc->cdata;
Lee Jones09022e62016-08-16 10:34:58 +0100298 u32 num_devs;
Lee Jones378fe112014-07-14 15:33:27 +0100299
Lee Jones09022e62016-08-16 10:34:58 +0100300 of_property_read_u32(np, "st,pwm-num-chan", &num_devs);
301 if (num_devs)
302 cdata->num_devs = num_devs;
Lee Jones378fe112014-07-14 15:33:27 +0100303
304 reg_fields = cdata->reg_fields;
305
Ajit Pal Singhbf9cc802014-07-14 15:33:29 +0100306 pc->prescale_low = devm_regmap_field_alloc(dev, pc->regmap,
307 reg_fields[PWMCLK_PRESCALE_LOW]);
308 if (IS_ERR(pc->prescale_low))
309 return PTR_ERR(pc->prescale_low);
310
311 pc->prescale_high = devm_regmap_field_alloc(dev, pc->regmap,
312 reg_fields[PWMCLK_PRESCALE_HIGH]);
313 if (IS_ERR(pc->prescale_high))
314 return PTR_ERR(pc->prescale_high);
Lee Jones378fe112014-07-14 15:33:27 +0100315
Lee Jones378fe112014-07-14 15:33:27 +0100316
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100317 pc->pwm_out_en = devm_regmap_field_alloc(dev, pc->regmap,
318 reg_fields[PWM_OUT_EN]);
319 if (IS_ERR(pc->pwm_out_en))
320 return PTR_ERR(pc->pwm_out_en);
321
322 pc->pwm_cpt_int_en = devm_regmap_field_alloc(dev, pc->regmap,
323 reg_fields[PWM_CPT_INT_EN]);
324 if (IS_ERR(pc->pwm_cpt_int_en))
325 return PTR_ERR(pc->pwm_cpt_int_en);
Lee Jones378fe112014-07-14 15:33:27 +0100326
327 return 0;
328}
329
330static const struct regmap_config sti_pwm_regmap_config = {
331 .reg_bits = 32,
332 .val_bits = 32,
333 .reg_stride = 4,
334};
335
336static int sti_pwm_probe(struct platform_device *pdev)
337{
338 struct device *dev = &pdev->dev;
339 struct sti_pwm_compat_data *cdata;
340 struct sti_pwm_chip *pc;
341 struct resource *res;
342 int ret;
343
344 pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL);
345 if (!pc)
346 return -ENOMEM;
347
348 cdata = devm_kzalloc(dev, sizeof(*cdata), GFP_KERNEL);
349 if (!cdata)
350 return -ENOMEM;
351
352 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
353
354 pc->mmio = devm_ioremap_resource(dev, res);
355 if (IS_ERR(pc->mmio))
356 return PTR_ERR(pc->mmio);
357
358 pc->regmap = devm_regmap_init_mmio(dev, pc->mmio,
359 &sti_pwm_regmap_config);
360 if (IS_ERR(pc->regmap))
361 return PTR_ERR(pc->regmap);
362
363 /*
364 * Setup PWM data with default values: some values could be replaced
365 * with specific ones provided from Device Tree.
366 */
367 cdata->reg_fields = &sti_pwm_regfields[0];
368 cdata->max_prescale = 0xff;
369 cdata->max_pwm_cnt = 255;
Lee Jones09022e62016-08-16 10:34:58 +0100370 cdata->num_devs = 1;
Lee Jones378fe112014-07-14 15:33:27 +0100371
372 pc->cdata = cdata;
373 pc->dev = dev;
Ajit Pal Singh6ad6b832014-07-14 15:33:31 +0100374 pc->en_count = 0;
375 mutex_init(&pc->sti_pwm_lock);
Lee Jones378fe112014-07-14 15:33:27 +0100376
377 ret = sti_pwm_probe_dt(pc);
378 if (ret)
379 return ret;
380
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100381 pc->pwm_clk = of_clk_get_by_name(dev->of_node, "pwm");
382 if (IS_ERR(pc->pwm_clk)) {
Lee Jones378fe112014-07-14 15:33:27 +0100383 dev_err(dev, "failed to get PWM clock\n");
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100384 return PTR_ERR(pc->pwm_clk);
Lee Jones378fe112014-07-14 15:33:27 +0100385 }
386
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100387 ret = clk_prepare(pc->pwm_clk);
Lee Jones378fe112014-07-14 15:33:27 +0100388 if (ret) {
389 dev_err(dev, "failed to prepare clock\n");
390 return ret;
391 }
392
Lee Jones378fe112014-07-14 15:33:27 +0100393 pc->chip.dev = dev;
394 pc->chip.ops = &sti_pwm_ops;
395 pc->chip.base = -1;
Lee Jones09022e62016-08-16 10:34:58 +0100396 pc->chip.npwm = pc->cdata->num_devs;
Lee Jones378fe112014-07-14 15:33:27 +0100397 pc->chip.can_sleep = true;
398
399 ret = pwmchip_add(&pc->chip);
400 if (ret < 0) {
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100401 clk_unprepare(pc->pwm_clk);
Lee Jones378fe112014-07-14 15:33:27 +0100402 return ret;
403 }
404
405 platform_set_drvdata(pdev, pc);
406
407 return 0;
408}
409
410static int sti_pwm_remove(struct platform_device *pdev)
411{
412 struct sti_pwm_chip *pc = platform_get_drvdata(pdev);
413 unsigned int i;
414
Lee Jones09022e62016-08-16 10:34:58 +0100415 for (i = 0; i < pc->cdata->num_devs; i++)
Lee Jones378fe112014-07-14 15:33:27 +0100416 pwm_disable(&pc->chip.pwms[i]);
417
Lee Jonesc5f94ae2016-08-16 10:34:59 +0100418 clk_unprepare(pc->pwm_clk);
Lee Jones378fe112014-07-14 15:33:27 +0100419
420 return pwmchip_remove(&pc->chip);
421}
422
423static const struct of_device_id sti_pwm_of_match[] = {
424 { .compatible = "st,sti-pwm", },
425 { /* sentinel */ }
426};
427MODULE_DEVICE_TABLE(of, sti_pwm_of_match);
428
429static struct platform_driver sti_pwm_driver = {
430 .driver = {
431 .name = "sti-pwm",
432 .of_match_table = sti_pwm_of_match,
433 },
434 .probe = sti_pwm_probe,
435 .remove = sti_pwm_remove,
436};
437module_platform_driver(sti_pwm_driver);
438
439MODULE_AUTHOR("Ajit Pal Singh <ajitpal.singh@st.com>");
440MODULE_DESCRIPTION("STMicroelectronics ST PWM driver");
441MODULE_LICENSE("GPL");