Commit cab85ead authored by Nuno Sá's avatar Nuno Sá Committed by Jonathan Cameron
Browse files

iio: adis16475: make use of the new unmasked_drdy flag



The library can now handle enabling/disabling IRQs for devices that
cannot unmask the data ready pin. Hence there's no need to provide an
'enable_irq' callback anymore.

The library will also automatically request the IRQ with 'IRQF_NO_AUTOEN'
so that we can also remove that from the driver.

Signed-off-by: default avatarNuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-4-nuno.sa@analog.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 31fa357a
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
@@ -606,20 +606,6 @@ static const char * const adis16475_status_error_msgs[] = {
	[ADIS16475_DIAG_STAT_CLK] = "Clock error",
};

static int adis16475_enable_irq(struct adis *adis, bool enable)
{
	/*
	 * There is no way to gate the data-ready signal internally inside the
	 * ADIS16475. We can only control it's polarity...
	 */
	if (enable)
		enable_irq(adis->spi->irq);
	else
		disable_irq(adis->spi->irq);

	return 0;
}

#define ADIS16475_DATA(_prod_id, _timeouts)				\
{									\
	.msc_ctrl_reg = ADIS16475_REG_MSG_CTRL,				\
@@ -640,7 +626,7 @@ static int adis16475_enable_irq(struct adis *adis, bool enable)
		BIT(ADIS16475_DIAG_STAT_SENSOR) |			\
		BIT(ADIS16475_DIAG_STAT_MEMORY) |			\
		BIT(ADIS16475_DIAG_STAT_CLK),				\
	.enable_irq = adis16475_enable_irq,				\
	.unmasked_drdy = true,						\
	.timeouts = (_timeouts),					\
	.burst_reg_cmd = ADIS16475_REG_GLOB_CMD,			\
	.burst_len = ADIS16475_BURST_MAX_DATA,				\
@@ -1254,9 +1240,6 @@ static int adis16475_config_irq_pin(struct adis16475 *st)
		return -EINVAL;
	}

	/* We cannot mask the interrupt so ensure it's not enabled at request */
	st->adis.irq_flag |= IRQF_NO_AUTOEN;

	val = ADIS16475_MSG_CTRL_DR_POL(polarity);
	ret = __adis_update_bits(&st->adis, ADIS16475_REG_MSG_CTRL,
				 ADIS16475_MSG_CTRL_DR_POL_MASK, val);