mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
c55cc97a25
A few bits for the counters subsystem mixed in here as well. There are some late breaking fixes as well, which aren't so urgent they can't wait for the merge window. New Device Support * adf4371 - New driver + bindings. - Support the adf4372 PLL. Mostly ID and bindings. * ad8366 (note includes rework of driver needed to allow support for these). - Support the ADL5240 variable gain amplifier (VGA). - Support the ADA4961 digital gain amplifier (DGA). * dps310 - New driver, in several parts from different authors for this temp and pressure sensor. - Includes errata workaround for a temperature reading issue. * stk3310 - Support the stk3335, mostly ID. Features and cleanups * core - drop error handling on debugfs registration. - harden by making sure we don't overrun iio_chan_info_postfix. * docs - convert remaining docs to rst. At somepoint we'll fit these few into the main IIO docs. - improve sampling_frequency_available docs but explaining the range form. * ad_sigma_delta - Drop a pointless goto. * ad2s1210 - Drop pointless platform data null check seeing as we don't actually use platform data anymore. * ad7124 - Relax limitation on channel numbers to allow pseudo different channels. - Support control of whether the input is buffered via DT. - Use dynamic allocation for channel configuration to make it easier to support new devices. - YAML binding conversion. * ad7150 - Comment tidy up. - Consistent and simple if (ret) handling of i2c errors. - FIELD_GET and GENMASK. - Ternary rather than !!(condition) for readability. - Use macros to avoid repetition of channel definitions. * ad7606 - Add software channel config (rather that pin controlled) - Refactor to simplify addition of new part in future. * ad7746 - of_deivce_id table. * ad7780 - MAINTAINERS entry - YAML DT bindings. * ad8366 - Stop using core mlock in favour of well scoped local lock. - SPDX + copyright date update. * ad9834 - of_device_id table * adf4371 - Add support for output stage muting before lock on has occured. * adis library - MAINTAINERS entry to reflect that this now Alexandru's problem ;) * adis162xx: - Fix a slightly incorrect set of comments and print statements on minimum supported voltage. * adis16203 - of_device_id table. * adis16240 - Add of_device_id table (in two parts as first patch only used it for MODULE_DEVICE_TABLE.) * adt7316-spi - of_device_id table * adxl372 - YAML DT binding conversion. - Cleanup use of buffer callback functions (precursor to core rework). * bh1710 - Simplify getting the i2c adapter from the client. * dht11 - Mote to newer GPIO consumer interface. * kxcjk-1013.c - Add binding for sensor in display of some ultrabooks after userspace tools updated for it not be a problem to report two similar sensors. * imx7d - drop unused variables. - white space - define instead of variable for clock frequency that is fixed. - drop pointless error message. * messon_saradc - SPDX * sps30 - MAINTAINERS entry - YAML binding conversion. * st_accel - Tidy up ordering in various buffer related callbacks. This is part of a long running effort to simplify the core code. * stm32-dfsdm: - Manage the resolution cleanly in triggerd modes. - Add fast mode support which allows more flexible filter choices. - Add a comment on the reason for a 16 bit record when technically not 'required'. * st_lsm6dsx - Embed device name in the sensor_settings struct as i3c doesn't have a convenient name field to use for this. * xilinx-adc - Relax constraints on supported platforms to reflect that this can used with FPGAs on PCIe cards and hence many architectures. * counters/ftm-quaddec - Fix some formatting io MODULE_AUTHOR - MAINTAINERS entry Fixes * tools - fix incorrect handling of 32 bit channels. * sca3000 - Potential endian bug that is unlikely to bite anyone (be64 host seems unlikely for this old part). * stm32-adc - Add vdda-supply. On some boards it needs to be turned on to supply the ADC. DT bindings included. * stm32-dfsdm - Fix output resolution to work with filter orders other than 3. - Fix output datatype as it's signed and previously claimed not to be. -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0VHIkRHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0FojyxhAAgrLRy2wlHjQCAh0S6J22LKs02uPX1qvY nm1aI/av2DGcMCV2NF6J1sW2Mocvtt5a79/1f/wRqDzOHBrTpFr0Q0Ngwijv9bzc fv6NwfHlWolmXynKx8wK4b6Sa3KVCkltojEVpEVbhkuMkafSQ+pQzYF1Uf7enOrX j3Gq6NYaCks4YtFZsBphgzo3DC0mh7CfunlPiOdVcgcg4Pj/KZY9QCX86fJx972x YI3BRFHnDSMDOxOTjeqeKvMiqU2zLPlqLSEOCUw2XCrh6HI9qFiU+LVsYx6SP0tx aJ2q+qYc9raOTANHk7O2JZYWv/52JXvtKcFSLiuQdABjaAI20xEr1QAZYVYUiXmg dFH6lBsWvQyAy5F/SyZ5tavZvTfGsNDB5LhlpEggeO2W6cIIL4CLfHimB2EcxFSH utqEA72HQZosEUKut1jbmG6iYMiRnHS72pLOqkJ6HC/2/pZfoEWlEH9x/S3xbBsW 918ISs9852VwjebQwck96+Dh0LwiKOl8Aii5ONzfNObJB6/JbULPoKKArsMdENQA mqDXLOMz6GspY3JgiVDCXAwg2x2Ht/ictR6svRJtOTLiBU2Iybpm/HRkPePhoePF HLw8fhwE+mOSWr22KhzjUJBHEAkoejo/14XOgKSTkO9V6amLlOWRDV3uK2PksmdI 7DQyYhX9Tos= =a3vh -----END PGP SIGNATURE----- Merge tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of IIO device support, features, cleanups and minor fixes for 5.3. A few bits for the counters subsystem mixed in here as well. There are some late breaking fixes as well, which aren't so urgent they can't wait for the merge window. New Device Support * adf4371 - New driver + bindings. - Support the adf4372 PLL. Mostly ID and bindings. * ad8366 (note includes rework of driver needed to allow support for these). - Support the ADL5240 variable gain amplifier (VGA). - Support the ADA4961 digital gain amplifier (DGA). * dps310 - New driver, in several parts from different authors for this temp and pressure sensor. - Includes errata workaround for a temperature reading issue. * stk3310 - Support the stk3335, mostly ID. Features and cleanups * core - drop error handling on debugfs registration. - harden by making sure we don't overrun iio_chan_info_postfix. * docs - convert remaining docs to rst. At somepoint we'll fit these few into the main IIO docs. - improve sampling_frequency_available docs but explaining the range form. * ad_sigma_delta - Drop a pointless goto. * ad2s1210 - Drop pointless platform data null check seeing as we don't actually use platform data anymore. * ad7124 - Relax limitation on channel numbers to allow pseudo different channels. - Support control of whether the input is buffered via DT. - Use dynamic allocation for channel configuration to make it easier to support new devices. - YAML binding conversion. * ad7150 - Comment tidy up. - Consistent and simple if (ret) handling of i2c errors. - FIELD_GET and GENMASK. - Ternary rather than !!(condition) for readability. - Use macros to avoid repetition of channel definitions. * ad7606 - Add software channel config (rather that pin controlled) - Refactor to simplify addition of new part in future. * ad7746 - of_deivce_id table. * ad7780 - MAINTAINERS entry - YAML DT bindings. * ad8366 - Stop using core mlock in favour of well scoped local lock. - SPDX + copyright date update. * ad9834 - of_device_id table * adf4371 - Add support for output stage muting before lock on has occured. * adis library - MAINTAINERS entry to reflect that this now Alexandru's problem ;) * adis162xx: - Fix a slightly incorrect set of comments and print statements on minimum supported voltage. * adis16203 - of_device_id table. * adis16240 - Add of_device_id table (in two parts as first patch only used it for MODULE_DEVICE_TABLE.) * adt7316-spi - of_device_id table * adxl372 - YAML DT binding conversion. - Cleanup use of buffer callback functions (precursor to core rework). * bh1710 - Simplify getting the i2c adapter from the client. * dht11 - Mote to newer GPIO consumer interface. * kxcjk-1013.c - Add binding for sensor in display of some ultrabooks after userspace tools updated for it not be a problem to report two similar sensors. * imx7d - drop unused variables. - white space - define instead of variable for clock frequency that is fixed. - drop pointless error message. * messon_saradc - SPDX * sps30 - MAINTAINERS entry - YAML binding conversion. * st_accel - Tidy up ordering in various buffer related callbacks. This is part of a long running effort to simplify the core code. * stm32-dfsdm: - Manage the resolution cleanly in triggerd modes. - Add fast mode support which allows more flexible filter choices. - Add a comment on the reason for a 16 bit record when technically not 'required'. * st_lsm6dsx - Embed device name in the sensor_settings struct as i3c doesn't have a convenient name field to use for this. * xilinx-adc - Relax constraints on supported platforms to reflect that this can used with FPGAs on PCIe cards and hence many architectures. * counters/ftm-quaddec - Fix some formatting io MODULE_AUTHOR - MAINTAINERS entry Fixes * tools - fix incorrect handling of 32 bit channels. * sca3000 - Potential endian bug that is unlikely to bite anyone (be64 host seems unlikely for this old part). * stm32-adc - Add vdda-supply. On some boards it needs to be turned on to supply the ADC. DT bindings included. * stm32-dfsdm - Fix output resolution to work with filter orders other than 3. - Fix output datatype as it's signed and previously claimed not to be. * tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits) iio: iio-utils: Fix possible incorrect mask calculation iio: frequency: adf4371: Add support for output stage mute dt-bindings: iio: frequency: Add ADF4372 PLL documentation iio: frequency: adf4371: Add support for ADF4372 PLL dt-bindings: iio: adc: Add buffered input property Convert AD7124 bindings documentation to YAML format. iio: adc: ad7124: Shift to dynamic allocation for channel configuration iio: adc: ad7124: Add buffered input support iio: adc: ad7124: Remove input number limitation MAINTAINERS: add ADIS IMU driver library entry iio: adis162xx: fix low-power docs & reports counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR iio: core: no need to check return value of debugfs_create functions docs: iio: convert to ReST iio: adc: stm32-adc: add missing vdda-supply dt-bindings: iio: adc: stm32: add missing vdda supply iio: adc: stm32-dfsdm: add comment for 16 bits record iio: adc: stm32-dfsdm: add fast mode support iio: adc: stm32-dfsdm: manage data resolution in trigger mode iio: adc: stm32-dfsdm: fix data type ...
367 lines
9.9 KiB
C
367 lines
9.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* STMicroelectronics st_lsm6dsx sensor driver
|
|
*
|
|
* Copyright 2016 STMicroelectronics Inc.
|
|
*
|
|
* Lorenzo Bianconi <lorenzo.bianconi@st.com>
|
|
* Denis Ciocca <denis.ciocca@st.com>
|
|
*/
|
|
|
|
#ifndef ST_LSM6DSX_H
|
|
#define ST_LSM6DSX_H
|
|
|
|
#include <linux/device.h>
|
|
|
|
#define ST_LSM6DS3_DEV_NAME "lsm6ds3"
|
|
#define ST_LSM6DS3H_DEV_NAME "lsm6ds3h"
|
|
#define ST_LSM6DSL_DEV_NAME "lsm6dsl"
|
|
#define ST_LSM6DSM_DEV_NAME "lsm6dsm"
|
|
#define ST_ISM330DLC_DEV_NAME "ism330dlc"
|
|
#define ST_LSM6DSO_DEV_NAME "lsm6dso"
|
|
#define ST_ASM330LHH_DEV_NAME "asm330lhh"
|
|
#define ST_LSM6DSOX_DEV_NAME "lsm6dsox"
|
|
#define ST_LSM6DSR_DEV_NAME "lsm6dsr"
|
|
|
|
enum st_lsm6dsx_hw_id {
|
|
ST_LSM6DS3_ID,
|
|
ST_LSM6DS3H_ID,
|
|
ST_LSM6DSL_ID,
|
|
ST_LSM6DSM_ID,
|
|
ST_ISM330DLC_ID,
|
|
ST_LSM6DSO_ID,
|
|
ST_ASM330LHH_ID,
|
|
ST_LSM6DSOX_ID,
|
|
ST_LSM6DSR_ID,
|
|
ST_LSM6DSX_MAX_ID,
|
|
};
|
|
|
|
#define ST_LSM6DSX_BUFF_SIZE 512
|
|
#define ST_LSM6DSX_CHAN_SIZE 2
|
|
#define ST_LSM6DSX_SAMPLE_SIZE 6
|
|
#define ST_LSM6DSX_TAG_SIZE 1
|
|
#define ST_LSM6DSX_TAGGED_SAMPLE_SIZE (ST_LSM6DSX_SAMPLE_SIZE + \
|
|
ST_LSM6DSX_TAG_SIZE)
|
|
#define ST_LSM6DSX_MAX_WORD_LEN ((32 / ST_LSM6DSX_SAMPLE_SIZE) * \
|
|
ST_LSM6DSX_SAMPLE_SIZE)
|
|
#define ST_LSM6DSX_MAX_TAGGED_WORD_LEN ((32 / ST_LSM6DSX_TAGGED_SAMPLE_SIZE) \
|
|
* ST_LSM6DSX_TAGGED_SAMPLE_SIZE)
|
|
#define ST_LSM6DSX_SHIFT_VAL(val, mask) (((val) << __ffs(mask)) & (mask))
|
|
|
|
#define ST_LSM6DSX_CHANNEL(chan_type, addr, mod, scan_idx) \
|
|
{ \
|
|
.type = chan_type, \
|
|
.address = addr, \
|
|
.modified = 1, \
|
|
.channel2 = mod, \
|
|
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
|
|
BIT(IIO_CHAN_INFO_SCALE), \
|
|
.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
|
|
.scan_index = scan_idx, \
|
|
.scan_type = { \
|
|
.sign = 's', \
|
|
.realbits = 16, \
|
|
.storagebits = 16, \
|
|
.endianness = IIO_LE, \
|
|
}, \
|
|
}
|
|
|
|
struct st_lsm6dsx_reg {
|
|
u8 addr;
|
|
u8 mask;
|
|
};
|
|
|
|
struct st_lsm6dsx_hw;
|
|
|
|
struct st_lsm6dsx_odr {
|
|
u16 hz;
|
|
u8 val;
|
|
};
|
|
|
|
#define ST_LSM6DSX_ODR_LIST_SIZE 6
|
|
struct st_lsm6dsx_odr_table_entry {
|
|
struct st_lsm6dsx_reg reg;
|
|
struct st_lsm6dsx_odr odr_avl[ST_LSM6DSX_ODR_LIST_SIZE];
|
|
};
|
|
|
|
struct st_lsm6dsx_fs {
|
|
u32 gain;
|
|
u8 val;
|
|
};
|
|
|
|
#define ST_LSM6DSX_FS_LIST_SIZE 4
|
|
struct st_lsm6dsx_fs_table_entry {
|
|
struct st_lsm6dsx_reg reg;
|
|
struct st_lsm6dsx_fs fs_avl[ST_LSM6DSX_FS_LIST_SIZE];
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_fifo_ops - ST IMU FIFO settings
|
|
* @read_fifo: Read FIFO callback.
|
|
* @fifo_th: FIFO threshold register info (addr + mask).
|
|
* @fifo_diff: FIFO diff status register info (addr + mask).
|
|
* @th_wl: FIFO threshold word length.
|
|
*/
|
|
struct st_lsm6dsx_fifo_ops {
|
|
int (*read_fifo)(struct st_lsm6dsx_hw *hw);
|
|
struct {
|
|
u8 addr;
|
|
u16 mask;
|
|
} fifo_th;
|
|
struct {
|
|
u8 addr;
|
|
u16 mask;
|
|
} fifo_diff;
|
|
u8 th_wl;
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_hw_ts_settings - ST IMU hw timer settings
|
|
* @timer_en: Hw timer enable register info (addr + mask).
|
|
* @hr_timer: Hw timer resolution register info (addr + mask).
|
|
* @fifo_en: Hw timer FIFO enable register info (addr + mask).
|
|
* @decimator: Hw timer FIFO decimator register info (addr + mask).
|
|
*/
|
|
struct st_lsm6dsx_hw_ts_settings {
|
|
struct st_lsm6dsx_reg timer_en;
|
|
struct st_lsm6dsx_reg hr_timer;
|
|
struct st_lsm6dsx_reg fifo_en;
|
|
struct st_lsm6dsx_reg decimator;
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_shub_settings - ST IMU hw i2c controller settings
|
|
* @page_mux: register page mux info (addr + mask).
|
|
* @master_en: master config register info (addr + mask).
|
|
* @pullup_en: i2c controller pull-up register info (addr + mask).
|
|
* @aux_sens: aux sensor register info (addr + mask).
|
|
* @wr_once: write_once register info (addr + mask).
|
|
* @shub_out: sensor hub first output register info.
|
|
* @slv0_addr: slave0 address in secondary page.
|
|
* @dw_slv0_addr: slave0 write register address in secondary page.
|
|
* @batch_en: Enable/disable FIFO batching.
|
|
*/
|
|
struct st_lsm6dsx_shub_settings {
|
|
struct st_lsm6dsx_reg page_mux;
|
|
struct st_lsm6dsx_reg master_en;
|
|
struct st_lsm6dsx_reg pullup_en;
|
|
struct st_lsm6dsx_reg aux_sens;
|
|
struct st_lsm6dsx_reg wr_once;
|
|
u8 shub_out;
|
|
u8 slv0_addr;
|
|
u8 dw_slv0_addr;
|
|
u8 batch_en;
|
|
};
|
|
|
|
enum st_lsm6dsx_ext_sensor_id {
|
|
ST_LSM6DSX_ID_MAGN,
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_ext_dev_settings - i2c controller slave settings
|
|
* @i2c_addr: I2c slave address list.
|
|
* @wai: Wai address info.
|
|
* @id: external sensor id.
|
|
* @odr: Output data rate of the sensor [Hz].
|
|
* @gain: Configured sensor sensitivity.
|
|
* @temp_comp: Temperature compensation register info (addr + mask).
|
|
* @pwr_table: Power on register info (addr + mask).
|
|
* @off_canc: Offset cancellation register info (addr + mask).
|
|
* @bdu: Block data update register info (addr + mask).
|
|
* @out: Output register info.
|
|
*/
|
|
struct st_lsm6dsx_ext_dev_settings {
|
|
u8 i2c_addr[2];
|
|
struct {
|
|
u8 addr;
|
|
u8 val;
|
|
} wai;
|
|
enum st_lsm6dsx_ext_sensor_id id;
|
|
struct st_lsm6dsx_odr_table_entry odr_table;
|
|
struct st_lsm6dsx_fs_table_entry fs_table;
|
|
struct st_lsm6dsx_reg temp_comp;
|
|
struct {
|
|
struct st_lsm6dsx_reg reg;
|
|
u8 off_val;
|
|
u8 on_val;
|
|
} pwr_table;
|
|
struct st_lsm6dsx_reg off_canc;
|
|
struct st_lsm6dsx_reg bdu;
|
|
struct {
|
|
u8 addr;
|
|
u8 len;
|
|
} out;
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_settings - ST IMU sensor settings
|
|
* @wai: Sensor WhoAmI default value.
|
|
* @max_fifo_size: Sensor max fifo length in FIFO words.
|
|
* @id: List of hw id/device name supported by the driver configuration.
|
|
* @decimator: List of decimator register info (addr + mask).
|
|
* @batch: List of FIFO batching register info (addr + mask).
|
|
* @fifo_ops: Sensor hw FIFO parameters.
|
|
* @ts_settings: Hw timer related settings.
|
|
* @shub_settings: i2c controller related settings.
|
|
*/
|
|
struct st_lsm6dsx_settings {
|
|
u8 wai;
|
|
u16 max_fifo_size;
|
|
struct {
|
|
enum st_lsm6dsx_hw_id hw_id;
|
|
const char *name;
|
|
} id[ST_LSM6DSX_MAX_ID];
|
|
struct st_lsm6dsx_reg decimator[ST_LSM6DSX_MAX_ID];
|
|
struct st_lsm6dsx_reg batch[ST_LSM6DSX_MAX_ID];
|
|
struct st_lsm6dsx_fifo_ops fifo_ops;
|
|
struct st_lsm6dsx_hw_ts_settings ts_settings;
|
|
struct st_lsm6dsx_shub_settings shub_settings;
|
|
};
|
|
|
|
enum st_lsm6dsx_sensor_id {
|
|
ST_LSM6DSX_ID_GYRO,
|
|
ST_LSM6DSX_ID_ACC,
|
|
ST_LSM6DSX_ID_EXT0,
|
|
ST_LSM6DSX_ID_EXT1,
|
|
ST_LSM6DSX_ID_EXT2,
|
|
ST_LSM6DSX_ID_MAX,
|
|
};
|
|
|
|
enum st_lsm6dsx_fifo_mode {
|
|
ST_LSM6DSX_FIFO_BYPASS = 0x0,
|
|
ST_LSM6DSX_FIFO_CONT = 0x6,
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_sensor - ST IMU sensor instance
|
|
* @name: Sensor name.
|
|
* @id: Sensor identifier.
|
|
* @hw: Pointer to instance of struct st_lsm6dsx_hw.
|
|
* @gain: Configured sensor sensitivity.
|
|
* @odr: Output data rate of the sensor [Hz].
|
|
* @watermark: Sensor watermark level.
|
|
* @sip: Number of samples in a given pattern.
|
|
* @decimator: FIFO decimation factor.
|
|
* @ts_ref: Sensor timestamp reference for hw one.
|
|
* @ext_info: Sensor settings if it is connected to i2c controller
|
|
*/
|
|
struct st_lsm6dsx_sensor {
|
|
char name[32];
|
|
enum st_lsm6dsx_sensor_id id;
|
|
struct st_lsm6dsx_hw *hw;
|
|
|
|
u32 gain;
|
|
u16 odr;
|
|
|
|
u16 watermark;
|
|
u8 sip;
|
|
u8 decimator;
|
|
s64 ts_ref;
|
|
|
|
struct {
|
|
const struct st_lsm6dsx_ext_dev_settings *settings;
|
|
u8 addr;
|
|
} ext_info;
|
|
};
|
|
|
|
/**
|
|
* struct st_lsm6dsx_hw - ST IMU MEMS hw instance
|
|
* @dev: Pointer to instance of struct device (I2C or SPI).
|
|
* @regmap: Register map of the device.
|
|
* @irq: Device interrupt line (I2C or SPI).
|
|
* @fifo_lock: Mutex to prevent concurrent access to the hw FIFO.
|
|
* @conf_lock: Mutex to prevent concurrent FIFO configuration update.
|
|
* @page_lock: Mutex to prevent concurrent memory page configuration.
|
|
* @fifo_mode: FIFO operating mode supported by the device.
|
|
* @suspend_mask: Suspended sensor bitmask.
|
|
* @enable_mask: Enabled sensor bitmask.
|
|
* @ts_sip: Total number of timestamp samples in a given pattern.
|
|
* @sip: Total number of samples (acc/gyro/ts) in a given pattern.
|
|
* @buff: Device read buffer.
|
|
* @iio_devs: Pointers to acc/gyro iio_dev instances.
|
|
* @settings: Pointer to the specific sensor settings in use.
|
|
*/
|
|
struct st_lsm6dsx_hw {
|
|
struct device *dev;
|
|
struct regmap *regmap;
|
|
int irq;
|
|
|
|
struct mutex fifo_lock;
|
|
struct mutex conf_lock;
|
|
struct mutex page_lock;
|
|
|
|
enum st_lsm6dsx_fifo_mode fifo_mode;
|
|
u8 suspend_mask;
|
|
u8 enable_mask;
|
|
u8 ts_sip;
|
|
u8 sip;
|
|
|
|
u8 *buff;
|
|
|
|
struct iio_dev *iio_devs[ST_LSM6DSX_ID_MAX];
|
|
|
|
const struct st_lsm6dsx_settings *settings;
|
|
};
|
|
|
|
static const unsigned long st_lsm6dsx_available_scan_masks[] = {0x7, 0x0};
|
|
extern const struct dev_pm_ops st_lsm6dsx_pm_ops;
|
|
|
|
int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
|
|
struct regmap *regmap);
|
|
int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
|
|
bool enable);
|
|
int st_lsm6dsx_fifo_setup(struct st_lsm6dsx_hw *hw);
|
|
int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val);
|
|
int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
|
|
u16 watermark);
|
|
int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
|
|
int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
|
|
enum st_lsm6dsx_fifo_mode fifo_mode);
|
|
int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
|
|
int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
|
|
int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u16 odr, u8 *val);
|
|
int st_lsm6dsx_shub_probe(struct st_lsm6dsx_hw *hw, const char *name);
|
|
int st_lsm6dsx_shub_set_enable(struct st_lsm6dsx_sensor *sensor, bool enable);
|
|
int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable);
|
|
|
|
static inline int
|
|
st_lsm6dsx_update_bits_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
|
|
unsigned int mask, unsigned int val)
|
|
{
|
|
int err;
|
|
|
|
mutex_lock(&hw->page_lock);
|
|
err = regmap_update_bits(hw->regmap, addr, mask, val);
|
|
mutex_unlock(&hw->page_lock);
|
|
|
|
return err;
|
|
}
|
|
|
|
static inline int
|
|
st_lsm6dsx_read_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
|
|
void *val, unsigned int len)
|
|
{
|
|
int err;
|
|
|
|
mutex_lock(&hw->page_lock);
|
|
err = regmap_bulk_read(hw->regmap, addr, val, len);
|
|
mutex_unlock(&hw->page_lock);
|
|
|
|
return err;
|
|
}
|
|
|
|
static inline int
|
|
st_lsm6dsx_write_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
|
|
unsigned int val)
|
|
{
|
|
int err;
|
|
|
|
mutex_lock(&hw->page_lock);
|
|
err = regmap_write(hw->regmap, addr, val);
|
|
mutex_unlock(&hw->page_lock);
|
|
|
|
return err;
|
|
}
|
|
|
|
#endif /* ST_LSM6DSX_H */
|