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

Commit e13cdcbd authored by Shubhashree Dhar's avatar Shubhashree Dhar
Browse files

drm/msm/sde: share common vbif interface for TRINKET target



Rotator and mdp share common AXI0(RT) port on trinket target,
hence share the same vbif interface.

Change-Id: Ib6251861aa706dceadd6e295157da9b6db3b352b
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
parent 1ee5220d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -426,6 +426,7 @@ Optional properties:
- qcom,sde-secure-sid-mask:	Array of secure SID masks used during
				secure-camera/secure-display usecases.
- #power-domain-cells:		Number of cells in a power-domain specifier and should contain 0.
- #list-cells:			Number of mdp cells, must be 1.
- qcom,sde-mixer-display-pref:  A string array indicating the preferred display type
				for the mixer block. Possible values:
				"primary" - preferred for primary display
+4 −0
Original line number Diff line number Diff line
@@ -128,6 +128,10 @@ Optional properties
- qcom,rot-reg-bus:		Property to provide Bus scaling for register
				access for rotator blocks.
- power-domains:		A phandle to respective power domain node.
- qcom,mdss-rot-parent:		A 2 cell property, with format of (mdp phandle,
				instance id), of mdp device.
- qcom,mdss-rot-xin-id:		An integer array of xin-ids when nrt path for rotation
				is not available.

Subnode properties:
- compatible:		Compatible name used in smmu v2.
+37 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -17,6 +17,7 @@
#include "sde_vbif.h"
#include "sde_hw_vbif.h"
#include "sde_trace.h"
#include "sde_rotator_vbif.h"

#define MAX_XIN_CLIENT	16

@@ -294,6 +295,41 @@ void sde_vbif_set_ot_limit(struct sde_kms *sde_kms,
	return;
}

void mdp_vbif_lock(struct platform_device *parent_pdev, bool enable)
{
	struct drm_device *ddev;
	struct sde_kms *sde_kms;
	struct sde_hw_vbif *vbif = NULL;
	int i;

	ddev = platform_get_drvdata(parent_pdev);
	if (!ddev || !ddev_to_msm_kms(ddev)) {
		SDE_ERROR("invalid drm device\n");
		return;
	}

	sde_kms = to_sde_kms(ddev_to_msm_kms(ddev));

	for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) {
		if (sde_kms->hw_vbif[i] &&
				sde_kms->hw_vbif[i]->idx == VBIF_RT) {
			vbif = sde_kms->hw_vbif[i];
			break;
		}
	}

	if (!vbif) {
		SDE_DEBUG("invalid vbif structure\n");
		return;
	}

	if (enable)
		mutex_lock(&vbif->mutex);
	else
		mutex_unlock(&vbif->mutex);

}

bool sde_vbif_set_xin_halt(struct sde_kms *sde_kms,
		struct sde_vbif_set_xin_halt_params *params)
{
+70 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include "sde_rotator_trace.h"
#include "sde_rotator_debug.h"
#include "sde_rotator_dev.h"
#include "sde_rotator_vbif.h"

static inline u64 fudge_factor(u64 val, u32 numer, u32 denom)
{
@@ -140,6 +141,22 @@ static bool force_on_xin_clk(u32 bit_off, u32 clk_ctl_reg_off, bool enable)
	return clk_forced_on;
}

void vbif_lock(struct platform_device *parent_pdev)
{
	if (!parent_pdev)
		return;

	mdp_vbif_lock(parent_pdev, true);
}

void vbif_unlock(struct platform_device *parent_pdev)
{
	if (!parent_pdev)
		return;

	mdp_vbif_lock(parent_pdev, false);
}

void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params)
{
	struct sde_rot_data_type *mdata = sde_rot_get_mdata();
@@ -152,7 +169,8 @@ void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params)
		return;
	}

	if (params->xin_id > MMSS_VBIF_NRT_VBIF_CLK_FORCE_CTRL0_XIN1) {
	if (!mdata->parent_pdev &&
		params->xin_id > MMSS_VBIF_NRT_VBIF_CLK_FORCE_CTRL0_XIN1) {
		SDEROT_ERR("xin_id:%d exceed max limit\n", params->xin_id);
		return;
	}
@@ -160,6 +178,8 @@ void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params)
	forced_on = force_on_xin_clk(params->bit_off_mdp_clk_ctrl,
		params->reg_off_mdp_clk_ctrl, true);

	vbif_lock(mdata->parent_pdev);

	SDEROT_EVTLOG(forced_on, params->xin_id);

	reg_val = SDE_VBIF_READ(mdata, MMSS_VBIF_XIN_HALT_CTRL0);
@@ -175,6 +195,8 @@ void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params)
	SDE_VBIF_WRITE(mdata, MMSS_VBIF_XIN_HALT_CTRL0,
		reg_val & ~BIT(params->xin_id));

	vbif_unlock(mdata->parent_pdev);

	if (forced_on)
		force_on_xin_clk(params->bit_off_mdp_clk_ctrl,
			params->reg_off_mdp_clk_ctrl, false);
