rp2040: pwm: Fix errors at CONFIG_PWM_NCHANNELS=1

Perhaps it has never been tested with CONFIG_PWM_NCHANNELS=1.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
This commit is contained in:
Takumi Ando 2023-11-13 15:04:14 +09:00 committed by Mateusz Szafoni
parent 4e89313913
commit c076cb1bef
3 changed files with 10 additions and 2 deletions

View File

@ -276,6 +276,7 @@ if PWM_MULTICHAN
config PWM_NCHANNELS
int "Number of channels"
default 2
range 1 2
---help---
If the number of channels is set to 1, the generated code will
only support the A channel of the PWM slices. This is functionally

View File

@ -288,8 +288,8 @@ int pwm_shutdown (struct pwm_lowerhalf_s * dev)
if (priv->pin >= 0)
{
rp2040_gpio_setdir(priv->pin[0], true);
rp2040_gpio_put(priv->pin[0],
rp2040_gpio_setdir(priv->pin, true);
rp2040_gpio_put(priv->pin,
((priv->flags & RP2040_PWM_CSR_A_INV) != 0));
rp2040_gpio_set_function(priv->pin, RP2040_GPIO_FUNC_SIO);
}

View File

@ -58,11 +58,18 @@ int rp2040_pwmdev_initialize(int slice,
int ret;
struct rp2040_pwm_lowerhalf_s *pwm_lowerhalf;
#if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
pwminfo("Initializing /dev/pwm%d a %d b %d f 0x%08lX..\n",
slice,
pin_a,
pin_b,
flags);
#else
pwminfo("Initializing /dev/pwm%d %d 0x%08lX..\n",
slice,
pin,
flags);
#endif
/* Initialize spi device */