summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-dwc-core.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-19pwm: dwc-core: Make use of pwmchip_parent() accessorUwe Kleine-König1-4/+4
struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the accessor function provided for exactly this purpose. Link: https://lore.kernel.org/r/5240ba82ac227e3723678041bd69b9c7a9e3db43.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-02-19pwm: dwc: Make use of devm_pwmchip_alloc() functionUwe Kleine-König1-6/+4
This prepares the pwm-dwc driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Also convert the to_dwc_pwm() helper macro to a static inline to get some type safety. Link: https://lore.kernel.org/r/64e64a9a8644600d51b234ad9bcae951b5748998.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-02-19pwm: dwc: Prepare removing pwm_chip from driver dataUwe Kleine-König1-7/+9
This prepares the driver for further changes that will drop struct pwm_chip chip from struct dwc_pwm. Use the pwm_chip as driver data and return value of dwc_pwm_alloc() instead of the dwc_pwm to get access to the pwm_chip in dwc_pwm_probe() and dwc_pwm_suspend() without using dwc->chip. Thanks to Raag Jadav for providing a hunk of this patch that Uwe missed during creation of this patch. Link: https://lore.kernel.org/r/008ce5ab84b8e3baa3e81ab6d36dbb0e4be5c319.1707900770.git.u.kleine-koenig@pengutronix.de Link: https://lore.kernel.org/r/20240219033835.11369-2-raag.jadav@intel.com Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2023-10-13pwm: dwc: add PWM bit unset in get_state callBen Dooks1-11/+19
If we are not in PWM mode, then the output is technically a 50% output based on a single timer instead of the high-low based on the two counters. Add a check for the PWM mode in dwc_pwm_get_state() and if DWC_TIM_CTRL_PWM is not set, then return a 50% cycle. This may only be an issue on initialisation, as the rest of the code currently assumes we're always going to have the extended PWM mode using two counters. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230907161242.67190-4-ben.dooks@codethink.co.uk Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2023-10-13pwm: dwc: make timer clock configurableBen Dooks1-4/+5
Add a configurable clock base rate for the pwm as when being built for non-PCI the block may be sourced from an internal clock. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230907161242.67190-3-ben.dooks@codethink.co.uk Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2023-10-13pwm: dwc: split pci out of core driverBen Dooks1-0/+175
Moving towards adding non-pci support for the driver, move the pci parts out of the core into their own module. This is partly due to the module_driver() code only being allowed once in a module and also to avoid a number of #ifdef if we build a single file in a system without pci support. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230907161242.67190-2-ben.dooks@codethink.co.uk Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>