GPIO control on the mm6108
take this with a grain of salt, but I believe the only way to control GPIOs is through definitions in the BCF files. at least for the mm6108.
From the BCF Manipulation Tool User Guide
This document gives instructions on how to use the BCF Manipulation Tool to edit a Morse
Micro Board Configuration File (BCF). A BCF is used to configure various parameters of the
Morse Micro chipsets such as the radio transmit power, MCS power levels, GPIO states,
Front-EndModule(FEM) controls, along with regional specific limits.
A BCF is used to configure various parameters of the
Morse Micro chipsets such […] GPIO states […].
How one would control that GPIO once configured in the BCF I don’t know.
But my guess would be that this is done with vendor specific action frames as used by the wake action.
GPIO control on the mm8108
for the mm8108 there seems to be an interface to control gpios directly through register commands.
the hw struct defines:
morse_driver/hw.h
struct morse_hw_cfg {
const struct morse_hw_regs *regs;
// ... omitted ...
/**
* Initialise gpio for output
*
* @return error code
*/
int (*gpio_enable_output)(struct morse *mors, int pin_num, bool enable);
/**
* Set or clear gpio output
*/
void (*gpio_write_output)(struct morse *mors, int pin_num, bool value);
// ... omitted ...
morse_driver/mm8108.c
struct morse_hw_cfg mm8108_cfg = {
// ... omitted ...
.gpio_enable_output = mm810x_gpio_enable_output,
.gpio_write_output = mm810x_gpio_write_output,
// ... omitted ...
};
morse_driver/mm8108.c
static int mm810x_gpio_enable_output(struct morse *mors, int pin_num, bool enable)
{
int ret;
u32 write_addr = enable ? MM8108_REG_GPIO_OUTPUT_EN_SET_ADDR
: MM8108_REG_GPIO_OUTPUT_EN_CLR_ADDR;
morse_claim_bus(mors);
ret = morse_reg32_write(mors, write_addr, 0x1 << pin_num);
morse_release_bus(mors);
if (ret < 0)
MORSE_WARN(mors, "Output enable on GPIO %d failed\n", pin_num);
return ret;
}
static void mm810x_gpio_write_output(struct morse *mors, int pin_num, bool active)
{
u32 write_addr = active ? MM8108_REG_GPIO_OUTPUT_VALUE_SET_ADDR
: MM8108_REG_GPIO_OUTPUT_VALUE_CLR_ADDR;
morse_claim_bus(mors);
morse_reg32_write(mors, write_addr, 0x1 << pin_num);
morse_release_bus(mors);
}
the above interface is used by the led module.
my guess would be that one could define an “LED” with the USER_DEF register control it as a gpio.
although this probably doesn’t provide the necessary control authority over the gpio you’re looking for.
/**
* LED behaviour configuration
* - DISABLED does not initialise the LED
* - HOST is controlled directly by the driver and indicates that the chip has been
* correctly initialised
* The remaining five options register the LED with the kernel subsystem LED callbacks
* - TX and RX indicate there is network traffic
* - ASSOC indicates that the station has associated (STA only)
* - RADIO indicates that the RF is up/down
* - USER_DEF registers the LED with mac80211 but does not set a default behaviour
* All of the mac80211-registered configurations can be configured and controlled in
* userspace in /sys/class/leds/<led_name>
*/