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

Commit eb1b446c authored by Benet Clark's avatar Benet Clark Committed by Narendra Muppalla
Browse files

drm/msm/sde: Add PA global adjustment properties to plane



Add support for hue, saturation, intensity, and contrast adjustment
in planes that have color processing support.

Change-Id: I4c794deb7a5a1c0cc30cc0d64fbffd967eb1d399
Signed-off-by: default avatarBenet Clark <benetc@codeaurora.org>
parent 479690d4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -119,7 +119,8 @@ msm_drm-$(CONFIG_DRM_MSM) += \
	sde/sde_hw_interrupts.o \
	sde/sde_hw_vbif.o \
	sde/sde_formats.o \
	sde_power_handle.o
	sde_power_handle.o \
	sde/sde_hw_color_processing_v1_7.o

msm_drm-$(CONFIG_DRM_SDE_WB) += sde/sde_wb.o \
	sde/sde_encoder_phys_wb.o
+4 −0
Original line number Diff line number Diff line
@@ -95,6 +95,10 @@ enum msm_mdp_plane_property {
	PLANE_PROP_H_DECIMATE,
	PLANE_PROP_V_DECIMATE,
	PLANE_PROP_INPUT_FENCE,
	PLANE_PROP_HUE_ADJUST,
	PLANE_PROP_SATURATION_ADJUST,
	PLANE_PROP_VALUE_ADJUST,
	PLANE_PROP_CONTRAST_ADJUST,

	/* enum/bitmask properties */
	PLANE_PROP_ROTATION,
+18 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _SDE_HW_COLOR_PROCESSING_H
#define _SDE_HW_COLOR_PROCESSING_H

#include "sde_hw_color_processing_v1_7.h"

#endif
+121 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include "sde_hw_color_processing_v1_7.h"

#define PA_HUE_OFF		0x110
#define PA_HUE_MASK		0xFFF
#define PA_SAT_OFF		0x114
#define PA_SAT_MASK		0xFFFF
#define PA_VAL_OFF		0x118
#define PA_VAL_MASK		0xFF
#define PA_CONT_OFF		0x11C
#define PA_CONT_MASK		0xFF

#define VIG_OP_PA_EN		BIT(4)
#define VIG_OP_PA_SKIN_EN	BIT(5)
#define VIG_OP_PA_FOL_EN	BIT(6)
#define VIG_OP_PA_SKY_EN	BIT(7)
#define VIG_OP_PA_HUE_EN	BIT(25)
#define VIG_OP_PA_SAT_EN	BIT(26)
#define VIG_OP_PA_VAL_EN	BIT(27)
#define VIG_OP_PA_CONT_EN	BIT(28)

#define PA_DISABLE_REQUIRED(x)	!((x) & \
				(VIG_OP_PA_SKIN_EN | VIG_OP_PA_SKY_EN | \
				VIG_OP_PA_FOL_EN | VIG_OP_PA_HUE_EN | \
				VIG_OP_PA_SAT_EN | VIG_OP_PA_VAL_EN | \
				VIG_OP_PA_CONT_EN))

void sde_setup_pipe_pa_hue_v1_7(struct sde_hw_pipe *ctx, void *cfg)
{
	uint32_t hue = *((uint32_t *)cfg);
	u32 base = ctx->cap->sblk->hsic_blk.base;
	u32 opmode = 0;

	SDE_REG_WRITE(&ctx->hw, base + PA_HUE_OFF, hue & PA_HUE_MASK);

	opmode = SDE_REG_READ(&ctx->hw, base);

	if (!hue) {
		opmode &= ~VIG_OP_PA_HUE_EN;
		if (PA_DISABLE_REQUIRED(opmode))
			opmode &= ~VIG_OP_PA_EN;
	} else {
		opmode |= VIG_OP_PA_HUE_EN | VIG_OP_PA_EN;
	}

	SDE_REG_WRITE(&ctx->hw, base, opmode);
}

