Lines Matching +full:mux +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0
3 * GPIO-controlled multiplexer driver
15 #include <linux/mux/driver.h>
23 static int mux_gpio_set(struct mux_control *mux, int state) in mux_gpio_set() argument
25 struct mux_gpio *mux_gpio = mux_chip_priv(mux->chip); in mux_gpio_set()
31 gpiod_set_array_value_cansleep(mux_gpio->gpios->ndescs, in mux_gpio_set()
32 mux_gpio->gpios->desc, in mux_gpio_set()
33 mux_gpio->gpios->info, values); in mux_gpio_set()
43 { .compatible = "gpio-mux", },
50 struct device *dev = &pdev->dev; in mux_gpio_probe()
57 pins = gpiod_count(dev, "mux"); in mux_gpio_probe()
66 mux_chip->ops = &mux_gpio_ops; in mux_gpio_probe()
68 mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW); in mux_gpio_probe()
69 if (IS_ERR(mux_gpio->gpios)) in mux_gpio_probe()
70 return dev_err_probe(dev, PTR_ERR(mux_gpio->gpios), in mux_gpio_probe()
72 WARN_ON(pins != mux_gpio->gpios->ndescs); in mux_gpio_probe()
73 mux_chip->mux->states = BIT(pins); in mux_gpio_probe()
75 ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state); in mux_gpio_probe()
77 if (idle_state < 0 || idle_state >= mux_chip->mux->states) { in mux_gpio_probe()
78 dev_err(dev, "invalid idle-state %u\n", idle_state); in mux_gpio_probe()
79 return -EINVAL; in mux_gpio_probe()
82 mux_chip->mux->idle_state = idle_state; in mux_gpio_probe()
89 dev_info(dev, "%u-way mux-controller registered\n", in mux_gpio_probe()
90 mux_chip->mux->states); in mux_gpio_probe()
97 .name = "gpio-mux",
104 MODULE_DESCRIPTION("GPIO-controlled multiplexer driver");