From: Christian Marangi <ansuelsmth@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
"Benjamin Larsson" <benjamin.larsson@genexis.eu>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Lorenzo Bianconi" <lorenzo@kernel.org>
Subject: Re: [PATCH v18] pwm: airoha: Add support for EN7581 SoC
Date: Fri, 27 Jun 2025 11:32:46 +0200 [thread overview]
Message-ID: <685e6544.5d0a0220.20cf55.9440@mx.google.com> (raw)
In-Reply-To: <aF5dHDr8yDSKlp5j@smile.fi.intel.com>
On Fri, Jun 27, 2025 at 11:58:04AM +0300, Andy Shevchenko wrote:
> On Fri, Jun 27, 2025 at 12:47:53AM +0200, Christian Marangi wrote:
> > From: Benjamin Larsson <benjamin.larsson@genexis.eu>
> >
> > Introduce driver for PWM module available on EN7581 SoC.
>
> ...
>
> > + * Copyright 2025 Markus Gothe <markus.gothe@genexis.eu>
> > + * Christian Marangi <ansuelsmth@gmail.com>
>
> I'm not sure you can change the copyright line like this. I would rather expect
>
> * Copyright 2012 Markus Gothe <markus.gothe@genexis.eu>
> * Copyright 2025 Christian Marangi <ansuelsmth@gmail.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.
>
Using a regular variable I lose all the benefits of refcount_t with
underflow and other checks.
> ...
>
> > + /*
> > + * 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).
>
Yes I'm confused by find_next_bit. Is the nbits part the rest of the bit
or the full size of the bitmap?
Google suggest it should be the full size of the bitmap but I wasn't so
sure. Anyway I will use bitmap_read since it seems more readable.
> > + regmap_clear_bits(pc->regmap, AIROHA_PWM_REG_SIPO_FLASH_MODE_CFG,
> > + AIROHA_PWM_SERIAL_GPIO_FLASH_MODE);
> > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
--
Ansuel
next prev parent reply other threads:[~2025-06-27 9:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 22:47 Christian Marangi
2025-06-27 8:58 ` Andy Shevchenko
2025-06-27 9:32 ` Christian Marangi [this message]
2025-06-27 10:25 ` Andy Shevchenko
2025-06-27 10:34 ` Christian Marangi
2025-06-27 10:56 ` Andy Shevchenko
2025-06-30 10:19 ` Christian Marangi
2025-06-30 10:29 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=685e6544.5d0a0220.20cf55.9440@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.larsson@genexis.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®