[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aF5dHDr8yDSKlp5j@smile.fi.intel.com>
Date: Fri, 27 Jun 2025 11:58:04 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Uwe Kleine-König <ukleinek@...nel.org>,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
Benjamin Larsson <benjamin.larsson@...exis.eu>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Lorenzo Bianconi <lorenzo@...nel.org>
Subject: Re: [PATCH v18] pwm: airoha: Add support for EN7581 SoC
On Fri, Jun 27, 2025 at 12:47:53AM +0200, Christian Marangi wrote:
> From: Benjamin Larsson <benjamin.larsson@...exis.eu>
>
> Introduce driver for PWM module available on EN7581 SoC.
...
> + * Copyright 2025 Markus Gothe <markus.gothe@...exis.eu>
> + * Christian Marangi <ansuelsmth@...il.com>
I'm not sure you can change the copyright line like this. I would rather expect
* Copyright 2012 Markus Gothe <markus.gothe@...exis.eu>
* Copyright 2025 Christian Marangi <ansuelsmth@...il.com>
(Sorry, I forgot the exact original year there, but you got the point)
...
> + /* Global mutex to protect bucket used refcount_t */
> + struct mutex mutex;
This makes a little sense. Either you use refcount_t (which is atomic) or
use mutex + regular variable.
...
> + /*
> + * It is necessary to explicitly shift out all zeros after muxing
> + * to initialize the shift register before enabling PWM
> + * mode because in PWM mode SIPO will not start shifting until
> + * it needs to output a non-zero value (bit 31 of led_data
> + * indicates shifting in progress and it must return to zero
> + * before led_data can be written or PWM mode can be set)
Missing period at the end.
> + */
...
> +static void airoha_pwm_disable(struct airoha_pwm *pc, struct pwm_device *pwm)
> +{
> + /* Disable PWM and release the bucket */
> + airoha_pwm_config_flash_map(pc, pwm->hwpwm, -1);
> + airoha_pwm_release_bucket_config(pc, pwm->hwpwm);
> +
> + clear_bit(pwm->hwpwm, pc->initialized);
> +
> + /* If no SIPO is used, disable the shift register chip */
> + if (find_next_bit(pc->initialized, AIROHA_PWM_MAX_CHANNELS,
> + AIROHA_PWM_NUM_GPIO) >= AIROHA_PWM_NUM_GPIO)
This can be rewritten as
if (!bitmap_read(pc->initialized, AIROHA_PWM_NUM_GPIO, AIROHA_PWM_NUM_SIPO))
(seems to me that the above code is buggy and has to have a check against the
full size of bitmap).
> + regmap_clear_bits(pc->regmap, AIROHA_PWM_REG_SIPO_FLASH_MODE_CFG,
> + AIROHA_PWM_SERIAL_GPIO_FLASH_MODE);
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists