diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/intel/common/block/gpio/gpio.c | 12 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/gpio.h | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index d49742d1b5..625c3f4355 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -1068,8 +1068,16 @@ bool gpio_get_vw_info(gpio_t pad, unsigned int *vw_index, unsigned int *vw_bit) if (i == comm->num_vw_entries) return false; - offset += pad - comm->vw_entries[i].first_pad; - *vw_index = comm->vw_base + offset / 8; + /* Adjust offset and calculate vw_index based on the mapping type */ + if (comm->vw_map) { + offset = pad - comm->vw_entries[i].first_pad; + offset += comm->vw_map[i].start_pos; + *vw_index = comm->vw_map[i].base + offset / 8; + } else { + offset += pad - comm->vw_entries[i].first_pad; + offset += comm->vw_base; + *vw_index = offset / 8; + } *vw_bit = offset % 8; return true; diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index 39d17a199a..a501f7fd54 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -110,6 +110,12 @@ struct vw_entries { gpio_t last_pad; }; +/* virtual-wire mapping base and the starting bit position for a group */ +struct vw_map { + uint8_t base; + uint8_t start_pos; +}; + /* This structure will be used to describe a community or each group within a * community when multiple groups exist inside a community */ @@ -152,6 +158,7 @@ struct pad_community { * which they map to VW indexes (beginning with VW base) */ const struct vw_entries *vw_entries; + const struct vw_map *vw_map; size_t num_vw_entries; }; |