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

Commit 9d4eb5bb authored by Shivaraj Shetty's avatar Shivaraj Shetty Committed by Sandeep Panda
Browse files

msm: mdss: cleanup the gdsc implementation for mdp3



This change adds mdss gdsc changes to mdp3 driver of
8909 platform and also throws error when iommu attach
fails in driver.

Change-Id: I6a0f18b19535e7450f0f9c3fad9b3c30178b9754
Signed-off-by: default avatarShivaraj Shetty <shivaraj@codeaurora.org>
Signed-off-by: default avatarSandeep Panda <spanda@codeaurora.org>
parent 4edc6a82
Loading
Loading
Loading
Loading
+44 −1
Original line number Diff line number Diff line
@@ -723,6 +723,7 @@ static int mdp3_get_iommu_domain(u32 type)

int mdp3_iommu_attach(int context)
{
	int rc = 0;
	struct mdp3_iommu_ctx_map *context_map;
	struct mdp3_iommu_domain_map *domain_map;

@@ -739,7 +740,11 @@ int mdp3_iommu_attach(int context)

	domain_map = context_map->domain;

	iommu_attach_device(domain_map->domain, context_map->ctx);
	rc = iommu_attach_device(domain_map->domain, context_map->ctx);
	if (rc) {
		pr_err("mpd3 iommu attach failed\n");
		return -EINVAL;
	}

	context_map->attached = true;
	mutex_unlock(&mdp3_res->iommu_lock);
@@ -1993,6 +1998,32 @@ struct mdss_panel_cfg *mdp3_panel_intf_type(int intf_val)
}
EXPORT_SYMBOL(mdp3_panel_intf_type);

int mdp3_footswitch_ctrl(int enable)
{
	int rc = 0;

	if (!mdp3_res->fs_ena && enable) {
		rc = regulator_enable(mdp3_res->fs);
		if (rc) {
			pr_err("mdp footswitch ctrl enable failed\n");
			return -EINVAL;
		} else {
			pr_debug("mdp footswitch ctrl enable success\n");
			mdp3_res->fs_ena = true;
		}
	} else if (mdp3_res->fs_ena && !enable) {
		rc = regulator_disable(mdp3_res->fs);
		if (rc)
			pr_warn("mdp footswitch ctrl disable failed\n");
		else
			mdp3_res->fs_ena = false;
	} else {
		pr_debug("mdp3 footswitch ctrl already configured\n");
	}

	return rc;
}

static int mdp3_probe(struct platform_device *pdev)
{
	int rc;
@@ -2053,6 +2084,18 @@ static int mdp3_probe(struct platform_device *pdev)
		goto probe_done;
	}

	mdp3_res->fs_ena = false;
	mdp3_res->fs = devm_regulator_get(&pdev->dev, "vdd");
	if (IS_ERR_OR_NULL(mdp3_res->fs)) {
		pr_err("unable to get mdss gdsc regulator\n");
		return -EINVAL;
	}
	rc = mdp3_footswitch_ctrl(1);
	if (rc) {
		pr_err("unable to turn on FS\n");
		goto probe_done;
	}

	rc = mdp3_check_version();
	if (rc) {
		pr_err("mdp3 check version failed\n");
+3 −0
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@ struct mdp3_hw_resource {
	bool batfet_required;
	struct regulator *batfet;
	struct regulator *vdd_cx;
	struct regulator *fs;
	bool fs_ena;
};

struct mdp3_img_data {
@@ -198,6 +200,7 @@ void mdp3_enable_regulator(int enable);
void mdp3_check_dsi_ctrl_status(struct work_struct *work,
				uint32_t interval);
int mdp3_dynamic_clock_gating_ctrl(int enable);
int mdp3_footswitch_ctrl(int enable);

#define MDP3_REG_WRITE(addr, val) writel_relaxed(val, mdp3_res->mdp_base + addr)
#define MDP3_REG_READ(addr) readl_relaxed(mdp3_res->mdp_base + addr)
+6 −0
Original line number Diff line number Diff line
@@ -590,6 +590,11 @@ static int mdp3_ctrl_on(struct msm_fb_data_type *mfd)
	}

	mdp3_enable_regulator(true);
	rc = mdp3_footswitch_ctrl(1);
	if (rc) {
		pr_err("fail to enable mdp footswitch ctrl\n");
		goto on_error;
	}
	mdp3_ctrl_notifier_register(mdp3_session,
		&mdp3_session->mfd->mdp_sync_pt_data.notifier);

@@ -708,6 +713,7 @@ static int mdp3_ctrl_off(struct msm_fb_data_type *mfd)
	mdp3_ctrl_notifier_unregister(mdp3_session,
		&mdp3_session->mfd->mdp_sync_pt_data.notifier);
	mdp3_enable_regulator(false);
	mdp3_footswitch_ctrl(0);
	mdp3_session->vsync_enabled = 0;
	atomic_set(&mdp3_session->vsync_countdown, 0);
	atomic_set(&mdp3_session->dma_done_cnt, 0);