Activate gpio expander


#1

hello, how can i activate gpio expander to enable the muxing between the SD card and iot0 on mangored?

thanks;


IoT card GPIO access
#2

To enbale gpio expander service just uncomment the line in the sdef file containing the expanderService app of the system build and make it.


#3

Thanks a lot for the quick response.

I tried that but not sure how to make it work.
I think when the sdio is switched to iot0 the d401 led supposed to be on which didn’t happened.

I saw there is the user tool gpioexp that was added to the red board but not sure how to use it…

Will be glad for more tips how to make the sdio switched to iot0…


#4

Changing the SDIO mux does not affect any LEDs on the mangOH Red. Unfortunately, the GPIO situation is still a bit of a mess. I have been pleading with the Sierra Wireless Linux reference team to help fix this for a long time, but I haven’t been able to get a commitment. Currently, the mangOH SDEF creates a kernel device controlled by the sx150x device driver to control the sx1509 GPIO expander. On top of that there’s a platform driver called led which allows the card detect LED to be controlled from userspace using sysfs. GpioExpanderService was a previous approach which uses a userspace driver to control the sx1509 so that Legato apps can manipulate GPIOs on the expander. This approach is incompatible with the current approach because it’s dangerous to have two drivers controlling the same device.


#5

Yes, this situation really needs an improvement. The labels and the workarounds create conflicts using the expander service.


#6

So after uncomment and build gpio expanderservice should I do anything else to activate the mux to iot0 or it will be the default state?

How can check it was changed to alternate configuration?

Thanks a lot


#7

You have to write an app which binds to the gpioExpanderService and then configures that GPIO as an output and set it to the correct output level. There is some sample code here that might help: https://github.com/mangOH/mangOH/tree/master/samples/tutorials/mangOH_Red/gpio/TimerLed


#8

Can the muxing be done using the gpioexp app that already on board?


#9

I believe gpioexp could be used to control the mux as well. However that program is basically it’s own driver as well, so it’s going to step on top of any other driver trying to control the sx1509.


#10

Thanks for the support…
I used the gpioexp and think i changed the mux (using the gpio 9 set to low) to iot0 on mango red, but can’t use it yet…

Could it be that we need to get the sdio driver to rescan the hw added on iot0 or something? If so how can it be done?

Thanks


#11

gpioexp was written for mangoh green. Are you saying it works for you?


#12

Yes I even got some led on using this tool…


#13

still on the subject please:

Is there is a way to make the gpio9 (select sdio mux to expander) to be the default on boot, using some configuration on DTS files or something?

thanks


#14

@nanomen in regards to rescan - Actually, 2 different drivers and there associated SDIO controllers exist. The WP76/77 series has a built-in driver that sits in 1-sec. poll loop scanning forever, but once it finds any device across SDIO it never rescans - to cause re-scanning needs some changes to the Linux Reference code SDHCI-MSM driver. Whereas on the WP85 series it scans at boot and never rescans, you can just load & unload the driver (by rmmod msm_sdcc; modprobe msm_sdcc) to start the rescan. Thus, it depends.


#15

Is there is a way to make the gpio9 (select sdio mux to expander) to be the default on boot, using some configuration on DTS files or something?

The platform data associated with the sx150x driver doesn’t allow for the ports to be configured as outputs. It should be possible to add a few lines of code to the mangOH_red driver to configure that specific GPIO as an output and write the appropriate value to it though.