Skip to content

Commit

Permalink
Merge branch 'msm-fixes-4.1' of git://people.freedesktop.org/~robclar…
Browse files Browse the repository at this point in the history
…k/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
  • Loading branch information
Dave Airlie committed May 19, 2015
2 parents e260818 + 774449e commit 64d237e
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 67 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/msm/adreno/adreno_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *gpu)
if (gpu->memptrs_bo) {
if (gpu->memptrs_iova)
msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);
drm_gem_object_unreference(gpu->memptrs_bo);
drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
}
release_firmware(gpu->pm4);
release_firmware(gpu->pfp);
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/msm/dsi/dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
goto fail;
}

for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
encoders[i]->bridge = msm_dsi->bridge;
msm_dsi->encoders[i] = encoders[i];
}

msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id);
if (IS_ERR(msm_dsi->connector)) {
ret = PTR_ERR(msm_dsi->connector);
Expand All @@ -185,11 +190,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
goto fail;
}

for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
encoders[i]->bridge = msm_dsi->bridge;
msm_dsi->encoders[i] = encoders[i];
}

priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
priv->connectors[priv->num_connectors++] = msm_dsi->connector;

Expand Down
21 changes: 8 additions & 13 deletions drivers/gpu/drm/msm/dsi/dsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ static int dsi_short_read1_resp(u8 *buf, const struct mipi_dsi_msg *msg)
*data = buf[1]; /* strip out dcs type */
return 1;
} else {
pr_err("%s: read data does not match with rx_buf len %d\n",
pr_err("%s: read data does not match with rx_buf len %zu\n",
__func__, msg->rx_len);
return -EINVAL;
}
Expand All @@ -1040,7 +1040,7 @@ static int dsi_short_read2_resp(u8 *buf, const struct mipi_dsi_msg *msg)
data[1] = buf[2];
return 2;
} else {
pr_err("%s: read data does not match with rx_buf len %d\n",
pr_err("%s: read data does not match with rx_buf len %zu\n",
__func__, msg->rx_len);
return -EINVAL;
}
Expand Down Expand Up @@ -1093,7 +1093,6 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
{
u32 *lp, *temp, data;
int i, j = 0, cnt;
bool ack_error = false;
u32 read_cnt;
u8 reg[16];
int repeated_bytes = 0;
Expand All @@ -1105,15 +1104,10 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
if (cnt > 4)
cnt = 4; /* 4 x 32 bits registers only */

/* Calculate real read data count */
read_cnt = dsi_read(msm_host, 0x1d4) >> 16;

ack_error = (rx_byte == 4) ?
(read_cnt == 8) : /* short pkt + 4-byte error pkt */
(read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/

if (ack_error)
read_cnt -= 4; /* Remove 4 byte error pkt */
if (rx_byte == 4)
read_cnt = 4;
else
read_cnt = pkt_size + 6;

/*
* In case of multiple reads from the panel, after the first read, there
Expand Down Expand Up @@ -1215,7 +1209,7 @@ static void dsi_err_worker(struct work_struct *work)
container_of(work, struct msm_dsi_host, err_work);
u32 status = msm_host->err_work_state;

pr_err("%s: status=%x\n", __func__, status);
pr_err_ratelimited("%s: status=%x\n", __func__, status);
if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW)
dsi_sw_reset_restore(msm_host);

Expand Down Expand Up @@ -1797,6 +1791,7 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host,
case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT:
pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__);
ret = 0;
break;
case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
ret = dsi_short_read1_resp(buf, msg);
Expand Down
6 changes: 5 additions & 1 deletion drivers/gpu/drm/msm/dsi/dsi_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
struct drm_connector *connector = NULL;
struct dsi_connector *dsi_connector;
int ret;
int ret, i;

dsi_connector = devm_kzalloc(msm_dsi->dev->dev,
sizeof(*dsi_connector), GFP_KERNEL);
Expand Down Expand Up @@ -495,6 +495,10 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
if (ret)
goto fail;

for (i = 0; i < MSM_DSI_ENCODER_NUM; i++)
drm_mode_connector_attach_encoder(connector,
msm_dsi->encoders[i]);

return connector;

fail:
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/msm/edp/edp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
/* msg sanity check */
if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) ||
(msg->size > AUX_CMD_I2C_MAX)) {
pr_err("%s: invalid msg: size(%d), request(%x)\n",
pr_err("%s: invalid msg: size(%zu), request(%x)\n",
__func__, msg->size, msg->request);
return -EINVAL;
}
Expand All @@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
*/
edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0);
msm_edp_aux_ctrl(aux, 1);
pr_err("%s: aux timeout, %d\n", __func__, ret);
pr_err("%s: aux timeout, %zd\n", __func__, ret);
goto unlock_exit;
}
DBG("completion");
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/msm/edp/edp_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ struct drm_connector *msm_edp_connector_init(struct msm_edp *edp)
if (ret)
goto fail;

