diff options
author | Tommaso Merciai <tommaso.merciai@amarulasolutions.com> | 2022-03-26 12:19:08 +0100 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2022-04-12 19:10:44 +0200 |
commit | d1016610878f2be45edd580867b1980acb0e3745 (patch) | |
tree | 8caf9e58fb85e495cd2b5198723ed0414186ccb4 /drivers/pwm/pwm-imx.c | |
parent | 2c432563dfd0f9976eb9d962bff726ae7b497ae7 (diff) |
driver: pwm: pwm-imx: separe dm from non dm implementation
Separe dm implementation from non dm implementation of pwm-imx
driver using CONFIG_DM_PWM
Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Diffstat (limited to 'drivers/pwm/pwm-imx.c')
-rw-r--r-- | drivers/pwm/pwm-imx.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 1d656e726f..9b8a8c189d 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -13,17 +13,6 @@ #include <pwm.h> #include <asm/arch/imx-regs.h> #include <asm/io.h> - -int pwm_init(int pwm_id, int div, int invert) -{ - struct pwm_regs *pwm = (struct pwm_regs *)pwm_id_to_reg(pwm_id); - - if (!pwm) - return -1; - - writel(0, &pwm->ir); - return 0; -} #include <clk.h> int pwm_config_internal(struct pwm_regs *pwm, unsigned long period_cycles, @@ -44,6 +33,7 @@ int pwm_config_internal(struct pwm_regs *pwm, unsigned long period_cycles, return 0; } +#ifndef CONFIG_DM_PWM /* pwm_id from 0..7 */ struct pwm_regs *pwm_id_to_reg(int pwm_id) { @@ -110,6 +100,17 @@ int pwm_imx_get_parms(int period_ns, int duty_ns, unsigned long *period_c, return 0; } +int pwm_init(int pwm_id, int div, int invert) +{ + struct pwm_regs *pwm = (struct pwm_regs *)pwm_id_to_reg(pwm_id); + + if (!pwm) + return -1; + + writel(0, &pwm->ir); + return 0; +} + int pwm_config(int pwm_id, int duty_ns, int period_ns) { struct pwm_regs *pwm = (struct pwm_regs *)pwm_id_to_reg(pwm_id); @@ -145,7 +146,7 @@ void pwm_disable(int pwm_id) clrbits_le32(&pwm->cr, PWMCR_EN); } -#if defined(CONFIG_DM_PWM) +#else struct imx_pwm_priv { struct pwm_regs *regs; bool invert; |