Lines Matching refs:mux

25 static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val)  in i2c_mux_gpio_set()  argument
31 gpiod_set_array_value_cansleep(mux->ngpios, mux->gpios, NULL, values); in i2c_mux_gpio_set()
36 struct gpiomux *mux = i2c_mux_priv(muxc); in i2c_mux_gpio_select() local
38 i2c_mux_gpio_set(mux, chan); in i2c_mux_gpio_select()
45 struct gpiomux *mux = i2c_mux_priv(muxc); in i2c_mux_gpio_deselect() local
47 i2c_mux_gpio_set(mux, mux->data.idle); in i2c_mux_gpio_deselect()
91 static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, in i2c_mux_gpio_probe_fw() argument
127 mux->data.parent = i2c_adapter_id(adapter); in i2c_mux_gpio_probe_fw()
130 mux->data.n_values = device_get_child_node_count(dev); in i2c_mux_gpio_probe_fw()
132 mux->data.n_values, sizeof(*mux->data.values), in i2c_mux_gpio_probe_fw()
151 mux->data.values = values; in i2c_mux_gpio_probe_fw()
153 if (fwnode_property_read_u32(dev->fwnode, "idle-state", &mux->data.idle)) in i2c_mux_gpio_probe_fw()
154 mux->data.idle = I2C_MUX_GPIO_NO_IDLE; in i2c_mux_gpio_probe_fw()
162 struct gpiomux *mux; in i2c_mux_gpio_probe() local
168 mux = devm_kzalloc(&pdev->dev, sizeof(*mux), GFP_KERNEL); in i2c_mux_gpio_probe()
169 if (!mux) in i2c_mux_gpio_probe()
173 ret = i2c_mux_gpio_probe_fw(mux, pdev); in i2c_mux_gpio_probe()
177 memcpy(&mux->data, dev_get_platdata(&pdev->dev), in i2c_mux_gpio_probe()
178 sizeof(mux->data)); in i2c_mux_gpio_probe()
186 mux->ngpios = ngpios; in i2c_mux_gpio_probe()
188 parent = i2c_get_adapter(mux->data.parent); in i2c_mux_gpio_probe()
192 muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, in i2c_mux_gpio_probe()
193 ngpios * sizeof(*mux->gpios), 0, in i2c_mux_gpio_probe()
199 mux->gpios = muxc->priv; in i2c_mux_gpio_probe()
200 muxc->priv = mux; in i2c_mux_gpio_probe()
208 if (mux->data.idle != I2C_MUX_GPIO_NO_IDLE) { in i2c_mux_gpio_probe()
209 initial_state = mux->data.idle; in i2c_mux_gpio_probe()
212 initial_state = mux->data.values[0]; in i2c_mux_gpio_probe()
230 mux->gpios[i] = gpiod; in i2c_mux_gpio_probe()
243 for (i = 0; i < mux->data.n_values; i++) { in i2c_mux_gpio_probe()
244 u32 nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0; in i2c_mux_gpio_probe()
245 unsigned int class = mux->data.classes ? mux->data.classes[i] : 0; in i2c_mux_gpio_probe()
247 ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class); in i2c_mux_gpio_probe()
253 mux->data.n_values, parent->name); in i2c_mux_gpio_probe()