Re: [PATCH 2/2] media: pwm-ir-tx: trigger edges from hrtimer interrupt context

From: Uwe Kleine-König
Date: Wed Oct 04 2023 - 05:36:11 EST


Hello,

On Wed, Oct 04, 2023 at 08:43:53AM +0100, Sean Young wrote:
> On Mon, Oct 02, 2023 at 12:52:00PM +0300, Ivaylo Dimitrov wrote:
> > On 2.10.23 г. 11:20 ч., Sean Young wrote:
> > > Requires a copy of pwm_state in pwm_ir, not a huge difference (copy of 28
> > > bytes vs keeping it around).
> >
> > see my previous comment re struct var. Also, look at the overhead:
> > https://elixir.bootlin.com/linux/v6.6-rc3/source/include/linux/pwm.h#L349 -
> > you call pwm_get_state() for every edge.
>
> That's the 28 bytes copy I was talking about.

Note that pwm_get_state() also has (IMHO) confusing semantics. It gives
you (most of the time) the state that was last pwm_state_apply()d and
not the state the hardware is currently in. In my book keeping the
pwm_state around is the nicer approach that often is also simpler ...

> However keeping a pointer in struct pwm_ir is a good compromise and makes
> the rest of the code cleaner.

... which seems to apply here, too.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature