History log of /linux-master/drivers/iio/adc/mcp3564.c
Revision Date Author Comments
# 408d4b33 29-Nov-2023 Marius Cristea <marius.cristea@microchip.com>

iio: adc: MCP3564: fix hardware identification logic

In mcp3564_config() fix the hardware identification logic
based on the hardware ID registers. Second part of the code was
disabled by an logic error.
Fix a typo related to the "MODULE_DESCRIPTION".

Fixes: 33ec3e5fc1ea (iio: adc: adding support for MCP3564 ADC)
Signed-off-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20231129135619.63475-1-marius.cristea@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 85ac6d92 01-Dec-2023 Javier Carrasco <javier.carrasco.cruz@gmail.com>

iio: adc: MCP3564: fix calib_bias and calib_scale range checks

The current implementation uses the AND (&&) operator to check if the
value to write for IIO_CHAN_INFO_CALIBBIAS and IIO_CHAN_INFO_CALIBSCALE
is within the valid ranges.
The evaluated values are the lower and upper limits of the ranges,
so this operation always evaluates to false.

The OR (||) operator must be used instead.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20231201-mcp3564_range_checks-v1-1-68f4436e22b0@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 349c1b49 13-Oct-2023 Marius Cristea <marius.cristea@microchip.com>

iio: adc: MCP3564: fix warn: unsigned '__x' is never less than zero.

The patch 33ec3e5fc1ea: "iio: adc: adding support for MCP3564 ADC"
leads to the following Smatch static checker warning:

smatch warnings:
drivers/iio/adc/mcp3564.c:1105 mcp3564_fill_scale_tbls() warn: unsigned '__x' is never less than zero.

vim +/__x +1105 drivers/iio/adc/mcp3564.c

1094
1095 static void mcp3564_fill_scale_tbls(struct mcp3564_state *adc)
1096 {
.....
1103 for (i = 0; i < MCP3564_MAX_PGA; i++) {
1104 ref = adc->vref_mv;
> 1105 tmp1 = shift_right((u64)ref * NANO, pow);
1106 div_u64_rem(tmp1, NANO, &tmp0);
1107
.....
1113 }

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309280738.NWjVfVt4-lkp@intel.com/
Fixes: 33ec3e5fc1ea (iio: adc: adding support for MCP3564 ADC)
Signed-off-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20231013132333.10582-1-marius.cristea@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# efea15e3 18-Sep-2023 Marius Cristea <marius.cristea@microchip.com>

iio: adc: MCP3564: fix the static checker warning

The patch 33ec3e5fc1ea: "iio: adc: adding support for MCP3564 ADC"
from Aug 29, 2023 (linux-next), leads to the following Smatch static
checker warning:

        drivers/iio/adc/mcp3564.c:1426 mcp3564_probe()
        warn: address of NULL pointer 'indio_dev'

drivers/iio/adc/mcp3564.c
1421 struct iio_dev *indio_dev;
1422 struct mcp3564_state *adc;
1423
1424 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc));
1425 if (!indio_dev) {
--> 1426 dev_err_probe(&indio_dev->dev, PTR_ERR(indio_dev),
^^^^^^^^^^^^^^^

Fixes: 33ec3e5fc1ea (iio: adc: adding support for MCP3564 ADC)
Signed-off-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20230918075633.1884-1-marius.cristea@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 33ec3e5f 29-Aug-2023 Marius Cristea <marius.cristea@microchip.com>

iio: adc: adding support for MCP3564 ADC

This is the iio driver for Microchip family of 153.6 ksps,
Low-Noise 16/24-Bit Delta-Sigma ADCs with an SPI interface
(Microchip's MCP3461, MCP3462, MCP3464, MCP3461R, MCP3462R,
MCP3464R, MCP3561, MCP3562, MCP3564, MCP3561R,
MCP3562R and MCP3564R analog to digital converters).

Signed-off-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20230829154133.40716-3-marius.cristea@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>