Lines Matching +full:long +full:- +full:term
1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * platform device ep93xx-pwm.1 - PWMOUT1 (EGPIO14)
12 * platform device ep93xx-pwm.0 - PWMOUT
15 * platform device ep93xx-pwm.0 - PWMOUT
16 * platform device ep93xx-pwm.1 - PWMOUT1 (EGPIO14)
49 struct platform_device *pdev = to_platform_device(chip->dev); in ep93xx_pwm_request()
56 struct platform_device *pdev = to_platform_device(chip->dev); in ep93xx_pwm_free()
65 void __iomem *base = ep93xx_pwm->base; in ep93xx_pwm_config()
66 unsigned long long c; in ep93xx_pwm_config()
67 unsigned long period_cycles; in ep93xx_pwm_config()
68 unsigned long duty_cycles; in ep93xx_pwm_config()
69 unsigned long term; in ep93xx_pwm_config() local
77 ret = clk_enable(ep93xx_pwm->clk); in ep93xx_pwm_config()
82 c = clk_get_rate(ep93xx_pwm->clk); in ep93xx_pwm_config()
93 term = readw(base + EP93XX_PWMx_TERM_COUNT); in ep93xx_pwm_config()
96 if (period_cycles > term) { in ep93xx_pwm_config()
104 ret = -EINVAL; in ep93xx_pwm_config()
108 clk_disable(ep93xx_pwm->clk); in ep93xx_pwm_config()
123 ret = clk_enable(ep93xx_pwm->clk); in ep93xx_pwm_polarity()
128 writew(0x1, ep93xx_pwm->base + EP93XX_PWMx_INVERT); in ep93xx_pwm_polarity()
130 writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_INVERT); in ep93xx_pwm_polarity()
132 clk_disable(ep93xx_pwm->clk); in ep93xx_pwm_polarity()
142 ret = clk_enable(ep93xx_pwm->clk); in ep93xx_pwm_enable()
146 writew(0x1, ep93xx_pwm->base + EP93XX_PWMx_ENABLE); in ep93xx_pwm_enable()
155 writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_ENABLE); in ep93xx_pwm_disable()
156 clk_disable(ep93xx_pwm->clk); in ep93xx_pwm_disable()
175 ep93xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_pwm), GFP_KERNEL); in ep93xx_pwm_probe()
177 return -ENOMEM; in ep93xx_pwm_probe()
180 ep93xx_pwm->base = devm_ioremap_resource(&pdev->dev, res); in ep93xx_pwm_probe()
181 if (IS_ERR(ep93xx_pwm->base)) in ep93xx_pwm_probe()
182 return PTR_ERR(ep93xx_pwm->base); in ep93xx_pwm_probe()
184 ep93xx_pwm->clk = devm_clk_get(&pdev->dev, "pwm_clk"); in ep93xx_pwm_probe()
185 if (IS_ERR(ep93xx_pwm->clk)) in ep93xx_pwm_probe()
186 return PTR_ERR(ep93xx_pwm->clk); in ep93xx_pwm_probe()
188 ep93xx_pwm->chip.dev = &pdev->dev; in ep93xx_pwm_probe()
189 ep93xx_pwm->chip.ops = &ep93xx_pwm_ops; in ep93xx_pwm_probe()
190 ep93xx_pwm->chip.base = -1; in ep93xx_pwm_probe()
191 ep93xx_pwm->chip.npwm = 1; in ep93xx_pwm_probe()
193 ret = pwmchip_add(&ep93xx_pwm->chip); in ep93xx_pwm_probe()
205 return pwmchip_remove(&ep93xx_pwm->chip); in ep93xx_pwm_remove()
210 .name = "ep93xx-pwm",
220 MODULE_ALIAS("platform:ep93xx-pwm");