linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] pwm: add freescale ftm pwm driver support
Date: Fri, 23 Aug 2013 09:58:29 +0200	[thread overview]
Message-ID: <20130823075828.GD3535@ulmo> (raw)
In-Reply-To: <20130821095049.GQ31036@pengutronix.de>

On Wed, Aug 21, 2013 at 11:50:49AM +0200, Sascha Hauer wrote:
> On Wed, Aug 21, 2013 at 09:24:56AM +0000, Xiubo Li-B47053 wrote:
> > TO Sascha,
> > 
> > > > +
> > > > +	fpc = to_fsl_chip(chip);
> > > > +
> > > > +	if (WARN_ON(!test_bit(PWMF_REQUESTED, &pwm->flags)))
> > > > +		return -ESHUTDOWN;
> > > > +
> > > > +	statename = kasprintf(GFP_KERNEL, "en%d", pwm->hwpwm);
> > > > +	pins_state = pinctrl_lookup_state(fpc->pinctrl,
> > > > +			statename);
> > > > +	/* enable pins to be muxed in and configured */
> > > > +	if (!IS_ERR(pins_state)) {
> > > > +		ret = pinctrl_select_state(fpc->pinctrl, pins_state);
> > > > +		if (ret)
> > > > +			dev_warn(&fpc->pdev->dev,
> > > > +					"could not set default pins\n");
> > > 
> > > Why do you need to manipulate the pinctrl to en/disable a channel?
> > > 
> > 
> > This is because in Vybrid VF610 TOWER board, there are 4 leds, and each led's one point(diode's positive pole) is connected to 3.3V,
> > and the other point is connected to pwm's one channel. When the 4 pinctrls are configured as enable at the same time, 
> > the 4 pinctrls is low valtage, and the 4 leds will be lighted up as default, then when you enable/disable one led will effects others.
> > 
> 
> I think the inactive state of a PWM is pretty much undefined by the PWM
> framework and left to the drivers.
> 
> I stumbled upon this aswell. It would be good to think about the
> inactive state and how the PWM framework could help us here getting
> things right.

I'm not sure if imposing what the inactive state should be is a good
thing to do. For one, it might not be possible to set that particular
state in all of the PWM drivers. Similarly some drivers may know of a
more optimal state to put the pin into.

> There are several things to consider. For a noninverted PWM the inactive
> state should probably logic 0. For an inverted PWM it should probably be
> logic 1. I guess several PWM devices have an undefined inactive state,
> most of the PWM devices probably can control the inactive state by
> setting the duty cycle to 100% / 0% without actually disabling the PWM.

That sounds like a reasonable set of rules. The above should also be
equivalent to the "no power" state. I think we could possibly write down
those rules (even though I think they are obvious enough), but enforcing
one specific state doesn't sound right to me.

> Using the pinctrl is one way to control the inactive state and probaby
> the only one before initialization. It might be good to wire this up in
> the core instead of the individual PWM drivers.

I don't really see how the PWM core can make an educated decision about
this. The proper inactive state for a PWM can only be known by it's
corresponding driver. Each driver's .disable() operation should take
care of putting the PWM into the inactive state. That is, if it can be
done without too much effort. If putting the PWM into the inactive state
involves pinmuxing and such, it's probably better to defer that to the
.free() operation.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130823/987325fc/attachment.sig>

  parent reply	other threads:[~2013-08-23  7:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21  3:07 [PATCH 0/4] Add freescale ftm pwm driver for Vybrid VF610 TOWER Xiubo Li
2013-08-21  3:07 ` [PATCH 1/4] pwm: add freescale ftm pwm driver support Xiubo Li
2013-08-21  7:36   ` Sascha Hauer
2013-08-21  9:24     ` Xiubo Li-B47053
2013-08-21  9:50       ` Sascha Hauer
2013-08-21 10:46         ` Xiubo Li-B47053
2013-08-23  7:58         ` Thierry Reding [this message]
2013-08-23  9:05   ` Thierry Reding
2013-08-26  7:32     ` Xiubo Li-B47053
2013-08-27  7:40       ` Thierry Reding
2013-08-27  9:56         ` Xiubo Li-B47053
2013-08-21  3:07 ` [PATCH 2/4] ARM: dts: Add Freescale ftm pwm node for VF610 Xiubo Li
2013-08-23  9:13   ` Thierry Reding
2013-08-26  5:58     ` Xiubo Li-B47053
2013-08-21  3:07 ` [PATCH 3/4] ARM: dts: Enables ftm pwm device for Vybrid VF610 TOWER board Xiubo Li
2013-08-23  9:13   ` Thierry Reding
2013-08-26  6:00     ` Xiubo Li-B47053
2013-08-21  3:07 ` [PATCH 4/4] Documentation: Add device tree bindings for Freescale FTM PWM Xiubo Li
2013-08-21 19:30   ` Tomasz Figa
2013-08-22  2:55     ` Xiubo Li-B47053
2013-08-22  6:26       ` Sascha Hauer
2013-08-22  7:32         ` Xiubo Li-B47053
2013-08-23  7:36         ` Thierry Reding
2013-08-23 19:29           ` Stephen Warren
2013-08-26  5:35             ` Xiubo Li-B47053
2013-08-26 20:01               ` Stephen Warren
2013-08-27  3:48                 ` Xiubo Li-B47053
2013-08-27  4:04                   ` Stephen Warren
2013-08-26  5:46           ` Xiubo Li-B47053
2013-08-22  8:25       ` Tomasz Figa
2013-08-22  9:52         ` Xiubo Li-B47053
2013-08-22 12:17           ` Tomasz Figa
2013-08-23  8:04         ` Thierry Reding
2013-08-23  9:10   ` Thierry Reding
2013-08-23 19:36     ` Stephen Warren
2013-08-30 19:19   ` Kumar Gala
2013-08-30 20:11     ` Stephen Warren
2013-09-03  5:25       ` Xiubo Li-B47053
2013-09-02  2:18     ` Xiubo Li-B47053

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=20130823075828.GD3535@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).