From: Aditya Prayoga <aditya@kobol.io>
To: andrew@lunn.ch
Cc: linux-gpio@vger.kernel.org, richard.genoud@gmail.com,
gregory.clement@bootlin.com, Gauthier Provost <gauthier@kobol.io>,
alban.browaeys@gmail.com, thierry.reding@gmail.com,
linus.walleij@linaro.org, linux-pwm@vger.kernel.org,
linux-kernel@vger.kernel.org, Dennis Gilmore <dennis@ausil.us>,
ralph.sennhauser@gmail.com
Subject: Re: [PATCH RESEND 2/2] gpio: mvebu: Allow to use non-default PWM counter
Date: Wed, 8 Aug 2018 18:40:09 +0700 [thread overview]
Message-ID: <CAFTRUBdSkLWLi1QJ-303JFZFM83z0UugEDUbF1coTn7RT5EMNA@mail.gmail.com> (raw)
In-Reply-To: <20180806135257.GB6584@lunn.ch>
On Mon, Aug 6, 2018 at 8:53 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Mon, Aug 06, 2018 at 10:29:16AM +0800, Aditya Prayoga wrote:
> > On multiple PWM lines, if the other PWM counter is unused, allocate it
> > to next PWM request. The priority would be:
> > 1. Default counter assigned to the bank
> > 2. Unused counter that is assigned to other bank
> > 3. Fallback to default counter
> >
> > For example on second bank there are three PWM request, first one would
> > use default counter (counter B), second one would try to use counter A,
> > and the third one would use counter B.
>
> Hi Aditya
>
> There are only two PWM counters for all the GPIO lines. So you cannot
> support 3 PWM requests. You have to enforce a maximum of two PWMs.
>
> When i implemented this PWM code, i only needed one PWM. So it took
> the easy option. GPIO bank 0 uses counter A, GPIO bank1 uses counter
> B. For the hardware you have, this is not sufficient, so you need to
> generalise this. Any PWM can use any counter, whatever is available
> when the PWM is requested.
Hi Andrew
Understood. I will change it in next version.
> Rather than have a linked list of PWM, i think it would be better to
> have a static array of two mvebu_pwm structures. Index 0 uses counter
> A, index 1 uses counter B. You can then keep with the concept of
> pwm->pgiod != NULL means the counter is in use. The request() call can
> then find an unused PWM, set pwm->gpiod, and point mvchip->mvpwm to
> one of the two static instances.
That was my initial idea to use static array but then I thought maybe
I could generalise it for future device by using linked list.
Regards,
Aditya
>
> Andrew
next prev parent reply other threads:[~2018-08-08 11:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 2:29 [PATCH RESEND 0/2] gpio: mvebu: Add support for multiple PWM lines Aditya Prayoga
2018-08-06 2:29 ` [PATCH RESEND 1/2] gpio: mvebu: Add support for multiple PWM lines per GPIO chip Aditya Prayoga
2018-08-06 3:38 ` Andrew Lunn
2018-08-08 10:27 ` Aditya Prayoga
2018-08-29 7:54 ` Linus Walleij
2018-08-29 8:02 ` Thomas Petazzoni
2018-08-29 12:09 ` Linus Walleij
2018-08-29 12:52 ` Andrew Lunn
2018-08-29 8:13 ` Gregory CLEMENT
2018-08-06 2:29 ` [PATCH RESEND 2/2] gpio: mvebu: Allow to use non-default PWM counter Aditya Prayoga
2018-08-06 13:52 ` Andrew Lunn
2018-08-08 11:40 ` Aditya Prayoga [this message]
2018-08-09 15:03 ` Richard Genoud
2018-08-09 15:43 ` Andrew Lunn
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=CAFTRUBdSkLWLi1QJ-303JFZFM83z0UugEDUbF1coTn7RT5EMNA@mail.gmail.com \
--to=aditya@kobol.io \
--cc=alban.browaeys@gmail.com \
--cc=andrew@lunn.ch \
--cc=dennis@ausil.us \
--cc=gauthier@kobol.io \
--cc=gregory.clement@bootlin.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=ralph.sennhauser@gmail.com \
--cc=richard.genoud@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).