[PATCH 64/87] drm/amd/display: Change offset_to_id to reflect what id_to_offset returns
sunpeng.li at amd.com
sunpeng.li at amd.com
Mon Jul 15 21:20:26 UTC 2019
From: Murton Liu <murton.liu at amd.com>
id_to_offset does not point to the same reg offset that offset_to_id checks for,
causing unintended asserts
Signed-off-by: Murton Liu <murton.liu at amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr at amd.com>
Acked-by: Leo Li <sunpeng.li at amd.com>
---
.../drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c | 2 +-
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c | 10 +++-------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c b/drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c
index b393cc13298a..915e896e0e91 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c
@@ -71,7 +71,7 @@ static bool offset_to_id(
{
switch (offset) {
/* GENERIC */
- case REG(DC_GENERICA):
+ case REG(DC_GPIO_GENERIC_A):
*id = GPIO_ID_GENERIC;
switch (mask) {
case DC_GPIO_GENERIC_A__DC_GPIO_GENERICA_A_MASK:
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
index 937478bac796..80f938e68285 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
@@ -148,14 +148,10 @@ struct gpio *dal_gpio_service_create_generic_mux(
uint32_t en;
struct gpio *generic;
- if (mask == 1)
- en = GPIO_GENERIC_A;
- else if (mask == 0x00000100L)
- en = GPIO_GENERIC_B;
- else
+ if (!service->translate.funcs->offset_to_id(offset, mask, &id, &en)) {
+ ASSERT_CRITICAL(false);
return NULL;
-
- id = GPIO_ID_GENERIC;
+ }
generic = dal_gpio_create(
service, id, en, GPIO_PIN_OUTPUT_STATE_DEFAULT);
--
2.22.0
More information about the amd-gfx
mailing list