void sde_setup_pipe_pa_sat_v1_7(struct sde_hw_pipe *ctx, void *cfg)
{
	uint32_t sat = *((uint32_t *)cfg);
	u32 base = ctx->cap->sblk->hsic_blk.base;
	u32 opmode = 0;

	SDE_REG_WRITE(&ctx->hw, base + PA_SAT_OFF, sat & PA_SAT_MASK);

	opmode = SDE_REG_READ(&ctx->hw, base);

	if (!sat) {
		opmode &= ~VIG_OP_PA_SAT_EN;
		if (PA_DISABLE_REQUIRED(opmode))
			opmode &= ~VIG_OP_PA_EN;
	} else {
		opmode |= VIG_OP_PA_SAT_EN | VIG_OP_PA_EN;
	}

	SDE_REG_WRITE(&ctx->hw, base, opmode);
}

void sde_setup_pipe_pa_val_v1_7(struct sde_hw_pipe *ctx, void *cfg)
{
	uint32_t value = *((uint32_t *)cfg);
	u32 base = ctx->cap->sblk->hsic_blk.base;
	u32 opmode = 0;

	SDE_REG_WRITE(&ctx->hw, base + PA_VAL_OFF, value & PA_VAL_MASK);

	opmode = SDE_REG_READ(&ctx->hw, base);

	if (!value) {
		opmode &= ~VIG_OP_PA_VAL_EN;
		if (PA_DISABLE_REQUIRED(opmode))
			opmode &= ~VIG_OP_PA_EN;
	} else {
		opmode |= VIG_OP_PA_VAL_EN | VIG_OP_PA_EN;
	}

	SDE_REG_WRITE(&ctx->hw, base, opmode);
}

void sde_setup_pipe_pa_cont_v1_7(struct sde_hw_pipe *ctx, void *cfg)
{
	uint32_t contrast = *((uint32_t *)cfg);
	u32 base = ctx->cap->sblk->hsic_blk.base;
	u32 opmode = 0;

	SDE_REG_WRITE(&ctx->hw, base + PA_CONT_OFF, contrast & PA_CONT_MASK);

	opmode = SDE_REG_READ(&ctx->hw, base);

	if (!contrast) {
		opmode &= ~VIG_OP_PA_CONT_EN;
		if (PA_DISABLE_REQUIRED(opmode))
			opmode &= ~VIG_OP_PA_EN;
	} else {
		opmode |= VIG_OP_PA_CONT_EN | VIG_OP_PA_EN;
	}

	SDE_REG_WRITE(&ctx->hw, base, opmode);
}
+46 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _SDE_HW_COLOR_PROCESSING_V1_7_H
#define _SDE_HW_COLOR_PROCESSING_V1_7_H

#include "sde_hw_sspp.h"

/**
 * sde_setup_pipe_pa_hue_v1_7 - setup SSPP hue feature in v1.7 hardware
 * @ctx: Pointer to pipe context
 * @cfg: Pointer to hue data
 */
void sde_setup_pipe_pa_hue_v1_7(struct sde_hw_pipe *ctx, void *cfg);

/**
 * sde_setup_pipe_pa_sat_v1_7 - setup SSPP saturation feature in v1.7 hardware
 * @ctx: Pointer to pipe context
 * @cfg: Pointer to saturation data
 */
void sde_setup_pipe_pa_sat_v1_7(struct sde_hw_pipe *ctx, void *cfg);

/**
 * sde_setup_pipe_pa_val_v1_7 - setup SSPP value feature in v1.7 hardware
 * @ctx: Pointer to pipe context
 * @cfg: Pointer to value data
 */
void sde_setup_pipe_pa_val_v1_7(struct sde_hw_pipe *ctx, void *cfg);

/**
 * sde_setup_pipe_pa_cont_v1_7 - setup SSPP contrast feature in v1.7 hardware
 * @ctx: Pointer to pipe context
 * @cfg: Pointer to contrast data
 */
void sde_setup_pipe_pa_cont_v1_7(struct sde_hw_pipe *ctx, void *cfg);

#endif
Loading