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>
 {
        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:
 
        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);