> Hi Arnaud,
> Glad to hear you find this approach reasonable.
> To be more specific, I’m proposing to do the following modifications for the
> protocol:
>
> - remove the “id” field (Message ID Code)
> - remove the “reserved[5]” field
> - and also reorder the fields so that port_idx appears before pin_idx
>
> If you think additional fields should be removed or adjusted, please let me
> know.
I would squash head and body into one. Remove vendor and version. Do
we need both cmd and type? It seems like they can be combined. And is
port_idx needed? Don't you just instantiate more instances of the
device, one per port. That is how you would do it with MMIO GPIOs.
struct gpio_rpmsg_packet {
u8 cmd;
u8 pin;
union {
u8 event;
u8 retcode;
u8 value;
} out;
union {
u8 wakeup;
u8 value;
} in;
}
4 bytes, a nice size.
#define GPIO_RPMSG_CMD_DIR_INPUT 1
#define GPIO_RPMSG_CMD_DIR_OUTPUT 2
#define GPIO_RPMSG_CMD_GET_DIR 3
#define GPIO_RPMSG_CMD_GET 4
#define GPIO_RPMSG_CMD_SET 5
These map onto the gpio_chip ops. And i leave space for the _multiple
ops if they are needed in the future.
#define GPIO_PRMSG_CMD_INTR_CONFIG 32
#define GPIO_PRMSG_CMD_INTR_EVENT 33
And then interrupt handling. These are less obvious, struct irq_chip
has a lot more ops, so i'm not very confident this is sufficient.
Andrew