drm_mode_connector_attach_encoder(connector, edp->encoder);

return connector;

fail:
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/msm/edp/edp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,12 +1149,13 @@ int msm_edp_ctrl_init(struct msm_edp *edp)
ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux);
if (!ctrl->aux || !ctrl->drm_aux) {
pr_err("%s:failed to init aux\n", __func__);
return ret;
return -ENOMEM;
}

ctrl->phy = msm_edp_phy_init(dev, ctrl->base);
if (!ctrl->phy) {
pr_err("%s:failed to init phy\n", __func__);
ret = -ENOMEM;
goto err_destory_aux;
}

Expand Down
34 changes: 17 additions & 17 deletions drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ const struct mdp5_cfg_hw msm8x74_config = {
.base = { 0x12d00, 0x12e00, 0x12f00 },
},
.intf = {
.count = 4,
.base = { 0x12500, 0x12700, 0x12900, 0x12b00 },
},
.intfs = {
[0] = INTF_eDP,
[1] = INTF_DSI,
[2] = INTF_DSI,
[3] = INTF_HDMI,
.connect = {
[0] = INTF_eDP,
[1] = INTF_DSI,
[2] = INTF_DSI,
[3] = INTF_HDMI,
},
},
.max_clk = 200000000,
};
Expand Down Expand Up @@ -142,14 +141,13 @@ const struct mdp5_cfg_hw apq8084_config = {
.base = { 0x12f00, 0x13000, 0x13100, 0x13200 },
},
.intf = {
.count = 5,
.base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 },
},
.intfs = {
[0] = INTF_eDP,
[1] = INTF_DSI,
[2] = INTF_DSI,
[3] = INTF_HDMI,
.connect = {
[0] = INTF_eDP,
[1] = INTF_DSI,
[2] = INTF_DSI,
[3] = INTF_HDMI,
},
},
.max_clk = 320000000,
};
Expand Down Expand Up @@ -196,10 +194,12 @@ const struct mdp5_cfg_hw msm8x16_config = {

},
.intf = {
.count = 1, /* INTF_1 */
.base = { 0x6B800 },
.base = { 0x00000, 0x6b800 },
.connect = {
[0] = INTF_DISABLED,
[1] = INTF_DSI,
},
},
/* TODO enable .intfs[] with [1] = INTF_DSI, once DSI is implemented */
.max_clk = 320000000,
};

