Example #1
0
static int inv_ami306_postenable(struct iio_dev *indio_dev)
{
	struct inv_ami306_state_s *st = iio_priv(indio_dev);
	int result;

	result = set_ami306_enable(indio_dev, true);
	schedule_delayed_work(&st->work,
		msecs_to_jiffies(st->delay));
	return 0;
}
Example #2
0
static int inv_ami306_postenable(struct iio_dev *indio_dev)
{
	struct inv_ami306_state_s *st = iio_priv(indio_dev);
	struct iio_buffer *ring = indio_dev->buffer;
	int result;

	/* when all the outputs are disabled, even though buffer/enable is on,
	   do nothing */
	if (!(iio_scan_mask_query(indio_dev, ring, INV_AMI306_SCAN_MAGN_X) ||
	    iio_scan_mask_query(indio_dev, ring, INV_AMI306_SCAN_MAGN_Y) ||
	    iio_scan_mask_query(indio_dev, ring, INV_AMI306_SCAN_MAGN_Z)))
		return 0;

	result = set_ami306_enable(indio_dev, true);
	if (result)
		return result;
	schedule_delayed_work(&st->work, msecs_to_jiffies(st->delay));

	return 0;
}