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

Commit d8f36bd0 authored by Padmanabhan Komanduru's avatar Padmanabhan Komanduru Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: add support for dedicated rotator control



In some MDP revisions, there is a control path that supports
only rotator operations whereas in other MDSS variants,
the same path can support both WFD and rotator. This change
takes care of this. Also, makes changes to support dedicated
WFD block.

Change-Id: Ife6ebd39a3f6a42501baeb2a8d4c6c8e1a9db39a
Signed-off-by: default avatarPadmanabhan Komanduru <pkomandu@codeaurora.org>
parent f9121b8a
Loading
Loading
Loading
Loading
+26 −9
Original line number Original line Diff line number Diff line
@@ -933,8 +933,21 @@ static int mdss_mdp_ctl_free(struct mdss_mdp_ctl *ctl)
	return 0;
	return 0;
}
}


/**
 * mdss_mdp_mixer_alloc() - allocate mdp mixer.
 * @ctl: mdp controller.
 * @type: specifying type of mixer requested. interface or writeback.
 * @mux: specifies if mixer allocation is for split_fb cases.
 * @rotator: specifies if the mixer requested for rotator operations.
 *
 * This function is called to request allocation of mdp mixer
 * during mdp controller path setup.
 *
 * Return: mdp mixer structure that is allocated.
 *	   NULL if mixer allocation fails.
 */
static struct mdss_mdp_mixer *mdss_mdp_mixer_alloc(
static struct mdss_mdp_mixer *mdss_mdp_mixer_alloc(
		struct mdss_mdp_ctl *ctl, u32 type, int mux)
		struct mdss_mdp_ctl *ctl, u32 type, int mux, int rotator)
{
{
	struct mdss_mdp_mixer *mixer = NULL, *alt_mixer = NULL;
	struct mdss_mdp_mixer *mixer = NULL, *alt_mixer = NULL;
	u32 nmixers_intf;
	u32 nmixers_intf;
@@ -971,6 +984,8 @@ static struct mdss_mdp_mixer *mdss_mdp_mixer_alloc(
	case MDSS_MDP_MIXER_TYPE_WRITEBACK:
	case MDSS_MDP_MIXER_TYPE_WRITEBACK:
		mixer_pool = ctl->mdata->mixer_wb;
		mixer_pool = ctl->mdata->mixer_wb;
		nmixers = nmixers_wb;
		nmixers = nmixers_wb;
		if ((ctl->mdata->wfd_mode == MDSS_MDP_WFD_DEDICATED) && rotator)
			mixer_pool = mixer_pool + nmixers;
		break;
		break;


	default:
	default:
@@ -1043,7 +1058,8 @@ struct mdss_mdp_mixer *mdss_mdp_wb_mixer_alloc(int rotator)
		return NULL;
		return NULL;
	}
	}


	mixer = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_WRITEBACK, false);
	mixer = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_WRITEBACK,
							false, rotator);
	if (!mixer) {
	if (!mixer) {
		pr_debug("unable to allocate wb mixer\n");
		pr_debug("unable to allocate wb mixer\n");
		goto error;
		goto error;
@@ -1230,7 +1246,7 @@ int mdss_mdp_ctl_setup(struct mdss_mdp_ctl *ctl)
	if (!ctl->mixer_left) {
	if (!ctl->mixer_left) {
		ctl->mixer_left =
		ctl->mixer_left =
			mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_INTF,
			mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_INTF,
			 ((width > MAX_MIXER_WIDTH) || split_fb));
			 ((width > MAX_MIXER_WIDTH) || split_fb), 0);
		if (!ctl->mixer_left) {
		if (!ctl->mixer_left) {
			pr_err("unable to allocate layer mixer\n");
			pr_err("unable to allocate layer mixer\n");
			return -ENOMEM;
			return -ENOMEM;
@@ -1261,7 +1277,7 @@ int mdss_mdp_ctl_setup(struct mdss_mdp_ctl *ctl)
	if (width < ctl->width) {
	if (width < ctl->width) {
		if (ctl->mixer_right == NULL) {
		if (ctl->mixer_right == NULL) {
			ctl->mixer_right = mdss_mdp_mixer_alloc(ctl,
			ctl->mixer_right = mdss_mdp_mixer_alloc(ctl,
					MDSS_MDP_MIXER_TYPE_INTF, true);
					MDSS_MDP_MIXER_TYPE_INTF, true, 0);
			if (!ctl->mixer_right) {
			if (!ctl->mixer_right) {
				pr_err("unable to allocate right mixer\n");
				pr_err("unable to allocate right mixer\n");
				if (ctl->mixer_left)
				if (ctl->mixer_left)
@@ -1301,17 +1317,18 @@ static int mdss_mdp_ctl_setup_wfd(struct mdss_mdp_ctl *ctl)
	else
	else
		mixer_type = MDSS_MDP_MIXER_TYPE_WRITEBACK;
		mixer_type = MDSS_MDP_MIXER_TYPE_WRITEBACK;


	mixer = mdss_mdp_mixer_alloc(ctl, mixer_type, false);
	mixer = mdss_mdp_mixer_alloc(ctl, mixer_type, false, 0);
	if (!mixer && mixer_type == MDSS_MDP_MIXER_TYPE_INTF)
	if (!mixer && mixer_type == MDSS_MDP_MIXER_TYPE_INTF)
		mixer = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_WRITEBACK,
		mixer = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_WRITEBACK,
				false);
				false, 0);


	if (!mixer) {
	if (!mixer) {
		pr_err("Unable to allocate writeback mixer\n");
		pr_err("Unable to allocate writeback mixer\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	if (mixer->type == MDSS_MDP_MIXER_TYPE_INTF) {
	if (mixer->type == MDSS_MDP_MIXER_TYPE_INTF ||
			(mdata->wfd_mode == MDSS_MDP_WFD_DEDICATED)) {
		ctl->opmode = MDSS_MDP_CTL_OP_WFD_MODE;
		ctl->opmode = MDSS_MDP_CTL_OP_WFD_MODE;
	} else {
	} else {
		switch (mixer->num) {
		switch (mixer->num) {
@@ -1463,14 +1480,14 @@ int mdss_mdp_ctl_split_display_setup(struct mdss_mdp_ctl *ctl,
	sctl->height = pdata->panel_info.yres;
	sctl->height = pdata->panel_info.yres;


	ctl->mixer_left = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_INTF,
	ctl->mixer_left = mdss_mdp_mixer_alloc(ctl, MDSS_MDP_MIXER_TYPE_INTF,
			false);
			false, 0);
	if (!ctl->mixer_left) {
	if (!ctl->mixer_left) {
		pr_err("unable to allocate layer mixer\n");
		pr_err("unable to allocate layer mixer\n");
		mdss_mdp_ctl_destroy(sctl);
		mdss_mdp_ctl_destroy(sctl);
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	mixer = mdss_mdp_mixer_alloc(sctl, MDSS_MDP_MIXER_TYPE_INTF, false);
	mixer = mdss_mdp_mixer_alloc(sctl, MDSS_MDP_MIXER_TYPE_INTF, false, 0);
	if (!mixer) {
	if (!mixer) {
		pr_err("unable to allocate layer mixer\n");
		pr_err("unable to allocate layer mixer\n");
		mdss_mdp_ctl_destroy(sctl);
		mdss_mdp_ctl_destroy(sctl);