/* The chip gives us an interrupt when the ON pin is asserted but we then need to poll to see when the pin is deasserted.  */
static void wm831x_poll_on(struct work_struct *work)
/* The chip gives us an interrupt when the ON pin is asserted but we then need to poll to see when the pin is deasserted.  */
static void wm831x_poll_on(struct work_struct *work)
{
	struct wm831x_on *wm831x_on = container_of(work, struct wm831x_on,
						   work.work);
	struct wm831x *wm831x = wm831x_on->wm831x;
	int poll, ret;
	ret = wm831x_reg_read(wm831x, WM831X_ON_PIN_CONTROL);
	if (ret >= 0) {
		poll = !(ret & WM831X_ON_PIN_STS);
		input_report_key(wm831x_on->dev, KEY_POWER, poll);
		input_sync(wm831x_on->dev);
	} else {
		dev_err(wm831x->dev, "Failed to read ON status: %d\n", ret);
		poll = 1;
	}
	if (poll)
		schedule_delayed_work(&wm831x_on->work, 100);
}