OMAPDSS: Misc Cleanups/Fixes
v2 cover OMAPDSS: Misc Cleanups/Fixes
These are minor cleanups and fixes which make some of the future work of making outputs less dependant a bit easier. Some patches remove a few omap_dss_device references which aren't needed any more after the patch:
"OMAPDSS: move clock settings from dssdev to dss pdata"
The rest add locking required in the DPI driver and the generic dpi panel driver.
The commits are on the tree:
git://gitorious.org/~boddob/linux-omap-dss2/archit-dss2-clone.git misc_cleanup_3_7
Changes since v2:
- Misc patches just taken out from the series which changes the way of passing timings from panel to interace driver.
Archit Taneja (5):
OMAPDSS: APPLY: Constify timings argument in dss_mgr_set_timings
OMAPDSS: DPI: Remove omap_dss_device arguments in
dpi_set_dsi_clk/dpi_set_dispc_clk
OMAPDSS: HDMI: Remove omap_dss_device argument from hdmi_compute_pll
OMAPDSS: DPI: Add locking for DPI interface
OMAPDSS: Displays: Add locking in generic DPI panel driver
drivers/video/omap2/displays/panel-generic-dpi.c | 69 +++++++++++++++++++--- drivers/video/omap2/dss/apply.c | 4 +- drivers/video/omap2/dss/dpi.c | 40 +++++++++---- drivers/video/omap2/dss/dss.h | 2 +- drivers/video/omap2/dss/hdmi.c | 5 +- 5 files changed, 97 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/5 OMAPDSS: APPLY: Constify timings argument in dss_mgr_set_timings
The function dss_mgr_set_timings is supposed to apply timings passed by an interface driver. It is not supposed to change the timings. Add const qualifier to the omap_video_timings pointer argument in dss_mgr_set_timings().
--- drivers/video/omap2/dss/apply.c | 4 ++-- drivers/video/omap2/dss/dss.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/video/omap2/dss/apply.c +2 -2
@@ -1302,7 +1302,7 @@ err: }static void dss_apply_mgr_timings (struct omap_overlay_manager *mgr, -struct omap_video_timings *timings) +const struct omap_video_timings *timings) {struct mgr_priv_data *mp =get_mgr_priv (mgr);
@@ -1311,7 +1311,7 @@ static void dss_apply_mgr_timings(struct omap_overlay_manager *mgr, }void dss_mgr_set_timings (struct omap_overlay_manager *mgr, -struct omap_video_timings *timings) +const struct omap_video_timings *timings) {unsigned long flags;
drivers/video/omap2/dss/dss.h +1 -1
@@ -207,7 +207,7 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr, struct omap_dss_device *dssdev);int dss_mgr_unset_device (struct omap_overlay_manager *mgr);void dss_mgr_set_timings (struct omap_overlay_manager *mgr, -struct omap_video_timings *timings); +const struct omap_video_timings *timings);void dss_mgr_set_lcd_config (struct omap_overlay_manager *mgr,const struct dss_lcd_mgr_config *config);const struct omap_video_timings *dss_mgr_get_timings (struct omap_overlay_manager *mgr);
Signature · 1 line
1.7.9.5
PATCH v2 2/5 OMAPDSS: DPI: Remove omap_dss_device arguments in dpi_set_dsi_clk/dpi_set_dispc_clk
In reply to Archit TanejaThe clock related info for DSS modules is not tied anymore to a panel's omap_dss_device struct. It's now passed via platform data. The functions dpi_set_dsi_clk() and dpi_set_dispc_clk() do not need the omap_dss_device argument to retieve these clocks. They use the api dss_get_platform_clock_config to get the clocks. Remove the omap_dss_device arguments from these functions.
--- drivers/video/omap2/dss/dpi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/video/omap2/dss/dpi.c +6 -8
@@ -80,9 +80,8 @@ static bool dpi_use_dsi_pll(struct omap_dss_device *dssdev) lcd_src ==OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC ; } -static int dpi_set_dsi_clk (struct omap_dss_device *dssdev, -unsigned long pck_req,unsigned long *fck,int *lck_div, -int *pck_div) +static int dpi_set_dsi_clk (unsigned long pck_req,unsigned long *fck, +int *lck_div,int *pck_div) {const struct omapdss_clock_config *clks;struct dsi_clock_info dsi_cinfo;
@@ -111,9 +110,8 @@ static int dpi_set_dsi_clk(struct omap_dss_device *dssdev,return 0 ; } -static int dpi_set_dispc_clk (struct omap_dss_device *dssdev, -unsigned long pck_req,unsigned long *fck,int *lck_div, -int *pck_div) +static int dpi_set_dispc_clk (unsigned long pck_req,unsigned long *fck, +int *lck_div,int *pck_div) {struct dss_clock_info dss_cinfo;struct dispc_clock_info dispc_cinfo;
@@ -145,10 +143,10 @@ static int dpi_set_mode(struct omap_dss_device *dssdev)int r =0 ;if (dpi_use_dsi_pll (dssdev)) - r =dpi_set_dsi_clk (dssdev, t->pixel_clock *1000 , &fck, + r =dpi_set_dsi_clk (t->pixel_clock *1000 , &fck, &lck_div, &pck_div);else - r =dpi_set_dispc_clk (dssdev, t->pixel_clock *1000 , &fck, + r =dpi_set_dispc_clk (t->pixel_clock *1000 , &fck, &lck_div, &pck_div);if (r)return r;
Signature · 1 line
1.7.9.5
PATCH v2 3/5 OMAPDSS: HDMI: Remove omap_dss_device argument from hdmi_compute_pll
In reply to Archit TanejaThe clock related info for DSS modules is not tied anymore to a panel's omap_dss_device struct. It's now passed via platform data. The function hdmi_compute_pll() do not need the omap_dss_device argument to retieve these clocks. They use the api dss_get_platform_clock_config() get the clocks. Remove the omap_dss_device argument from hdmi_compute_pll()
--- drivers/video/omap2/dss/hdmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/video/omap2/dss/hdmi.c +2 -3
@@ -405,8 +405,7 @@ unsigned long hdmi_get_pixel_clock(void)return hdmi.ip_data.cfg.timings.pixel_clock *1000 ; } -static void hdmi_compute_pll (struct omap_dss_device *dssdev,int phy, -struct hdmi_pll_info *pi) +static void hdmi_compute_pll (int phy,struct hdmi_pll_info *pi) {const struct omapdss_clock_config *clks;unsigned long clkin, refclk;
@@ -491,7 +490,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev) } phy = p->pixel_clock; -hdmi_compute_pll (dssdev, phy, &hdmi.ip_data.pll_data); +hdmi_compute_pll (phy, &hdmi.ip_data.pll_data); hdmi.ip_data.ops->video_disable (&hdmi.ip_data);
Signature · 1 line
1.7.9.5
PATCH v2 4/5 OMAPDSS: DPI: Add locking for DPI interface
In reply to Archit TanejaThe DPI interface driver currently relies on the panel driver to ensure calls like omapdss_dpi_display_enable() and omapdss_dpi_display_disable() are executed sequentially. Also, currently, there is no way to protect the DPI driver data.
All DPI panel drivers don't ensure this, and in general, a DPI panel driver should use it's lock to that ensure it's own driver data and omap_dss_device states are taken care of, and not worry about the DPI interface.
Add mutex locking in the DPI enable/disable/set_timings ops.
--- drivers/video/omap2/dss/dpi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/video/omap2/dss/dpi.c +24 -2
@@ -39,6 +39,8 @@ static struct {struct regulator *vdds_dsi_reg;struct platform_device *dsidev; +struct mutex lock; +struct dss_lcd_mgr_config mgr_config; } dpi;
@@ -184,14 +186,18 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) {int r; +mutex_lock (&dpi.lock); +if (cpu_is_omap34xx () && !dpi.vdds_dsi_reg) {DSSERR ("no VDSS_DSI regulator\n" ); -return -ENODEV ; + r = -ENODEV ; + goto err_no_reg; }if (dssdev->manager ==NULL ) {DSSERR ("failed to enable display: no manager\n" ); -return -ENODEV ; + r = -ENODEV ; + goto err_no_mgr; }if (dpi_use_dsi_pll (dssdev)) {
@@ -238,6 +244,8 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev)if (r) goto err_mgr_enable; +mutex_unlock (&dpi.lock); +return 0 ; err_mgr_enable:
@@ -255,12 +263,17 @@ err_get_dispc: err_reg_enable:omap_dss_stop_device (dssdev); err_start_dev: +err_no_mgr: +err_no_reg: +mutex_unlock (&dpi.lock);return r; }EXPORT_SYMBOL (omapdss_dpi_display_enable);void omapdss_dpi_display_disable (struct omap_dss_device *dssdev) { +mutex_lock (&dpi.lock); +dss_mgr_disable (dssdev->manager);if (dpi_use_dsi_pll (dssdev)) {
@@ -275,6 +288,8 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)regulator_disable (dpi.vdds_dsi_reg);omap_dss_stop_device (dssdev); + +mutex_unlock (&dpi.lock); }EXPORT_SYMBOL (omapdss_dpi_display_disable);
@@ -284,6 +299,9 @@ void dpi_set_timings(struct omap_dss_device *dssdev,int r;DSSDBG ("dpi_set_timings\n" ); + +mutex_lock (&dpi.lock); + dssdev->panel.timings = *timings;if (dssdev->state ==OMAP_DSS_DISPLAY_ACTIVE ) { r =dispc_runtime_get ();
@@ -296,6 +314,8 @@ void dpi_set_timings(struct omap_dss_device *dssdev, }else {dss_mgr_set_timings (dssdev->manager, timings); } + +mutex_unlock (&dpi.lock); }EXPORT_SYMBOL (dpi_set_timings);
@@ -392,6 +412,8 @@ static void __init dpi_probe_pdata(struct platform_device *pdev)static int __init omap_dpi_probe (struct platform_device *pdev) { +mutex_init (&dpi.lock); +dpi_probe_pdata (pdev);return 0 ;
Signature · 1 line
1.7.9.5
PATCH v2 5/5 OMAPDSS: Displays: Add locking in generic DPI panel driver
In reply to Archit TanejaThe generic DPI panel driver doesn't currently have locking to ensure that the display states and the driver data is maintained correctly. Add mutex locking to take care of this. Add a new get_timings driver op to override the default get_timings op. The new driver op contains locking to ensure the correct panel timings are seen when a DSS2 user calls device->driver->get_timings.
--- drivers/video/omap2/displays/panel-generic-dpi.c | 69 +++++++++++++++++++--- 1 file changed, 62 insertions(+), 7 deletions(-)
drivers/video/omap2/displays/panel-generic-dpi.c +62 -7
@@ -545,6 +545,8 @@ struct panel_drv_data {struct omap_dss_device *dssdev;struct panel_config *panel_config; + +struct mutex lock; }; static inline struct panel_generic_dpi_data
@@ -634,6 +636,8 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev) drv_data->dssdev = dssdev; drv_data->panel_config = panel_config; +mutex_init (&drv_data->lock); +dev_set_drvdata (&dssdev->dev, drv_data);return 0 ;
@@ -652,56 +656,106 @@ static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)static int generic_dpi_panel_enable (struct omap_dss_device *dssdev) { -int r =0 ; +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); +int r; + +mutex_lock (&drv_data->lock); r =generic_dpi_panel_power_on (dssdev);if (r) -return r; + goto err; dssdev->state =OMAP_DSS_DISPLAY_ACTIVE ; +err: +mutex_unlock (&drv_data->lock); -return 0 ; +return r; }static void generic_dpi_panel_disable (struct omap_dss_device *dssdev) { +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); + +mutex_lock (&drv_data->lock); +generic_dpi_panel_power_off (dssdev); dssdev->state =OMAP_DSS_DISPLAY_DISABLED ; + +mutex_unlock (&drv_data->lock); }static int generic_dpi_panel_suspend (struct omap_dss_device *dssdev) { +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); + +mutex_lock (&drv_data->lock); +generic_dpi_panel_power_off (dssdev); dssdev->state =OMAP_DSS_DISPLAY_SUSPENDED ; +mutex_unlock (&drv_data->lock); +return 0 ; }static int generic_dpi_panel_resume (struct omap_dss_device *dssdev) { -int r =0 ; +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); +int r; + +mutex_lock (&drv_data->lock); r =generic_dpi_panel_power_on (dssdev);if (r) -return r; + goto err; dssdev->state =OMAP_DSS_DISPLAY_ACTIVE ; -return 0 ; +err: +mutex_unlock (&drv_data->lock); + +return r; }static void generic_dpi_panel_set_timings (struct omap_dss_device *dssdev,struct omap_video_timings *timings) { +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); + +mutex_lock (&drv_data->lock); +dpi_set_timings (dssdev, timings); + +mutex_unlock (&drv_data->lock); +} + +static void generic_dpi_panel_get_timings (struct omap_dss_device *dssdev, +struct omap_video_timings *timings) +{ +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); + +mutex_lock (&drv_data->lock); + + *timings = dssdev->panel.timings; + +mutex_unlock (&drv_data->lock); }static int generic_dpi_panel_check_timings (struct omap_dss_device *dssdev,struct omap_video_timings *timings) { -return dpi_check_timings (dssdev, timings); +struct panel_drv_data *drv_data =dev_get_drvdata (&dssdev->dev); +int r; + +mutex_lock (&drv_data->lock); + + r =dpi_check_timings (dssdev, timings); + +mutex_unlock (&drv_data->lock); + +return r; }static struct omap_dss_driver dpi_driver = {
@@ -714,6 +768,7 @@ static struct omap_dss_driver dpi_driver = { .resume = generic_dpi_panel_resume, .set_timings = generic_dpi_panel_set_timings, + .get_timings = generic_dpi_panel_get_timings, .check_timings = generic_dpi_panel_check_timings, .driver = {
Signature · 1 line
1.7.9.5