OMAPDSS: HDMI: Add M2 divider while calculating clkout
PATCH v2 1/1 OMAPDSS: HDMI: Add M2 divider while calculating clkout
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2) Internal oscillator output clock on internal LDO domain: CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.
--- drivers/video/omap2/dss/hdmi.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/video/omap2/dss/hdmi.c +8 -8
@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; -/* -* multiplier is pixel_clk/ref_clk -* Multiplying by 100 to avoid fractional part removal -*/ - pi->regm = (phy *100 / (refclk)) /100 ; -if (dssdev->clocks.hdmi.regm2 ==0 ) pi->regm2 =HDMI_DEFAULT_REGM2 ;else pi->regm2 = dssdev->clocks.hdmi.regm2;/* +* multiplier is pixel_clk/ref_clk +* Multiplying by 100 to avoid fractional part removal +*/ + pi->regm = (phy *100 * pi->regm2 / (refclk)) /100 ; + +/* * fractional multiplier is remainder of the difference between * multiplier and actual phy(required pixel clock thus should be * multiplied by 2^18(262144) divided by the reference clock */ - mf = (phy - pi->regm * refclk) *262144 ; - pi->regmf = mf / (refclk); + mf = (phy - pi->regm / pi->regm2 * refclk) *262144 ; + pi->regmf = pi->regm2 * mf / refclk;/* * Dcofreq should be set to 1 if required pixel clock
Signature · 1 line
1.7.5.4
Quoted 32 lines · On Wed, 2012-02-15 at 11:20 +0530, [email protected] wrote:
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:CLKOUT = (M / (N+1))*CLKINP*(1/M2) Internal oscillator output clock on internal LDO domain: CLKDCOLDO = (M / (N+1))*CLKINPThe current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.
Signed-off-by Mythri P K <[email protected]>--- drivers/video/omap2/dss/hdmi.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)drivers/video/omap2/dss/hdmi.c +0
-6@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; -/* -* multiplier is pixel_clk/ref_clk -* Multiplying by 100 to avoid fractional part removal -*/ - pi->regm = (phy *100 / (refclk)) /100 ; -
drivers/video/omap2/dss/hdmi.c static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, · line 268
Quoted 10 lines
drivers/video/omap2/dss/hdmi.c +4
-0if (dssdev->clocks.hdmi.regm2 ==0 ) pi->regm2 =HDMI_DEFAULT_REGM2 ;else pi->regm2 = dssdev->clocks.hdmi.regm2;/* +* multiplier is pixel_clk/ref_clk +* Multiplying by 100 to avoid fractional part removal +*/ + pi->regm = (phy *100 * pi->regm2 / (refclk)) /100 ;
No need for parenthesis around refclk.
drivers/video/omap2/dss/hdmi.c static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, · line 275
Quoted 9 lines
drivers/video/omap2/dss/hdmi.c +3
-2+ +/* * fractional multiplier is remainder of the difference between * multiplier and actual phy(required pixel clock thus should be * multiplied by 2^18(262144) divided by the reference clock */ - mf = (phy - pi->regm * refclk) *262144 ; - pi->regmf = mf / (refclk); + mf = (phy - pi->regm / pi->regm2 * refclk) *262144 ;
What kind of values does regm have? If the regm2 is something else than 1, and regm is relatively small value, it's quite easy to lose precision there. Would it be better to have:
pi->regm * refclk / pi->regm2
Tomi
Hi,
Quoted 38 lines · Tomi Valkeinen
Quoted 37 lines · On Wed, 2012-02-15 at 11:20 +0530, [email protected] wrote:
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2)
Internal oscillator output clock on internal LDO domain:
CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.Signed-off-by Mythri P K <[email protected]>---
drivers/video/omap2/dss/hdmi.c | 16 ++++++++--------1 files changed, 8 insertions(+), 8 deletions(-)drivers/video/omap2/dss/hdmi.c +0
-6@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; - /* - * multiplier is pixel_clk/ref_clk - * Multiplying by 100 to avoid fractional part removal - */ - pi->regm = (phy * 100 / (refclk)) / 100; - if (dssdev->clocks.hdmi.regm2 == 0) pi->regm2 = HDMI_DEFAULT_REGM2;else
pi->regm2=dssdev->clocks.hdmi.regm2;
Quoted 7 lines
Quoted 5 lines
/*
+ * multiplier is pixel_clk/ref_clk
+ * Multiplying by 100 to avoid fractional part removal
+ */
+pi->regm= (phy * 100 *pi->regm2/ (refclk)) / 100;No need for parenthesis around refclk.
Well this is just a copy of old code will change.
Quoted 11 lines
Quoted 10 lines
+
+ /*
* fractional multiplier is remainder of the difference between
* multiplier and actual phy(required pixel clock thus should be
* multiplied by 2^18(262144) divided by the reference clock */
- mf = (phy -pi->regm* refclk) * 262144;
-pi->regmf= mf / (refclk);
+ mf = (phy -pi->regm/pi->regm2* refclk) * 262144;
Quoted 3 lines
What kind of values does regm have? If the regm2 is something else than 1, and regm is relatively small value, it's quite easy to lose precision there. Would it be better to have:
Normally regm values are much higher compared to regm2 , regm2 is normally 1 or 2.
also given that regm2 is a multiplier factor in calculating regm there should not be any precision factor what do you think ?
Thanks and regards,
Mythri.
Quoted 5 lines
pi->regm* refclk /pi->regm2Tomi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 41 lines · Mythri P
Hi,
Quoted 38 lines · Tomi Valkeinen
Quoted 37 lines · On Wed, 2012-02-15 at 11:20 +0530, [email protected] wrote:
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:CLKOUT = (M / (N+1))*CLKINP*(1/M2) Internal oscillator output clock on internal LDO domain: CLKDCOLDO = (M / (N+1))*CLKINPThe current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.
Signed-off-by Mythri P K <[email protected]>--- drivers/video/omap2/dss/hdmi.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)drivers/video/omap2/dss/hdmi.c +0
-6@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; -/* -* multiplier is pixel_clk/ref_clk -* Multiplying by 100 to avoid fractional part removal -*/ - pi->regm = (phy *100 / (refclk)) /100 ; -if (dssdev->clocks.hdmi.regm2 ==0 ) pi->regm2 =HDMI_DEFAULT_REGM2 ;else pi->regm2 = dssdev->clocks.hdmi.regm2;
Quoted 8 lines
Quoted 7 lines
drivers/video/omap2/dss/hdmi.c static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, · line 268
Quoted 5 lines
drivers/video/omap2/dss/hdmi.c +4
-0/* +* multiplier is pixel_clk/ref_clk +* Multiplying by 100 to avoid fractional part removal +*/ + pi->regm = (phy *100 * pi->regm2 / (refclk)) /100 ;No need for parenthesis around refclk.
Well this is just a copy of old code will change.
The multiplication and division with 100 is actually extra also, they don't bring any precision here.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/video/omap2/dss/hdmi.c +3
-2+ +/* * fractional multiplier is remainder of the difference between * multiplier and actual phy(required pixel clock thus should be * multiplied by 2^18(262144) divided by the reference clock */ - mf = (phy - pi->regm * refclk) *262144 ; - pi->regmf = mf / (refclk); + mf = (phy - pi->regm / pi->regm2 * refclk) *262144 ;
Quoted 7 lines
Quoted 3 lines
What kind of values does regm have? If the regm2 is something else than 1, and regm is relatively small value, it's quite easy to lose precision there. Would it be better to have:
Normally regm values are much higher compared to regm2 , regm2 is normally 1 or 2.
also given that regm2 is a multiplier factor in calculating regm there should not be any precision factor what do you think ?
Ok, I think it's fine.
Tomi
Hi Tomi,
Quoted 49 lines · Tomi Valkeinen
Quoted 48 lines · Mythri P
Hi,
Quoted 45 lines · Tomi Valkeinen
Quoted 37 lines · On Wed, 2012-02-15 at 11:20 +0530, [email protected] wrote:
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:
CLKOUT = (M / (N+1))*CLKINP*(1/M2)
Internal oscillator output clock on internal LDO domain:
CLKDCOLDO = (M / (N+1))*CLKINP
The current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.Signed-off-by Mythri P K <[email protected]>---
drivers/video/omap2/dss/hdmi.c | 16 ++++++++--------1 files changed, 8 insertions(+), 8 deletions(-)drivers/video/omap2/dss/hdmi.c +0
-6@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; - /* - * multiplier is pixel_clk/ref_clk - * Multiplying by 100 to avoid fractional part removal - */ - pi->regm = (phy * 100 / (refclk)) / 100; - if (dssdev->clocks.hdmi.regm2 == 0) pi->regm2 = HDMI_DEFAULT_REGM2;else
pi->regm2=dssdev->clocks.hdmi.regm2;Quoted 5 lines
/*
+ * multiplier is pixel_clk/ref_clk
+ * Multiplying by 100 to avoid fractional part removal
+ */
+pi->regm= (phy * 100 *pi->regm2/ (refclk)) / 100;No need for parenthesis around refclk.
Quoted 5 lines
Quoted 1 line
Well this is just a copy of old code will change.
The multiplication and division with 100 is actually extra also, they don't bring any precision here.
Well this is actually done to accommodate the pixel clock, For some pixel clock like 25175 for VGA VESA
there is slight change which is detected by the analyzer so it is added for that reason.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Thanks and regards,
Mythri.
Quoted 2 lines
Tomi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 54 lines · Mythri P
Hi Tomi,
Quoted 51 lines · Tomi Valkeinen
Quoted 49 lines · Mythri P
Hi,
Quoted 38 lines · Tomi Valkeinen
Quoted 37 lines · On Wed, 2012-02-15 at 11:20 +0530, [email protected] wrote:
From: Mythri P K <[email protected]>
Add M2 divider in the equation to calculate regm and regmf. Formula for calculating:
Output clock on digital core domain:CLKOUT = (M / (N+1))*CLKINP*(1/M2) Internal oscillator output clock on internal LDO domain: CLKDCOLDO = (M / (N+1))*CLKINPThe current code when allows variable M2 values as input ignores using M2 divider values in calculation of regm and regmf. so fix it by using M2 in calculation although the default value for M2 is 1.
Signed-off-by Mythri P K <[email protected]>--- drivers/video/omap2/dss/hdmi.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)drivers/video/omap2/dss/hdmi.c +0
-6@@ -256,24 +256,24 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, refclk = clkin / pi->regn; -/* -* multiplier is pixel_clk/ref_clk -* Multiplying by 100 to avoid fractional part removal -*/ - pi->regm = (phy *100 / (refclk)) /100 ; -if (dssdev->clocks.hdmi.regm2 ==0 ) pi->regm2 =HDMI_DEFAULT_REGM2 ;else pi->regm2 = dssdev->clocks.hdmi.regm2;Quoted 7 lines
drivers/video/omap2/dss/hdmi.c static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, · line 268
Quoted 5 lines
drivers/video/omap2/dss/hdmi.c +4
-0/* +* multiplier is pixel_clk/ref_clk +* Multiplying by 100 to avoid fractional part removal +*/ + pi->regm = (phy *100 * pi->regm2 / (refclk)) /100 ;No need for parenthesis around refclk.
Well this is just a copy of old code will change.
Quoted 7 lines
Quoted 3 lines
The multiplication and division with 100 is actually extra also, they don't bring any precision here.
Well this is actually done to accommodate the pixel clock, For some pixel clock like 25175 for VGA VESA
there is slight change which is detected by the analyzer so it is added for that reason.
These two will always return the same value, so I don't think the analyzer has detected that:
(phy * 100 * pi->regm2 / (refclk)) / 100
phy * pi->regm2 / refclk
Tomi