linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <u.kleine-koenig@pengutronix.de>
Cc: <linux-pwm@vger.kernel.org>, <alexandre.belloni@bootlin.com>,
	<corbet@lwn.net>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <Ludovic.Desroches@microchip.com>,
	<thierry.reding@gmail.com>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v8 1/6] pwm: extend PWM framework with PWM modes
Date: Wed, 9 Jan 2019 09:02:44 +0000	[thread overview]
Message-ID: <085ac33b-89ee-dcdb-6085-735ae5fa08cb@microchip.com> (raw)
In-Reply-To: <20190108220838.amrun6jsa24yeisg@pengutronix.de>



On 09.01.2019 00:08, Uwe Kleine-König wrote:
> On Tue, Jan 08, 2019 at 09:21:34AM +0000, Claudiu.Beznea@microchip.com wrote:
>> Hi Uwe,
>>
>> On 08.01.2019 00:10, Uwe Kleine-König wrote:
>>> Hello Claudiu,
>>>
>>> On Mon, Jan 07, 2019 at 09:30:55AM +0000, Claudiu.Beznea@microchip.com wrote:
>>>> On 05.01.2019 23:05, Uwe Kleine-König wrote:
>>>>> On Thu, Jan 03, 2019 at 01:29:44PM +0000, Claudiu.Beznea@microchip.com wrote:
>>>>>> From: Claudiu Beznea <claudiu.beznea@microchip.com>
>>>>>>
>>>>>> Add basic PWM modes: normal and complementary. These modes should
>>>>>> differentiate the single output PWM channels from two outputs PWM
>>>>>> channels. These modes could be set as follow:
>>>>>> 1. PWM channels with one output per channel:
>>>>>> - normal mode
>>>>>> 2. PWM channels with two outputs per channel:
>>>>>> - normal mode
>>>>>> - complementary mode
>>>>>> Since users could use a PWM channel with two output as one output PWM
>>>>>> channel, the PWM normal mode is allowed to be set for PWM channels with
>>>>>> two outputs; in fact PWM normal mode should be supported by all PWMs.
>>>>>
>>>>> I still think that my suggestion that I sent in reply to your v5 using
>>>>> .alt_duty_cycle and .alt_offset is the better one as it is more generic.
>>>>
>>>> I like it better my way, I explained myself why.
>>>
>>> I couldn't really follow your argument though. You seemed to acknowledge
>>> that using .alt_duty_cycle and .alt_offset is more generic.
>>
>> True it is more generic in the way that it gives the possibility to
>> configure all kind of waveforms. But not all controllers supports this.
>> The use case of this would be to have dead-times with any values, right?
> 
> Well, I didn't target that. The model I suggested is just a generic set
> of parameters that are able to describe the wave forms for all three
> modes you suggested. That it allows to express dead-times is just a nice
> by-product.
> 
>>>>> I fail to see the upside of storing the mode as 2^mode instead of a
>>>>> plain enum pwm_mode. Given that struct pwm_state is visible for pwm
>>>>> users a plain pwm_mode would at least be more intuitive.
>>>>
>>>> To have all modes supported by a controller grouped in pwm_caps::modes_msk.
>>>
>>> My question was not about struct pwm_caps::modes_msk but about
>>> struct pwm_state::modebit. As struct pwm_state has visibility even
>>> outside of the pwm API (i.e. it is used by consumers) it is beneficial
>>> to keep that simple. Letting a consumer pass in the mode he wants is
>>> easier to explain than setting a single bit. Also error checking with a
>>> plain enum is easier because you just do:
>>>
>>> 	if (mode >= MODE_CNT)
>>> 		error()
>>>
>>> which is easy to grasp. Compare that to
>>>
>>> 	if (!is_power_of_two(modebit) || modebit >= PWM_MODE_BIT(CNT))
>>> 		error()
>>>
>>> (modulo syntactical correctness).
>>
>> The reason I choose to have it as bit was the memcmp() at the beginning of
>> pwm_apply_state() and to avoid starting enum pwm_mode from 1 and to avoid
>> having bit 0 of pwm_caps::modes_msk unused (in the driver I'm using
>> PWM_MODE_BIT() macro to fill in the driver's supported modes).
> 
> Does that mean you are convinced by my argument?

I know what you are talking about. I balanced in between these two paths
while I wrote the code. The approach I chose looked to me to be more easy
to read. Now, since there is another person (you) thinking the other
approach is best, I'm thinking to change it in the next version.

Thank you,
Claudiu Beznea

> 
> Best regards
> Uwe
> 

  reply	other threads:[~2019-01-09  9:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 13:29 [PATCH v8 0/6] extend PWM framework to support PWM modes Claudiu.Beznea
2019-01-03 13:29 ` [PATCH v8 1/6] pwm: extend PWM framework with " Claudiu.Beznea
2019-01-05 21:05   ` Uwe Kleine-König
2019-01-07  9:30     ` Claudiu.Beznea
2019-01-07 22:10       ` Uwe Kleine-König
2019-01-08  9:21         ` Claudiu.Beznea
2019-01-08 22:08           ` Uwe Kleine-König
2019-01-09  9:02             ` Claudiu.Beznea [this message]
2019-02-05 23:01         ` Thierry Reding
2019-02-06  8:24           ` Uwe Kleine-König
2019-02-13 15:38             ` Claudiu.Beznea
2019-02-14  9:48               ` Uwe Kleine-König
2019-02-05 22:49     ` Thierry Reding
2019-02-13 15:37       ` Claudiu.Beznea
2019-01-03 13:29 ` [PATCH v8 2/6] pwm: add " Claudiu.Beznea
2019-01-05 20:41   ` Uwe Kleine-König
2019-01-07  9:30     ` Claudiu.Beznea
2019-01-03 13:29 ` [PATCH v8 3/6] pwm: atmel: add pwm capabilities Claudiu.Beznea
2019-01-03 13:29 ` [PATCH v8 4/6] pwm: add push-pull mode support Claudiu.Beznea
2019-01-03 13:29 ` [PATCH v8 5/6] pwm: add documentation for pwm push-pull mode Claudiu.Beznea
2019-01-03 13:30 ` [PATCH v8 6/6] 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=085ac33b-89ee-dcdb-6085-735ae5fa08cb@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).