diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-03-06 11:10:29 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-04-03 15:19:17 +0300 |
commit | 777f05cc79892c1a5c25a72cfb3cc24554378a45 (patch) | |
tree | 4913a4a29399b315e764d2ab846d7d78040847c4 /drivers/video/omap2 | |
parent | 17518189218cdf4c8136ce6f0284519b9a878a09 (diff) | |
download | linux-stable-777f05cc79892c1a5c25a72cfb3cc24554378a45.tar.gz linux-stable-777f05cc79892c1a5c25a72cfb3cc24554378a45.tar.bz2 linux-stable-777f05cc79892c1a5c25a72cfb3cc24554378a45.zip |
OMAPDSS: DSI: simplify dsi configuration
We have a bunch of dsi functions that are used to do the basic
configuration for DSI. To simplify things, and to make sure we have all
the necessary information, create a single dsi config function, which
does the basic configuration.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 16 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 74 |
2 files changed, 19 insertions, 71 deletions
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index bc4c95ee41cc..eb86cbae8c2a 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c @@ -919,6 +919,13 @@ static int taal_power_on(struct omap_dss_device *dssdev) struct taal_data *td = dev_get_drvdata(&dssdev->dev); u8 id1, id2, id3; int r; + struct omap_dss_dsi_config dsi_config = { + .mode = OMAP_DSS_DSI_CMD_MODE, + .pixel_format = OMAP_DSS_DSI_FMT_RGB888, + .timings = &dssdev->panel.timings, + .hs_clk = 216000000, + .lp_clk = 10000000, + }; r = omapdss_dsi_configure_pins(dssdev, &td->pin_config); if (r) { @@ -926,14 +933,9 @@ static int taal_power_on(struct omap_dss_device *dssdev) goto err0; }; - omapdss_dsi_set_size(dssdev, dssdev->panel.timings.x_res, - dssdev->panel.timings.y_res); - omapdss_dsi_set_pixel_format(dssdev, OMAP_DSS_DSI_FMT_RGB888); - omapdss_dsi_set_operation_mode(dssdev, OMAP_DSS_DSI_CMD_MODE); - - r = omapdss_dsi_set_clocks(dssdev, 216000000, 10000000); + r = omapdss_dsi_set_config(dssdev, &dsi_config); if (r) { - dev_err(&dssdev->dev, "failed to set HS and LP clocks\n"); + dev_err(&dssdev->dev, "failed to configure DSI\n"); goto err0; } diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index dd13bd9138fc..8cb43af60fe1 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -4278,7 +4278,7 @@ int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, } EXPORT_SYMBOL(omapdss_dsi_configure_pins); -int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, +static int dsi_set_clocks(struct omap_dss_device *dssdev, unsigned long ddr_clk, unsigned long lp_clk) { struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); @@ -4293,8 +4293,6 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk); - mutex_lock(&dsi->lock); - /* Calculate PLL output clock */ r = dsi_pll_calc_ddrfreq(dsidev, ddr_clk * 4, &cinfo); if (r) @@ -4336,13 +4334,10 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI : OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI; - mutex_unlock(&dsi->lock); return 0; err: - mutex_unlock(&dsi->lock); return r; } -EXPORT_SYMBOL(omapdss_dsi_set_clocks); int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) { @@ -4884,75 +4879,26 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) } EXPORT_SYMBOL(omapdss_dsi_enable_te); -void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, - struct omap_video_timings *timings) +int omapdss_dsi_set_config(struct omap_dss_device *dssdev, + const struct omap_dss_dsi_config *config) { struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); mutex_lock(&dsi->lock); - dsi->timings = *timings; - - mutex_unlock(&dsi->lock); -} -EXPORT_SYMBOL(omapdss_dsi_set_timings); - -void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h) -{ - struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - - mutex_lock(&dsi->lock); + dsi->timings = *config->timings; + dsi->vm_timings = *config->vm_timings; + dsi->pix_fmt = config->pixel_format; + dsi->mode = config->mode; - dsi->timings.x_res = w; - dsi->timings.y_res = h; + dsi_set_clocks(dssdev, config->hs_clk, config->lp_clk); mutex_unlock(&dsi->lock); -} -EXPORT_SYMBOL(omapdss_dsi_set_size); -void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev, - enum omap_dss_dsi_pixel_format fmt) -{ - struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - - mutex_lock(&dsi->lock); - - dsi->pix_fmt = fmt; - - mutex_unlock(&dsi->lock); -} -EXPORT_SYMBOL(omapdss_dsi_set_pixel_format); - -void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev, - enum omap_dss_dsi_mode mode) -{ - struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - - mutex_lock(&dsi->lock); - - dsi->mode = mode; - - mutex_unlock(&dsi->lock); -} -EXPORT_SYMBOL(omapdss_dsi_set_operation_mode); - -void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev, - struct omap_dss_dsi_videomode_timings *timings) -{ - struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - - mutex_lock(&dsi->lock); - - dsi->vm_timings = *timings; - - mutex_unlock(&dsi->lock); + return 0; } -EXPORT_SYMBOL(omapdss_dsi_set_videomode_timings); +EXPORT_SYMBOL(omapdss_dsi_set_config); /* * Return a hardcoded channel for the DSI output. This should work for |