Lines Matching +full:spi +full:- +full:mux
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ADGS1408/ADGS1409 SPI MUX driver
11 #include <linux/mux/driver.h>
13 #include <linux/spi/spi.h>
25 static int adgs1408_spi_reg_write(struct spi_device *spi, in adgs1408_spi_reg_write() argument
33 return spi_write_then_read(spi, tx_buf, sizeof(tx_buf), NULL, 0); in adgs1408_spi_reg_write()
36 static int adgs1408_set(struct mux_control *mux, int state) in adgs1408_set() argument
38 struct spi_device *spi = to_spi_device(mux->chip->dev.parent); in adgs1408_set() local
46 return adgs1408_spi_reg_write(spi, ADGS1408_SW_DATA, reg); in adgs1408_set()
53 static int adgs1408_probe(struct spi_device *spi) in adgs1408_probe() argument
55 struct device *dev = &spi->dev; in adgs1408_probe()
58 struct mux_control *mux; in adgs1408_probe() local
64 chip_id = spi_get_device_id(spi)->driver_data; in adgs1408_probe()
70 mux_chip->ops = &adgs1408_ops; in adgs1408_probe()
72 ret = adgs1408_spi_reg_write(spi, ADGS1408_SW_DATA, ADGS1408_DISABLE); in adgs1408_probe()
76 ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state); in adgs1408_probe()
80 mux = mux_chip->mux; in adgs1408_probe()
83 mux->states = 8; in adgs1408_probe()
85 mux->states = 4; in adgs1408_probe()
92 if (idle_state < mux->states) { in adgs1408_probe()
93 mux->idle_state = idle_state; in adgs1408_probe()
98 dev_err(dev, "invalid idle-state %d\n", idle_state); in adgs1408_probe()
99 return -EINVAL; in adgs1408_probe()
110 MODULE_DEVICE_TABLE(spi, adgs1408_spi_id);
130 MODULE_DESCRIPTION("Analog Devices ADGS1408 MUX driver");