clk: meson: vid-pll-div: added meson_vid_pll_div_ops support
PATCH v2 1/1 clk: meson: vid-pll-div: added meson_vid_pll_div_ops support
Since the previous code only provides "ro_ops" for the vid_pll_div clock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.
--- drivers/clk/meson/vid-pll-div.c | 67 +++++++++++++++++++++++++++++++++ drivers/clk/meson/vid-pll-div.h | 3 ++ 2 files changed, 70 insertions(+)
drivers/clk/meson/vid-pll-div.c +67 -0
@@ -89,6 +89,73 @@ static unsigned long meson_vid_pll_div_recalc_rate(struct clk_hw *hw,return DIV_ROUND_UP_ULL (parent_rate * div->multiplier, div->divider); } +static int meson_vid_pll_div_determine_rate (struct clk_hw *hw, +struct clk_rate_request *req) +{ +unsigned long parent_rate, best =0 , now =0 , rate; +unsigned long parent_rate_saved = req->best_parent_rate; +unsigned int i, best_i =0 ; + +for (i =0 ; i <VID_PLL_DIV_TABLE_SIZE ; ++i) { + rate =DIV_ROUND_CLOSEST_ULL (req->rate * vid_pll_div_table[i].divider, + vid_pll_div_table[i].multiplier); +if (parent_rate_saved == rate) { + req->best_parent_rate = parent_rate_saved; + best_i = i; +break ; + } + + parent_rate =clk_hw_round_rate (req->best_parent_hw, rate); + now =DIV_ROUND_CLOSEST_ULL (parent_rate * + vid_pll_div_table[i].multiplier, + vid_pll_div_table[i].divider); +if (abs (now - req->rate) <abs (best - req->rate)) { + best = now; + best_i = i; + req->best_parent_rate = parent_rate; + } + } + + req->rate =DIV_ROUND_CLOSEST_ULL (req->best_parent_rate * + vid_pll_div_table[best_i].multiplier, + vid_pll_div_table[best_i].divider); + +return 0 ; +} + +static int meson_vid_pll_div_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct clk_regmap *clk =to_clk_regmap (hw); +struct meson_vid_pll_div_data *pll_div =meson_vid_pll_div_data (clk); +unsigned long best =0 , now =0 ; +unsigned int i, best_i =0 ; + +for (i =0 ; i <VID_PLL_DIV_TABLE_SIZE ; ++i) { + now =DIV_ROUND_CLOSEST_ULL (parent_rate * vid_pll_div_table[i].multiplier, + vid_pll_div_table[i].divider); +if (now == rate) { + best_i = i; +break ; + }else if (abs (now - rate) <abs (best - rate)) { + best = now; + best_i = i; + } + } + +meson_parm_write (clk->map, &pll_div->val, vid_pll_div_table[best_i].shift_val); +meson_parm_write (clk->map, &pll_div->sel, vid_pll_div_table[best_i].shift_sel); + +return 0 ; +} + +const struct clk_ops meson_vid_pll_div_ops = { + .recalc_rate = meson_vid_pll_div_recalc_rate, + .determine_rate = meson_vid_pll_div_determine_rate, + .set_rate = meson_vid_pll_div_set_rate, +}; +EXPORT_SYMBOL_GPL (meson_vid_pll_div_ops); +const struct clk_ops meson_vid_pll_div_ro_ops = { .recalc_rate = meson_vid_pll_div_recalc_rate, };
drivers/clk/meson/vid-pll-div.h +3 -0
@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14 +struct meson_vid_pll_div_data {struct parm val;struct parm sel; };extern const struct clk_ops meson_vid_pll_div_ro_ops; +extern const struct clk_ops meson_vid_pll_div_ops;#endif /* __MESON_VID_PLL_DIV_H */
Signature · 7 lines
2.33.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Martin Blumenstingl
reviewerHello Yu Tu,
Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14
In v1 you used ARRAY_SIZE(vid_pll_div_table) wherever this new macro is used instead.
I think using ARRAY_SIZE is the better approach because it means the references will update automatically if an entry is added/removed from vid_pll_div_table
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
From what I understand is that you interpreted this as "let's change ARRAY_SIZE(vid_pll_div_table) to a new macro called VID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid of vid_pll_div_table and implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings in vid_pll_div_table". Look at clk-mpll.c and/or clk-pll.c which allow calculating arbitrary rates without any hard-coded tables.
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi Martin,
First of all, thank you for your reply.
Quoted 6 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,
Quoted 1 line · Yu Tu
Quoted 7 lines
Quoted 6 lines
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 10 lines
[...]
Quoted 8 lines
drivers/clk/meson/vid-pll-div.h +0
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h"
Quoted 6 lines
drivers/clk/meson/vid-pll-div.h line 13
Quoted 1 line
drivers/clk/meson/vid-pll-div.h +1
-0+#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_table
I agree with you. Perhaps the key is to understand what Jerome said.
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.
In fact, pll and mpll are also fixed register writes corresponding values. But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 5 lines
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerQuoted 27 lines · Yu Tu
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 9 lines
[...]
Quoted 8 lines
drivers/clk/meson/vid-pll-div.h +0
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h"
Quoted 8 lines
Quoted 6 lines
drivers/clk/meson/vid-pll-div.h line 13
Quoted 1 line
drivers/clk/meson/vid-pll-div.h +1
-0+#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_tableI agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove ARRAY_SIZE().
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead.
What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how".
This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.
exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
Quoted 6 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
Quoted 1 line · Jerome Brunet
[ EXTERNAL EMAIL ]
Hi Jerome,
Thank you for your reply.
Quoted 38 lines · Yu Tu
Quoted 35 lines
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 15 lines
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_table
Quoted 4 lines
Quoted 1 line
I agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove
ARRAY_SIZE().
OKay! I misunderstood your meaning.
Quoted 27 lines
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead.
What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how".
This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.
Quoted 9 lines
exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
After consulting the engineer of the chip design, the clock is a digital frequency divider, and the frequency divider is verified by the sequence generator, which is bit0-bi15. bit16-bit17 confirms the size of the frequency division. Whereas other PLLS and MPLLS are analog dividers so there are fixed formulas to calculate.
So Neil had no problem implementing it this way. So now I want to know your advice what should I do next?
Quoted 7 lines
Quoted 6 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerQuoted 74 lines · Yu Tu
Quoted 1 line · Jerome Brunet
[ EXTERNAL EMAIL ]
Hi Jerome,
Thank you for your reply.Quoted 36 lines · Yu Tu
Quoted 35 lines
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 15 lines
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_tableQuoted 3 lines
Quoted 1 line
I agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove
ARRAY_SIZE().OKay! I misunderstood your meaning.
Quoted 28 lines
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead. What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how". This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
Quoted 8 lines
Quoted 3 lines
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
After consulting the engineer of the chip design, the clock is a digital frequency divider, and the frequency divider is verified by the sequence generator, which is bit0-bi15. bit16-bit17 confirms the size of the frequency division.
That, we already know. This is what the datasheet already give us. It is still a bit light.
You don't set the bit randomly and check the output, do you ?
The question is how setting this bit impact the relation between the input and output rate? IOW, from these 17bits, how do you come up with the multiplier and divider values (and the other way around) ?
Quoted 5 lines
Whereas other PLLS and MPLLS are analog dividers so there are fixed formulas to calculate.
So Neil had no problem implementing it this way. So now I want to know your advice what should I do next?
1) Neil did what he could to get compute the rate (RO) which the little information he had. You are trying to extend the driver, keeping an dummy approach. It is only fair that I ask you to make this a real driver.
2) Because something has been done once, it not necessarily appropriate to continue ... this type of argument hardly a valid reason.
I don't want to keep adding table based driver unless necessary. So far, you have not proved this approach is really required, nor provided the necessary information to make the calculation.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
Quoted 108 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 74 lines · Yu Tu
Quoted 1 line · Jerome Brunet
[ EXTERNAL EMAIL ]
Hi Jerome,
Thank you for your reply.Quoted 36 lines · Yu Tu
Quoted 35 lines
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 15 lines
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_tableQuoted 3 lines
Quoted 1 line
I agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove
ARRAY_SIZE().OKay! I misunderstood your meaning.
Quoted 28 lines
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead. What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how". This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
Quoted 8 lines
Quoted 3 lines
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
After consulting the engineer of the chip design, the clock is a digital frequency divider, and the frequency divider is verified by the sequence generator, which is bit0-bi15. bit16-bit17 confirms the size of the frequency division.
That, we already know. This is what the datasheet already give us. It is still a bit light.
You don't set the bit randomly and check the output, do you ?
The question is how setting this bit impact the relation between the input and output rate? IOW, from these 17bits, how do you come up with the multiplier and divider values (and the other way around) ?
Quoted 5 lines
Whereas other PLLS and MPLLS are analog dividers so there are fixed formulas to calculate.
So Neil had no problem implementing it this way. So now I want to know your advice what should I do next?
1) Neil did what he could to get compute the rate (RO) which the little information he had. You are trying to extend the driver, keeping an dummy approach. It is only fair that I ask you to make this a real driver.
Quoted 6 lines
2) Because something has been done once, it not necessarily appropriate to continue ... this type of argument hardly a valid reason.
I don't want to keep adding table based driver unless necessary. So far, you have not proved this approach is really required, nor provided the necessary information to make the calculation.
Technically you are right. I am communicating and confirming with the chip designer to see if the general calculation formula can be given. If not, I will explain why. Please give me some time.
But I have to mention that the SOC, although there is this register but actually does not use the clock. Can we treat this as a separate patch that we will continue to send and explain later?
This way I can continue with the other patches of S4 SOC first, and this clock stays the same way as the G12A first. Later, after the patch of the clock is corrected, it can be corrected to "ops" as required.Otherwise, we cannot continue other driver patches. I don't know if you agree?
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerQuoted 112 lines · Yu Tu
Quoted 97 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 74 lines · Yu Tu
Quoted 1 line · Jerome Brunet
[ EXTERNAL EMAIL ]
Hi Jerome,
Thank you for your reply.Quoted 36 lines · Yu Tu
Quoted 35 lines
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 15 lines
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_tableQuoted 3 lines
Quoted 1 line
I agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove
ARRAY_SIZE().OKay! I misunderstood your meaning.
Quoted 28 lines
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead. What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how". This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
Quoted 8 lines
Quoted 3 lines
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
After consulting the engineer of the chip design, the clock is a digital frequency divider, and the frequency divider is verified by the sequence generator, which is bit0-bi15. bit16-bit17 confirms the size of the frequency division.
That, we already know. This is what the datasheet already give us. It is still a bit light.
You don't set the bit randomly and check the output, do you ? The question is how setting this bit impact the relation between the input and output rate? IOW, from these 17bits, how do you come up with the multiplier and divider values (and the other way around) ?Quoted 5 lines
Whereas other PLLS and MPLLS are analog dividers so there are fixed formulas to calculate.
So Neil had no problem implementing it this way. So now I want to know your advice what should I do next?
Quoted 9 lines
1) Neil did what he could to get compute the rate (RO) which the little information he had. You are trying to extend the driver, keeping an dummy approach. It is only fair that I ask you to make this a real driver.
2) Because something has been done once, it not necessarily appropriate to continue ... this type of argument hardly a valid reason. I don't want to keep adding table based driver unless necessary. So far, you have not proved this approach is really required, nor provided the necessary information to make the calculation.Technically you are right. I am communicating and confirming with the chip designer to see if the general calculation formula can be given. If not, I will explain why. Please give me some time.
Quoted 9 lines
But I have to mention that the SOC, although there is this register but actually does not use the clock. Can we treat this as a separate patch that we will continue to send and explain later?
This way I can continue with the other patches of S4 SOC first, and this clock stays the same way as the G12A first. Later, after the patch of the clock is corrected, it can be corrected to "ops" as required.Otherwise, we cannot continue other driver patches. I don't know if you agree?
Sure you can send your s4 series with RO ops and change to RW later on if necessary.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
Quoted 121 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 116 lines · Yu Tu
Quoted 97 lines · Jerome Brunet
[ EXTERNAL EMAIL ]
Quoted 74 lines · Yu Tu
Quoted 1 line · Jerome Brunet
[ EXTERNAL EMAIL ]
Hi Jerome,
Thank you for your reply.Quoted 36 lines · Yu Tu
Quoted 35 lines
Hi Martin,
First of all, thank you for your reply.Quoted 11 lines · Martin Blumenstingl
[ EXTERNAL EMAIL ]
Hello Yu Tu,Quoted 7 lines · Yu Tu
Since the previous code only provides "
ro_ops" for thevid_pll_divclock. In fact, the clock can be set. So add "ops" that can set the clock, especially for later chips like S4 SOC and so on.Signed-off-by Yu Tu <[email protected]>---
please describe the changes you did compared to the previous version(s)
I'll add it in the next version.
Quoted 15 lines
[...]
drivers/clk/meson/vid-pll-div.h line 13
Quoted 9 lines
drivers/clk/meson/vid-pll-div.h +1
-0@@ -10,11 +10,14 @@#include <linux/clk-provider.h> #include "parm.h" +#define VID_PLL_DIV_TABLE_SIZE 14In v1 you used
ARRAY_SIZE(vid_pll_div_table)wherever this new macro is used instead.
I think usingARRAY_SIZEis the better approach because it means the references will update automatically if an entry is added/removed fromvid_pll_div_tableQuoted 3 lines
Quoted 1 line
I agree with you. Perhaps the key is to understand what Jerome said.
I asked you to describe how this divider actually works. Not remove
ARRAY_SIZE().OKay! I misunderstood your meaning.
Quoted 28 lines
This divider uses tables only because the parameters are "magic". I'd like the driver to be able come up with "computed" values instead. What I requested is some explanation about how this HW clock works because the documentation is not very clear when it comes to this. These values must come from somewhere, I'd like to understand "how". This is the same as the PLL driver which can take a range and come up with the different parameters, instead of using big pre-computed tables.
Quoted 6 lines
Quoted 6 lines
Also I think there's a different understanding about what Jerome
Quoted 3 lines · previously
It would be nice to actually describe how this vid pll work so we can stop using precompute "magic" values and actually use the IP to its full capacity.
Quoted 9 lines
Quoted 8 lines
From what I understand is that you interpreted this as "let's change
ARRAY_SIZE(vid_pll_div_table)to a new macro calledVID_PLL_DIV_TABLE_SIZE".
But I think what Jerome meant is: "let's get rid ofvid_pll_div_tableand implement how to actually calculate the clock rate - without hard-coding 14 possible clock settings invid_pll_div_table". Look atclk-mpll.cand/orclk-pll.cwhich allow calculating arbitrary rates without any hard-coded tables.exactly ... or at least an explanation about how it works and why it is too complicated to compute the values at runtime.
Quoted 2 lines
In fact, pll and mpll are also fixed register writes corresponding values.
Quoted 8 lines
Quoted 3 lines
That is not true. The pll and mpll drivers are able to compute their values at runtime. Please have a look at the drivers.
After consulting the engineer of the chip design, the clock is a digital frequency divider, and the frequency divider is verified by the sequence generator, which is bit0-bi15. bit16-bit17 confirms the size of the frequency division.
That, we already know. This is what the datasheet already give us. It is still a bit light.
You don't set the bit randomly and check the output, do you ? The question is how setting this bit impact the relation between the input and output rate? IOW, from these 17bits, how do you come up with the multiplier and divider values (and the other way around) ?Quoted 5 lines
Whereas other PLLS and MPLLS are analog dividers so there are fixed formulas to calculate.
So Neil had no problem implementing it this way. So now I want to know your advice what should I do next?
Quoted 9 lines
1) Neil did what he could to get compute the rate (RO) which the little information he had. You are trying to extend the driver, keeping an dummy approach. It is only fair that I ask you to make this a real driver.
2) Because something has been done once, it not necessarily appropriate to continue ... this type of argument hardly a valid reason. I don't want to keep adding table based driver unless necessary. So far, you have not proved this approach is really required, nor provided the necessary information to make the calculation.Technically you are right. I am communicating and confirming with the chip designer to see if the general calculation formula can be given. If not, I will explain why. Please give me some time.
But I have to mention that the SOC, although there is this register but actually does not use the clock. Can we treat this as a separate patch that we will continue to send and explain later?
Quoted 8 lines
Quoted 5 lines
This way I can continue with the other patches of S4 SOC first, and this clock stays the same way as the G12A first. Later, after the patch of the clock is corrected, it can be corrected to "ops" as required.Otherwise, we cannot continue other driver patches. I don't know if you agree?
Sure you can send your s4 series with RO ops and change to RW later on if necessary.
Ok, I will be ready to send S4 chip other patch with VID clock RO ops first.
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
But every SOC is different, so it makes more sense to set it outside. The VID PLL is a fixed value for all current SoCs.
Quoted 3 lines
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic