Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93fde65c authored by Shivaraj Shetty's avatar Shivaraj Shetty Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: Add get pan cfg and get iommu dom to common interface



Add get panel configuration and get iommu domain functions to
common utility interface. This will make sure that DSI 6G gets
the right information on ferrum which has mdp3.

Change-Id: Ib5a9d70b8202eaa9e3003475398ecef88dfb573d
Signed-off-by: default avatarShivaraj Shetty <shivaraj@codeaurora.org>
parent 500fd73c
Loading
Loading
Loading
Loading
+26 −12
Original line number Diff line number Diff line
@@ -700,6 +700,18 @@ static int mdp3_irq_setup(void)
	return 0;
}


static int mdp3_get_iommu_domain(u32 type)
{
	if (type >= MDSS_IOMMU_MAX_DOMAIN)
		return -EINVAL;

	if (!mdp3_res)
		return -ENODEV;

	return mdp3_res->domains[type].domain_idx;
}

int mdp3_iommu_attach(int context)
{
	struct mdp3_iommu_ctx_map *context_map;
@@ -1909,6 +1921,18 @@ int mdp3_misr_set(struct mdp_misr *misr_req)
	return ret;
}

struct mdss_panel_cfg *mdp3_panel_intf_type(int intf_val)
{
	if (!mdp3_res || !mdp3_res->pan_cfg.init_done)
		return ERR_PTR(-EPROBE_DEFER);

	if (mdp3_res->pan_cfg.pan_intf == intf_val)
		return &mdp3_res->pan_cfg;
	else
		return NULL;
}
EXPORT_SYMBOL(mdp3_panel_intf_type);

static int mdp3_probe(struct platform_device *pdev)
{
	int rc;
@@ -1953,9 +1977,11 @@ static int mdp3_probe(struct platform_device *pdev)
		rc =  -ENODEV;
		goto get_util_fail;
	}
	mdp3_res->mdss_util->get_iommu_domain = mdp3_get_iommu_domain;
	mdp3_res->mdss_util->iommu_attached = mdp3_iommu_is_attached;
	mdp3_res->mdss_util->iommu_ctrl = mdp3_iommu_ctrl;
	mdp3_res->mdss_util->bus_scale_set_quota = mdp3_bus_scale_set_quota;
	mdp3_res->mdss_util->panel_intf_type = mdp3_panel_intf_type;

	rc = mdp3_parse_dt(pdev);
	if (rc)
@@ -2015,18 +2041,6 @@ get_util_fail:
	return rc;
}

struct mdss_panel_cfg *mdp3_panel_intf_type(int intf_val)
{
	if (!mdp3_res || !mdp3_res->pan_cfg.init_done)
		return ERR_PTR(-EPROBE_DEFER);

	if (mdp3_res->pan_cfg.pan_intf == intf_val)
		return &mdp3_res->pan_cfg;
	else
		return NULL;
}
EXPORT_SYMBOL(mdp3_panel_intf_type);

int mdp3_panel_get_boot_cfg(void)
{
	int rc;
+2 −0
Original line number Diff line number Diff line
@@ -278,11 +278,13 @@ struct mdss_util_intf {
	void (*disable_irq)(struct mdss_hw *hw);
	void (*disable_irq_nosync)(struct mdss_hw *hw);
	int (*irq_dispatch)(u32 hw_ndx, int irq, void *ptr);
	int (*get_iommu_domain)(u32 type);
	int (*iommu_attached)(void);
	int (*iommu_ctrl)(int enable);
	void (*bus_bandwidth_ctrl)(int enable);
	int (*bus_scale_set_quota)(int client, u64 ab_quota,
					u64 ab_quote_nrt, u64 ib_quota);
	struct mdss_panel_cfg* (*panel_intf_type)(int intf_val);
};

struct mdss_util_intf *mdss_get_util_intf(void);
+5 −4
Original line number Diff line number Diff line
@@ -423,7 +423,8 @@ novreg:
	return rc;
}

static int mdss_dsi_get_panel_cfg(char *panel_cfg)
static int mdss_dsi_get_panel_cfg(char *panel_cfg,
				struct mdss_dsi_ctrl_pdata *ctrl)
{
	int rc;
	struct mdss_panel_cfg *pan_cfg = NULL;
@@ -431,7 +432,7 @@ static int mdss_dsi_get_panel_cfg(char *panel_cfg)
	if (!panel_cfg)
		return MDSS_PANEL_INTF_INVALID;

