aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /drivers/gpu/drm/sun4i
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/gpu/drm/sun4i')
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_crtc.c4
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_dotclock.c5
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c3
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c6
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_rgb.c2
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c97
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.h1
7 files changed, 68 insertions, 50 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 5decae0069d0..78cbc3145e44 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -93,6 +93,8 @@ static void sun4i_crtc_atomic_disable(struct drm_crtc *crtc,
93 93
94 DRM_DEBUG_DRIVER("Disabling the CRTC\n"); 94 DRM_DEBUG_DRIVER("Disabling the CRTC\n");
95 95
96 drm_crtc_vblank_off(crtc);
97
96 sun4i_tcon_set_status(scrtc->tcon, encoder, false); 98 sun4i_tcon_set_status(scrtc->tcon, encoder, false);
97 99
98 if (crtc->state->event && !crtc->state->active) { 100 if (crtc->state->event && !crtc->state->active) {
@@ -113,6 +115,8 @@ static void sun4i_crtc_atomic_enable(struct drm_crtc *crtc,
113 DRM_DEBUG_DRIVER("Enabling the CRTC\n"); 115 DRM_DEBUG_DRIVER("Enabling the CRTC\n");
114 116
115 sun4i_tcon_set_status(scrtc->tcon, encoder, true); 117 sun4i_tcon_set_status(scrtc->tcon, encoder, true);
118
119 drm_crtc_vblank_on(crtc);
116} 120}
117 121
118static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc) 122static void sun4i_crtc_mode_set_nofb(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 023f39bda633..e36004fbe453 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -132,10 +132,13 @@ static int sun4i_dclk_get_phase(struct clk_hw *hw)
132static int sun4i_dclk_set_phase(struct clk_hw *hw, int degrees) 132static int sun4i_dclk_set_phase(struct clk_hw *hw, int degrees)
133{ 133{
134 struct sun4i_dclk *dclk = hw_to_dclk(hw); 134 struct sun4i_dclk *dclk = hw_to_dclk(hw);
135 u32 val = degrees / 120;
136
137 val <<= 28;
135 138
136 regmap_update_bits(dclk->regmap, SUN4I_TCON0_IO_POL_REG, 139 regmap_update_bits(dclk->regmap, SUN4I_TCON0_IO_POL_REG,
137 GENMASK(29, 28), 140 GENMASK(29, 28),
138 degrees / 120); 141 val);
139 142
140 return 0; 143 return 0;
141} 144}
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 4570da0227b4..d9a71f361b14 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -111,7 +111,7 @@ static int sun4i_drv_bind(struct device *dev)
111 /* drm_vblank_init calls kcalloc, which can fail */ 111 /* drm_vblank_init calls kcalloc, which can fail */
112 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); 112 ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
113 if (ret) 113 if (ret)
114 goto free_mem_region; 114 goto cleanup_mode_config;
115 115
116 drm->irq_enabled = true; 116 drm->irq_enabled = true;
117 117
@@ -139,7 +139,6 @@ finish_poll:
139 sun4i_framebuffer_free(drm); 139 sun4i_framebuffer_free(drm);
140cleanup_mode_config: 140cleanup_mode_config:
141 drm_mode_config_cleanup(drm); 141 drm_mode_config_cleanup(drm);
142free_mem_region:
143 of_reserved_mem_device_release(dev); 142 of_reserved_mem_device_release(dev);
144free_drm: 143free_drm:
145 drm_dev_unref(drm); 144 drm_dev_unref(drm);
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 500b6fb3e028..fa4bcd092eaf 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -538,7 +538,8 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
538 &sun4i_hdmi_regmap_config); 538 &sun4i_hdmi_regmap_config);
539 if (IS_ERR(hdmi->regmap)) { 539 if (IS_ERR(hdmi->regmap)) {
540 dev_err(dev, "Couldn't create HDMI encoder regmap\n"); 540 dev_err(dev, "Couldn't create HDMI encoder regmap\n");
541 return PTR_ERR(hdmi->regmap); 541 ret = PTR_ERR(hdmi->regmap);
542 goto err_disable_mod_clk;
542 } 543 }
543 544
544 ret = sun4i_tmds_create(hdmi); 545 ret = sun4i_tmds_create(hdmi);
@@ -551,7 +552,8 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master,
551 hdmi->ddc_parent_clk = devm_clk_get(dev, "ddc"); 552 hdmi->ddc_parent_clk = devm_clk_get(dev, "ddc");
552 if (IS_ERR(hdmi->ddc_parent_clk)) { 553 if (IS_ERR(hdmi->ddc_parent_clk)) {
553 dev_err(dev, "Couldn't get the HDMI DDC clock\n"); 554 dev_err(dev, "Couldn't get the HDMI DDC clock\n");
554 return PTR_ERR(hdmi->ddc_parent_clk); 555 ret = PTR_ERR(hdmi->ddc_parent_clk);
556 goto err_disable_mod_clk;
555 } 557 }
556 } else { 558 } else {
557 hdmi->ddc_parent_clk = hdmi->tmds_clk; 559 hdmi->ddc_parent_clk = hdmi->tmds_clk;
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 832f8f9bc47f..b8da5a50a61d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -92,6 +92,8 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector,
92 92
93 DRM_DEBUG_DRIVER("Vertical parameters OK\n"); 93 DRM_DEBUG_DRIVER("Vertical parameters OK\n");
94 94
95 tcon->dclk_min_div = 6;
96 tcon->dclk_max_div = 127;
95 rounded_rate = clk_round_rate(tcon->dclk, rate); 97 rounded_rate = clk_round_rate(tcon->dclk, rate);
96 if (rounded_rate < rate) 98 if (rounded_rate < rate)
97 return MODE_CLOCK_LOW; 99 return MODE_CLOCK_LOW;
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 = {
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index b761c7b823c5..278700c7bf9f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -175,6 +175,7 @@ struct sun4i_tcon_quirks {
175 bool has_channel_1; /* a33 does not have channel 1 */ 175 bool has_channel_1; /* a33 does not have channel 1 */
176 bool has_lvds_alt; /* Does the LVDS clock have a parent other than the TCON clock? */ 176 bool has_lvds_alt; /* Does the LVDS clock have a parent other than the TCON clock? */
177 bool needs_de_be_mux; /* sun6i needs mux to select backend */ 177 bool needs_de_be_mux; /* sun6i needs mux to select backend */
178 bool supports_lvds; /* Does the TCON support an LVDS output? */
178 179
179 /* callback to handle tcon muxing options */ 180 /* callback to handle tcon muxing options */
180 int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *); 181 int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *);