Lines Matching +full:spi +full:- +full:dev

1 /* lsm6dsl_spi.c - SPI routines for LSM6DSL driver
7 * SPDX-License-Identifier: Apache-2.0
17 #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
23 static int lsm6dsl_raw_read(const struct device *dev, uint8_t reg_addr, in lsm6dsl_raw_read() argument
26 const struct lsm6dsl_config *cfg = dev->config; in lsm6dsl_raw_read()
53 return -EIO; in lsm6dsl_raw_read()
56 if (spi_transceive_dt(&cfg->bus_cfg.spi, &tx, &rx)) { in lsm6dsl_raw_read()
57 return -EIO; in lsm6dsl_raw_read()
63 static int lsm6dsl_raw_write(const struct device *dev, uint8_t reg_addr, in lsm6dsl_raw_write() argument
66 const struct lsm6dsl_config *cfg = dev->config; in lsm6dsl_raw_write()
85 return -EIO; in lsm6dsl_raw_write()
88 if (spi_write_dt(&cfg->bus_cfg.spi, &tx)) { in lsm6dsl_raw_write()
89 return -EIO; in lsm6dsl_raw_write()
95 static int lsm6dsl_spi_read_data(const struct device *dev, uint8_t reg_addr, in lsm6dsl_spi_read_data() argument
98 return lsm6dsl_raw_read(dev, reg_addr, value, len); in lsm6dsl_spi_read_data()
101 static int lsm6dsl_spi_write_data(const struct device *dev, uint8_t reg_addr, in lsm6dsl_spi_write_data() argument
104 return lsm6dsl_raw_write(dev, reg_addr, value, len); in lsm6dsl_spi_write_data()
107 static int lsm6dsl_spi_read_reg(const struct device *dev, uint8_t reg_addr, in lsm6dsl_spi_read_reg() argument
110 return lsm6dsl_raw_read(dev, reg_addr, value, 1); in lsm6dsl_spi_read_reg()
113 static int lsm6dsl_spi_update_reg(const struct device *dev, uint8_t reg_addr, in lsm6dsl_spi_update_reg() argument
118 lsm6dsl_raw_read(dev, reg_addr, &tmp_val, 1); in lsm6dsl_spi_update_reg()
121 return lsm6dsl_raw_write(dev, reg_addr, &tmp_val, 1); in lsm6dsl_spi_update_reg()
131 int lsm6dsl_spi_init(const struct device *dev) in lsm6dsl_spi_init() argument
133 struct lsm6dsl_data *data = dev->data; in lsm6dsl_spi_init()
134 const struct lsm6dsl_config *cfg = dev->config; in lsm6dsl_spi_init()
136 data->hw_tf = &lsm6dsl_spi_transfer_fn; in lsm6dsl_spi_init()
138 if (!spi_is_ready_dt(&cfg->bus_cfg.spi)) { in lsm6dsl_spi_init()
139 return -ENODEV; in lsm6dsl_spi_init()
144 #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */