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

pwm: omap-dmtimer: Add debug message for effective period and duty cycle

After going through the math and constraints checking to compute load
and match values, it is helpful to know what the resultant period and
duty cycle are.

Signed-off-by: David Rivshin <drivshin@allworx.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

David Rivshin and committed by
Thierry Reding
922201d1 7b0883f3

+8 -1
+8 -1
drivers/pwm/pwm-omap-dmtimer.c
··· 102 102 unsigned long clk_rate; 103 103 bool timer_active; 104 104 105 - dev_dbg(chip->dev, "duty cycle: %d, period %d\n", duty_ns, period_ns); 105 + dev_dbg(chip->dev, "requested duty cycle: %d ns, period: %d ns\n", 106 + duty_ns, period_ns); 106 107 107 108 mutex_lock(&omap->mutex); 108 109 if (duty_ns == pwm_get_duty_cycle(pwm) && ··· 166 165 dev_dbg(chip->dev, "using maximum of 1 clock cycle less than period\n"); 167 166 duty_cycles = period_cycles - 1; 168 167 } 168 + 169 + dev_dbg(chip->dev, "effective duty cycle: %lld ns, period: %lld ns\n", 170 + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * duty_cycles, 171 + clk_rate), 172 + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * period_cycles, 173 + clk_rate)); 169 174 170 175 load_value = (DM_TIMER_MAX - period_cycles) + 1; 171 176 match_value = load_value + duty_cycles - 1;