Skip to contentSkip to conversation

use_gpio_descriptor with a runtime-added table

DISCUSSION Marco Sirabella 1 participant 2 messages Mar 11, 2024 SPI

lore
Share & tools
lore
#0 lore raw

Hi,

let me know if there's a better place to ask for help.

I'm registering a controller and trying to take advantage of:

    master->use_gpio_descriptors = true

but the gpio table with the auto-lookup "cs" is being registered at runtime with gpiod_add_lookup_table (kind of like how spi-bcm2835 does it).

My issue is basically that table.dev_id doesn't have a value that it can be set to until halfway through the devm_spi_register_controller call with the dev_set_name and by then I can't update the table's dev_id for it to be found via the gpio handling in the second half of the register_controller call.

My current workaround is to statically assign a master->bus_num and use that but I'm pretty sure that's not what it's intended for.

Any tips? I have a patch that might fix this but don't want to jump the gun if I'm just doing something wrong.

Signature · 1 line
Marco Sirabella
#1 lore raw

Hi,

let me know if there's a better place to ask for help.

I'm registering a controller and trying to take advantage of:

    master->use_gpio_descriptors = true

but the gpio table with the auto-lookup "cs" is being registered at runtime with gpiod_add_lookup_table (kind of like how spi-bcm2835 does it).

My issue is basically that table.dev_id doesn't have a value that it can be set to until halfway through the devm_spi_register_controller call with the dev_set_name and by then I can't update the table's dev_id for it to be found via the gpio handling in the second half of the register_controller call.

My current workaround is to statically assign a master->bus_num and use that but I'm pretty sure that's not what it's intended for.

Any tips? I have a patch that might fix this but don't want to jump the gun if I'm just doing something wrong.

--
Marco Sirabella