aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-jz4740.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pwm/pwm-jz4740.c')
-rw-r--r--drivers/pwm/pwm-jz4740.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 6539c001fe32..a7b134af5e04 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -18,6 +18,7 @@
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/of_device.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <linux/pwm.h> 23#include <linux/pwm.h>
23 24
@@ -174,6 +175,8 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
174 jz4740->chip.ops = &jz4740_pwm_ops; 175 jz4740->chip.ops = &jz4740_pwm_ops;
175 jz4740->chip.npwm = NUM_PWM; 176 jz4740->chip.npwm = NUM_PWM;
176 jz4740->chip.base = -1; 177 jz4740->chip.base = -1;
178 jz4740->chip.of_xlate = of_pwm_xlate_with_flags;
179 jz4740->chip.of_pwm_n_cells = 3;
177 180
178 platform_set_drvdata(pdev, jz4740); 181 platform_set_drvdata(pdev, jz4740);
179 182
@@ -187,9 +190,20 @@ static int jz4740_pwm_remove(struct platform_device *pdev)
187 return pwmchip_remove(&jz4740->chip); 190 return pwmchip_remove(&jz4740->chip);
188} 191}
189 192
193#ifdef CONFIG_OF
194static const struct of_device_id jz4740_pwm_dt_ids[] = {
195 { .compatible = "ingenic,jz4740-pwm", },
196 { .compatible = "ingenic,jz4770-pwm", },
197 { .compatible = "ingenic,jz4780-pwm", },
198 {},
199};
200MODULE_DEVICE_TABLE(of, jz4740_pwm_dt_ids);
201#endif
202
190static struct platform_driver jz4740_pwm_driver = { 203static struct platform_driver jz4740_pwm_driver = {
191 .driver = { 204 .driver = {
192 .name = "jz4740-pwm", 205 .name = "jz4740-pwm",
206 .of_match_table = of_match_ptr(jz4740_pwm_dt_ids),
193 }, 207 },
194 .probe = jz4740_pwm_probe, 208 .probe = jz4740_pwm_probe,
195 .remove = jz4740_pwm_remove, 209 .remove = jz4740_pwm_remove,