hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
....@@ -352,6 +352,7 @@
352352 uint32_t count = 0;
353353 unsigned int table_index = 0;
354354 bool find_valid = false;
355
+ struct atom_gpio_pin_assignment *pin;
355356
356357 if (!info)
357358 return BP_RESULT_BADINPUT;
....@@ -379,20 +380,17 @@
379380 - sizeof(struct atom_common_table_header))
380381 / sizeof(struct atom_gpio_pin_assignment);
381382
383
+ pin = (struct atom_gpio_pin_assignment *) header->gpio_pin;
384
+
382385 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))) {
392389 /* still valid */
393390 find_valid = true;
394391 break;
395392 }
393
+ pin = (struct atom_gpio_pin_assignment *)((uint8_t *)pin + sizeof(struct atom_gpio_pin_assignment));
396394 }
397395
398396 /* If we don't find the entry that we are looking for then
....@@ -408,11 +406,8 @@
408406 info->i2c_slave_address = record->i2c_slave_addr;
409407
410408 /* 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;
416411
417412 return BP_RESULT_OK;
418413 }