Expand Down
9 changes: 6 additions & 3 deletions drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ struct mdp5_smp_block {

#define MDP5_INTF_NUM_MAX 5

struct mdp5_intf_block {
uint32_t base[MAX_BASES];
u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
};

struct mdp5_cfg_hw {
char *name;

Expand All @@ -72,9 +77,7 @@ struct mdp5_cfg_hw {
struct mdp5_sub_block dspp;
struct mdp5_sub_block ad;
struct mdp5_sub_block pp;
struct mdp5_sub_block intf;

u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
struct mdp5_intf_block intf;

uint32_t max_clk;
};
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms,

static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num)
{
const int intf_cnt = hw_cfg->intf.count;
const u32 *intfs = hw_cfg->intfs;
const enum mdp5_intf_type *intfs = hw_cfg->intf.connect;
const int intf_cnt = ARRAY_SIZE(hw_cfg->intf.connect);
int id = 0, i;

for (i = 0; i < intf_cnt; i++) {
Expand All @@ -228,7 +228,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num)
struct msm_drm_private *priv = dev->dev_private;
const struct mdp5_cfg_hw *hw_cfg =
mdp5_cfg_get_hw_config(mdp5_kms->cfg);
enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num];
enum mdp5_intf_type intf_type = hw_cfg->intf.connect[intf_num];
struct drm_encoder *encoder;
int ret = 0;

Expand Down Expand Up @@ -365,7 +365,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
/* Construct encoders and modeset initialize connector devices
* for each external display interface.
*/
for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) {
for (i = 0; i < ARRAY_SIZE(hw_cfg->intf.connect); i++) {
ret = modeset_init_intf(mdp5_kms, i);
if (ret)
goto fail;
Expand Down Expand Up @@ -514,8 +514,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
*/
mdp5_enable(mdp5_kms);
for (i = 0; i < MDP5_INTF_NUM_MAX; i++) {
if (!config->hw->intf.base[i] ||
mdp5_cfg_intf_is_virtual(config->hw->intfs[i]))
if (mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) ||
!config->hw->intf.base[i])
continue;
mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0);
}
Expand Down
24 changes: 14 additions & 10 deletions drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

static void msm_fb_output_poll_changed(struct drm_device *dev)
{
#ifdef CONFIG_DRM_MSM_FBDEV
struct msm_drm_private *priv = dev->dev_private;
if (priv->fbdev)
drm_fb_helper_hotplug_event(priv->fbdev);
#endif
}

static const struct drm_mode_config_funcs mode_config_funcs = {
Expand Down Expand Up @@ -94,23 +96,23 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
}

if (reglog)
printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size);
printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);

return ptr;
}

void msm_writel(u32 data, void __iomem *addr)
{
if (reglog)
printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data);
printk(KERN_DEBUG "IO:W %p %08x\n", addr, data);
writel(data, addr);
}

u32 msm_readl(const void __iomem *addr)
{
u32 val = readl(addr);
if (reglog)
printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val);
printk(KERN_ERR "IO:R %p %08x\n", addr, val);
return val;
}

Expand Down Expand Up @@ -143,8 +145,8 @@ static int msm_unload(struct drm_device *dev)
if (gpu) {
mutex_lock(&dev->struct_mutex);
gpu->funcs->pm_suspend(gpu);
gpu->funcs->destroy(gpu);
mutex_unlock(&dev->struct_mutex);
gpu->funcs->destroy(gpu);
}

if (priv->vram.paddr) {
Expand Down Expand Up @@ -177,7 +179,7 @@ static int get_mdp_ver(struct platform_device *pdev)
const struct of_device_id *match;
match = of_match_node(match_types, dev->of_node);
if (match)
return (int)match->data;
return (int)(unsigned long)match->data;
#endif
return 4;
}
Expand Down Expand Up @@ -216,7 +218,7 @@ static int msm_init_vram(struct drm_device *dev)
if (ret)
return ret;
size = r.end - r.start;
DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start);
DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
} else
#endif

Expand Down Expand Up @@ -283,17 +285,17 @@ static int msm_load(struct drm_device *dev, unsigned long flags)

drm_mode_config_init(dev);

ret = msm_init_vram(dev);
if (ret)
goto fail;

platform_set_drvdata(pdev, dev);

/* Bind all our sub-components: */
ret = component_bind_all(dev->dev, dev);
if (ret)
return ret;

ret = msm_init_vram(dev);
if (ret)
goto fail;

switch (get_mdp_ver(pdev)) {
case 4:
kms = mdp4_kms_init(dev);
Expand Down Expand Up @@ -419,9 +421,11 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file)

static void msm_lastclose(struct drm_device *dev)
{
#ifdef CONFIG_DRM_MSM_FBDEV
struct msm_drm_private *priv = dev->dev_private;
if (priv->fbdev)
drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
#endif
}

static irqreturn_t msm_irq(int irq, void *arg)
Expand Down
Loading

0 comments on commit 64d237e

Please sign in to comment.