Lines Matching full:omap

12  *   This file is the core OMAP support for the generic, Linux
13 * PWM driver / controller, using the OMAP's dual-mode timers
29 * - PWM OMAP DM timer cannot change the polarity when pwm is active. When
43 #include <linux/platform_data/dmtimer-omap.h>
55 * corresponding to omap dmtimer.
56 * @dm_timer: Pointer to omap dm timer.
57 * @pdata: Pointer to omap dm timer ops.
58 * @dm_timer_pdev: Pointer to omap dm timer platform device
86 * pwm_omap_dmtimer_start() - Start the pwm omap dm timer in pwm mode
87 * @omap: Pointer to pwm omap dm timer chip
89 static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap) in pwm_omap_dmtimer_start() argument
92 * According to OMAP 4 TRM section 22.2.4.10 the counter should be in pwm_omap_dmtimer_start()
99 omap->pdata->enable(omap->dm_timer); in pwm_omap_dmtimer_start()
100 omap->pdata->write_counter(omap->dm_timer, DM_TIMER_LOAD_MIN); in pwm_omap_dmtimer_start()
101 omap->pdata->disable(omap->dm_timer); in pwm_omap_dmtimer_start()
103 omap->pdata->start(omap->dm_timer); in pwm_omap_dmtimer_start()
108 * @omap: Pointer to pwm omap dm timer chip
112 static bool pwm_omap_dmtimer_is_enabled(struct pwm_omap_dmtimer_chip *omap) in pwm_omap_dmtimer_is_enabled() argument
116 status = omap->pdata->get_pwm_status(omap->dm_timer); in pwm_omap_dmtimer_is_enabled()
123 * @omap: Pointer to pwm omap dm timer chip
127 static int pwm_omap_dmtimer_polarity(struct pwm_omap_dmtimer_chip *omap) in pwm_omap_dmtimer_polarity() argument
131 status = omap->pdata->get_pwm_status(omap->dm_timer); in pwm_omap_dmtimer_polarity()
137 * pwm_omap_dmtimer_config() - Update the configuration of pwm omap dm timer
150 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_config() local
163 fclk = omap->pdata->get_fclk(omap->dm_timer); in pwm_omap_dmtimer_config()
226 omap->pdata->set_load(omap->dm_timer, load_value); in pwm_omap_dmtimer_config()
227 omap->pdata->set_match(omap->dm_timer, true, match_value); in pwm_omap_dmtimer_config()
245 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_set_polarity() local
249 enabled = pwm_omap_dmtimer_is_enabled(omap); in pwm_omap_dmtimer_set_polarity()
251 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_set_polarity()
253 omap->pdata->set_pwm(omap->dm_timer, in pwm_omap_dmtimer_set_polarity()
259 pwm_omap_dmtimer_start(omap); in pwm_omap_dmtimer_set_polarity()
263 * pwm_omap_dmtimer_apply() - Changes the state of the pwm omap dm timer.
274 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_apply() local
277 if (pwm_omap_dmtimer_is_enabled(omap) && !state->enabled) { in pwm_omap_dmtimer_apply()
278 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_apply()
282 if (pwm_omap_dmtimer_polarity(omap) != state->polarity) in pwm_omap_dmtimer_apply()
290 if (!pwm_omap_dmtimer_is_enabled(omap) && state->enabled) { in pwm_omap_dmtimer_apply()
291 omap->pdata->set_pwm(omap->dm_timer, in pwm_omap_dmtimer_apply()
296 pwm_omap_dmtimer_start(omap); in pwm_omap_dmtimer_apply()
313 struct pwm_omap_dmtimer_chip *omap; in pwm_omap_dmtimer_probe() local
370 chip = devm_pwmchip_alloc(&pdev->dev, 1, sizeof(*omap)); in pwm_omap_dmtimer_probe()
375 omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_probe()
377 omap->pdata = pdata; in pwm_omap_dmtimer_probe()
378 omap->dm_timer = dm_timer; in pwm_omap_dmtimer_probe()
379 omap->dm_timer_pdev = timer_pdev; in pwm_omap_dmtimer_probe()
385 if (pm_runtime_active(&omap->dm_timer_pdev->dev)) in pwm_omap_dmtimer_probe()
386 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_probe()
389 omap->pdata->set_prescaler(omap->dm_timer, v); in pwm_omap_dmtimer_probe()
393 omap->pdata->set_source(omap->dm_timer, v); in pwm_omap_dmtimer_probe()
412 * *omap is allocated using devm_kzalloc, in pwm_omap_dmtimer_probe()
434 struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); in pwm_omap_dmtimer_remove() local
438 if (pm_runtime_active(&omap->dm_timer_pdev->dev)) in pwm_omap_dmtimer_remove()
439 omap->pdata->stop(omap->dm_timer); in pwm_omap_dmtimer_remove()
441 omap->pdata->free(omap->dm_timer); in pwm_omap_dmtimer_remove()
443 put_device(&omap->dm_timer_pdev->dev); in pwm_omap_dmtimer_remove()
447 {.compatible = "ti,omap-dmtimer-pwm"},
454 .name = "omap-dmtimer-pwm",
466 MODULE_DESCRIPTION("OMAP PWM Driver using Dual-mode Timers");