Lines Matching refs:pwm
2 * drivers/pwm/pwm-tegra.c
7 * Based on arch/arm/plat-mxc/pwm.c by Sascha Hauer <s.hauer@pengutronix.de>
29 #include <linux/pwm.h>
66 static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
115 if (!test_bit(PWMF_ENABLED, &pwm->flags)) {
122 pwm_writel(pc, pwm->hwpwm, val);
127 if (!test_bit(PWMF_ENABLED, &pwm->flags))
133 static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
143 val = pwm_readl(pc, pwm->hwpwm);
145 pwm_writel(pc, pwm->hwpwm, val);
150 static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
155 val = pwm_readl(pc, pwm->hwpwm);
157 pwm_writel(pc, pwm->hwpwm, val);
171 struct tegra_pwm_chip *pwm;
175 pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
176 if (!pwm)
179 pwm->dev = &pdev->dev;
182 pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
183 if (IS_ERR(pwm->mmio_base))
184 return PTR_ERR(pwm->mmio_base);
186 platform_set_drvdata(pdev, pwm);
188 pwm->clk = devm_clk_get(&pdev->dev, NULL);
189 if (IS_ERR(pwm->clk))
190 return PTR_ERR(pwm->clk);
192 pwm->chip.dev = &pdev->dev;
193 pwm->chip.ops = &tegra_pwm_ops;
194 pwm->chip.base = -1;
195 pwm->chip.npwm = NUM_PWM;
197 ret = pwmchip_add(&pwm->chip);
215 struct pwm_device *pwm = &pc->chip.pwms[i];
217 if (!test_bit(PWMF_ENABLED, &pwm->flags))
230 { .compatible = "nvidia,tegra20-pwm" },
231 { .compatible = "nvidia,tegra30-pwm" },
239 .name = "tegra-pwm",
251 MODULE_ALIAS("platform:tegra-pwm");