Commit 99440286 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-fixes-for-6.2a' of...

Merge tag 'iio-fixes-for-6.2a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:
  "1st set of IIO fixes for the 6.2 cycle.

   The usual mixed bag - with a bunch of issues found by Carlos Song
   in the fxos8700 IMU driver dominating.

   hid-accel,gyro
    - Fix wrong returned value when read succeeds.
   marvell,berlin-adc
    - Missing of_node_put() in an error path.
   nxp,fxos8700 (freescale)
    - Wrong channel type match.
    - Swapped channel read back.
    - Incomplete channel read back (not enough bytes).
    - Missing shift of acceleration data.
    - Range selection didn't work (datasheet bug)
    - Wrong ODR mode read back due to wrong field offset.
    - Drop unused, but wrong define.
    - Fix issue with magnetometer scale an units.
   nxp,imx8qxp
    - Fix an irq flood due to not reading data early enough.
   st,lsm6dsx
    - Add CONFIG_IIO_TRIGGERED_BUFFER select.
   st,stm32-adc
    - Fix missing MODULE_DEVICE_TABLE() needed for module aliases.
   ti,twl6030
    - Fix missing enable of some channels.
    - Fix a typo in previous patch that meant one channel still wasn't enabled.
   xilinx,xadc
    - Carrying on incorrectly after allocation error."

* tag 'iio-fixes-for-6.2a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: imu: fxos8700: fix MAGN sensor scale and unit
  iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN
  iio: imu: fxos8700: fix failed initialization ODR mode assignment
  iio: imu: fxos8700: fix incorrect ODR mode readback
  iio: light: cm32181: Fix PM support on system with 2 I2C resources
  iio: hid: fix the retval in gyro_3d_capture_sample
  iio: hid: fix the retval in accel_3d_capture_sample
  iio: imu: st_lsm6dsx: fix build when CONFIG_IIO_TRIGGERED_BUFFER=m
  iio:adc:twl6030: Enable measurement of VAC
  iio: imu: fxos8700: fix ACCEL measurement range selection
  iio: imu: fxos8700: fix IMU data bits returned to user space
  iio: imu: fxos8700: fix incomplete ACCEL and MAGN channels readback
  iio: imu: fxos8700: fix swapped ACCEL and MAGN channels readback
  iio: imu: fxos8700: fix map label of channel type to MAGN sensor
  iio:adc:twl6030: Enable measurements of VUSB, VBAT and others
  iio: imx8qxp-adc: fix irq flood when call imx8qxp_adc_read_raw()
  iio: adc: xilinx-ams: fix devm_krealloc() return value check
  iio: adc: berlin2-adc: Add missing of_node_put() in error path
  iio: adc: stm32-dfsdm: fill module aliases
parents bf29ce87 2acd0313
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
			hid_sensor_convert_timestamp(
					&accel_state->common_attributes,
					*(int64_t *)raw_data);
		ret = 0;
	break;
	default:
		break;
+3 −1
Original line number Diff line number Diff line
@@ -298,8 +298,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
	int ret;

	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
	if (!indio_dev)
	if (!indio_dev) {
		of_node_put(parent_np);
		return -ENOMEM;
	}

	priv = iio_priv(indio_dev);

+9 −2
Original line number Diff line number Diff line
@@ -86,6 +86,8 @@

#define IMX8QXP_ADC_TIMEOUT		msecs_to_jiffies(100)

#define IMX8QXP_ADC_MAX_FIFO_SIZE		16

struct imx8qxp_adc {
	struct device *dev;
	void __iomem *regs;
@@ -95,6 +97,7 @@ struct imx8qxp_adc {
	/* Serialise ADC channel reads */
	struct mutex lock;
	struct completion completion;
	u32 fifo[IMX8QXP_ADC_MAX_FIFO_SIZE];
};

#define IMX8QXP_ADC_CHAN(_idx) {				\
@@ -238,8 +241,7 @@ static int imx8qxp_adc_read_raw(struct iio_dev *indio_dev,
			return ret;
		}

		*val = FIELD_GET(IMX8QXP_ADC_RESFIFO_VAL_MASK,
				 readl(adc->regs + IMX8QXP_ADR_ADC_RESFIFO));
		*val = adc->fifo[0];

		mutex_unlock(&adc->lock);
		return IIO_VAL_INT;
@@ -265,10 +267,15 @@ static irqreturn_t imx8qxp_adc_isr(int irq, void *dev_id)
{
	struct imx8qxp_adc *adc = dev_id;
	u32 fifo_count;
	int i;

	fifo_count = FIELD_GET(IMX8QXP_ADC_FCTRL_FCOUNT_MASK,
			       readl(adc->regs + IMX8QXP_ADR_ADC_FCTRL));

	for (i = 0; i < fifo_count; i++)
		adc->fifo[i] = FIELD_GET(IMX8QXP_ADC_RESFIFO_VAL_MASK,
				readl_relaxed(adc->regs + IMX8QXP_ADR_ADC_RESFIFO));

	if (fifo_count)
		complete(&adc->completion);

+1 −0
Original line number Diff line number Diff line
@@ -1520,6 +1520,7 @@ static const struct of_device_id stm32_dfsdm_adc_match[] = {
	},
	{}
};
MODULE_DEVICE_TABLE(of, stm32_dfsdm_adc_match);

static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
{
+32 −0
Original line number Diff line number Diff line
@@ -57,6 +57,18 @@
#define TWL6030_GPADCS				BIT(1)
#define TWL6030_GPADCR				BIT(0)

#define USB_VBUS_CTRL_SET			0x04
#define USB_ID_CTRL_SET				0x06

#define TWL6030_MISC1				0xE4
#define VBUS_MEAS				0x01
#define ID_MEAS					0x01

#define VAC_MEAS                0x04
#define VBAT_MEAS               0x02
#define BB_MEAS                 0x01


/**
 * struct twl6030_chnl_calib - channel calibration
 * @gain:		slope coefficient for ideal curve
@@ -927,6 +939,26 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
		return ret;
	}

	ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET);
	if (ret < 0) {
		dev_err(dev, "failed to wire up inputs\n");
		return ret;
	}

	ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET);
	if (ret < 0) {
		dev_err(dev, "failed to wire up inputs\n");
		return ret;
	}

	ret = twl_i2c_write_u8(TWL6030_MODULE_ID0,
				VBAT_MEAS | BB_MEAS | VAC_MEAS,
				TWL6030_MISC1);
	if (ret < 0) {
		dev_err(dev, "failed to wire up inputs\n");
		return ret;
	}

	indio_dev->name = DRIVER_NAME;
	indio_dev->info = &twl6030_gpadc_iio_info;
	indio_dev->modes = INDIO_DIRECT_MODE;
Loading