Lines Matching refs:pwm
79 static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, in tegra_pwm_config() argument
129 if (!pwm_is_enabled(pwm)) { in tegra_pwm_config()
136 pwm_writel(pc, pwm->hwpwm, val); in tegra_pwm_config()
141 if (!pwm_is_enabled(pwm)) in tegra_pwm_config()
147 static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) in tegra_pwm_enable() argument
157 val = pwm_readl(pc, pwm->hwpwm); in tegra_pwm_enable()
159 pwm_writel(pc, pwm->hwpwm, val); in tegra_pwm_enable()
164 static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) in tegra_pwm_disable() argument
169 val = pwm_readl(pc, pwm->hwpwm); in tegra_pwm_disable()
171 pwm_writel(pc, pwm->hwpwm, val); in tegra_pwm_disable()
185 struct tegra_pwm_chip *pwm; in tegra_pwm_probe() local
189 pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); in tegra_pwm_probe()
190 if (!pwm) in tegra_pwm_probe()
193 pwm->soc = of_device_get_match_data(&pdev->dev); in tegra_pwm_probe()
194 pwm->dev = &pdev->dev; in tegra_pwm_probe()
197 pwm->regs = devm_ioremap_resource(&pdev->dev, r); in tegra_pwm_probe()
198 if (IS_ERR(pwm->regs)) in tegra_pwm_probe()
199 return PTR_ERR(pwm->regs); in tegra_pwm_probe()
201 platform_set_drvdata(pdev, pwm); in tegra_pwm_probe()
203 pwm->clk = devm_clk_get(&pdev->dev, NULL); in tegra_pwm_probe()
204 if (IS_ERR(pwm->clk)) in tegra_pwm_probe()
205 return PTR_ERR(pwm->clk); in tegra_pwm_probe()
208 ret = clk_set_rate(pwm->clk, pwm->soc->max_frequency); in tegra_pwm_probe()
219 pwm->clk_rate = clk_get_rate(pwm->clk); in tegra_pwm_probe()
221 pwm->rst = devm_reset_control_get_exclusive(&pdev->dev, "pwm"); in tegra_pwm_probe()
222 if (IS_ERR(pwm->rst)) { in tegra_pwm_probe()
223 ret = PTR_ERR(pwm->rst); in tegra_pwm_probe()
228 reset_control_deassert(pwm->rst); in tegra_pwm_probe()
230 pwm->chip.dev = &pdev->dev; in tegra_pwm_probe()
231 pwm->chip.ops = &tegra_pwm_ops; in tegra_pwm_probe()
232 pwm->chip.base = -1; in tegra_pwm_probe()
233 pwm->chip.npwm = pwm->soc->num_channels; in tegra_pwm_probe()
235 ret = pwmchip_add(&pwm->chip); in tegra_pwm_probe()
238 reset_control_assert(pwm->rst); in tegra_pwm_probe()
259 struct pwm_device *pwm = &pc->chip.pwms[i]; in tegra_pwm_remove() local
261 if (!pwm_is_enabled(pwm)) in tegra_pwm_remove()