OMAP2PLUS:DSS2: use opt-clocks information from hwmod.
Subsystems (4)
v2 cover OMAP2PLUS:DSS2: use opt-clocks information from hwmod.
This series uses information about opt-clocks provided by omap_hwmod framework to select which of the non-mandatory DSS clocks are available on a given platform.
A function pointer opt_clock_available is exported via pdata, which checks the clock roles returned by hwmod database.
In the driver, while doing clk-get, it is checked if as per hwmod a given clock is an opt-clock or not, and is handled accordingly.
Tested on: OMAP3430sdp
Sumit Semwal (2):
OMAP2PLUS:DSS2: add opt_clock_available in pdata OMAP2PLUS:DSS2: Use opt_clock_available from pdata
changes from v1:
- made opt_clock_available a function pointer in the omap_display_platform_data to avoid having to copy the opt-clock role names.
Based on top of:
http://gitorious.org/linux-omap-dss2/linux/commits/master
commit: ad1c76c: OMAP: Overo Palo43 LCD support
arch/arm/mach-omap2/display.c | 20 ++++++++++++ arch/arm/plat-omap/include/plat/display.h | 2 + drivers/video/omap2/dss/dss.c | 46 +++++++++++++++++++---------- 3 files changed, 52 insertions(+), 16 deletions(-)
PATCH v2 1/2 OMAP2PLUS:DSS2: add opt_clock_available in pdata
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
(based on implementation from Senthil)
--- arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/include/plat/display.h | 2 ++ 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/display.c +20 -0
@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, }; +static bool opt_clock_available (const char *clk_role) +{ +int i; +struct omap_hwmod *oh; + +/* opt_clks are always associated with dss hwmod */ + oh =omap_hwmod_lookup ("dss_core" ); +if (!oh) { +pr_err ("Could not look up dss_core.\n" ); +return -ENODEV ; + } + +for (i =0 ; i < oh->opt_clks_cnt; i++) { +if (!strcmp (oh->opt_clks[i].role, clk_role)) +return true; + } +return false; +} +int __init omap_display_init (struct omap_dss_board_info *board_data) {int r =0 ;
@@ -76,6 +95,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) pdata.board_data = board_data; pdata.board_data->get_last_off_on_transaction_id =NULL ; + pdata.opt_clock_available = opt_clock_available;for (i =0 ; i < oh_count; i++) { oh =omap_hwmod_lookup (oh_name[i]);
arch/arm/plat-omap/include/plat/display.h +2 -0
@@ -240,6 +240,8 @@ static inline int omap_display_init(struct omap_dss_board_info *board_data)struct omap_display_platform_data {struct omap_dss_board_info *board_data;/* TODO: Additional members to be added when PM is considered */ + +bool (*opt_clock_available)(const char *clk_role); };struct omap_video_timings {
Signature · 1 line
1.7.1
PATCH v2 2/2 OMAP2PLUS:DSS2: Use opt_clock_available from pdata
In reply to Sumit Semwalhwmod databases provide information about which optional clocks are available for a given platform. This is available via a function pointer opt_clock_enable in pdata.
Use this information during get/enable/disable/put of clocks.
--- drivers/video/omap2/dss/dss.c | 46 ++++++++++++++++++++++++++-------------- 1 files changed, 30 insertions(+), 16 deletions(-)
drivers/video/omap2/dss/dss.c +30 -16
@@ -699,6 +699,7 @@ static int dss_get_clock(struct clk **clock, const char *clk_name)static int dss_get_clocks (void ) {int r; +struct omap_display_platform_data *pdata = dss.pdev->dev.platform_data; dss.dss_ick =NULL ; dss.dss_fck =NULL ;
@@ -714,17 +715,28 @@ static int dss_get_clocks(void)if (r) goto err; - r =dss_get_clock (&dss.dss_sys_clk,"sys_clk" ); -if (r) +if (!pdata->opt_clock_available) { + r = -ENODEV ; goto err; + } - r =dss_get_clock (&dss.dss_tv_fck,"tv_clk" ); -if (r) - goto err; +if (pdata->opt_clock_available ("sys_clk" )) { + r =dss_get_clock (&dss.dss_sys_clk,"sys_clk" ); +if (r) + goto err; + } - r =dss_get_clock (&dss.dss_video_fck,"video_clk" ); -if (r) - goto err; +if (pdata->opt_clock_available ("tv_clk" )) { + r =dss_get_clock (&dss.dss_tv_fck,"tv_clk" ); +if (r) + goto err; + } + +if (pdata->opt_clock_available ("video_clk" )) { + r =dss_get_clock (&dss.dss_video_fck,"video_clk" ); +if (r) + goto err; + }return 0 ;
@@ -747,9 +759,11 @@ static void dss_put_clocks(void) {if (dss.dss_video_fck)clk_put (dss.dss_video_fck); -clk_put (dss.dss_tv_fck); +if (dss.dss_tv_fck) +clk_put (dss.dss_tv_fck); +if (dss.dss_sys_clk) +clk_put (dss.dss_sys_clk);clk_put (dss.dss_fck); -clk_put (dss.dss_sys_clk);clk_put (dss.dss_ick); }
@@ -798,11 +812,11 @@ static void dss_clk_enable_no_ctx(enum dss_clock clks)clk_enable (dss.dss_ick);if (clks &DSS_CLK_FCK )clk_enable (dss.dss_fck); -if (clks &DSS_CLK_SYSCK ) +if ((clks &DSS_CLK_SYSCK ) && dss.dss_sys_clk)clk_enable (dss.dss_sys_clk); -if (clks &DSS_CLK_TVFCK ) +if ((clks &DSS_CLK_TVFCK ) && dss.dss_tv_fck)clk_enable (dss.dss_tv_fck); -if (clks &DSS_CLK_VIDFCK ) +if ((clks &DSS_CLK_VIDFCK ) && dss.dss_video_fck)clk_enable (dss.dss_video_fck); dss.num_clks_enabled += num_clks;
@@ -826,11 +840,11 @@ static void dss_clk_disable_no_ctx(enum dss_clock clks)clk_disable (dss.dss_ick);if (clks &DSS_CLK_FCK )clk_disable (dss.dss_fck); -if (clks &DSS_CLK_SYSCK ) +if ((clks &DSS_CLK_SYSCK ) && dss.dss_sys_clk)clk_disable (dss.dss_sys_clk); -if (clks &DSS_CLK_TVFCK ) +if ((clks &DSS_CLK_TVFCK ) && dss.dss_tv_fck)clk_disable (dss.dss_tv_fck); -if (clks &DSS_CLK_VIDFCK ) +if ((clks &DSS_CLK_VIDFCK ) && dss.dss_video_fck)clk_disable (dss.dss_video_fck); dss.num_clks_enabled -= num_clks;
Signature · 1 line
1.7.1
Minor correction:
On Mon, Feb 28, 2011 at 8:32 PM, Sumit Semwal <[email protected]> wrote:
<snip>
Quoted 3 lines
Based on top of:
http://gitorious.org/linux-omap-dss2/linux/commits/master
commit: ad1c76c: OMAP: Overo Palo43 LCD support
The correct base is:
http://gitorious.org/linux-omap-dss2/linux/commits/for-next
commit: 799a626: MAINTAINERS: Update OMAP DSS maintainer
Please let me know if you want me to rebase on top of master.
BR,
~S.
<snip>
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
In reply to Sumit SemwalQuoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>--- arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/include/plat/display.h | 2 ++ 2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };
arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ +int i; +struct omap_hwmod *oh; + +/* opt_clks are always associated with dss hwmod */ + oh =omap_hwmod_lookup ("dss_core" ); +if (!oh) { +pr_err ("Could not look up dss_core.\n" ); +return -ENODEV ;
The function returns a bool. Perhaps the lookup would be better done in omap_display_init(), and stored in a static variable.
Or if it's clear that this should never happen, BUG_ON(!oh);
Tomi
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
Quoted 21 lines · Tomi Valkeinen
Quoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>---
arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++arch/arm/plat-omap/include/plat/display.h| 2 ++2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };
Quoted 13 lines
arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ + int i; + struct omap_hwmod *oh; + + /* opt_clks are always associated with dss hwmod */ + oh = omap_hwmod_lookup("dss_core"); + if (!oh) { + pr_err("Could not look up dss_core.\n"); + return -ENODEV;The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.
Yes; I guess I should go with your earlier suggestion - of keeping this 'oh' as part of pdata, and then use it here.
Quoted 2 lines
Or if it's clear that this should never happen,
BUG_ON(!oh);
Well, multiple people have 'frowned' upon using BUG_ON in dss - especially because some people might still want their kernel to keep working despite a display failure?
~Sumit.
Quoted 9 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
--
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
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
Quoted 35 lines · Sumit
Quoted 21 lines · Tomi Valkeinen
Quoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>--- arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/include/plat/display.h | 2 ++ 2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };Quoted 13 lines
arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ +int i; +struct omap_hwmod *oh; + +/* opt_clks are always associated with dss hwmod */ + oh =omap_hwmod_lookup ("dss_core" ); +if (!oh) { +pr_err ("Could not look up dss_core.\n" ); +return -ENODEV ;The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.
Quoted 2 lines
Yes; I guess I should go with your earlier suggestion - of keeping this 'oh' as part of pdata, and then use it here.
I don't think it needs to be part of pdata. It's internal to this file, and if I'm not mistaken, omap_display_init() is called just once from the current board file. Thus the data could as well be stored in a static variable.
Quoted 4 lines
Quoted 1 line
Or if it's clear that this should never happen,
BUG_ON(!oh);Well, multiple people have 'frowned' upon using
BUG_ONin dss - especially because some people might still want their kernel to keep working despite a display failure?
Yes, BUG is an easy, not good, way out =).
Tomi
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
Quoted 36 lines · Tomi Valkeinen
Quoted 35 lines · Sumit
Quoted 34 lines · Tomi Valkeinen
Quoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>---
arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++arch/arm/plat-omap/include/plat/display.h| 2 ++2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ + int i; + struct omap_hwmod *oh; + + /* opt_clks are always associated with dss hwmod */ + oh = omap_hwmod_lookup("dss_core"); + if (!oh) { + pr_err("Could not look up dss_core.\n"); + return -ENODEV;The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.
Quoted 7 lines
Quoted 2 lines
Yes; I guess I should go with your earlier suggestion - of keeping this 'oh' as part of pdata, and then use it here.
I don't think it needs to be part of pdata. It's internal to this file, and if I'm not mistaken,
omap_display_init()is called just once from the current board file. Thus the data could as well be stored in a static variable.
:) ok, that's correct; though we might need to make 'oh' part of pdata based on our adaptation to the reset functionality - but that will come later.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Or if it's clear that this should never happen,
BUG_ON(!oh);Well, multiple people have 'frowned' upon using
BUG_ONin dss - especially because some people might still want their kernel to keep working despite a display failure?Yes, BUG is an easy, not good, way out =).
:) hmmm... should I just return 'false' and print out a warning?
Quoted 5 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
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
Quoted 49 lines · Sumit
Quoted 36 lines · Tomi Valkeinen
Quoted 35 lines · Sumit
Quoted 34 lines · Tomi Valkeinen
Quoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>--- arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/include/plat/display.h | 2 ++ 2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ +int i; +struct omap_hwmod *oh; + +/* opt_clks are always associated with dss hwmod */ + oh =omap_hwmod_lookup ("dss_core" ); +if (!oh) { +pr_err ("Could not look up dss_core.\n" ); +return -ENODEV ;The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.Quoted 7 lines
Quoted 2 lines
Yes; I guess I should go with your earlier suggestion - of keeping this 'oh' as part of pdata, and then use it here.
I don't think it needs to be part of pdata. It's internal to this file, and if I'm not mistaken,
omap_display_init()is called just once from the current board file. Thus the data could as well be stored in a static variable.:) ok, that's correct; though we might need to make 'oh' part of pdata based on our adaptation to the reset functionality - but that will come later.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Or if it's clear that this should never happen,
BUG_ON(!oh);
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Well, multiple people have 'frowned' upon using
BUG_ONin dss - especially because some people might still want their kernel to keep working despite a display failure?Yes, BUG is an easy, not good, way out =).
:) hmmm... should I just return 'false' and print out a warning?
From
opt_clock_available()if the hwmod was not found? Well, preferably
opt_clock_available() will never be called, if the hwmod is not found in omap_display_init(). So omap_display_init() should fail -> DSS driver refuses to start -> opt_clock_available() is never called.
Tomi
Re: [Patch v2 1/2] OMAP2PLUS:DSS2: add opt_clock_available in pdata
Quoted 54 lines · Tomi Valkeinen
Quoted 53 lines · Sumit
Quoted 36 lines · Tomi Valkeinen
Quoted 35 lines · Sumit
Quoted 34 lines · Tomi Valkeinen
Quoted 20 lines · Sumit
Provide a function in pdata to allow dss submodules to check if a given clock is available on a platform as an optional clock.
Signed-off-by Senthilvadivu Guruswamy <[email protected]>(based on implementation from Senthil)
Signed-off-by Sumit Semwal <[email protected]>---
arch/arm/mach-omap2/display.c | 20 ++++++++++++++++++++arch/arm/plat-omap/include/plat/display.h| 2 ++2 files changed, 22 insertions(+), 0 deletions(-)arch/arm/mach-omap2/display.c +0
-0@@ -42,6 +42,25 @@ static struct omap_device_pm_latency omap_dss_latency[] = { }, };arch/arm/mach-omap2/display.c static struct omap_device_pm_latency omap_dss_latency[] = { · line 54
Quoted 10 lines
arch/arm/mach-omap2/display.c +10
-0+static bool opt_clock_available (const char *clk_role) +{ + int i; + struct omap_hwmod *oh; + + /* opt_clks are always associated with dss hwmod */ + oh = omap_hwmod_lookup("dss_core"); + if (!oh) { + pr_err("Could not look up dss_core.\n"); + return -ENODEV;The function returns a bool. Perhaps the lookup would be better done in
omap_display_init(), and stored in a static variable.Quoted 7 lines
Quoted 2 lines
Yes; I guess I should go with your earlier suggestion - of keeping this 'oh' as part of pdata, and then use it here.
I don't think it needs to be part of pdata. It's internal to this file, and if I'm not mistaken,
omap_display_init()is called just once from the current board file. Thus the data could as well be stored in a static variable.:) ok, that's correct; though we might need to make 'oh' part of pdata based on our adaptation to the reset functionality - but that will come later.
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Or if it's clear that this should never happen,
BUG_ON(!oh);Well, multiple people have 'frowned' upon using
BUG_ONin dss - especially because some people might still want their kernel to keep working despite a display failure?
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Yes, BUG is an easy, not good, way out =).
:) hmmm... should I just return 'false' and print out a warning?
From
opt_clock_available()if the hwmod was not found? Well, preferablyopt_clock_available()will never be called, if the hwmod is not found inomap_display_init(). Soomap_display_init()should fail -> DSS driver refuses to start ->opt_clock_available()is never called.
:) Yes, that's true. will leave out the check then.
Quoted 5 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