Loading drivers/gpu/drm/msm/dsi-staging/dsi_display.c +77 −7 Original line number Diff line number Diff line Loading @@ -263,6 +263,9 @@ static int dsi_display_read_status(struct dsi_display_ctrl *ctrl, if (!panel) return -EINVAL; /* acquire panel_lock to make sure no commands are in progress */ dsi_panel_acquire_panel_lock(panel); config = &(panel->esd_config); lenp = config->status_valid_params ?: config->status_cmds_rlen; count = config->status_cmd.count; Loading @@ -289,6 +292,8 @@ static int dsi_display_read_status(struct dsi_display_ctrl *ctrl, } error: /* release panel_lock */ dsi_panel_release_panel_lock(panel); return rc; } Loading Loading @@ -1919,6 +1924,61 @@ static int dsi_display_phy_sw_reset(struct dsi_display *display) return rc; } static void dsi_display_aspace_cb_locked(void *cb_data, bool is_detach) { struct dsi_display *display; struct dsi_display_ctrl *display_ctrl; int rc, cnt; if (!cb_data) { pr_err("aspace cb called with invalid cb_data\n"); return; } display = (struct dsi_display *)cb_data; /* * acquire panel_lock to make sure no commands are in-progress * while detaching the non-secure context banks */ dsi_panel_acquire_panel_lock(display->panel); if (is_detach) { /* invalidate the stored iova */ display->cmd_buffer_iova = 0; /* return the virtual address mapping */ msm_gem_put_vaddr_locked(display->tx_cmd_buf); msm_gem_vunmap(display->tx_cmd_buf); } else { rc = msm_gem_get_iova_locked(display->tx_cmd_buf, display->aspace, &(display->cmd_buffer_iova)); if (rc) { pr_err("failed to get the iova rc %d\n", rc); goto end; } display->vaddr = (void *) msm_gem_get_vaddr_locked(display->tx_cmd_buf); if (IS_ERR_OR_NULL(display->vaddr)) { pr_err("failed to get va rc %d\n", rc); goto end; } } for (cnt = 0; cnt < display->ctrl_count; cnt++) { display_ctrl = &display->ctrl[cnt]; display_ctrl->ctrl->cmd_buffer_size = display->cmd_buffer_size; display_ctrl->ctrl->cmd_buffer_iova = display->cmd_buffer_iova; display_ctrl->ctrl->vaddr = display->vaddr; } end: /* release panel_lock */ dsi_panel_release_panel_lock(display->panel); } static int dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi) { Loading @@ -1936,7 +1996,6 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, { struct dsi_display *display = to_dsi_display(host); struct dsi_display_ctrl *display_ctrl; struct msm_gem_address_space *aspace = NULL; int rc = 0, cnt = 0; if (!host || !msg) { Loading Loading @@ -1980,19 +2039,27 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, goto error_disable_cmd_engine; } aspace = msm_gem_smmu_address_space_get(display->drm_dev, MSM_SMMU_DOMAIN_UNSECURE); if (!aspace) { display->aspace = msm_gem_smmu_address_space_get( display->drm_dev, MSM_SMMU_DOMAIN_UNSECURE); if (!display->aspace) { pr_err("failed to get aspace\n"); rc = -EINVAL; goto free_gem; } rc = msm_gem_get_iova(display->tx_cmd_buf, aspace, /* register to aspace */ rc = msm_gem_address_space_register_cb(display->aspace, dsi_display_aspace_cb_locked, (void *)display); if (rc) { pr_err("failed to register callback %d", rc); goto free_gem; } rc = msm_gem_get_iova(display->tx_cmd_buf, display->aspace, &(display->cmd_buffer_iova)); if (rc) { pr_err("failed to get the iova rc %d\n", rc); goto free_gem; goto free_aspace_cb; } display->vaddr = Loading Loading @@ -2044,7 +2111,10 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, } return rc; put_iova: msm_gem_put_iova(display->tx_cmd_buf, aspace); msm_gem_put_iova(display->tx_cmd_buf, display->aspace); free_aspace_cb: msm_gem_address_space_unregister_cb(display->aspace, dsi_display_aspace_cb_locked, display); free_gem: mutex_lock(&display->drm_dev->struct_mutex); msm_gem_free_object(display->tx_cmd_buf); Loading drivers/gpu/drm/msm/dsi-staging/dsi_display.h +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ struct dsi_display { u32 cmd_buffer_size; u32 cmd_buffer_iova; void *vaddr; struct msm_gem_address_space *aspace; struct mipi_dsi_host host; struct dsi_bridge *bridge; Loading drivers/gpu/drm/msm/dsi-staging/dsi_panel.h +10 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,16 @@ static inline bool dsi_panel_initialized(struct dsi_panel *panel) return panel->panel_initialized; } static inline void dsi_panel_acquire_panel_lock(struct dsi_panel *panel) { mutex_lock(&panel->panel_lock); } static inline void dsi_panel_release_panel_lock(struct dsi_panel *panel) { mutex_unlock(&panel->panel_lock); } struct dsi_panel *dsi_panel_get(struct device *parent, struct device_node *of_node, int topology_override); Loading Loading
drivers/gpu/drm/msm/dsi-staging/dsi_display.c +77 −7 Original line number Diff line number Diff line Loading @@ -263,6 +263,9 @@ static int dsi_display_read_status(struct dsi_display_ctrl *ctrl, if (!panel) return -EINVAL; /* acquire panel_lock to make sure no commands are in progress */ dsi_panel_acquire_panel_lock(panel); config = &(panel->esd_config); lenp = config->status_valid_params ?: config->status_cmds_rlen; count = config->status_cmd.count; Loading @@ -289,6 +292,8 @@ static int dsi_display_read_status(struct dsi_display_ctrl *ctrl, } error: /* release panel_lock */ dsi_panel_release_panel_lock(panel); return rc; } Loading Loading @@ -1919,6 +1924,61 @@ static int dsi_display_phy_sw_reset(struct dsi_display *display) return rc; } static void dsi_display_aspace_cb_locked(void *cb_data, bool is_detach) { struct dsi_display *display; struct dsi_display_ctrl *display_ctrl; int rc, cnt; if (!cb_data) { pr_err("aspace cb called with invalid cb_data\n"); return; } display = (struct dsi_display *)cb_data; /* * acquire panel_lock to make sure no commands are in-progress * while detaching the non-secure context banks */ dsi_panel_acquire_panel_lock(display->panel); if (is_detach) { /* invalidate the stored iova */ display->cmd_buffer_iova = 0; /* return the virtual address mapping */ msm_gem_put_vaddr_locked(display->tx_cmd_buf); msm_gem_vunmap(display->tx_cmd_buf); } else { rc = msm_gem_get_iova_locked(display->tx_cmd_buf, display->aspace, &(display->cmd_buffer_iova)); if (rc) { pr_err("failed to get the iova rc %d\n", rc); goto end; } display->vaddr = (void *) msm_gem_get_vaddr_locked(display->tx_cmd_buf); if (IS_ERR_OR_NULL(display->vaddr)) { pr_err("failed to get va rc %d\n", rc); goto end; } } for (cnt = 0; cnt < display->ctrl_count; cnt++) { display_ctrl = &display->ctrl[cnt]; display_ctrl->ctrl->cmd_buffer_size = display->cmd_buffer_size; display_ctrl->ctrl->cmd_buffer_iova = display->cmd_buffer_iova; display_ctrl->ctrl->vaddr = display->vaddr; } end: /* release panel_lock */ dsi_panel_release_panel_lock(display->panel); } static int dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi) { Loading @@ -1936,7 +1996,6 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, { struct dsi_display *display = to_dsi_display(host); struct dsi_display_ctrl *display_ctrl; struct msm_gem_address_space *aspace = NULL; int rc = 0, cnt = 0; if (!host || !msg) { Loading Loading @@ -1980,19 +2039,27 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, goto error_disable_cmd_engine; } aspace = msm_gem_smmu_address_space_get(display->drm_dev, MSM_SMMU_DOMAIN_UNSECURE); if (!aspace) { display->aspace = msm_gem_smmu_address_space_get( display->drm_dev, MSM_SMMU_DOMAIN_UNSECURE); if (!display->aspace) { pr_err("failed to get aspace\n"); rc = -EINVAL; goto free_gem; } rc = msm_gem_get_iova(display->tx_cmd_buf, aspace, /* register to aspace */ rc = msm_gem_address_space_register_cb(display->aspace, dsi_display_aspace_cb_locked, (void *)display); if (rc) { pr_err("failed to register callback %d", rc); goto free_gem; } rc = msm_gem_get_iova(display->tx_cmd_buf, display->aspace, &(display->cmd_buffer_iova)); if (rc) { pr_err("failed to get the iova rc %d\n", rc); goto free_gem; goto free_aspace_cb; } display->vaddr = Loading Loading @@ -2044,7 +2111,10 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host, } return rc; put_iova: msm_gem_put_iova(display->tx_cmd_buf, aspace); msm_gem_put_iova(display->tx_cmd_buf, display->aspace); free_aspace_cb: msm_gem_address_space_unregister_cb(display->aspace, dsi_display_aspace_cb_locked, display); free_gem: mutex_lock(&display->drm_dev->struct_mutex); msm_gem_free_object(display->tx_cmd_buf); Loading
drivers/gpu/drm/msm/dsi-staging/dsi_display.h +1 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ struct dsi_display { u32 cmd_buffer_size; u32 cmd_buffer_iova; void *vaddr; struct msm_gem_address_space *aspace; struct mipi_dsi_host host; struct dsi_bridge *bridge; Loading
drivers/gpu/drm/msm/dsi-staging/dsi_panel.h +10 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,16 @@ static inline bool dsi_panel_initialized(struct dsi_panel *panel) return panel->panel_initialized; } static inline void dsi_panel_acquire_panel_lock(struct dsi_panel *panel) { mutex_lock(&panel->panel_lock); } static inline void dsi_panel_release_panel_lock(struct dsi_panel *panel) { mutex_unlock(&panel->panel_lock); } struct dsi_panel *dsi_panel_get(struct device *parent, struct device_node *of_node, int topology_override); Loading