devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: "David.Wu" <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Cc: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops
Date: Fri, 4 Aug 2017 09:09:35 +0200	[thread overview]
Message-ID: <20170804090935.6aba3351@bbrezillon> (raw)
In-Reply-To: <6d1f60ee-2402-5ee0-54f6-9521c039c36c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

On Fri, 4 Aug 2017 10:38:26 +0800
"David.Wu" <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org> wrote:

> Hi Boris,
> 
> 在 2017/8/2 19:40, Boris Brezillon 写道:
> > Yep, just define 3 different pwm_ops (one for each IP), each of them
> > implementing ->apply() and ->get_state() and that's all.
> > 
> > Something like:
> > 
> > static const struct pwm_ops rockchip_pwm_ops_v1 = {
> > 	.get_state = rockchip_pwm_v1_get_state,
> > 	.apply = rockchip_pwm_v1_apply,
> > 	.owner = THIS_MODULE,
> > };
> > 
> > static const struct pwm_ops rockchip_pwm_ops_v2 = {
> > 	.get_state = rockchip_pwm_v2_get_state,
> > 	.apply = rockchip_pwm_v2_apply,
> > 	.owner = THIS_MODULE,
> > };
> > 
> > static const struct pwm_ops rockchip_pwm_ops_vop = {
> > 	.get_state = rockchip_pwm_vop_get_state,
> > 	.apply = rockchip_pwm_vop_apply,
> > 	.owner = THIS_MODULE,
> > };
> > 
> > static const struct of_device_id rockchip_pwm_dt_ids[] = {
> > 	{ .compatible = "rockchip,rk2928-pwm", .data = &rockchip_pwm_ops_v1 },
> > 	{ .compatible = "rockchip,rk3288-pwm", .data = &rockchip_pwm_ops_v2 },
> > 	{ .compatible = "rockchip,vop-pwm", .data = &rockchip_pwm_ops_vop },
> > 	{ /* sentinel */ }
> > };
> > MODULE_DEVICE_TABLE(of, rockchip_pwm_dt_ids);  
> 
> I think we should keep the data members in the rockchip_pwm_data,like 
> supports_polarity and regs...
> 
> The supports_polarity is needed for of_pwm_n_cells when pwm registered.
> And the other data members is helpful for us to use common code.
> 
> It's okay for just define 3 different pwm_ops (one for each IP), but 
> they are with other data members in the struct of rockchip_pwm_data.
> 

I think we could even get rid of the other fields in rockchip_pwm_data,
but ok, let's do that.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-08-04  7:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-08  4:03 [PATCH v2 0/7] Add rk3328 pwm support David Wu
2017-07-08  4:03 ` [PATCH v2 1/7] pwm: rockchip: Add APB and function both clocks support David Wu
2017-07-11 17:03   ` Doug Anderson
     [not found]     ` <CAD=FV=Vqkueo_cqU8bJXXT3pV5d1dZR5LF+c=O-Ka1qR-Ff-WQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-12  8:38       ` David.Wu
     [not found]         ` <caba81f3-d066-d64e-7e8e-6457b759e757-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-07-12 19:09           ` Heiko Stübner
2017-07-08  4:03 ` [PATCH v2 2/7] pwm: rockchip: Remove the judge from return value of pwm_config David Wu
2017-07-08  4:03 ` [PATCH v2 4/7] pwm: rockchip: Use pwm_apply instead of the pwm_enable David Wu
2017-07-08  4:09 ` [PATCH v2 6/7] pwm: rockchip: Add rk3328 pwm support David Wu
2017-07-08  4:10 ` [PATCH v2 7/7] arm64: dts: rockchip: Add pwm nodes for rk3328 David Wu
     [not found] ` <1499486629-9659-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-07-08  4:03   ` [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops David Wu
2017-08-02  8:59     ` Boris Brezillon
2017-08-02 11:31       ` David.Wu
     [not found]         ` <af056420-5c33-e6c8-62cb-bcd3456000a7-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-02 11:40           ` Boris Brezillon
2017-08-04  2:38             ` David.Wu
     [not found]               ` <6d1f60ee-2402-5ee0-54f6-9521c039c36c-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-08-04  7:09                 ` Boris Brezillon [this message]
2017-08-08 15:41                   ` David.Wu
2017-07-08  4:08   ` [PATCH v2 5/7] pwm: rockchip: Move the configuration of polarity from rockchip_pwm_set_enable() to rockchip_pwm_config() David Wu
2017-07-08  4:25   ` [RESEND PATCH v2 6/7] pwm: rockchip: Add rk3328 pwm support David Wu
2017-08-02  8:46   ` [PATCH v2 0/7] " David.Wu

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=20170804090935.6aba3351@bbrezillon \
    --to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).