diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-21 05:09:54 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-24 09:50:08 -0400 |
commit | de09e4555592986219132b518c3f7834a28823cd (patch) | |
tree | bdd8ef011e33e8bd009e3401c75000d8e6b5067c | |
parent | 84273a9593306926af56ad5b4a69029c2886c5de (diff) |
OMAPDSS: Add support for DPI source selection
We can select the video source for DPI output as follows:
OMAP2/3: always LCD1
OMAP4: LCD2 or DIGIT
OMAP5: LCD1/LCD2/LCD3/DIGIT
This patch adds support to select the source, and makes dpi.c call the
function to set the source.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: David Anders <x0132446@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 5 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.c | 65 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 1 |
3 files changed, 71 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 5ccce9b69e42..b7233882fcfd 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -203,6 +203,10 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) | |||
203 | if (r) | 203 | if (r) |
204 | goto err_get_dispc; | 204 | goto err_get_dispc; |
205 | 205 | ||
206 | r = dss_dpi_select_source(dssdev->channel); | ||
207 | if (r) | ||
208 | goto err_src_sel; | ||
209 | |||
206 | if (dpi_use_dsi_pll(dssdev)) { | 210 | if (dpi_use_dsi_pll(dssdev)) { |
207 | r = dsi_runtime_get(dpi.dsidev); | 211 | r = dsi_runtime_get(dpi.dsidev); |
208 | if (r) | 212 | if (r) |
@@ -237,6 +241,7 @@ err_dsi_pll_init: | |||
237 | if (dpi_use_dsi_pll(dssdev)) | 241 | if (dpi_use_dsi_pll(dssdev)) |
238 | dsi_runtime_put(dpi.dsidev); | 242 | dsi_runtime_put(dpi.dsidev); |
239 | err_get_dsi: | 243 | err_get_dsi: |
244 | err_src_sel: | ||
240 | dispc_runtime_put(); | 245 | dispc_runtime_put(); |
241 | err_get_dispc: | 246 | err_get_dispc: |
242 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) | 247 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 660813b01197..2ab1c3e96553 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -69,6 +69,7 @@ struct dss_features { | |||
69 | u8 fck_div_max; | 69 | u8 fck_div_max; |
70 | u8 dss_fck_multiplier; | 70 | u8 dss_fck_multiplier; |
71 | const char *clk_name; | 71 | const char *clk_name; |
72 | int (*dpi_select_source)(enum omap_channel channel); | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | static struct { | 75 | static struct { |
@@ -623,6 +624,65 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void) | |||
623 | return REG_GET(DSS_CONTROL, 15, 15); | 624 | return REG_GET(DSS_CONTROL, 15, 15); |
624 | } | 625 | } |
625 | 626 | ||
627 | static int dss_dpi_select_source_omap2_omap3(enum omap_channel channel) | ||
628 | { | ||
629 | if (channel != OMAP_DSS_CHANNEL_LCD) | ||
630 | return -EINVAL; | ||
631 | |||
632 | return 0; | ||
633 | } | ||
634 | |||
635 | static int dss_dpi_select_source_omap4(enum omap_channel channel) | ||
636 | { | ||
637 | int val; | ||
638 | |||
639 | switch (channel) { | ||
640 | case OMAP_DSS_CHANNEL_LCD2: | ||
641 | val = 0; | ||
642 | break; | ||
643 | case OMAP_DSS_CHANNEL_DIGIT: | ||
644 | val = 1; | ||
645 | break; | ||
646 | default: | ||
647 | return -EINVAL; | ||
648 | } | ||
649 | |||
650 | REG_FLD_MOD(DSS_CONTROL, val, 17, 17); | ||
651 | |||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | static int dss_dpi_select_source_omap5(enum omap_channel channel) | ||
656 | { | ||
657 | int val; | ||
658 | |||
659 | switch (channel) { | ||
660 | case OMAP_DSS_CHANNEL_LCD: | ||
661 | val = 1; | ||
662 | break; | ||
663 | case OMAP_DSS_CHANNEL_LCD2: | ||
664 | val = 2; | ||
665 | break; | ||
666 | case OMAP_DSS_CHANNEL_LCD3: | ||
667 | val = 3; | ||
668 | break; | ||
669 | case OMAP_DSS_CHANNEL_DIGIT: | ||
670 | val = 0; | ||
671 | break; | ||
672 | default: | ||
673 | return -EINVAL; | ||
674 | } | ||
675 | |||
676 | REG_FLD_MOD(DSS_CONTROL, val, 17, 16); | ||
677 | |||
678 | return 0; | ||
679 | } | ||
680 | |||
681 | int dss_dpi_select_source(enum omap_channel channel) | ||
682 | { | ||
683 | return dss.feat->dpi_select_source(channel); | ||
684 | } | ||
685 | |||
626 | static int dss_get_clocks(void) | 686 | static int dss_get_clocks(void) |
627 | { | 687 | { |
628 | struct clk *clk; | 688 | struct clk *clk; |
@@ -701,30 +761,35 @@ static const struct dss_features omap24xx_dss_feats __initconst = { | |||
701 | .fck_div_max = 16, | 761 | .fck_div_max = 16, |
702 | .dss_fck_multiplier = 2, | 762 | .dss_fck_multiplier = 2, |
703 | .clk_name = NULL, | 763 | .clk_name = NULL, |
764 | .dpi_select_source = &dss_dpi_select_source_omap2_omap3, | ||
704 | }; | 765 | }; |
705 | 766 | ||
706 | static const struct dss_features omap34xx_dss_feats __initconst = { | 767 | static const struct dss_features omap34xx_dss_feats __initconst = { |
707 | .fck_div_max = 16, | 768 | .fck_div_max = 16, |
708 | .dss_fck_multiplier = 2, | 769 | .dss_fck_multiplier = 2, |
709 | .clk_name = "dpll4_m4_ck", | 770 | .clk_name = "dpll4_m4_ck", |
771 | .dpi_select_source = &dss_dpi_select_source_omap2_omap3, | ||
710 | }; | 772 | }; |
711 | 773 | ||
712 | static const struct dss_features omap3630_dss_feats __initconst = { | 774 | static const struct dss_features omap3630_dss_feats __initconst = { |
713 | .fck_div_max = 32, | 775 | .fck_div_max = 32, |
714 | .dss_fck_multiplier = 1, | 776 | .dss_fck_multiplier = 1, |
715 | .clk_name = "dpll4_m4_ck", | 777 | .clk_name = "dpll4_m4_ck", |
778 | .dpi_select_source = &dss_dpi_select_source_omap2_omap3, | ||
716 | }; | 779 | }; |
717 | 780 | ||
718 | static const struct dss_features omap44xx_dss_feats __initconst = { | 781 | static const struct dss_features omap44xx_dss_feats __initconst = { |
719 | .fck_div_max = 32, | 782 | .fck_div_max = 32, |
720 | .dss_fck_multiplier = 1, | 783 | .dss_fck_multiplier = 1, |
721 | .clk_name = "dpll_per_m5x2_ck", | 784 | .clk_name = "dpll_per_m5x2_ck", |
785 | .dpi_select_source = &dss_dpi_select_source_omap4, | ||
722 | }; | 786 | }; |
723 | 787 | ||
724 | static const struct dss_features omap54xx_dss_feats __initconst = { | 788 | static const struct dss_features omap54xx_dss_feats __initconst = { |
725 | .fck_div_max = 64, | 789 | .fck_div_max = 64, |
726 | .dss_fck_multiplier = 1, | 790 | .dss_fck_multiplier = 1, |
727 | .clk_name = "dpll_per_h12x2_ck", | 791 | .clk_name = "dpll_per_h12x2_ck", |
792 | .dpi_select_source = &dss_dpi_select_source_omap5, | ||
728 | }; | 793 | }; |
729 | 794 | ||
730 | static int __init dss_init_features(struct device *dev) | 795 | static int __init dss_init_features(struct device *dev) |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 5e9fd7691728..2a51ae99474c 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -277,6 +277,7 @@ void dss_overlay_kobj_uninit(struct omap_overlay *ovl); | |||
277 | int dss_init_platform_driver(void) __init; | 277 | int dss_init_platform_driver(void) __init; |
278 | void dss_uninit_platform_driver(void); | 278 | void dss_uninit_platform_driver(void); |
279 | 279 | ||
280 | int dss_dpi_select_source(enum omap_channel channel); | ||
280 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); | 281 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); |
281 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); | 282 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); |
282 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); | 283 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); |