summaryrefslogtreecommitdiffstats
path: root/include/pwm.h
Commit message (Collapse)AuthorAgeFilesLines
* sound: add PWM beeper supportAhmad Fatoum2021-02-081-0/+33
| | | | | | | This driver can be used to drive a piezo-buzzer attached to a PWM. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: add apply API support for polarityAhmad Fatoum2020-03-311-0/+6
| | | | | | | | Some PWM chips support outputting an inverted PWM signal. Add API support for this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: apply initial state in of_pwm_requestAhmad Fatoum2020-03-311-0/+6
| | | | | | | | | | | | This functions prepares a state that can later be tweaked and applied to the PWM device with pwm_apply_state(). This is a convenient function that first retrieves the current PWM state and the replaces the period with the reference values defined in pwm->args. Once the function returns, you can adjust the ->enabled and ->duty_cycle fields according to your needs before calling pwm_apply_state(). Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: retire pwm_set_periodAhmad Fatoum2020-03-311-1/+0
| | | | | | | | Client code can use pwm_apply_state or pwm_config to set period as well as duty cycle. Having a pwm_set_period thus doesn't add any value. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: remove old PWM API in favor of Linux ->applyAhmad Fatoum2020-03-311-17/+31
| | | | | | | | | Linux has the new atomic PWM API in addition to the old one for backward compatibility. We only have three PWM drivers in here, so port them over to the new ->apply API. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: group PWM state into new struct pwm_stateAhmad Fatoum2020-03-311-6/+15
| | | | | | | | As a prerequisite for moving to the new apply API, we need to group all state into one struct that we can apply at once. Prepare for this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: remove ineffectual pwm_{set,get}_duty_cycleAhmad Fatoum2020-03-311-2/+0
| | | | | | | | | The setter sets a value unused anywhere, but in the getter. As the functions are unused, just drop them. There's pwm_config that can be used for this instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: core: remove FLAG_ENABLEDAhmad Fatoum2020-03-311-0/+2
| | | | | | | | In preparation for moving to a struct pwm_state like Linux does, turn the flag into a variable. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2020-02-181-0/+1
|\
| * include: add SPDX GPL-2.0-only license tags for files without licensing ↵Roland Hieber2020-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | information According to our /README, GPL-2.0-only applies for the whole project except noted otherwise. Signed-off-by: Roland Hieber <rohieb@rohieb.name> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | PWM: core: constify chip->ops pointerAhmad Fatoum2020-02-101-1/+1
|/ | | | | | | | There's no reason,users of the member would want to change the pointee. Make it const. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: Allow multiple PWMs per device nodeSascha Hauer2015-06-121-0/+2
| | | | | | | Matching a device node is enough since a device node may have multiple PWMs. Check for a id aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: Implement devicetree supportSascha Hauer2014-02-281-0/+2
| | | | | | This implements of_pwm_request() for PWM client drivers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PWM: Add functions for getting/setting period/duty cycleSascha Hauer2014-02-281-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/pwm: add duty_ns and period_ns to core pwm chipRobert Jarzmik2012-02-171-1/+6
| | | | | | | | | | Add variables to control the duty_ns and period_ns of PWM chips. When these variables are set, a call to either pwm_enable() or pwm_config() is performed to enforce the setup values. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add pwm core supportSascha Hauer2012-02-171-0/+63
This patch adds framework support for PWM (pulse width modulation) devices. A new pwm can be registered from a hardware driver using pwmchip_add(). It can then be requested from a client driver using pwm_request(). A string is used as a unique identifier for the pwms. It should usually be initialized by the hardware drivers using dev_name(dev). The client API is the same as currently in the Linux Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>