aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i/sun4i_tcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_tcon.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c97
1 files changed, 52 insertions, 45 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index b3960118deb9..a818ca491605 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -101,10 +101,13 @@ static void sun4i_tcon_channel_set_status(struct sun4i_tcon *tcon, int channel,
101 return; 101 return;
102 } 102 }
103 103
104 if (enabled) 104 if (enabled) {
105 clk_prepare_enable(clk); 105 clk_prepare_enable(clk);
106 else 106 clk_rate_exclusive_get(clk);
107 } else {
108 clk_rate_exclusive_put(clk);
107 clk_disable_unprepare(clk); 109 clk_disable_unprepare(clk);
110 }
108} 111}
109 112
110static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon, 113static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon,
@@ -260,7 +263,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
260 const struct drm_display_mode *mode) 263 const struct drm_display_mode *mode)
261{ 264{
262 /* Configure the dot clock */ 265 /* Configure the dot clock */
263 clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000); 266 clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
264 267
265 /* Set the resolution */ 268 /* Set the resolution */
266 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, 269 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -421,7 +424,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
421 WARN_ON(!tcon->quirks->has_channel_1); 424 WARN_ON(!tcon->quirks->has_channel_1);
422 425
423 /* Configure the dot clock */ 426 /* Configure the dot clock */
424 clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000); 427 clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
425 428
426 /* Adjust clock delay */ 429 /* Adjust clock delay */
427 clk_delay = sun4i_tcon_get_clk_delay(mode, 1); 430 clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
@@ -873,52 +876,56 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
873 return ret; 876 return ret;
874 } 877 }
875 878
876 /* 879 if (tcon->quirks->supports_lvds) {
877 * This can only be made optional since we've had DT nodes 880 /*
878 * without the LVDS reset properties. 881 * This can only be made optional since we've had DT
879 * 882 * nodes without the LVDS reset properties.
880 * If the property is missing, just disable LVDS, and print a 883 *
881 * warning. 884 * If the property is missing, just disable LVDS, and
882 */ 885 * print a warning.
883 tcon->lvds_rst = devm_reset_control_get_optional(dev, "lvds"); 886 */
884 if (IS_ERR(tcon->lvds_rst)) { 887 tcon->lvds_rst = devm_reset_control_get_optional(dev, "lvds");
885 dev_err(dev, "Couldn't get our reset line\n"); 888 if (IS_ERR(tcon->lvds_rst)) {
886 return PTR_ERR(tcon->lvds_rst); 889 dev_err(dev, "Couldn't get our reset line\n");
887 } else if (tcon->lvds_rst) { 890 return PTR_ERR(tcon->lvds_rst);
888 has_lvds_rst = true; 891 } else if (tcon->lvds_rst) {
889 reset_control_reset(tcon->lvds_rst); 892 has_lvds_rst = true;
890 } else { 893 reset_control_reset(tcon->lvds_rst);
891 has_lvds_rst = false; 894 } else {
892 } 895 has_lvds_rst = false;
896 }
893 897
894 /* 898 /*
895 * This can only be made optional since we've had DT nodes 899 * This can only be made optional since we've had DT
896 * without the LVDS reset properties. 900 * nodes without the LVDS reset properties.
897 * 901 *
898 * If the property is missing, just disable LVDS, and print a 902 * If the property is missing, just disable LVDS, and
899 * warning. 903 * print a warning.
900 */ 904 */
901 if (tcon->quirks->has_lvds_alt) { 905 if (tcon->quirks->has_lvds_alt) {
902 tcon->lvds_pll = devm_clk_get(dev, "lvds-alt"); 906 tcon->lvds_pll = devm_clk_get(dev, "lvds-alt");
903 if (IS_ERR(tcon->lvds_pll)) { 907 if (IS_ERR(tcon->lvds_pll)) {
904 if (PTR_ERR(tcon->lvds_pll) == -ENOENT) { 908 if (PTR_ERR(tcon->lvds_pll) == -ENOENT) {
905 has_lvds_alt = false; 909 has_lvds_alt = false;
910 } else {
911 dev_err(dev, "Couldn't get the LVDS PLL\n");
912 return PTR_ERR(tcon->lvds_pll);
913 }
906 } else { 914 } else {
907 dev_err(dev, "Couldn't get the LVDS PLL\n"); 915 has_lvds_alt = true;
908 return PTR_ERR(tcon->lvds_pll);
909 } 916 }
910 } else {
911 has_lvds_alt = true;
912 } 917 }
913 }
914 918
915 if (!has_lvds_rst || (tcon->quirks->has_lvds_alt && !has_lvds_alt)) { 919 if (!has_lvds_rst ||
916 dev_warn(dev, 920 (tcon->quirks->has_lvds_alt && !has_lvds_alt)) {
917 "Missing LVDS properties, Please upgrade your DT\n"); 921 dev_warn(dev, "Missing LVDS properties, Please upgrade your DT\n");
918 dev_warn(dev, "LVDS output disabled\n"); 922 dev_warn(dev, "LVDS output disabled\n");
919 can_lvds = false; 923 can_lvds = false;
924 } else {
925 can_lvds = true;
926 }
920 } else { 927 } else {
921 can_lvds = true; 928 can_lvds = false;
922 } 929 }
923 930
924 ret = sun4i_tcon_init_clocks(dev, tcon); 931 ret = sun4i_tcon_init_clocks(dev, tcon);
@@ -1137,7 +1144,7 @@ static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
1137}; 1144};
1138 1145
1139static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = { 1146static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = {
1140 /* nothing is supported */ 1147 .supports_lvds = true,
1141}; 1148};
1142 1149
1143static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { 1150static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {