Move ctx structure from struct data to struct config, so that
it can be filled at compile time and we could get rid of the bus
init routines.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The STMEMSC HAL i/f requires every driver using it to define
for each instance a stmdev_ctx_t structure, which is used to
export the hardware specific APIs to handle i2c and spi busses
operations. Since this structure is bus agnostic, there is no
need to declare it twice for both i2c and spi. Instead, declare
only one structure, which will be populated either with i2c APIs
or with spi APIs according to where that particular instance is
declared inside the DT.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Make this driver multi-instance and use the new API.
Notes for sensorhub mode:
In case of multiples devices it is possible that some of them
has i2c slaves attached to it (sensorhub mode) but not the
others. Since the driver is configured in the same way for
all the instances (CONFIG_SENSORHUB=y), the routine that initialize
the sensorhub part does not fail anymore in case no slaves
are found for a particular instance. Instead, those non-sensorhub
driver instances will set the shub_inited flag to false and
will totally ignore the feature.
Notes for triggers:
In case of multiples devices the device pin the interrupt wire is
attached to can be different (INT1 or INT2 pin). So, this
information has been moved in DTS and then stored in the
specific instance config structure.
Currently the driver is able to handle a sngle interrupt line
at a time attached to either INT1 or INT2.
MOreover, the interrupt initialization for a driver instance proceed
only if the drdy has been configured in its DT, else it returns ok.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The IIS2ICLX is a high-accuracy. ultra-low noise, low-power
two-axis linear accelerometer which can be interfaced through
either I2C or SPI bus.
Its high accuracy, stability over temperature and repeatability
make IIS2ICLX particularly suitable for inclination measurement
for industrial applications (inclinometers).
https://www.st.com/resource/en/datasheet/iis2iclx.pdf
This driver is based on stmemsc i/f v1.03.
Signed-off-by: Armando Visconti <armando.visconti@st.com>