Can't get events from nPM1300 MFD

I would like to get the events offered by the mfd driver for VBUS detect but for some reason my callback is never triggered.

I'm doing this atm:

static void pmic_evt_cb(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
    LOG_INF("PMIC Event: %d\n", pins);
}

main:

if (!device_is_ready(pmic)) {
LOG_ERR("PMIC device not ready.\n");
return;
}
static struct gpio_callback event_cb;
gpio_init_callback(&event_cb, pmic_evt_cb, BIT(NPM1300_EVENT_VBUS_DETECTED));
mfd_npm1300_add_callback(pmic, &event_cb);


Devicetree:

npm1300_pmic: npm1300@6b {
	status = "okay";
	compatible = "nordic,npm1300";
	reg = <0x6b>;
	host-int-gpios = <&gpio1 9 0>;
	pmic-int-pin = <0>;
	
	...

Loosely following the EK sample.
Removing and attaching VBUS does not trigger my callback as I would expect. Is there something that needs to be configured to enable them?
I'm using NCS2.7

Parents Reply
  • I found the issue but not quite sure what exactly the cause is. In a hunch I removed the GPIO device definition that I had copied from the EK shield overlay. Without that it starts to work.

    npm1300_gpio: gpio-controller {
    compatible = "nordic,npm1300-gpio";
    gpio-controller;
    #gpio-cells = <2>;
    ngpios = <5>;
    };

    Is the GPIO driver mutually exclusive to getting event interrupts or is it clashing in other ways with the mfd driver?
    I don't need the GPIO controller in this application so its fine but I would like to understand what went wrong here in the future. I don't quite understand what the gpio-cells and ngpios property tell the driver in the context of the nPM1300.

Children
Related