	pan_cfg = mdss_panel_intf_type(MDSS_PANEL_INTF_DSI);
	pan_cfg = ctrl->mdss_util->panel_intf_type(MDSS_PANEL_INTF_DSI);
	if (IS_ERR(pan_cfg)) {
		return PTR_ERR(pan_cfg);
	} else if (!pan_cfg) {
@@ -1378,7 +1379,7 @@ static int mdss_dsi_ctrl_probe(struct platform_device *pdev)
		return -ENOTSUPP;
	}

	pan_cfg = mdss_panel_intf_type(MDSS_PANEL_INTF_HDMI);
	pan_cfg = util->panel_intf_type(MDSS_PANEL_INTF_HDMI);
	if (IS_ERR(pan_cfg)) {
		return PTR_ERR(pan_cfg);
	} else if (pan_cfg) {
@@ -1456,7 +1457,7 @@ static int mdss_dsi_ctrl_probe(struct platform_device *pdev)
			pdev->dev.of_node, "qcom,dsi-panel-bias-vreg");

	/* DSI panels can be different between controllers */
	rc = mdss_dsi_get_panel_cfg(panel_cfg);
	rc = mdss_dsi_get_panel_cfg(panel_cfg, ctrl_pdata);
	if (!rc)
		/* dsi panel cfg not present */
		pr_warn("%s:%d:dsi specific cfg not present\n",
+5 −3
Original line number Diff line number Diff line
@@ -1213,7 +1213,7 @@ static int mdss_dsi_cmd_dma_tx(struct mdss_dsi_ctrl_pdata *ctrl,

	if (ctrl->mdss_util->iommu_attached()) {
		int ret = msm_iommu_map_contig_buffer(tp->dmap,
				mdss_get_iommu_domain(domain), 0,
				ctrl->mdss_util->get_iommu_domain(domain), 0,
				ctrl->dma_size, SZ_4K, 0, &(ctrl->dma_addr));
		if (IS_ERR_VALUE(ret)) {
			pr_err("unable to map dma memory to iommu(%d)\n", ret);
@@ -1261,7 +1261,8 @@ static int mdss_dsi_cmd_dma_tx(struct mdss_dsi_ctrl_pdata *ctrl,
	if (mctrl && mctrl->dma_addr) {
		if (ctrl->mdss_util->iommu_attached()) {
			msm_iommu_unmap_contig_buffer(mctrl->dma_addr,
			mdss_get_iommu_domain(domain), 0, mctrl->dma_size);
			ctrl->mdss_util->get_iommu_domain(domain),
							0, mctrl->dma_size);
		}
		mctrl->dma_addr = 0;
		mctrl->dma_size = 0;
@@ -1269,7 +1270,8 @@ static int mdss_dsi_cmd_dma_tx(struct mdss_dsi_ctrl_pdata *ctrl,

	if (ctrl->mdss_util->iommu_attached()) {
		msm_iommu_unmap_contig_buffer(ctrl->dma_addr,
			mdss_get_iommu_domain(domain), 0, ctrl->dma_size);
			ctrl->mdss_util->get_iommu_domain(domain),
							0, ctrl->dma_size);
	}

	ctrl->dma_addr = 0;
+2 −0
Original line number Diff line number Diff line
@@ -1448,10 +1448,12 @@ static int mdss_mdp_probe(struct platform_device *pdev)
		return -ENODEV;
	}

	mdss_res->mdss_util->get_iommu_domain = mdss_get_iommu_domain;
	mdss_res->mdss_util->iommu_attached = is_mdss_iommu_attached;
	mdss_res->mdss_util->iommu_ctrl = mdss_iommu_ctrl;
	mdss_res->mdss_util->bus_scale_set_quota = mdss_bus_scale_set_quota;
	mdss_res->mdss_util->bus_bandwidth_ctrl = mdss_bus_bandwidth_ctrl;
	mdss_res->mdss_util->panel_intf_type = mdss_panel_intf_type;

	rc = msm_dss_ioremap_byname(pdev, &mdata->mdss_io, "mdp_phys");
	if (rc) {
Loading