Lines Matching +full:gpios +full:- +full:states
1 // SPDX-License-Identifier: GPL-2.0
3 * GPIO-controlled multiplexer driver
19 struct gpio_descs *gpios; member
24 struct mux_gpio *mux_gpio = mux_chip_priv(mux->chip); in mux_gpio_set()
29 gpiod_set_array_value_cansleep(mux_gpio->gpios->ndescs, in mux_gpio_set()
30 mux_gpio->gpios->desc, in mux_gpio_set()
31 mux_gpio->gpios->info, values); in mux_gpio_set()
41 { .compatible = "gpio-mux", },
48 struct device *dev = &pdev->dev; in mux_gpio_probe()
64 mux_chip->ops = &mux_gpio_ops; in mux_gpio_probe()
66 mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW); in mux_gpio_probe()
67 if (IS_ERR(mux_gpio->gpios)) { in mux_gpio_probe()
68 ret = PTR_ERR(mux_gpio->gpios); in mux_gpio_probe()
69 if (ret != -EPROBE_DEFER) in mux_gpio_probe()
70 dev_err(dev, "failed to get gpios\n"); in mux_gpio_probe()
73 WARN_ON(pins != mux_gpio->gpios->ndescs); in mux_gpio_probe()
74 mux_chip->mux->states = 1 << pins; in mux_gpio_probe()
76 ret = device_property_read_u32(dev, "idle-state", (u32 *)&idle_state); in mux_gpio_probe()
78 if (idle_state < 0 || idle_state >= mux_chip->mux->states) { in mux_gpio_probe()
79 dev_err(dev, "invalid idle-state %u\n", idle_state); in mux_gpio_probe()
80 return -EINVAL; in mux_gpio_probe()
83 mux_chip->mux->idle_state = idle_state; in mux_gpio_probe()
90 dev_info(dev, "%u-way mux-controller registered\n", in mux_gpio_probe()
91 mux_chip->mux->states); in mux_gpio_probe()
98 .name = "gpio-mux",
105 MODULE_DESCRIPTION("GPIO-controlled multiplexer driver");