@@ -285,6 +307,8 @@ void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params)
	u32 sts;
	bool forced_on;

	vbif_lock(mdata->parent_pdev);

	ot_lim = get_ot_limit(
		reg_off_vbif_lim_conf,
		bit_off_vbif_lim_conf,
@@ -330,6 +354,7 @@ void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params)

	SDEROT_EVTLOG(params->num, params->xin_id, ot_lim);
exit:
	vbif_unlock(mdata->parent_pdev);
	return;
}

@@ -555,6 +580,16 @@ static void sde_mdp_parse_vbif_qos(struct platform_device *pdev,
	}
}

static void sde_mdp_parse_vbif_xin_id(struct platform_device *pdev,
		struct sde_rot_data_type *mdata)
{
	mdata->vbif_xin_id[XIN_SSPP] = XIN_SSPP;
	mdata->vbif_xin_id[XIN_WRITEBACK] = XIN_WRITEBACK;

	sde_mdp_parse_dt_handler(pdev, "qcom,mdss-rot-xin-id",
					mdata->vbif_xin_id, MAX_XIN);
}

static void sde_mdp_parse_cdp_setting(struct platform_device *pdev,
		struct sde_rot_data_type *mdata)
{
@@ -685,6 +720,35 @@ static void sde_mdp_parse_inline_rot_lut_setting(struct platform_device *pdev,
	}
}

static void sde_mdp_parse_rt_rotator(struct device_node *np)
{
	struct sde_rot_data_type *mdata = sde_rot_get_mdata();
	struct platform_device *pdev;
	struct of_phandle_args phargs;
	int rc = 0;

	rc = of_parse_phandle_with_args(np,
			"qcom,mdss-rot-parent", "#list-cells", 0, &phargs);

	if (rc)
		return;

	if (!phargs.np || !phargs.args_count) {
		SDEROT_ERR("invalid args\n");
		return;
	}

	pdev = of_find_device_by_node(phargs.np);
	if (pdev) {
		mdata->parent_pdev = pdev;
	} else {
		mdata->parent_pdev = NULL;
		SDEROT_ERR("Parent mdp node not available\n");
	}

	of_node_put(phargs.np);
}

static int sde_mdp_parse_dt_misc(struct platform_device *pdev,
		struct sde_rot_data_type *mdata)
{
@@ -713,6 +777,8 @@ static int sde_mdp_parse_dt_misc(struct platform_device *pdev,

	sde_mdp_parse_vbif_qos(pdev, mdata);

	sde_mdp_parse_vbif_xin_id(pdev, mdata);

	sde_mdp_parse_vbif_memtype(pdev, mdata);

	sde_mdp_parse_rot_lut_setting(pdev, mdata);
@@ -853,9 +919,11 @@ int sde_rotator_base_init(struct sde_rot_data_type **pmdata,
		SDEROT_ERR("unable to map SDE ROT VBIF base\n");
		goto probe_done;
	}
	SDEROT_DBG("SDE ROT VBIF HW Base addr=%p len=0x%x\n",
	SDEROT_DBG("SDE ROT VBIF HW Base addr=%pK len=0x%x\n",
			mdata->vbif_nrt_io.base, mdata->vbif_nrt_io.len);

	sde_mdp_parse_rt_rotator(pdev->dev.of_node);

	rc = sde_mdp_parse_dt_misc(pdev, mdata);
	if (rc) {
		SDEROT_ERR("Error in device tree : misc\n");
+13 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <linux/kref.h>
#include <linux/kernel.h>
#include <linux/regulator/consumer.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>

#include "sde_rotator_hwio.h"
#include "sde_rotator_io_util.h"
@@ -53,6 +55,11 @@
#define SDE_MDP_VBIF_4_LEVEL_REMAPPER	4
#define SDE_MDP_VBIF_8_LEVEL_REMAPPER	8

/* XIN mapping */
#define XIN_SSPP	0
#define XIN_WRITEBACK	1
#define MAX_XIN		2

struct sde_mult_factor {
	uint32_t numer;
	uint32_t denom;
@@ -227,6 +234,7 @@ struct sde_rot_data_type {
	u32 mdss_version;

	struct platform_device *pdev;
	struct platform_device *parent_pdev;
	struct sde_io_data sde_io;
	struct sde_io_data vbif_nrt_io;
	char __iomem *mdp_base;
@@ -255,6 +263,8 @@ struct sde_rot_data_type {
	u32 *vbif_nrt_qos;
	u32 npriority_lvl;

	u32 vbif_xin_id[MAX_XIN];

	struct pm_qos_request pm_qos_rot_cpu_req;
	u32 rot_pm_qos_cpu_count;
	u32 rot_pm_qos_cpu_mask;
@@ -307,6 +317,9 @@ u32 sde_mdp_get_ot_limit(u32 width, u32 height, u32 pixfmt, u32 fps, u32 is_rd);

void sde_mdp_set_ot_limit(struct sde_mdp_set_ot_params *params);

void vbif_lock(struct platform_device *parent_pdev);
void vbif_unlock(struct platform_device *parent_pdev);

void sde_mdp_halt_vbif_xin(struct sde_mdp_vbif_halt_params *params);

int sde_mdp_init_vbif(void);
Loading