Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1376721

Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept

From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept
Date 2016-04-12 13:40 +0200
Message-ID <rn4PL-6Jq-9@gated-at.bofh.it> (permalink)
References <riuBc-28V-5@gated-at.bofh.it> <riuUy-2hW-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Mar 30, 2016 at 10:03:28PM +0200, Boris Brezillon wrote:
> Currently the PWM core mixes the current PWM state with the per-platform
> reference config (specified through the PWM lookup table, DT definition or
> directly hardcoded in PWM drivers).
> 
> Create a pwm_args struct to store this reference config, so that PWM users
> can differentiate the current config from the reference one.
> 
> Patch all places where pwm->args should be initialized. We keep the
> pwm_set_polarity/period() calls until all PWM users are patched to
> use pwm_args instead of pwm_get_period/polarity().

Perhaps a helper would be useful? Something like:

	static inline void
	pwm_apply_args(struct pwm_device *pwm, const struct pwm_args *args)
	{
		pwm_set_duty_cycle(pwm, args->duty_cycle);
		pwm_set_period(pwm, args->period);
	}

? That would make it slightly easier to get rid of it again after all
clients have been converted.

With the exception of pwm-clps711x all of these args are set at of_xlate
time (for DT) or from the lookup table in pwm_get() (for non-DT), so it
might even be possible to move this call to the core, so that removal of
it will be a one-liner.

Thierry

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 13:40 +0200
  Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 14:10 +0200
    Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 14:30 +0200
      Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 15:00 +0200
  Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 15:10 +0200
    Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 15:20 +0200

csiph-web