Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1703731
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops |
| Date | 2017-08-04 09:10 +0200 |
| Message-ID | <uaEUa-3Ro-9@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <u0Pea-5J8-19@gated-at.bofh.it> <u9XFw-7As-13@gated-at.bofh.it> <ua0am-Og-17@gated-at.bofh.it> <ua0k1-RL-3@gated-at.bofh.it> <uaAGS-Pk-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 4 Aug 2017 10:38:26 +0800
"David.Wu" <david.wu@rock-chips.com> 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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-02 11:00 +0200
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops "David.Wu" <david.wu@rock-chips.com> - 2017-08-02 13:40 +0200
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-02 13:50 +0200
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops "David.Wu" <david.wu@rock-chips.com> - 2017-08-04 04:40 +0200
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-04 09:10 +0200
Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops "David.Wu" <david.wu@rock-chips.com> - 2017-08-08 17:50 +0200
csiph-web