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

Commit 713b21aa authored by Animesh Kishore's avatar Animesh Kishore
Browse files

drm/msm/sde: Move output select to cdm core



Configure cdm output selection via cdm ops.

Change-Id: I7eabba7fd58145e66568eeff74f049f347be3284
Signed-off-by: default avatarAnimesh Kishore <animeshk@codeaurora.org>
parent c0f77713
Loading
Loading
Loading
Loading
+24 −8
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
@@ -254,8 +254,8 @@ int sde_hw_cdm_enable(struct sde_hw_cdm *ctx,
	if (ctx && ctx->ops.bind_pingpong_blk)
		ctx->ops.bind_pingpong_blk(ctx, true,
				cdm->pp_id);
	else if (ctx->hw_mdp && ctx->hw_mdp->ops.setup_cdm_output)
		ctx->hw_mdp->ops.setup_cdm_output(ctx->hw_mdp, &cdm_cfg);
	else if (ctx && ctx->ops.setup_output)
		ctx->ops.setup_output(ctx, cdm);

	SDE_REG_WRITE(c, CDM_CSC_10_OPMODE, csc);
	SDE_REG_WRITE(c, CDM_HDMI_PACK_OP_MODE, opmode);
@@ -264,15 +264,29 @@ int sde_hw_cdm_enable(struct sde_hw_cdm *ctx,

void sde_hw_cdm_disable(struct sde_hw_cdm *ctx)
{
	struct cdm_output_cfg cdm_cfg = { 0 };
	if (ctx && ctx->ops.bind_pingpong_blk)
		ctx->ops.bind_pingpong_blk(ctx, false, 0);
	else if (ctx && ctx->ops.setup_output)
		ctx->ops.setup_output(ctx, NULL);
}

static void sde_hw_cdm_setup_output(struct sde_hw_cdm *ctx,
	struct sde_hw_cdm_cfg *cfg)
{
	struct sde_hw_blk_reg_map *c;
	u32 out_ctl = 0;

	if (!ctx)
		return;

	if (ctx && ctx->ops.bind_pingpong_blk)
		ctx->ops.bind_pingpong_blk(ctx, false, 0);
	else if (ctx->hw_mdp && ctx->hw_mdp->ops.setup_cdm_output)
		ctx->hw_mdp->ops.setup_cdm_output(ctx->hw_mdp, &cdm_cfg);
	c = &ctx->hw;

	if (cfg && cfg->output_type == CDM_CDWN_OUTPUT_WB)
		out_ctl |= BIT(24);
	else if (cfg && cfg->output_type == CDM_CDWN_OUTPUT_HDMI)
		out_ctl |= BIT(19);

	SDE_REG_WRITE(c, MDP_OUT_CTL_0, out_ctl);
}

static void sde_hw_cdm_bind_pingpong_blk(
@@ -302,6 +316,8 @@ static void _setup_cdm_ops(struct sde_hw_cdm_ops *ops,
	ops->setup_cdwn = sde_hw_cdm_setup_cdwn;
	ops->enable = sde_hw_cdm_enable;
	ops->disable = sde_hw_cdm_disable;
	ops->setup_output = sde_hw_cdm_setup_output;

	if (features & BIT(SDE_CDM_INPUT_CTRL))
		ops->bind_pingpong_blk = sde_hw_cdm_bind_pingpong_blk;
}
+8 −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
@@ -103,6 +103,13 @@ struct sde_hw_cdm_ops {
	void (*bind_pingpong_blk)(struct sde_hw_cdm *cdm,
			bool enable,
			const enum sde_pingpong pp);

	/**
	 * Configure CDM output
	 * @cdm         Pointer to chroma down context
	 */
	void (*setup_output)(struct sde_hw_cdm *cdm,
	struct sde_hw_cdm_cfg *cfg);
};

struct sde_hw_cdm {
+0 −20
Original line number Diff line number Diff line
@@ -150,25 +150,6 @@ static void sde_hw_setup_pp_split(struct sde_hw_mdp *mdp,
	}
}

static void sde_hw_setup_cdm_output(struct sde_hw_mdp *mdp,
		struct cdm_output_cfg *cfg)
{
	struct sde_hw_blk_reg_map *c;
	u32 out_ctl = 0;

	if (!mdp || !cfg)
		return;

	c = &mdp->hw;

	if (cfg->wb_en)
		out_ctl |= BIT(24);
	else if (cfg->intf_en)
		out_ctl |= BIT(19);

	SDE_REG_WRITE(c, MDP_OUT_CTL_0, out_ctl);
}

static bool sde_hw_setup_clk_force_ctrl(struct sde_hw_mdp *mdp,
		enum sde_clk_ctrl_type clk_ctrl, bool enable)
{
@@ -436,7 +417,6 @@ static void _setup_mdp_ops(struct sde_hw_mdp_ops *ops,
{
	ops->setup_split_pipe = sde_hw_setup_split_pipe;
	ops->setup_pp_split = sde_hw_setup_pp_split;
	ops->setup_cdm_output = sde_hw_setup_cdm_output;
	ops->setup_clk_force_ctrl = sde_hw_setup_clk_force_ctrl;
	ops->get_danger_status = sde_hw_get_danger_status;
	ops->setup_vsync_source = sde_hw_setup_vsync_source;
+1 −9
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
@@ -121,14 +121,6 @@ struct sde_hw_mdp_ops {
	void (*setup_pp_split)(struct sde_hw_mdp *mdp,
			struct split_pipe_cfg *cfg);

	/**
	 * setup_cdm_output() : Setup selection control of the cdm data path
	 * @mdp  : mdp top context driver
	 * @cfg  : cdm output configuration
	 */
	void (*setup_cdm_output)(struct sde_hw_mdp *mdp,
			struct cdm_output_cfg *cfg);

	/**
	 * setup_traffic_shaper() : Setup traffic shaper control
	 * @mdp  : mdp top context driver