diff options
author | Murton Liu <murton.liu@amd.com> | 2019-07-02 18:32:19 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-07-18 22:27:25 +0300 |
commit | 54eef8a411699779fdbb1a2cd333f1b914bd5699 (patch) | |
tree | f1b1b6a5e450102882db5625b8ce497c4e09ac84 /drivers/gpu/drm/amd/display/dc/gpio | |
parent | 925f566cb7aedbcf26005035cf894ec824e8ca2f (diff) | |
download | linux-54eef8a411699779fdbb1a2cd333f1b914bd5699.tar.xz |
drm/amd/display: Change offset_to_id to reflect what id_to_offset returns
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@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/gpio')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_translate_dcn20.c | 2 | ||||
-rw-r--r-- | 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 5b02db13eb2a..a7bc3ee5dfec 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c @@ -150,14 +150,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); |