aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch
new file mode 100644
index 00000000..091ef04d
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1594-drm-amd-display-add-HW-i2c-arbitration-with-dmcu.patch
@@ -0,0 +1,86 @@
+From f3a3bea08889b60a3628b1ee1a4f95258bf26cb3 Mon Sep 17 00:00:00 2001
+From: Charlene Liu <charlene.liu@amd.com>
+Date: Fri, 22 Feb 2019 13:55:46 -0500
+Subject: [PATCH 1594/2940] drm/amd/display: add HW i2c arbitration with dmcu
+
+Signed-off-by: Charlene Liu <charlene.liu@amd.com>
+Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
+Acked-by: Leo Li <sunpeng.li@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 12 +++++++++++-
+ drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.h | 8 ++++++--
+ 2 files changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
+index 40f2d6e0b122..cd26161bcc4d 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
+@@ -346,6 +346,16 @@ static void release_engine(
+
+ }
+
++static bool is_engine_available(struct dce_i2c_hw *dce_i2c_hw)
++{
++ unsigned int arbitrate;
++
++ REG_GET(DC_I2C_ARBITRATION, DC_I2C_REG_RW_CNTL_STATUS, &arbitrate);
++ if (arbitrate == DC_I2C_REG_RW_CNTL_STATUS_DMCU_ONLY)
++ return false;
++ return true;
++}
++
+ struct dce_i2c_hw *acquire_i2c_hw_engine(
+ struct resource_pool *pool,
+ struct ddc *ddc)
+@@ -368,7 +378,7 @@ struct dce_i2c_hw *acquire_i2c_hw_engine(
+ if (!dce_i2c_hw)
+ return NULL;
+
+- if (pool->i2c_hw_buffer_in_use)
++ if (pool->i2c_hw_buffer_in_use || !is_engine_available(dce_i2c_hw))
+ return NULL;
+
+ do {
+diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.h b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.h
+index 7f19bb439665..575500755b2e 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.h
++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.h
+@@ -29,7 +29,8 @@
+ enum dc_i2c_status {
+ DC_I2C_STATUS__DC_I2C_STATUS_IDLE,
+ DC_I2C_STATUS__DC_I2C_STATUS_USED_BY_SW,
+- DC_I2C_STATUS__DC_I2C_STATUS_USED_BY_HW
++ DC_I2C_STATUS__DC_I2C_STATUS_USED_BY_HW,
++ DC_I2C_REG_RW_CNTL_STATUS_DMCU_ONLY = 2,
+ };
+
+ enum dc_i2c_arbitration {
+@@ -129,7 +130,8 @@ enum {
+ I2C_SF(DC_I2C_DATA, DC_I2C_DATA, mask_sh),\
+ I2C_SF(DC_I2C_DATA, DC_I2C_INDEX, mask_sh),\
+ I2C_SF(DC_I2C_DATA, DC_I2C_INDEX_WRITE, mask_sh),\
+- I2C_SF(MICROSECOND_TIME_BASE_DIV, XTAL_REF_DIV, mask_sh)
++ I2C_SF(MICROSECOND_TIME_BASE_DIV, XTAL_REF_DIV, mask_sh),\
++ I2C_SF(DC_I2C_ARBITRATION, DC_I2C_REG_RW_CNTL_STATUS, mask_sh)
+
+ #define I2C_COMMON_MASK_SH_LIST_DCE110(mask_sh)\
+ I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh),\
+@@ -170,6 +172,7 @@ struct dce_i2c_shift {
+ uint8_t DC_I2C_INDEX;
+ uint8_t DC_I2C_INDEX_WRITE;
+ uint8_t XTAL_REF_DIV;
++ uint8_t DC_I2C_REG_RW_CNTL_STATUS;
+ };
+
+ struct dce_i2c_mask {
+@@ -207,6 +210,7 @@ struct dce_i2c_mask {
+ uint32_t DC_I2C_INDEX;
+ uint32_t DC_I2C_INDEX_WRITE;
+ uint32_t XTAL_REF_DIV;
++ uint32_t DC_I2C_REG_RW_CNTL_STATUS;
+ };
+
+ struct dce_i2c_registers {
+--
+2.17.1
+