aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-05-18 20:17:34 -0400
committerDave Airlie <airlied@redhat.com>2015-05-18 20:17:34 -0400
commit64d237e66d562348f04a9c04a45455c1f3201ced (patch)
tree1c22ddff40501365727aa00340a1f9f4db9e83fc /drivers/gpu
parente26081808edadfd257c6c9d81014e3b25e9a6118 (diff)
parent774449ebcb18bae146e2b6f6d012b46e64a095b9 (diff)
Merge branch 'msm-fixes-4.1' of git://people.freedesktop.org/~robclark/linux into drm-fixes
msm fixes, pretty scattered. * 'msm-fixes-4.1' of git://people.freedesktop.org/~robclark/linux: drm/msm: fix locking inconsistencies in gpu->destroy() drm/msm/dsi: Simplify the code to get the number of read byte drm/msm: Attach assigned encoder to eDP and DSI connectors drm/msm: setup vram after component_bind_all() drm/msm/dsi: use pr_err_ratelimited drm/msm: fix unbalanced DRM framebuffer init/destroy drm/msm/mdp5: Fix iteration on INTF config array drm/msm/dsi: Fixup missing *break* statement during cmd rx drm/msm/dp: fix error return code drm: msm: Fix build when legacy fbdev support isn't set drm/msm/dsi: Fix a couple more 64-bit build warnings drm/msm: Fix a couple of 64-bit build warnings
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_gpu.c2
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi.c10
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_host.c21
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_manager.c6
-rw-r--r--drivers/gpu/drm/msm/edp/edp_aux.c4
-rw-r--r--drivers/gpu/drm/msm/edp/edp_connector.c2
-rw-r--r--drivers/gpu/drm/msm/edp/edp_ctrl.c3
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c34
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h9
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c12
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c24
-rw-r--r--drivers/gpu/drm/msm/msm_fb.c7
-rw-r--r--drivers/gpu/drm/msm/msm_gem.c2
-rw-r--r--drivers/gpu/drm/msm/msm_iommu.c4
-rw-r--r--drivers/gpu/drm/msm/msm_ringbuffer.c2
15 files changed, 75 insertions, 67 deletions
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 94a5bee69fe7..bbdcab0a56c1 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -384,7 +384,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *gpu)
384 if (gpu->memptrs_bo) { 384 if (gpu->memptrs_bo) {
385 if (gpu->memptrs_iova) 385 if (gpu->memptrs_iova)
386 msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); 386 msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);
387 drm_gem_object_unreference(gpu->memptrs_bo); 387 drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
388 } 388 }
389 release_firmware(gpu->pm4); 389 release_firmware(gpu->pm4);
390 release_firmware(gpu->pfp); 390 release_firmware(gpu->pfp);
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 28d1f95a90cc..ad50b80225f5 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -177,6 +177,11 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
177 goto fail; 177 goto fail;
178 } 178 }
179 179
180 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
181 encoders[i]->bridge = msm_dsi->bridge;
182 msm_dsi->encoders[i] = encoders[i];
183 }
184
180 msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); 185 msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id);
181 if (IS_ERR(msm_dsi->connector)) { 186 if (IS_ERR(msm_dsi->connector)) {
182 ret = PTR_ERR(msm_dsi->connector); 187 ret = PTR_ERR(msm_dsi->connector);
@@ -185,11 +190,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
185 goto fail; 190 goto fail;
186 } 191 }
187 192
188 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
189 encoders[i]->bridge = msm_dsi->bridge;
190 msm_dsi->encoders[i] = encoders[i];
191 }
192
193 priv->bridges[priv->num_bridges++] = msm_dsi->bridge; 193 priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
194 priv->connectors[priv->num_connectors++] = msm_dsi->connector; 194 priv->connectors[priv->num_connectors++] = msm_dsi->connector;
195 195
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 956b22492c9a..649d20d29f92 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1023,7 +1023,7 @@ static int dsi_short_read1_resp(u8 *buf, const struct mipi_dsi_msg *msg)
1023 *data = buf[1]; /* strip out dcs type */ 1023 *data = buf[1]; /* strip out dcs type */
1024 return 1; 1024 return 1;
1025 } else { 1025 } else {
1026 pr_err("%s: read data does not match with rx_buf len %d\n", 1026 pr_err("%s: read data does not match with rx_buf len %zu\n",
1027 __func__, msg->rx_len); 1027 __func__, msg->rx_len);
1028 return -EINVAL; 1028 return -EINVAL;
1029 } 1029 }
@@ -1040,7 +1040,7 @@ static int dsi_short_read2_resp(u8 *buf, const struct mipi_dsi_msg *msg)
1040 data[1] = buf[2]; 1040 data[1] = buf[2];
1041 return 2; 1041 return 2;
1042 } else { 1042 } else {
1043 pr_err("%s: read data does not match with rx_buf len %d\n", 1043 pr_err("%s: read data does not match with rx_buf len %zu\n",
1044 __func__, msg->rx_len); 1044 __func__, msg->rx_len);
1045 return -EINVAL; 1045 return -EINVAL;
1046 } 1046 }
@@ -1093,7 +1093,6 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
1093{ 1093{
1094 u32 *lp, *temp, data; 1094 u32 *lp, *temp, data;
1095 int i, j = 0, cnt; 1095 int i, j = 0, cnt;
1096 bool ack_error = false;
1097 u32 read_cnt; 1096 u32 read_cnt;
1098 u8 reg[16]; 1097 u8 reg[16];
1099 int repeated_bytes = 0; 1098 int repeated_bytes = 0;
@@ -1105,15 +1104,10 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
1105 if (cnt > 4) 1104 if (cnt > 4)
1106 cnt = 4; /* 4 x 32 bits registers only */ 1105 cnt = 4; /* 4 x 32 bits registers only */
1107 1106
1108 /* Calculate real read data count */ 1107 if (rx_byte == 4)
1109 read_cnt = dsi_read(msm_host, 0x1d4) >> 16; 1108 read_cnt = 4;
1110 1109 else
1111 ack_error = (rx_byte == 4) ? 1110 read_cnt = pkt_size + 6;
1112 (read_cnt == 8) : /* short pkt + 4-byte error pkt */
1113 (read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/
1114
1115 if (ack_error)
1116 read_cnt -= 4; /* Remove 4 byte error pkt */
1117 1111
1118 /* 1112 /*
1119 * In case of multiple reads from the panel, after the first read, there 1113 * In case of multiple reads from the panel, after the first read, there
@@ -1215,7 +1209,7 @@ static void dsi_err_worker(struct work_struct *work)
1215 container_of(work, struct msm_dsi_host, err_work); 1209 container_of(work, struct msm_dsi_host, err_work);
1216 u32 status = msm_host->err_work_state; 1210 u32 status = msm_host->err_work_state;
1217 1211
1218 pr_err("%s: status=%x\n", __func__, status); 1212 pr_err_ratelimited("%s: status=%x\n", __func__, status);
1219 if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) 1213 if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW)
1220 dsi_sw_reset_restore(msm_host); 1214 dsi_sw_reset_restore(msm_host);
1221 1215
@@ -1797,6 +1791,7 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host,
1797 case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: 1791 case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT:
1798 pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); 1792 pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__);
1799 ret = 0; 1793 ret = 0;
1794 break;
1800 case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: 1795 case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
1801 case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: 1796 case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
1802 ret = dsi_short_read1_resp(buf, msg); 1797 ret = dsi_short_read1_resp(buf, msg);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index ee3ebcaa33f5..0a40f3c64e8b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -462,7 +462,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
462 struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); 462 struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
463 struct drm_connector *connector = NULL; 463 struct drm_connector *connector = NULL;
464 struct dsi_connector *dsi_connector; 464 struct dsi_connector *dsi_connector;
465 int ret; 465 int ret, i;
466 466
467 dsi_connector = devm_kzalloc(msm_dsi->dev->dev, 467 dsi_connector = devm_kzalloc(msm_dsi->dev->dev,
468 sizeof(*dsi_connector), GFP_KERNEL); 468 sizeof(*dsi_connector), GFP_KERNEL);
@@ -495,6 +495,10 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
495 if (ret) 495 if (ret)
496 goto fail; 496 goto fail;
497 497
498 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++)
499 drm_mode_connector_attach_encoder(connector,
500 msm_dsi->encoders[i]);
501
498 return connector; 502 return connector;
499 503
500fail: 504fail:
diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c
index 5f5a84f6074c..208f9d47f82e 100644
--- a/drivers/gpu/drm/msm/edp/edp_aux.c
+++ b/drivers/gpu/drm/msm/edp/edp_aux.c
@@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
132 /* msg sanity check */ 132 /* msg sanity check */
133 if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || 133 if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) ||
134 (msg->size > AUX_CMD_I2C_MAX)) { 134 (msg->size > AUX_CMD_I2C_MAX)) {
135 pr_err("%s: invalid msg: size(%d), request(%x)\n", 135 pr_err("%s: invalid msg: size(%zu), request(%x)\n",
136 __func__, msg->size, msg->request); 136 __func__, msg->size, msg->request);
137 return -EINVAL; 137 return -EINVAL;
138 } 138 }
@@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
155 */ 155 */
156 edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); 156 edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0);
157 msm_edp_aux_ctrl(aux, 1); 157 msm_edp_aux_ctrl(aux, 1);
158 pr_err("%s: aux timeout, %d\n", __func__, ret); 158 pr_err("%s: aux timeout, %zd\n", __func__, ret);
159 goto unlock_exit; 159 goto unlock_exit;
160 } 160 }
161 DBG("completion"); 161 DBG("completion");
diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c
index d8812e84da54..b4d1b469862a 100644
--- a/drivers/gpu/drm/msm/edp/edp_connector.c
+++ b/drivers/gpu/drm/msm/edp/edp_connector.c
@@ -151,6 +151,8 @@ struct drm_connector *msm_edp_connector_init(struct msm_edp *edp)
151 if (ret) 151 if (ret)
152 goto fail; 152 goto fail;
153 153
154 drm_mode_connector_attach_encoder(connector, edp->encoder);
155
154 return connector; 156 return connector;
155 157
156fail: 158fail:
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c
index 0ec5abdba5c4..29e52d7c61c0 100644
--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c
+++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c
@@ -1149,12 +1149,13 @@ int msm_edp_ctrl_init(struct msm_edp *edp)
1149 ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); 1149 ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux);
1150 if (!ctrl->aux || !ctrl->drm_aux) { 1150 if (!ctrl->aux || !ctrl->drm_aux) {
1151 pr_err("%s:failed to init aux\n", __func__); 1151 pr_err("%s:failed to init aux\n", __func__);
1152 return ret; 1152 return -ENOMEM;
1153 } 1153 }
1154 1154
1155 ctrl->phy = msm_edp_phy_init(dev, ctrl->base); 1155 ctrl->phy = msm_edp_phy_init(dev, ctrl->base);
1156 if (!ctrl->phy) { 1156 if (!ctrl->phy) {
1157 pr_err("%s:failed to init phy\n", __func__); 1157 pr_err("%s:failed to init phy\n", __func__);
1158 ret = -ENOMEM;
1158 goto err_destory_aux; 1159 goto err_destory_aux;
1159 } 1160 }
1160 1161
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index e001e6b2296a..8b9a7931b162 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -72,14 +72,13 @@ const struct mdp5_cfg_hw msm8x74_config = {
72 .base = { 0x12d00, 0x12e00, 0x12f00 }, 72 .base = { 0x12d00, 0x12e00, 0x12f00 },
73 }, 73 },
74 .intf = { 74 .intf = {
75 .count = 4,
76 .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, 75 .base = { 0x12500, 0x12700, 0x12900, 0x12b00 },
77 }, 76 .connect = {
78 .intfs = { 77 [0] = INTF_eDP,
79 [0] = INTF_eDP, 78 [1] = INTF_DSI,
80 [1] = INTF_DSI, 79 [2] = INTF_DSI,
81 [2] = INTF_DSI, 80 [3] = INTF_HDMI,
82 [3] = INTF_HDMI, 81 },
83 }, 82 },
84 .max_clk = 200000000, 83 .max_clk = 200000000,
85}; 84};
@@ -142,14 +141,13 @@ const struct mdp5_cfg_hw apq8084_config = {
142 .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, 141 .base = { 0x12f00, 0x13000, 0x13100, 0x13200 },
143 }, 142 },
144 .intf = { 143 .intf = {
145 .count = 5,
146 .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, 144 .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 },
147 }, 145 .connect = {
148 .intfs = { 146 [0] = INTF_eDP,
149 [0] = INTF_eDP, 147 [1] = INTF_DSI,
150 [1] = INTF_DSI, 148 [2] = INTF_DSI,
151 [2] = INTF_DSI, 149 [3] = INTF_HDMI,
152 [3] = INTF_HDMI, 150 },
153 }, 151 },
154 .max_clk = 320000000, 152 .max_clk = 320000000,
155}; 153};
@@ -196,10 +194,12 @@ const struct mdp5_cfg_hw msm8x16_config = {
196 194
197 }, 195 },
198 .intf = { 196 .intf = {
199 .count = 1, /* INTF_1 */ 197 .base = { 0x00000, 0x6b800 },
200 .base = { 0x6B800 }, 198 .connect = {
199 [0] = INTF_DISABLED,
200 [1] = INTF_DSI,
201 },
201 }, 202 },
202 /* TODO enable .intfs[] with [1] = INTF_DSI, once DSI is implemented */
203 .max_clk = 320000000, 203 .max_clk = 320000000,
204}; 204};
205 205
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
index 3a551b0892d8..69349abe59f2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
@@ -59,6 +59,11 @@ struct mdp5_smp_block {
59 59
60#define MDP5_INTF_NUM_MAX 5 60#define MDP5_INTF_NUM_MAX 5
61 61
62struct mdp5_intf_block {
63 uint32_t base[MAX_BASES];
64 u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
65};
66
62struct mdp5_cfg_hw { 67struct mdp5_cfg_hw {
63 char *name; 68 char *name;
64 69
@@ -72,9 +77,7 @@ struct mdp5_cfg_hw {
72 struct mdp5_sub_block dspp; 77 struct mdp5_sub_block dspp;
73 struct mdp5_sub_block ad; 78 struct mdp5_sub_block ad;
74 struct mdp5_sub_block pp; 79 struct mdp5_sub_block pp;
75 struct mdp5_sub_block intf; 80 struct mdp5_intf_block intf;
76
77 u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
78 81
79 uint32_t max_clk; 82 uint32_t max_clk;
80}; 83};
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index dfa8beb9343a..bbacf9d2b738 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -206,8 +206,8 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms,
206 206
207static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) 207static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num)
208{ 208{
209 const int intf_cnt = hw_cfg->intf.count; 209 const enum mdp5_intf_type *intfs = hw_cfg->intf.connect;
210 const u32 *intfs = hw_cfg->intfs; 210 const int intf_cnt = ARRAY_SIZE(hw_cfg->intf.connect);
211 int id = 0, i; 211 int id = 0, i;
212 212
213 for (i = 0; i < intf_cnt; i++) { 213 for (i = 0; i < intf_cnt; i++) {
@@ -228,7 +228,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num)
228 struct msm_drm_private *priv = dev->dev_private; 228 struct msm_drm_private *priv = dev->dev_private;
229 const struct mdp5_cfg_hw *hw_cfg = 229 const struct mdp5_cfg_hw *hw_cfg =
230 mdp5_cfg_get_hw_config(mdp5_kms->cfg); 230 mdp5_cfg_get_hw_config(mdp5_kms->cfg);
231 enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num]; 231 enum mdp5_intf_type intf_type = hw_cfg->intf.connect[intf_num];
232 struct drm_encoder *encoder; 232 struct drm_encoder *encoder;
233 int ret = 0; 233 int ret = 0;
234 234
@@ -365,7 +365,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
365 /* Construct encoders and modeset initialize connector devices 365 /* Construct encoders and modeset initialize connector devices
366 * for each external display interface. 366 * for each external display interface.
367 */ 367 */
368 for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) { 368 for (i = 0; i < ARRAY_SIZE(hw_cfg->intf.connect); i++) {
369 ret = modeset_init_intf(mdp5_kms, i); 369 ret = modeset_init_intf(mdp5_kms, i);
370 if (ret) 370 if (ret)
371 goto fail; 371 goto fail;
@@ -514,8 +514,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
514 */ 514 */
515 mdp5_enable(mdp5_kms); 515 mdp5_enable(mdp5_kms);
516 for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { 516 for (i = 0; i < MDP5_INTF_NUM_MAX; i++) {
517 if (!config->hw->intf.base[i] || 517 if (mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) ||
518 mdp5_cfg_intf_is_virtual(config->hw->intfs[i])) 518 !config->hw->intf.base[i])
519 continue; 519 continue;
520 mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); 520 mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0);
521 } 521 }
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 47f4dd407671..c80a6bee2b18 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -21,9 +21,11 @@
21 21
22static void msm_fb_output_poll_changed(struct drm_device *dev) 22static void msm_fb_output_poll_changed(struct drm_device *dev)
23{ 23{
24#ifdef CONFIG_DRM_MSM_FBDEV
24 struct msm_drm_private *priv = dev->dev_private; 25 struct msm_drm_private *priv = dev->dev_private;
25 if (priv->fbdev) 26 if (priv->fbdev)
26 drm_fb_helper_hotplug_event(priv->fbdev); 27 drm_fb_helper_hotplug_event(priv->fbdev);
28#endif
27} 29}
28 30
29static const struct drm_mode_config_funcs mode_config_funcs = { 31static const struct drm_mode_config_funcs mode_config_funcs = {
@@ -94,7 +96,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
94 } 96 }
95 97
96 if (reglog) 98 if (reglog)
97 printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size); 99 printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
98 100
99 return ptr; 101 return ptr;
100} 102}
@@ -102,7 +104,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
102void msm_writel(u32 data, void __iomem *addr) 104void msm_writel(u32 data, void __iomem *addr)
103{ 105{
104 if (reglog) 106 if (reglog)
105 printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data); 107 printk(KERN_DEBUG "IO:W %p %08x\n", addr, data);
106 writel(data, addr); 108 writel(data, addr);
107} 109}
108 110
@@ -110,7 +112,7 @@ u32 msm_readl(const void __iomem *addr)
110{ 112{
111 u32 val = readl(addr); 113 u32 val = readl(addr);
112 if (reglog) 114 if (reglog)
113 printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val); 115 printk(KERN_ERR "IO:R %p %08x\n", addr, val);
114 return val; 116 return val;
115} 117}
116 118
@@ -143,8 +145,8 @@ static int msm_unload(struct drm_device *dev)
143 if (gpu) { 145 if (gpu) {
144 mutex_lock(&dev->struct_mutex); 146 mutex_lock(&dev->struct_mutex);
145 gpu->funcs->pm_suspend(gpu); 147 gpu->funcs->pm_suspend(gpu);
146 gpu->funcs->destroy(gpu);
147 mutex_unlock(&dev->struct_mutex); 148 mutex_unlock(&dev->struct_mutex);
149 gpu->funcs->destroy(gpu);
148 } 150 }
149 151
150 if (priv->vram.paddr) { 152 if (priv->vram.paddr) {
@@ -177,7 +179,7 @@ static int get_mdp_ver(struct platform_device *pdev)
177 const struct of_device_id *match; 179 const struct of_device_id *match;
178 match = of_match_node(match_types, dev->of_node); 180 match = of_match_node(match_types, dev->of_node);
179 if (match) 181 if (match)
180 return (int)match->data; 182 return (int)(unsigned long)match->data;
181#endif 183#endif
182 return 4; 184 return 4;
183} 185}
@@ -216,7 +218,7 @@ static int msm_init_vram(struct drm_device *dev)
216 if (ret) 218 if (ret)
217 return ret; 219 return ret;
218 size = r.end - r.start; 220 size = r.end - r.start;
219 DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start); 221 DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
220 } else 222 } else
221#endif 223#endif
222 224
@@ -283,10 +285,6 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
283 285
284 drm_mode_config_init(dev); 286 drm_mode_config_init(dev);
285 287
286 ret = msm_init_vram(dev);
287 if (ret)
288 goto fail;
289
290 platform_set_drvdata(pdev, dev); 288 platform_set_drvdata(pdev, dev);
291 289
292 /* Bind all our sub-components: */ 290 /* Bind all our sub-components: */
@@ -294,6 +292,10 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
294 if (ret) 292 if (ret)
295 return ret; 293 return ret;
296 294
295 ret = msm_init_vram(dev);
296 if (ret)
297 goto fail;
298
297 switch (get_mdp_ver(pdev)) { 299 switch (get_mdp_ver(pdev)) {
298 case 4: 300 case 4:
299 kms = mdp4_kms_init(dev); 301 kms = mdp4_kms_init(dev);
@@ -419,9 +421,11 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file)
419 421
420static void msm_lastclose(struct drm_device *dev) 422static void msm_lastclose(struct drm_device *dev)
421{ 423{
424#ifdef CONFIG_DRM_MSM_FBDEV
422 struct msm_drm_private *priv = dev->dev_private; 425 struct msm_drm_private *priv = dev->dev_private;
423 if (priv->fbdev) 426 if (priv->fbdev)
424 drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); 427 drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
428#endif
425} 429}
426 430
427static irqreturn_t msm_irq(int irq, void *arg) 431static irqreturn_t msm_irq(int irq, void *arg)
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 6b573e612f27..121713281417 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -172,8 +172,8 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
172{ 172{
173 struct msm_drm_private *priv = dev->dev_private; 173 struct msm_drm_private *priv = dev->dev_private;
174 struct msm_kms *kms = priv->kms; 174 struct msm_kms *kms = priv->kms;
175 struct msm_framebuffer *msm_fb; 175 struct msm_framebuffer *msm_fb = NULL;
176 struct drm_framebuffer *fb = NULL; 176 struct drm_framebuffer *fb;
177 const struct msm_format *format; 177 const struct msm_format *format;
178 int ret, i, n; 178 int ret, i, n;
179 unsigned int hsub, vsub; 179 unsigned int hsub, vsub;
@@ -239,8 +239,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
239 return fb; 239 return fb;
240 240
241fail: 241fail:
242 if (fb) 242 kfree(msm_fb);
243 msm_framebuffer_destroy(fb);
244 243
245 return ERR_PTR(ret); 244 return ERR_PTR(ret);
246} 245}
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 479d8af72bcb..52839769eb6c 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -483,7 +483,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
483 uint64_t off = drm_vma_node_start(&obj->vma_node); 483 uint64_t off = drm_vma_node_start(&obj->vma_node);
484 484
485 WARN_ON(!mutex_is_locked(&dev->struct_mutex)); 485 WARN_ON(!mutex_is_locked(&dev->struct_mutex));
486 seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n", 486 seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n",
487 msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', 487 msm_obj->flags, is_active(msm_obj) ? 'A' : 'I',
488 msm_obj->read_fence, msm_obj->write_fence, 488 msm_obj->read_fence, msm_obj->write_fence,
489 obj->name, obj->refcount.refcount.counter, 489 obj->name, obj->refcount.refcount.counter,
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 7acdaa5688b7..7ac2f1997e4a 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -60,7 +60,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
60 u32 pa = sg_phys(sg) - sg->offset; 60 u32 pa = sg_phys(sg) - sg->offset;
61 size_t bytes = sg->length + sg->offset; 61 size_t bytes = sg->length + sg->offset;
62 62
63 VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes); 63 VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
64 64
65 ret = iommu_map(domain, da, pa, bytes, prot); 65 ret = iommu_map(domain, da, pa, bytes, prot);
66 if (ret) 66 if (ret)
@@ -99,7 +99,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
99 if (unmapped < bytes) 99 if (unmapped < bytes)
100 return unmapped; 100 return unmapped;
101 101
102 VERB("unmap[%d]: %08x(%x)", i, iova, bytes); 102 VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
103 103
104 BUG_ON(!PAGE_ALIGNED(bytes)); 104 BUG_ON(!PAGE_ALIGNED(bytes));
105 105
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 8171537dd7d1..1f14b908b221 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -56,6 +56,6 @@ fail:
56void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) 56void msm_ringbuffer_destroy(struct msm_ringbuffer *ring)
57{ 57{
58 if (ring->bo) 58 if (ring->bo)
59 drm_gem_object_unreference(ring->bo); 59 drm_gem_object_unreference_unlocked(ring->bo);
60 kfree(ring); 60 kfree(ring);
61} 61}