From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751303AbdHDHJj convert rfc822-to-8bit (ORCPT ); Fri, 4 Aug 2017 03:09:39 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:49561 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbdHDHJh (ORCPT ); Fri, 4 Aug 2017 03:09:37 -0400 Date: Fri, 4 Aug 2017 09:09:35 +0200 From: Boris Brezillon To: "David.Wu" Cc: thierry.reding@gmail.com, heiko@sntech.de, robh+dt@kernel.org, catalin.marinas@arm.com, briannorris@chromium.org, dianders@chromium.org, mark.rutland@arm.com, huangtao@rock-chips.com, linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops Message-ID: <20170804090935.6aba3351@bbrezillon> In-Reply-To: <6d1f60ee-2402-5ee0-54f6-9521c039c36c@rock-chips.com> References: <1499486629-9659-1-git-send-email-david.wu@rock-chips.com> <1499486629-9659-4-git-send-email-david.wu@rock-chips.com> <20170802105902.2d137072@bbrezillon> <20170802134011.1124f1dd@bbrezillon> <6d1f60ee-2402-5ee0-54f6-9521c039c36c@rock-chips.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 4 Aug 2017 10:38:26 +0800 "David.Wu" 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. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Subject: Re: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops Date: Fri, 4 Aug 2017 09:09:35 +0200 Message-ID: <20170804090935.6aba3351@bbrezillon> References: <1499486629-9659-1-git-send-email-david.wu@rock-chips.com> <1499486629-9659-4-git-send-email-david.wu@rock-chips.com> <20170802105902.2d137072@bbrezillon> <20170802134011.1124f1dd@bbrezillon> <6d1f60ee-2402-5ee0-54f6-9521c039c36c@rock-chips.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: <6d1f60ee-2402-5ee0-54f6-9521c039c36c-TNX95d0MmH7DzftRWevZcw@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "David.Wu" 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 List-Id: devicetree@vger.kernel.org On Fri, 4 Aug 2017 10:38:26 +0800 "David.Wu" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: boris.brezillon@free-electrons.com (Boris Brezillon) Date: Fri, 4 Aug 2017 09:09:35 +0200 Subject: [PATCH v2 3/7] pwm: rockchip: Remove the dumplicate rockchip_pwm_ops ops In-Reply-To: <6d1f60ee-2402-5ee0-54f6-9521c039c36c@rock-chips.com> References: <1499486629-9659-1-git-send-email-david.wu@rock-chips.com> <1499486629-9659-4-git-send-email-david.wu@rock-chips.com> <20170802105902.2d137072@bbrezillon> <20170802134011.1124f1dd@bbrezillon> <6d1f60ee-2402-5ee0-54f6-9521c039c36c@rock-chips.com> Message-ID: <20170804090935.6aba3351@bbrezillon> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, 4 Aug 2017 10:38:26 +0800 "David.Wu" 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.