Lines Matching refs:rpipwm
89 struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); in raspberrypi_pwm_get_state() local
92 state->duty_cycle = DIV_ROUND_UP(rpipwm->duty_cycle * RPI_PWM_PERIOD_NS, in raspberrypi_pwm_get_state()
94 state->enabled = !!(rpipwm->duty_cycle); in raspberrypi_pwm_get_state()
103 struct raspberrypi_pwm *rpipwm = raspberrypi_pwm_from_chip(chip); in raspberrypi_pwm_apply() local
119 if (duty_cycle == rpipwm->duty_cycle) in raspberrypi_pwm_apply()
122 ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, in raspberrypi_pwm_apply()
130 rpipwm->duty_cycle = duty_cycle; in raspberrypi_pwm_apply()
146 struct raspberrypi_pwm *rpipwm; in raspberrypi_pwm_probe() local
161 rpipwm = devm_kzalloc(&pdev->dev, sizeof(*rpipwm), GFP_KERNEL); in raspberrypi_pwm_probe()
162 if (!rpipwm) in raspberrypi_pwm_probe()
165 rpipwm->firmware = firmware; in raspberrypi_pwm_probe()
166 rpipwm->chip.dev = dev; in raspberrypi_pwm_probe()
167 rpipwm->chip.ops = &raspberrypi_pwm_ops; in raspberrypi_pwm_probe()
168 rpipwm->chip.npwm = RASPBERRYPI_FIRMWARE_PWM_NUM; in raspberrypi_pwm_probe()
170 ret = raspberrypi_pwm_get_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG, in raspberrypi_pwm_probe()
171 &rpipwm->duty_cycle); in raspberrypi_pwm_probe()
177 return devm_pwmchip_add(dev, &rpipwm->chip); in raspberrypi_pwm_probe()