Pergunta

I am trying to use a driver with a gpio interrupt on BeagleboneBlack. My device tree has the following entry for my custom device:

&i2c1{...

mydevice: mydevice@0c {
    compatible = "mydevice,mydeice";
    reg = <0x0c>;
    mag_irq_gpio = <&gpio1 13 0>; /* INT line */ 
};
...}

Its driver counterpart has this:

static int parse_dt(struct i2c_client *client)
{
    struct device_node *node = client->dev.of_node;
    struct mydev_data *data = i2c_get_clientdata(client);

    return of_property_read_u32(node, "mag_irq_gpio", &data->gpio);
} 

The driver loads and works fine, except the gpio number is completely wrong. The property read function returns success, and reads 8 as the gpio number, even if I put a different number to the device tree.

How am I supposed to pass a gpio number as generic data? The interrupt works if I manually override the gpio number inside my driver.

Foi útil?

Solução

As per comment by @sawdust

<&gpio1 13 0>

denotes an array of three values. I solved the issue by manually calculating the GPIO number and passing it as a single number:

<14>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top