aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-03-06 04:10:29 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-03 08:19:17 -0400
commit777f05cc79892c1a5c25a72cfb3cc24554378a45 (patch)
tree4913a4a29399b315e764d2ab846d7d78040847c4
parent17518189218cdf4c8136ce6f0284519b9a878a09 (diff)
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>
-rw-r--r--drivers/video/omap2/displays/panel-taal.c16
-rw-r--r--drivers/video/omap2/dss/dsi.c74
-rw-r--r--include/video/omapdss.h23
3 files changed, 31 insertions, 82 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)
919 struct taal_data *td = dev_get_drvdata(&dssdev->dev); 919 struct taal_data *td = dev_get_drvdata(&dssdev->dev);
920 u8 id1, id2, id3; 920 u8 id1, id2, id3;
921 int r; 921 int r;
922 struct omap_dss_dsi_config dsi_config = {
923 .mode = OMAP_DSS_DSI_CMD_MODE,
924 .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
925 .timings = &dssdev->panel.timings,
926 .hs_clk = 216000000,
927 .lp_clk = 10000000,
928 };
922 929
923 r = omapdss_dsi_configure_pins(dssdev, &td->pin_config); 930 r = omapdss_dsi_configure_pins(dssdev, &td->pin_config);
924 if (r) { 931 if (r) {
@@ -926,14 +933,9 @@ static int taal_power_on(struct omap_dss_device *dssdev)
926 goto err0; 933 goto err0;
927 }; 934 };
928 935
929 omapdss_dsi_set_size(dssdev, dssdev->panel.timings.x_res, 936 r = omapdss_dsi_set_config(dssdev, &dsi_config);
930 dssdev->panel.timings.y_res);
931 omapdss_dsi_set_pixel_format(dssdev, OMAP_DSS_DSI_FMT_RGB888);
932 omapdss_dsi_set_operation_mode(dssdev, OMAP_DSS_DSI_CMD_MODE);
933
934 r = omapdss_dsi_set_clocks(dssdev, 216000000, 10000000);
935 if (r) { 937 if (r) {
936 dev_err(&dssdev->dev, "failed to set HS and LP clocks\n"); 938 dev_err(&dssdev->dev, "failed to configure DSI\n");
937 goto err0; 939 goto err0;
938 } 940 }
939 941
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,
4278} 4278}
4279EXPORT_SYMBOL(omapdss_dsi_configure_pins); 4279EXPORT_SYMBOL(omapdss_dsi_configure_pins);
4280 4280
4281int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev, 4281static int dsi_set_clocks(struct omap_dss_device *dssdev,
4282 unsigned long ddr_clk, unsigned long lp_clk) 4282 unsigned long ddr_clk, unsigned long lp_clk)
4283{ 4283{
4284 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4284 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4293,8 +4293,6 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
4293 4293
4294 DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk); 4294 DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
4295 4295
4296 mutex_lock(&dsi->lock);
4297
4298 /* Calculate PLL output clock */ 4296 /* Calculate PLL output clock */
4299 r = dsi_pll_calc_ddrfreq(dsidev, ddr_clk * 4, &cinfo); 4297 r = dsi_pll_calc_ddrfreq(dsidev, ddr_clk * 4, &cinfo);
4300 if (r) 4298 if (r)
@@ -4336,13 +4334,10 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
4336 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI : 4334 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI :
4337 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI; 4335 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI;
4338 4336
4339 mutex_unlock(&dsi->lock);
4340 return 0; 4337 return 0;
4341err: 4338err:
4342 mutex_unlock(&dsi->lock);
4343 return r; 4339 return r;
4344} 4340}
4345EXPORT_SYMBOL(omapdss_dsi_set_clocks);
4346 4341
4347int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) 4342int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
4348{ 4343{
@@ -4884,75 +4879,26 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
4884} 4879}
4885EXPORT_SYMBOL(omapdss_dsi_enable_te); 4880EXPORT_SYMBOL(omapdss_dsi_enable_te);
4886 4881
4887void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, 4882int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
4888 struct omap_video_timings *timings) 4883 const struct omap_dss_dsi_config *config)
4889{ 4884{
4890 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4885 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4891 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4886 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4892 4887
4893 mutex_lock(&dsi->lock); 4888 mutex_lock(&dsi->lock);
4894 4889
4895 dsi->timings = *timings; 4890 dsi->timings = *config->timings;
4896 4891 dsi->vm_timings = *config->vm_timings;
4897 mutex_unlock(&dsi->lock); 4892 dsi->pix_fmt = config->pixel_format;
4898} 4893 dsi->mode = config->mode;
4899EXPORT_SYMBOL(omapdss_dsi_set_timings);
4900
4901void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h)
4902{
4903 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4904 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4905
4906 mutex_lock(&dsi->lock);
4907 4894
4908 dsi->timings.x_res = w; 4895 dsi_set_clocks(dssdev, config->hs_clk, config->lp_clk);
4909 dsi->timings.y_res = h;
4910 4896
4911 mutex_unlock(&dsi->lock); 4897 mutex_unlock(&dsi->lock);
4912}
4913EXPORT_SYMBOL(omapdss_dsi_set_size);
4914 4898
4915void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev, 4899 return 0;
4916 enum omap_dss_dsi_pixel_format fmt)
4917{
4918 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4919 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4920
4921 mutex_lock(&dsi->lock);
4922
4923 dsi->pix_fmt = fmt;
4924
4925 mutex_unlock(&dsi->lock);
4926}
4927EXPORT_SYMBOL(omapdss_dsi_set_pixel_format);
4928
4929void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
4930 enum omap_dss_dsi_mode mode)
4931{
4932 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4933 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4934
4935 mutex_lock(&dsi->lock);
4936
4937 dsi->mode = mode;
4938
4939 mutex_unlock(&dsi->lock);
4940}
4941EXPORT_SYMBOL(omapdss_dsi_set_operation_mode);
4942
4943void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
4944 struct omap_dss_dsi_videomode_timings *timings)
4945{
4946 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4947 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
4948
4949 mutex_lock(&dsi->lock);
4950
4951 dsi->vm_timings = *timings;
4952
4953 mutex_unlock(&dsi->lock);
4954} 4900}
4955EXPORT_SYMBOL(omapdss_dsi_set_videomode_timings); 4901EXPORT_SYMBOL(omapdss_dsi_set_config);
4956 4902
4957/* 4903/*
4958 * Return a hardcoded channel for the DSI output. This should work for 4904 * Return a hardcoded channel for the DSI output. This should work for
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 41fb434093e9..4dd4cea41bd4 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -282,6 +282,16 @@ struct omap_dss_dsi_videomode_timings {
282 int window_sync; 282 int window_sync;
283}; 283};
284 284
285struct omap_dss_dsi_config {
286 enum omap_dss_dsi_mode mode;
287 enum omap_dss_dsi_pixel_format pixel_format;
288 const struct omap_video_timings *timings;
289 const struct omap_dss_dsi_videomode_timings *vm_timings;
290
291 unsigned long hs_clk;
292 unsigned long lp_clk;
293};
294
285void dsi_bus_lock(struct omap_dss_device *dssdev); 295void dsi_bus_lock(struct omap_dss_device *dssdev);
286void dsi_bus_unlock(struct omap_dss_device *dssdev); 296void dsi_bus_unlock(struct omap_dss_device *dssdev);
287int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, 297int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
@@ -806,15 +816,8 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
806void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 816void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
807 bool enable); 817 bool enable);
808int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); 818int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
809void omapdss_dsi_set_timings(struct omap_dss_device *dssdev, 819int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
810 struct omap_video_timings *timings); 820 const struct omap_dss_dsi_config *config);
811void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
812void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev,
813 enum omap_dss_dsi_pixel_format fmt);
814void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
815 enum omap_dss_dsi_mode mode);
816void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
817 struct omap_dss_dsi_videomode_timings *timings);
818 821
819int omap_dsi_update(struct omap_dss_device *dssdev, int channel, 822int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
820 void (*callback)(int, void *), void *data); 823 void (*callback)(int, void *), void *data);
@@ -823,8 +826,6 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
823void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 826void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
824int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, 827int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
825 const struct omap_dsi_pin_config *pin_cfg); 828 const struct omap_dsi_pin_config *pin_cfg);
826int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
827 unsigned long ddr_clk, unsigned long lp_clk);
828 829
829int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 830int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
830void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 831void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,