Commit 38e71289 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: add AUX and I2C for DCN2

Adding support to program DCN2 AUX and I2C HW.
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 97930145
...@@ -29,6 +29,16 @@ ...@@ -29,6 +29,16 @@
#include "i2caux_interface.h" #include "i2caux_interface.h"
#include "inc/hw/aux_engine.h" #include "inc/hw/aux_engine.h"
#ifdef CONFIG_DRM_AMD_DC_DCN2_0
#define AUX_COMMON_REG_LIST0(id)\
SRI(AUX_CONTROL, DP_AUX, id), \
SRI(AUX_ARB_CONTROL, DP_AUX, id), \
SRI(AUX_SW_DATA, DP_AUX, id), \
SRI(AUX_SW_CONTROL, DP_AUX, id), \
SRI(AUX_INTERRUPT_CONTROL, DP_AUX, id), \
SRI(AUX_SW_STATUS, DP_AUX, id)
#endif
#define AUX_COMMON_REG_LIST(id)\ #define AUX_COMMON_REG_LIST(id)\
SRI(AUX_CONTROL, DP_AUX, id), \ SRI(AUX_CONTROL, DP_AUX, id), \
SRI(AUX_ARB_CONTROL, DP_AUX, id), \ SRI(AUX_ARB_CONTROL, DP_AUX, id), \
......
...@@ -303,6 +303,10 @@ static bool setup_engine( ...@@ -303,6 +303,10 @@ static bool setup_engine(
struct dce_i2c_hw *dce_i2c_hw) struct dce_i2c_hw *dce_i2c_hw)
{ {
uint32_t i2c_setup_limit = I2C_SETUP_TIME_LIMIT_DCE; uint32_t i2c_setup_limit = I2C_SETUP_TIME_LIMIT_DCE;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
uint32_t reset_length = 0;
#endif
/* we have checked I2c not used by DMCU, set SW use I2C REQ to 1 to indicate SW using it*/ /* we have checked I2c not used by DMCU, set SW use I2C REQ to 1 to indicate SW using it*/
REG_UPDATE(DC_I2C_ARBITRATION, DC_I2C_SW_USE_I2C_REG_REQ, 1); REG_UPDATE(DC_I2C_ARBITRATION, DC_I2C_SW_USE_I2C_REG_REQ, 1);
...@@ -323,6 +327,14 @@ static bool setup_engine( ...@@ -323,6 +327,14 @@ static bool setup_engine(
REG_UPDATE_N(SETUP, 2, REG_UPDATE_N(SETUP, 2,
FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_TIME_LIMIT), i2c_setup_limit, FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_TIME_LIMIT), i2c_setup_limit,
FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_ENABLE), 1); FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_ENABLE), 1);
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
} else {
reset_length = dce_i2c_hw->send_reset_length;
REG_UPDATE_N(SETUP, 3,
FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_TIME_LIMIT), i2c_setup_limit,
FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_SEND_RESET_LENGTH), reset_length,
FN(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_ENABLE), 1);
#endif
} }
/* Program HW priority /* Program HW priority
* set to High - interrupt software I2C at any time * set to High - interrupt software I2C at any time
...@@ -698,3 +710,23 @@ void dcn1_i2c_hw_construct( ...@@ -698,3 +710,23 @@ void dcn1_i2c_hw_construct(
dce_i2c_hw->setup_limit = I2C_SETUP_TIME_LIMIT_DCN; dce_i2c_hw->setup_limit = I2C_SETUP_TIME_LIMIT_DCN;
} }
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
void dcn2_i2c_hw_construct(
struct dce_i2c_hw *dce_i2c_hw,
struct dc_context *ctx,
uint32_t engine_id,
const struct dce_i2c_registers *regs,
const struct dce_i2c_shift *shifts,
const struct dce_i2c_mask *masks)
{
dcn1_i2c_hw_construct(dce_i2c_hw,
ctx,
engine_id,
regs,
shifts,
masks);
dce_i2c_hw->send_reset_length = I2C_SEND_RESET_LENGTH_9;
if (ctx->dc->debug.scl_reset_length10)
dce_i2c_hw->send_reset_length = I2C_SEND_RESET_LENGTH_10;
}
#endif
...@@ -177,6 +177,9 @@ struct dce_i2c_shift { ...@@ -177,6 +177,9 @@ struct dce_i2c_shift {
uint8_t DC_I2C_INDEX; uint8_t DC_I2C_INDEX;
uint8_t DC_I2C_INDEX_WRITE; uint8_t DC_I2C_INDEX_WRITE;
uint8_t XTAL_REF_DIV; uint8_t XTAL_REF_DIV;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
uint8_t DC_I2C_DDC1_SEND_RESET_LENGTH;
#endif
uint8_t DC_I2C_REG_RW_CNTL_STATUS; uint8_t DC_I2C_REG_RW_CNTL_STATUS;
}; };
...@@ -217,9 +220,18 @@ struct dce_i2c_mask { ...@@ -217,9 +220,18 @@ struct dce_i2c_mask {
uint32_t DC_I2C_INDEX; uint32_t DC_I2C_INDEX;
uint32_t DC_I2C_INDEX_WRITE; uint32_t DC_I2C_INDEX_WRITE;
uint32_t XTAL_REF_DIV; uint32_t XTAL_REF_DIV;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
uint32_t DC_I2C_DDC1_SEND_RESET_LENGTH;
#endif
uint32_t DC_I2C_REG_RW_CNTL_STATUS; uint32_t DC_I2C_REG_RW_CNTL_STATUS;
}; };
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
#define I2C_COMMON_MASK_SH_LIST_DCN2(mask_sh)\
I2C_COMMON_MASK_SH_LIST_DCE110(mask_sh),\
I2C_SF(DC_I2C_DDC1_SETUP, DC_I2C_DDC1_SEND_RESET_LENGTH, mask_sh)
#endif
struct dce_i2c_registers { struct dce_i2c_registers {
uint32_t SETUP; uint32_t SETUP;
uint32_t SPEED; uint32_t SPEED;
...@@ -300,6 +312,16 @@ void dcn1_i2c_hw_construct( ...@@ -300,6 +312,16 @@ void dcn1_i2c_hw_construct(
const struct dce_i2c_shift *shifts, const struct dce_i2c_shift *shifts,
const struct dce_i2c_mask *masks); const struct dce_i2c_mask *masks);
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
void dcn2_i2c_hw_construct(
struct dce_i2c_hw *dce_i2c_hw,
struct dc_context *ctx,
uint32_t engine_id,
const struct dce_i2c_registers *regs,
const struct dce_i2c_shift *shifts,
const struct dce_i2c_mask *masks);
#endif
bool dce_i2c_submit_command_hw( bool dce_i2c_submit_command_hw(
struct resource_pool *pool, struct resource_pool *pool,
struct ddc *ddc, struct ddc *ddc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment