IIO: 1st set of fixes for the 6.8 cycle

Usual mixed bag of issues introduced this cycle and fixes for long term
 issues that have been identified recently + one case where I messed up
 a merge resolution and dropped the build file changes.
 
 Most important is the userspace ABI fix for the iio_modifier enum
 where we accidentally added new entries in the middle rather than at
 the end.
 
 IIO Core
  - Close a memory leak in an error path.
  - Move LIGHT_UVA and LIGHT_UVB definitions to end of the iio_modifier
    enum to avoid breaking older userspace. (not yet in a released kernel
    thankfully).
 
 adi,adis
  - Fix a DMA buffer alignment issue that was missing in series that fixed
    these across IIO.
 
 adi,ad-sigma-delta
  - Fix a DMA buffer alignment issue that was missing in series that fixed
    these across IIO.
 
 adi,ad4130
  - Zero init remaining fields of clock init data.
  - Only set GPIO control bits on pins that aren't in use for anything else.
 
 adi,ad5933
  - Fix an old bug due to type mismatch. This is a rare device so good to
    get some new test coverage.
 
 adi,ad7091r
  - Use right variable for an error return code.
 
 bosch,bma400
  - Add missing CONFIG_REGMAP_I2C dependency.
 
 bosch,bmp280:
  - Add missing bmp085 ID to the SPI table to avoid mismatch with the
    of_device_id table.
 
 hid-sensors:
  - Avoid returning an error for timestamp read back that succeeds.
 
 pni,rm3100
  - Check value read from RM31000_REG_TMRC register is valid before using
    it. Hardening  to avoid a real world issue seen on some faulty hardware.
 
 st,st-sensors
  - Fix a DMA buffer alignment issue that was missing in series that fixed
    these across IIO.
 
 ti,hdc3020
  - Add missing Kconfig and Makefile entrees accidentally dropped when patches
    were applied.
  - Fix wrong temperature offset (negated)
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmXI+e4RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohgNg//VnWVGDquObS2aElYRSiV68MnNGsGlUto
 kbYkNT7TRdNPqtjUHOPajBwxmSM/oNPyUFJyreLJuYFj6MenR4Cdxr1ZOkGTAsx0
 zY89WMXkHiYHd7LSb3CNjm+xrvbDnPGq2iZTrSiHWLvbAgeYHFurRvRnqUJ9/o5E
 TxNl3Cn0IVJAs10uur21Rom9WTJYasmRNhMpQoyeWHtioqTHYrvFAb7/jIuYJGFW
 ctZqV5rY6LxxxlZQ3rNgR1aV6FAV4S8WX1Bx/Uc2xdlyYEpvVn4aFDZ0GTyQSHN8
 6x9k1nNqvL5bCRCJTPW4oa+TUYYOmJkJGfFgP3bXVsHyebBN9v/2sAePMaitIi3c
 xdcM41dUJY7wz7/dV2KAO9bXcA9MCHq5FjtuLFuf8IrcRePohogu+wui3HANdjDJ
 fDX4vmtPtdoW5mhKbnnc10HVkQ40xyM9+Wpe5mU2DYQ9LKE9syMI65SfVhQ8xUcN
 SMt1HhBSA7EmVQSkLWVKeOPfLAy2M3zDeQK987n7b1yGHDmc/L/hf0vw8MGNK1m3
 vGdrpsD3K6affVOSOgyt9PNREWPMYjvz2O+qVFfvvPcTOtEh1szJN3OkxO0SgFkT
 Tsf+aoH5UUFw+/Qf8Abh3vpf3hg+bWRoIBmMsduw//8yFnuU6DQZeNMbhFxW1frc
 Jb0u+590MiU=
 =Y9n7
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-6.8a' of http://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

IIO: 1st set of fixes for the 6.8 cycle

Usual mixed bag of issues introduced this cycle and fixes for long term
issues that have been identified recently + one case where I messed up
a merge resolution and dropped the build file changes.

Most important is the userspace ABI fix for the iio_modifier enum
where we accidentally added new entries in the middle rather than at
the end.

IIO Core
 - Close a memory leak in an error path.
 - Move LIGHT_UVA and LIGHT_UVB definitions to end of the iio_modifier
   enum to avoid breaking older userspace. (not yet in a released kernel
   thankfully).

adi,adis
 - Fix a DMA buffer alignment issue that was missing in series that fixed
   these across IIO.

adi,ad-sigma-delta
 - Fix a DMA buffer alignment issue that was missing in series that fixed
   these across IIO.

adi,ad4130
 - Zero init remaining fields of clock init data.
 - Only set GPIO control bits on pins that aren't in use for anything else.

adi,ad5933
 - Fix an old bug due to type mismatch. This is a rare device so good to
   get some new test coverage.

adi,ad7091r
 - Use right variable for an error return code.

bosch,bma400
 - Add missing CONFIG_REGMAP_I2C dependency.

bosch,bmp280:
 - Add missing bmp085 ID to the SPI table to avoid mismatch with the
   of_device_id table.

hid-sensors:
 - Avoid returning an error for timestamp read back that succeeds.

pni,rm3100
 - Check value read from RM31000_REG_TMRC register is valid before using
   it. Hardening  to avoid a real world issue seen on some faulty hardware.

st,st-sensors
 - Fix a DMA buffer alignment issue that was missing in series that fixed
   these across IIO.

ti,hdc3020
 - Add missing Kconfig and Makefile entrees accidentally dropped when patches
   were applied.
 - Fix wrong temperature offset (negated)

* tag 'iio-fixes-for-6.8a' of http://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: adc: ad4130: only set GPIO_CTRL if pin is unused
  iio: adc: ad4130: zero-initialize clock init data
  iio: accel: bma400: Fix a compilation problem
  iio: commom: st_sensors: ensure proper DMA alignment
  iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
  iio: move LIGHT_UVA and LIGHT_UVB to the end of iio_modifier
  staging: iio: ad5933: fix type mismatch regression
  iio: humidity: hdc3020: fix temperature offset
  iio: adc: ad7091r8: Fix error code in ad7091r8_gpio_setup()
  iio: adc: ad_sigma_delta: ensure proper DMA alignment
  iio: imu: adis: ensure proper DMA alignment
  iio: humidity: hdc3020: Add Makefile, Kconfig and MAINTAINERS entry
  iio: imu: bno055: serdev requires REGMAP
  iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC
  iio: pressure: bmp280: Add missing bmp085 to SPI id table
  iio: core: fix memleak in iio_device_register_sysfs
This commit is contained in:
Greg Kroah-Hartman 2024-02-14 16:19:17 +01:00
commit 23d62fb5d3
17 changed files with 58 additions and 16 deletions

View File

@ -22010,6 +22010,14 @@ F: Documentation/devicetree/bindings/media/i2c/ti,ds90*
F: drivers/media/i2c/ds90*
F: include/media/i2c/ds90*
TI HDC302X HUMIDITY DRIVER
M: Javier Carrasco <javier.carrasco.cruz@gmail.com>
M: Li peiyu <579lpy@gmail.com>
L: linux-iio@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
F: drivers/iio/humidity/hdc3020.c
TI ICSSG ETHERNET DRIVER (ICSSG)
R: MD Danish Anwar <danishanwar@ti.com>
R: Roger Quadros <rogerq@kernel.org>

View File

@ -219,10 +219,12 @@ config BMA400
config BMA400_I2C
tristate
select REGMAP_I2C
depends on BMA400
config BMA400_SPI
tristate
select REGMAP_SPI
depends on BMA400
config BMC150_ACCEL

View File

@ -1821,7 +1821,7 @@ static int ad4130_setup_int_clk(struct ad4130_state *st)
{
struct device *dev = &st->spi->dev;
struct device_node *of_node = dev_of_node(dev);
struct clk_init_data init;
struct clk_init_data init = {};
const char *clk_name;
int ret;
@ -1891,10 +1891,14 @@ static int ad4130_setup(struct iio_dev *indio_dev)
return ret;
/*
* Configure all GPIOs for output. If configured, the interrupt function
* of P2 takes priority over the GPIO out function.
* Configure unused GPIOs for output. If configured, the interrupt
* function of P2 takes priority over the GPIO out function.
*/
val = AD4130_IO_CONTROL_GPIO_CTRL_MASK;
val = 0;
for (i = 0; i < AD4130_MAX_GPIOS; i++)
if (st->pins_fn[i + AD4130_AIN2_P1] == AD4130_PIN_FN_NONE)
val |= FIELD_PREP(AD4130_IO_CONTROL_GPIO_CTRL_MASK, BIT(i));
val |= FIELD_PREP(AD4130_IO_CONTROL_INT_PIN_SEL_MASK, st->int_pin_sel);
ret = regmap_write(st->regmap, AD4130_IO_CONTROL_REG, val);

View File

@ -195,7 +195,7 @@ static int ad7091r8_gpio_setup(struct ad7091r_state *st)
st->reset_gpio = devm_gpiod_get_optional(st->dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(st->reset_gpio))
return dev_err_probe(st->dev, PTR_ERR(st->convst_gpio),
return dev_err_probe(st->dev, PTR_ERR(st->reset_gpio),
"Error on requesting reset GPIO\n");
if (st->reset_gpio) {

View File

@ -48,6 +48,18 @@ config HDC2010
To compile this driver as a module, choose M here: the module
will be called hdc2010.
config HDC3020
tristate "TI HDC3020 relative humidity and temperature sensor"
depends on I2C
select CRC8
help
Say yes here to build support for the Texas Instruments
HDC3020, HDC3021 and HDC3022 relative humidity and temperature
sensors.
To compile this driver as a module, choose M here: the module
will be called hdc3020.
config HID_SENSOR_HUMIDITY
tristate "HID Environmental humidity sensor"
depends on HID_SENSOR_HUB

View File

@ -7,6 +7,7 @@ obj-$(CONFIG_AM2315) += am2315.o
obj-$(CONFIG_DHT11) += dht11.o
obj-$(CONFIG_HDC100X) += hdc100x.o
obj-$(CONFIG_HDC2010) += hdc2010.o
obj-$(CONFIG_HDC3020) += hdc3020.o
obj-$(CONFIG_HID_SENSOR_HUMIDITY) += hid-sensor-humidity.o
hts221-y := hts221_core.o \

View File

@ -322,7 +322,7 @@ static int hdc3020_read_raw(struct iio_dev *indio_dev,
if (chan->type != IIO_TEMP)
return -EINVAL;
*val = 16852;
*val = -16852;
return IIO_VAL_INT;
default:

View File

@ -8,6 +8,7 @@ config BOSCH_BNO055
config BOSCH_BNO055_SERIAL
tristate "Bosch BNO055 attached via UART"
depends on SERIAL_DEV_BUS
select REGMAP
select BOSCH_BNO055
help
Enable this to support Bosch BNO055 IMUs attached via UART.

View File

@ -1584,10 +1584,13 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)
ret = iio_device_register_sysfs_group(indio_dev,
&iio_dev_opaque->chan_attr_group);
if (ret)
goto error_clear_attrs;
goto error_free_chan_attrs;
return 0;
error_free_chan_attrs:
kfree(iio_dev_opaque->chan_attr_group.attrs);
iio_dev_opaque->chan_attr_group.attrs = NULL;
error_clear_attrs:
iio_free_chan_devattr_list(&iio_dev_opaque->channel_attr_list);

View File

@ -226,6 +226,7 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev,
case HID_USAGE_SENSOR_TIME_TIMESTAMP:
als_state->timestamp = hid_sensor_convert_timestamp(&als_state->common_attributes,
*(s64 *)raw_data);
ret = 0;
break;
default:
break;

View File

@ -530,6 +530,7 @@ int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
struct rm3100_data *data;
unsigned int tmp;
int ret;
int samp_rate_index;
indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
if (!indio_dev)
@ -586,9 +587,14 @@ int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
ret = regmap_read(regmap, RM3100_REG_TMRC, &tmp);
if (ret < 0)
return ret;
samp_rate_index = tmp - RM3100_TMRC_OFFSET;
if (samp_rate_index < 0 || samp_rate_index >= RM3100_SAMP_NUM) {
dev_err(dev, "The value read from RM3100_REG_TMRC is invalid!\n");
return -EINVAL;
}
/* Initializing max wait time, which is double conversion time. */
data->conversion_time = rm3100_samp_rates[tmp - RM3100_TMRC_OFFSET][2]
* 2;
data->conversion_time = rm3100_samp_rates[samp_rate_index][2] * 2;
/* Cycle count values may not be what we want. */
if ((tmp - RM3100_TMRC_OFFSET) == 0)

View File

@ -87,6 +87,7 @@ static const struct of_device_id bmp280_of_spi_match[] = {
MODULE_DEVICE_TABLE(of, bmp280_of_spi_match);
static const struct spi_device_id bmp280_spi_id[] = {
{ "bmp085", (kernel_ulong_t)&bmp180_chip_info },
{ "bmp180", (kernel_ulong_t)&bmp180_chip_info },
{ "bmp181", (kernel_ulong_t)&bmp180_chip_info },
{ "bmp280", (kernel_ulong_t)&bmp280_chip_info },

View File

@ -608,7 +608,7 @@ static void ad5933_work(struct work_struct *work)
struct ad5933_state, work.work);
struct iio_dev *indio_dev = i2c_get_clientdata(st->client);
__be16 buf[2];
int val[2];
u16 val[2];
unsigned char status;
int ret;

View File

@ -8,6 +8,8 @@
#ifndef __AD_SIGMA_DELTA_H__
#define __AD_SIGMA_DELTA_H__
#include <linux/iio/iio.h>
enum ad_sigma_delta_mode {
AD_SD_MODE_CONTINUOUS = 0,
AD_SD_MODE_SINGLE = 1,
@ -99,7 +101,7 @@ struct ad_sigma_delta {
* 'rx_buf' is up to 32 bits per sample + 64 bit timestamp,
* rounded to 16 bytes to take into account padding.
*/
uint8_t tx_buf[4] ____cacheline_aligned;
uint8_t tx_buf[4] __aligned(IIO_DMA_MINALIGN);
uint8_t rx_buf[16] __aligned(8);
};

View File

@ -258,9 +258,9 @@ struct st_sensor_data {
bool hw_irq_trigger;
s64 hw_timestamp;
char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned;
struct mutex odr_lock;
char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] __aligned(IIO_DMA_MINALIGN);
};
#ifdef CONFIG_IIO_BUFFER

View File

@ -11,6 +11,7 @@
#include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>
#define ADIS_WRITE_REG(reg) ((0x80 | (reg)))
@ -131,7 +132,7 @@ struct adis {
unsigned long irq_flag;
void *buffer;
u8 tx[10] ____cacheline_aligned;
u8 tx[10] __aligned(IIO_DMA_MINALIGN);
u8 rx[4];
};

View File

@ -91,8 +91,6 @@ enum iio_modifier {
IIO_MOD_CO2,
IIO_MOD_VOC,
IIO_MOD_LIGHT_UV,
IIO_MOD_LIGHT_UVA,
IIO_MOD_LIGHT_UVB,
IIO_MOD_LIGHT_DUV,
IIO_MOD_PM1,
IIO_MOD_PM2P5,
@ -107,6 +105,8 @@ enum iio_modifier {
IIO_MOD_PITCH,
IIO_MOD_YAW,
IIO_MOD_ROLL,
IIO_MOD_LIGHT_UVA,
IIO_MOD_LIGHT_UVB,
};
enum iio_event_type {