Lines Matching full:omap
15 * This file is the core OMAP support for the generic, Linux
16 * PWM driver / controller, using the OMAP's dual-mode timers.
26 #include <linux/platform_data/dmtimer-omap.h>
56 static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap) in pwm_omap_dmtimer_start() argument
59 * According to OMAP 4 TRM section 22.2.4.10 the counter should be in pwm_omap_dmtimer_start()
66 omap->pdata->enable(omap->dm_timer); in pwm_omap_dmtimer_start()
67 omap->pdata->write_counter(omap->dm_timer, DM_TIMER_LOAD_MIN); in pwm_omap_dmtimer_start()
68 omap->pdata->disable(omap->dm_timer); in pwm_omap_dmtimer_start()
70 omap->pdata->start(omap->dm_timer); in pwm_omap_dmtimer_start()
76 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_enable() local
78 mutex_lock(&omap->mutex); in pwm_omap_dmtimer_enable()
79 pwm_omap_dmtimer_start(omap); in pwm_omap_dmtimer_enable()
80 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_enable()
88 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_disable() local
90 mutex_lock(&omap->mutex); in pwm_omap_dmtimer_disable()
91 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_disable()
92 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_disable()
99 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_config() local
109 mutex_lock(&omap->mutex); in pwm_omap_dmtimer_config()
113 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_config()
117 fclk = omap->pdata->get_fclk(omap->dm_timer); in pwm_omap_dmtimer_config()
185 timer_active = pm_runtime_active(&omap->dm_timer_pdev->dev); in pwm_omap_dmtimer_config()
187 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_config()
189 omap->pdata->set_load(omap->dm_timer, true, load_value); in pwm_omap_dmtimer_config()
190 omap->pdata->set_match(omap->dm_timer, true, match_value); in pwm_omap_dmtimer_config()
195 omap->pdata->set_pwm(omap->dm_timer, in pwm_omap_dmtimer_config()
202 pwm_omap_dmtimer_start(omap); in pwm_omap_dmtimer_config()
204 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_config()
209 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_config()
218 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_set_polarity() local
224 mutex_lock(&omap->mutex); in pwm_omap_dmtimer_set_polarity()
225 omap->pdata->set_pwm(omap->dm_timer, in pwm_omap_dmtimer_set_polarity()
229 mutex_unlock(&omap->mutex); in pwm_omap_dmtimer_set_polarity()
247 struct pwm_omap_dmtimer_chip *omap; in pwm_omap_dmtimer_probe() local
304 omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL); in pwm_omap_dmtimer_probe()
305 if (!omap) { in pwm_omap_dmtimer_probe()
310 omap->pdata = pdata; in pwm_omap_dmtimer_probe()
311 omap->dm_timer = dm_timer; in pwm_omap_dmtimer_probe()
312 omap->dm_timer_pdev = timer_pdev; in pwm_omap_dmtimer_probe()
318 if (pm_runtime_active(&omap->dm_timer_pdev->dev)) in pwm_omap_dmtimer_probe()
319 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_probe()
322 omap->pdata->set_prescaler(omap->dm_timer, v); in pwm_omap_dmtimer_probe()
326 omap->pdata->set_source(omap->dm_timer, v); in pwm_omap_dmtimer_probe()
328 omap->chip.dev = &pdev->dev; in pwm_omap_dmtimer_probe()
329 omap->chip.ops = &pwm_omap_dmtimer_ops; in pwm_omap_dmtimer_probe()
330 omap->chip.base = -1; in pwm_omap_dmtimer_probe()
331 omap->chip.npwm = 1; in pwm_omap_dmtimer_probe()
332 omap->chip.of_xlate = of_pwm_xlate_with_flags; in pwm_omap_dmtimer_probe()
333 omap->chip.of_pwm_n_cells = 3; in pwm_omap_dmtimer_probe()
335 mutex_init(&omap->mutex); in pwm_omap_dmtimer_probe()
337 ret = pwmchip_add(&omap->chip); in pwm_omap_dmtimer_probe()
345 platform_set_drvdata(pdev, omap); in pwm_omap_dmtimer_probe()
352 * *omap is allocated using devm_kzalloc, in pwm_omap_dmtimer_probe()
373 struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev); in pwm_omap_dmtimer_remove() local
376 ret = pwmchip_remove(&omap->chip); in pwm_omap_dmtimer_remove()
380 if (pm_runtime_active(&omap->dm_timer_pdev->dev)) in pwm_omap_dmtimer_remove()
381 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_remove()
383 omap->pdata->free(omap->dm_timer); in pwm_omap_dmtimer_remove()
385 put_device(&omap->dm_timer_pdev->dev); in pwm_omap_dmtimer_remove()
387 mutex_destroy(&omap->mutex); in pwm_omap_dmtimer_remove()
393 {.compatible = "ti,omap-dmtimer-pwm"},
400 .name = "omap-dmtimer-pwm",
412 MODULE_DESCRIPTION("OMAP PWM Driver using Dual-mode Timers");