From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] pwm: add freescale ftm pwm driver support
Date: Wed, 21 Aug 2013 11:50:49 +0200 [thread overview]
Message-ID: <20130821095049.GQ31036@pengutronix.de> (raw)
In-Reply-To: <1DD289F6464F0949A2FCA5AA6DC23F827D1C51@039-SN2MPN1-013.039d.mgd.msft.net>
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.
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.
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.
These are just the thoughts which first came to my mind.
Thierry, any more input about this?
> > > + fpc = dev_get_drvdata(dev);
> > > +
> > > + ret = kstrtouint(buf, 0, &val);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + mutex_lock(&fpc->lock);
> > > + if (!!(val) != !!(fpc->cpwm)) {
> > > + fpc->cpwm = !!val;
> > > + fsl_updata_config(fpc, NULL);
> > > + }
> > > + mutex_unlock(&fpc->lock);
> > > +
> > > + return count;
> > > +}
> >
> > What is this cpwm thingy?
>
> Up-down counting mode:
> CNTIN(a register) defines the starting value of the count and MOD(a register) defines the final value of the
> count. The value of CNTIN is loaded into the FTM counter, and the counter increments
> until the value of MOD is reached, at which point the counter is decremented until it
> returns to the value of CNTIN and the up-down counting restarts.
The current PWM framework only cares about period times and duty cycles.
Why would I want to care about this?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-08-21 9:50 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 [this message]
2013-08-21 10:46 ` Xiubo Li-B47053
2013-08-23 7:58 ` Thierry Reding
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=20130821095049.GQ31036@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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).