From: Claudiu Beznea <Claudiu.Beznea@microchip.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
Thierry Reding <thierry.reding@gmail.com>
Cc: <shc_work@mail.ru>, <kgene@kernel.org>, <krzk@kernel.org>,
<linux@armlinux.org.uk>, <mturquette@baylibre.com>,
<sboyd@codeaurora.org>, <joonas.lahtinen@linux.intel.com>,
<rodrigo.vivi@intel.com>, <airlied@linux.ie>, <kamil@wypas.org>,
<b.zolnierkie@samsung.com>, <jdelvare@suse.com>,
<linux@roeck-us.net>, <dmitry.torokhov@gmail.com>,
<rpurdie@rpsys.net>, <jacek.anaszewski@gmail.com>, <pavel@ucw.cz>,
<mchehab@kernel.org>, <sean@mess.org>, <lee.jones@linaro.org>,
<daniel.thompson@linaro.org>, <jingoohan1@gmail.com>,
<milo.kim@ti.com>, <robh+dt@kernel.org>, <mark.rutland@arm.com>,
<corbet@lwn.net>, <nicolas.ferre@microchip.com>,
<alexandre.belloni@free-electrons.com>,
<linux-pwm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-samsung-soc@vger.kernel.org>, <linux-clk@vger.kernel.org>,
<intel-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-hwmon@vger.kernel.org>,
<linux-input@vger.kernel.org>, <linux-leds@vger.kernel.org>,
<linux-media@vger.kernel.org>, <linux-fbdev@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config()
Date: Fri, 2 Mar 2018 11:28:09 +0200 [thread overview]
Message-ID: <585cc4ae-3674-c119-295b-e59f4242e619@microchip.com> (raw)
In-Reply-To: <87r2p4hod7.fsf@intel.com>
On 28.02.2018 22:04, Jani Nikula wrote:
> On Wed, 28 Feb 2018, Thierry Reding <thierry.reding@gmail.com> wrote:
>> Anyone that needs something other than normal mode should use the new
>> atomic PWM API.
>
> At the risk of revealing my true ignorance, what is the new atomic PWM
> API? Where? Examples of how one would convert old code over to the new
> API?
As far as I know, the old PWM core code uses config(), set_polarity(),
enable(), disable() methods of driver, registered as pwm_ops:
struct pwm_ops {
int (*request)(struct pwm_chip *chip, struct pwm_device *pwm);
void (*free)(struct pwm_chip *chip, struct pwm_device *pwm);
int (*config)(struct pwm_chip *chip, struct pwm_device *pwm,
int duty_ns, int period_ns);
int (*set_polarity)(struct pwm_chip *chip, struct pwm_device *pwm,
enum pwm_polarity polarity);
int (*capture)(struct pwm_chip *chip, struct pwm_device *pwm,
struct pwm_capture *result, unsigned long timeout);
int (*enable)(struct pwm_chip *chip, struct pwm_device *pwm);
void (*disable)(struct pwm_chip *chip, struct pwm_device *pwm);
int (*apply)(struct pwm_chip *chip, struct pwm_device *pwm,
struct pwm_state *state);
void (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm,
struct pwm_state *state);
#ifdef CONFIG_DEBUG_FS
void (*dbg_show)(struct pwm_chip *chip, struct seq_file *s);
#endif
struct module *owner;
};
to do settings on hardware. In order to so settings on a PWM the users
should have been follow the below steps:
->config()
->set_polarity()
->enable()
Moreover, if the PWM was previously enabled it should have been first
disable and then to follow the above steps in order to apply a new settings
on hardware.
The driver should have been provide, at probe, all the above function:
->config(), ->set_polarity(), ->disable(), ->enable(), function that were
used by PWM core.
Now, having atomic PWM, the driver should provide one function to PWM core,
which is ->apply() function. Every PWM has a state associated, which keeps
the period, duty cycle, polarity and enable/disable status. The driver's
->apply() function takes as argument the state that should be applied and
it takes care of applying this new state directly without asking user to
call ->disable(), then ->config()/->set_polarity(), then ->enable() to
apply new hardware settings.
The PWM consumer could set a new state for PWM it uses, using
pwm_apply_state(pwm, new_state);
Regarding the models to switch on atomic PWM, on the controller side you
can check for drivers that registers apply function at probe time.
Regarding the PWM users, you can look for pwm_apply_state()
(drivers/hwmon/pwm-fan.c or drivers/input/misc/pwm-beeper.c are some examples).
Thierry, please correct me if I'm wrong.
Thank you,
Claudiu Beznea
>
> BR,
> Jani.
>
next prev parent reply other threads:[~2018-03-02 9:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-22 12:01 [PATCH v3 00/10] extend PWM framework to support PWM modes Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 01/10] pwm: extend PWM framework with " Claudiu Beznea
2018-02-24 20:49 ` kbuild test robot
2018-02-26 8:11 ` Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 02/10] pwm: clps711x: populate PWM mode in of_xlate function Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 03/10] pwm: cros-ec: " Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 04/10] pwm: pxa: " Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 05/10] pwm: add PWM mode to pwm_config() Claudiu Beznea
2018-02-22 12:33 ` Daniel Thompson
2018-02-22 13:21 ` Claudiu Beznea
2018-02-26 9:57 ` Jani Nikula
2018-02-26 14:24 ` Claudiu Beznea
2018-02-27 10:54 ` Daniel Thompson
2018-02-27 11:40 ` Claudiu Beznea
2018-02-27 15:38 ` Daniel Thompson
2018-02-27 16:15 ` Claudiu Beznea
2018-02-22 13:01 ` Sean Young
2018-02-22 13:23 ` Claudiu Beznea
2018-02-28 19:44 ` Thierry Reding
2018-02-28 20:04 ` Jani Nikula
2018-03-02 9:28 ` Claudiu Beznea [this message]
2018-03-02 9:19 ` Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 06/10] pwm: add PWM modes Claudiu Beznea
2018-02-22 17:28 ` Andy Shevchenko
2018-02-22 17:42 ` Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 07/10] pwm: atmel: add pwm capabilities Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 08/10] pwm: add push-pull mode support Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 09/10] pwm: add documentation for pwm push-pull mode Claudiu Beznea
2018-02-22 12:01 ` [PATCH v3 10/10] pwm: atmel: add push-pull mode support Claudiu Beznea
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=585cc4ae-3674-c119-295b-e59f4242e619@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=airlied@linux.ie \
--cc=alexandre.belloni@free-electrons.com \
--cc=b.zolnierkie@samsung.com \
--cc=corbet@lwn.net \
--cc=daniel.thompson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jacek.anaszewski@gmail.com \
--cc=jani.nikula@linux.intel.com \
--cc=jdelvare@suse.com \
--cc=jingoohan1@gmail.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kamil@wypas.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=mchehab@kernel.org \
--cc=milo.kim@ti.com \
--cc=mturquette@baylibre.com \
--cc=nicolas.ferre@microchip.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=rpurdie@rpsys.net \
--cc=sboyd@codeaurora.org \
--cc=sean@mess.org \
--cc=shc_work@mail.ru \
--cc=thierry.reding@gmail.com \
/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