From mboxrd@z Thu Jan 1 00:00:00 1970 From: sboyd@codeaurora.org (Stephen Boyd) Date: Tue, 7 Mar 2017 06:11:57 -0800 Subject: [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock In-Reply-To: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> References: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> Message-ID: <20170307141157.GC10239@codeaurora.org> To: linus-amlogic@lists.infradead.org List-Id: linus-amlogic.lists.infradead.org On 03/07, Maxime Ripard wrote: > So far, divider_round_rate only considers the parent clock returned by > clk_hw_get_parent. > > This works fine on clocks that have a single parents, this doesn't work on > muxes, since we will only consider the first parent, while other parents > may totally be able to provide a better combination. > > Clocks in that case cannot use divider_round_rate, so would have to come up > with a very similar logic to work around it. Instead of having to do > something like this, and duplicate that logic everywhere, give an > additional parameter for the parent clock to consider. > > Current users have been converted using the following coccinelle script > > @@ > identifier hw, rate, prate, table, width, flags; > @@ > > -long divider_round_rate(struct clk_hw *hw, > +long divider_round_rate(struct clk_hw *hw, struct clk_hw *parent, > unsigned long rate, > unsigned long *prate, > const struct clk_div_table *table, > u8 width, > unsigned long flags) { ... } > > @@ > identifier fn, hw; > expression E2, E3, E4, E5, E6; > @@ > fn (struct clk_hw *hw, ...) { > <... > -divider_round_rate(hw, E2, E3, E4, E5, E6) > +divider_round_rate(hw, clk_hw_get_parent(hw), E2, E3, E4, E5, E6) > ...> > } Why not introduce another function like divider_round_rate_parent() divider_round_rate_mux() that takes the extra parent argument? Technically, a divider is considered to only have one parent, and if it has more than one parent, then it is a mux and a divider. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: Re: [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock Date: Tue, 7 Mar 2017 06:11:57 -0800 Message-ID: <20170307141157.GC10239@codeaurora.org> References: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Content-Disposition: inline In-Reply-To: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Maxime Ripard Cc: Mark Rutland , Mike Turquette , dri-devel@lists.freedesktop.org, David Brown , linux-sunxi@googlegroups.com, Alexandre Belloni , Daniel Vetter , linux-clk@vger.kernel.org, Kevin Hilman , Chen-Yu Tsai , Sylvain Lemieux , Andy Gross , devicetree@vger.kernel.org, rtc-linux@googlegroups.com, linux-arm-msm@vger.kernel.org, Vladimir Zapolskiy , Rob Herring , linux-amlogic@lists.infradead.org, linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Alessandro Zummo , linux-kernel@vger.kernel.org, Carlo Caione List-Id: linux-arm-msm@vger.kernel.org T24gMDMvMDcsIE1heGltZSBSaXBhcmQgd3JvdGU6Cj4gU28gZmFyLCBkaXZpZGVyX3JvdW5kX3Jh dGUgb25seSBjb25zaWRlcnMgdGhlIHBhcmVudCBjbG9jayByZXR1cm5lZCBieQo+IGNsa19od19n ZXRfcGFyZW50Lgo+IAo+IFRoaXMgd29ya3MgZmluZSBvbiBjbG9ja3MgdGhhdCBoYXZlIGEgc2lu Z2xlIHBhcmVudHMsIHRoaXMgZG9lc24ndCB3b3JrIG9uCj4gbXV4ZXMsIHNpbmNlIHdlIHdpbGwg b25seSBjb25zaWRlciB0aGUgZmlyc3QgcGFyZW50LCB3aGlsZSBvdGhlciBwYXJlbnRzCj4gbWF5 IHRvdGFsbHkgYmUgYWJsZSB0byBwcm92aWRlIGEgYmV0dGVyIGNvbWJpbmF0aW9uLgo+IAo+IENs b2NrcyBpbiB0aG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UyLCBFMywgRTQsIEU1LCBFNjsKPiBAQAo+ICBmbiAoc3RydWN0 IGNsa19odyAqaHcsIC4uLikgewo+ICA8Li4uCj4gLWRpdmlkZXJfcm91bmRfcmF0ZShodywgRTIs IEUzLCBFNCwgRTUsIEU2KQo+ICtkaXZpZGVyX3JvdW5kX3JhdGUoaHcsIGNsa19od19nZXRfcGFy ZW50KGh3KSwgRTIsIEUzLCBFNCwgRTUsIEU2KQo+ICAuLi4+Cj4gfQoKV2h5IG5vdCBpbnRyb2R1 Y2UgYW5vdGhlciBmdW5jdGlvbiBsaWtlIAoKCWRpdmlkZXJfcm91bmRfcmF0ZV9wYXJlbnQoKQoJ ZGl2aWRlcl9yb3VuZF9yYXRlX211eCgpCgp0aGF0IHRha2VzIHRoZSBleHRyYSBwYXJlbnQgYXJn dW1lbnQ/IFRlY2huaWNhbGx5LCBhIGRpdmlkZXIgaXMKY29uc2lkZXJlZCB0byBvbmx5IGhhdmUg b25lIHBhcmVudCwgYW5kIGlmIGl0IGhhcyBtb3JlIHRoYW4gb25lCnBhcmVudCwgdGhlbiBpdCBp cyBhIG11eCBhbmQgYSBkaXZpZGVyLgoKLS0gClF1YWxjb21tIElubm92YXRpb24gQ2VudGVyLCBJ bmMuIGlzIGEgbWVtYmVyIG9mIENvZGUgQXVyb3JhIEZvcnVtLAphIExpbnV4IEZvdW5kYXRpb24g Q29sbGFib3JhdGl2ZSBQcm9qZWN0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fCmRyaS1kZXZlbCBtYWlsaW5nIGxpc3QKZHJpLWRldmVsQGxpc3RzLmZyZWVk ZXNrdG9wLm9yZwpodHRwczovL2xpc3RzLmZyZWVkZXNrdG9wLm9yZy9tYWlsbWFuL2xpc3RpbmZv L2RyaS1kZXZlbAo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 7 Mar 2017 06:11:57 -0800 From: Stephen Boyd To: Maxime Ripard Cc: Mike Turquette , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Carlo Caione , Kevin Hilman , Vladimir Zapolskiy , Sylvain Lemieux , Andy Gross , David Brown , Alessandro Zummo , Alexandre Belloni , linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rtc-linux@googlegroups.com Subject: Re: [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock Message-ID: <20170307141157.GC10239@codeaurora.org> References: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> List-ID: On 03/07, Maxime Ripard wrote: > So far, divider_round_rate only considers the parent clock returned by > clk_hw_get_parent. > > This works fine on clocks that have a single parents, this doesn't work on > muxes, since we will only consider the first parent, while other parents > may totally be able to provide a better combination. > > Clocks in that case cannot use divider_round_rate, so would have to come up > with a very similar logic to work around it. Instead of having to do > something like this, and duplicate that logic everywhere, give an > additional parameter for the parent clock to consider. > > Current users have been converted using the following coccinelle script > > @@ > identifier hw, rate, prate, table, width, flags; > @@ > > -long divider_round_rate(struct clk_hw *hw, > +long divider_round_rate(struct clk_hw *hw, struct clk_hw *parent, > unsigned long rate, > unsigned long *prate, > const struct clk_div_table *table, > u8 width, > unsigned long flags) { ... } > > @@ > identifier fn, hw; > expression E2, E3, E4, E5, E6; > @@ > fn (struct clk_hw *hw, ...) { > <... > -divider_round_rate(hw, E2, E3, E4, E5, E6) > +divider_round_rate(hw, clk_hw_get_parent(hw), E2, E3, E4, E5, E6) > ...> > } Why not introduce another function like divider_round_rate_parent() divider_round_rate_mux() that takes the extra parent argument? Technically, a divider is considered to only have one parent, and if it has more than one parent, then it is a mux and a divider. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Sender: rtc-linux@googlegroups.com Date: Tue, 7 Mar 2017 06:11:57 -0800 From: Stephen Boyd To: Maxime Ripard Cc: Mike Turquette , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Mark Rutland , Rob Herring , devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Carlo Caione , Kevin Hilman , Vladimir Zapolskiy , Sylvain Lemieux , Andy Gross , David Brown , Alessandro Zummo , Alexandre Belloni , linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rtc-linux@googlegroups.com Subject: [rtc-linux] Re: [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock Message-ID: <20170307141157.GC10239@codeaurora.org> References: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 In-Reply-To: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On 03/07, Maxime Ripard wrote: > So far, divider_round_rate only considers the parent clock returned by > clk_hw_get_parent. > > This works fine on clocks that have a single parents, this doesn't work on > muxes, since we will only consider the first parent, while other parents > may totally be able to provide a better combination. > > Clocks in that case cannot use divider_round_rate, so would have to come up > with a very similar logic to work around it. Instead of having to do > something like this, and duplicate that logic everywhere, give an > additional parameter for the parent clock to consider. > > Current users have been converted using the following coccinelle script > > @@ > identifier hw, rate, prate, table, width, flags; > @@ > > -long divider_round_rate(struct clk_hw *hw, > +long divider_round_rate(struct clk_hw *hw, struct clk_hw *parent, > unsigned long rate, > unsigned long *prate, > const struct clk_div_table *table, > u8 width, > unsigned long flags) { ... } > > @@ > identifier fn, hw; > expression E2, E3, E4, E5, E6; > @@ > fn (struct clk_hw *hw, ...) { > <... > -divider_round_rate(hw, E2, E3, E4, E5, E6) > +divider_round_rate(hw, clk_hw_get_parent(hw), E2, E3, E4, E5, E6) > ...> > } Why not introduce another function like divider_round_rate_parent() divider_round_rate_mux() that takes the extra parent argument? Technically, a divider is considered to only have one parent, and if it has more than one parent, then it is a mux and a divider. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 From: sboyd@codeaurora.org (Stephen Boyd) Date: Tue, 7 Mar 2017 06:11:57 -0800 Subject: [PATCH 1/15] clk: divider: Make divider_round_rate take the parent clock In-Reply-To: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> References: <7ebd073b4941e4b7c619f15ff0a375ff7919d403.1488876832.git-series.maxime.ripard@free-electrons.com> Message-ID: <20170307141157.GC10239@codeaurora.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 03/07, Maxime Ripard wrote: > So far, divider_round_rate only considers the parent clock returned by > clk_hw_get_parent. > > This works fine on clocks that have a single parents, this doesn't work on > muxes, since we will only consider the first parent, while other parents > may totally be able to provide a better combination. > > Clocks in that case cannot use divider_round_rate, so would have to come up > with a very similar logic to work around it. Instead of having to do > something like this, and duplicate that logic everywhere, give an > additional parameter for the parent clock to consider. > > Current users have been converted using the following coccinelle script > > @@ > identifier hw, rate, prate, table, width, flags; > @@ > > -long divider_round_rate(struct clk_hw *hw, > +long divider_round_rate(struct clk_hw *hw, struct clk_hw *parent, > unsigned long rate, > unsigned long *prate, > const struct clk_div_table *table, > u8 width, > unsigned long flags) { ... } > > @@ > identifier fn, hw; > expression E2, E3, E4, E5, E6; > @@ > fn (struct clk_hw *hw, ...) { > <... > -divider_round_rate(hw, E2, E3, E4, E5, E6) > +divider_round_rate(hw, clk_hw_get_parent(hw), E2, E3, E4, E5, E6) > ...> > } Why not introduce another function like divider_round_rate_parent() divider_round_rate_mux() that takes the extra parent argument? Technically, a divider is considered to only have one parent, and if it has more than one parent, then it is a mux and a divider. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project