| .. | .. |
|---|
| 352 | 352 | uint32_t count = 0; |
|---|
| 353 | 353 | unsigned int table_index = 0; |
|---|
| 354 | 354 | bool find_valid = false; |
|---|
| 355 | + struct atom_gpio_pin_assignment *pin; |
|---|
| 355 | 356 | |
|---|
| 356 | 357 | if (!info) |
|---|
| 357 | 358 | return BP_RESULT_BADINPUT; |
|---|
| .. | .. |
|---|
| 379 | 380 | - sizeof(struct atom_common_table_header)) |
|---|
| 380 | 381 | / sizeof(struct atom_gpio_pin_assignment); |
|---|
| 381 | 382 | |
|---|
| 383 | + pin = (struct atom_gpio_pin_assignment *) header->gpio_pin; |
|---|
| 384 | + |
|---|
| 382 | 385 | for (table_index = 0; table_index < count; table_index++) { |
|---|
| 383 | | - if (((record->i2c_id & I2C_HW_CAP) == ( |
|---|
| 384 | | - header->gpio_pin[table_index].gpio_id & |
|---|
| 385 | | - I2C_HW_CAP)) && |
|---|
| 386 | | - ((record->i2c_id & I2C_HW_ENGINE_ID_MASK) == |
|---|
| 387 | | - (header->gpio_pin[table_index].gpio_id & |
|---|
| 388 | | - I2C_HW_ENGINE_ID_MASK)) && |
|---|
| 389 | | - ((record->i2c_id & I2C_HW_LANE_MUX) == |
|---|
| 390 | | - (header->gpio_pin[table_index].gpio_id & |
|---|
| 391 | | - I2C_HW_LANE_MUX))) { |
|---|
| 386 | + if (((record->i2c_id & I2C_HW_CAP) == (pin->gpio_id & I2C_HW_CAP)) && |
|---|
| 387 | + ((record->i2c_id & I2C_HW_ENGINE_ID_MASK) == (pin->gpio_id & I2C_HW_ENGINE_ID_MASK)) && |
|---|
| 388 | + ((record->i2c_id & I2C_HW_LANE_MUX) == (pin->gpio_id & I2C_HW_LANE_MUX))) { |
|---|
| 392 | 389 | /* still valid */ |
|---|
| 393 | 390 | find_valid = true; |
|---|
| 394 | 391 | break; |
|---|
| 395 | 392 | } |
|---|
| 393 | + pin = (struct atom_gpio_pin_assignment *)((uint8_t *)pin + sizeof(struct atom_gpio_pin_assignment)); |
|---|
| 396 | 394 | } |
|---|
| 397 | 395 | |
|---|
| 398 | 396 | /* If we don't find the entry that we are looking for then |
|---|
| .. | .. |
|---|
| 408 | 406 | info->i2c_slave_address = record->i2c_slave_addr; |
|---|
| 409 | 407 | |
|---|
| 410 | 408 | /* TODO: check how to get register offset for en, Y, etc. */ |
|---|
| 411 | | - info->gpio_info.clk_a_register_index = |
|---|
| 412 | | - le16_to_cpu( |
|---|
| 413 | | - header->gpio_pin[table_index].data_a_reg_index); |
|---|
| 414 | | - info->gpio_info.clk_a_shift = |
|---|
| 415 | | - header->gpio_pin[table_index].gpio_bitshift; |
|---|
| 409 | + info->gpio_info.clk_a_register_index = le16_to_cpu(pin->data_a_reg_index); |
|---|
| 410 | + info->gpio_info.clk_a_shift = pin->gpio_bitshift; |
|---|
| 416 | 411 | |
|---|
| 417 | 412 | return BP_RESULT_OK; |
|---|
| 418 | 413 | } |
|---|