Lines Matching refs:gpios

52 void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)  in mctrl_gpio_set()  argument
59 if (gpios == NULL) in mctrl_gpio_set()
63 if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_set()
64 desc_array[count] = gpios->gpio[i]; in mctrl_gpio_set()
79 struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, in mctrl_gpio_to_gpiod() argument
82 if (gpios == NULL) in mctrl_gpio_to_gpiod()
85 return gpios->gpio[gidx]; in mctrl_gpio_to_gpiod()
97 unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) in mctrl_gpio_get() argument
101 if (gpios == NULL) in mctrl_gpio_get()
105 if (gpios->gpio[i] && !mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_get()
106 if (gpiod_get_value(gpios->gpio[i])) in mctrl_gpio_get()
118 mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) in mctrl_gpio_get_outputs() argument
122 if (gpios == NULL) in mctrl_gpio_get_outputs()
126 if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_get_outputs()
127 if (gpiod_get_value(gpios->gpio[i])) in mctrl_gpio_get_outputs()
140 struct mctrl_gpios *gpios; in mctrl_gpio_init_noauto() local
143 gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL); in mctrl_gpio_init_noauto()
144 if (!gpios) in mctrl_gpio_init_noauto()
162 gpios->gpio[i] = in mctrl_gpio_init_noauto()
168 if (IS_ERR(gpios->gpio[i])) in mctrl_gpio_init_noauto()
169 return ERR_CAST(gpios->gpio[i]); in mctrl_gpio_init_noauto()
172 return gpios; in mctrl_gpio_init_noauto()
179 struct mctrl_gpios *gpios = context; in mctrl_gpio_irq_handle() local
180 struct uart_port *port = gpios->port; in mctrl_gpio_irq_handle()
181 u32 mctrl = gpios->mctrl_prev; in mctrl_gpio_irq_handle()
185 mctrl_gpio_get(gpios, &mctrl); in mctrl_gpio_irq_handle()
189 mctrl_diff = mctrl ^ gpios->mctrl_prev; in mctrl_gpio_irq_handle()
190 gpios->mctrl_prev = mctrl; in mctrl_gpio_irq_handle()
226 struct mctrl_gpios *gpios; in mctrl_gpio_init() local
229 gpios = mctrl_gpio_init_noauto(port->dev, idx); in mctrl_gpio_init()
230 if (IS_ERR(gpios)) in mctrl_gpio_init()
231 return gpios; in mctrl_gpio_init()
233 gpios->port = port; in mctrl_gpio_init()
238 if (!gpios->gpio[i] || mctrl_gpio_flags_is_dir_out(i)) in mctrl_gpio_init()
241 ret = gpiod_to_irq(gpios->gpio[i]); in mctrl_gpio_init()
248 gpios->irq[i] = ret; in mctrl_gpio_init()
251 irq_set_status_flags(gpios->irq[i], IRQ_NOAUTOEN); in mctrl_gpio_init()
253 ret = devm_request_irq(port->dev, gpios->irq[i], in mctrl_gpio_init()
256 gpios); in mctrl_gpio_init()
266 return gpios; in mctrl_gpio_init()
278 void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios) in mctrl_gpio_free() argument
282 if (gpios == NULL) in mctrl_gpio_free()
286 if (gpios->irq[i]) in mctrl_gpio_free()
287 devm_free_irq(gpios->port->dev, gpios->irq[i], gpios); in mctrl_gpio_free()
289 if (gpios->gpio[i]) in mctrl_gpio_free()
290 devm_gpiod_put(dev, gpios->gpio[i]); in mctrl_gpio_free()
292 devm_kfree(dev, gpios); in mctrl_gpio_free()
300 void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios) in mctrl_gpio_enable_ms() argument
304 if (gpios == NULL) in mctrl_gpio_enable_ms()
308 if (gpios->mctrl_on) in mctrl_gpio_enable_ms()
311 gpios->mctrl_on = true; in mctrl_gpio_enable_ms()
314 mctrl_gpio_get(gpios, &gpios->mctrl_prev); in mctrl_gpio_enable_ms()
317 if (!gpios->irq[i]) in mctrl_gpio_enable_ms()
320 enable_irq(gpios->irq[i]); in mctrl_gpio_enable_ms()
329 void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) in mctrl_gpio_disable_ms() argument
333 if (gpios == NULL) in mctrl_gpio_disable_ms()
336 if (!gpios->mctrl_on) in mctrl_gpio_disable_ms()
339 gpios->mctrl_on = false; in mctrl_gpio_disable_ms()
342 if (!gpios->irq[i]) in mctrl_gpio_disable_ms()
345 disable_irq(gpios->irq[i]); in mctrl_gpio_disable_ms()
350 void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios) in mctrl_gpio_enable_irq_wake() argument
354 if (!gpios) in mctrl_gpio_enable_irq_wake()
357 if (!gpios->mctrl_on) in mctrl_gpio_enable_irq_wake()
361 if (!gpios->irq[i]) in mctrl_gpio_enable_irq_wake()
364 enable_irq_wake(gpios->irq[i]); in mctrl_gpio_enable_irq_wake()
369 void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios) in mctrl_gpio_disable_irq_wake() argument
373 if (!gpios) in mctrl_gpio_disable_irq_wake()
376 if (!gpios->mctrl_on) in mctrl_gpio_disable_irq_wake()
380 if (!gpios->irq[i]) in mctrl_gpio_disable_irq_wake()
383 disable_irq_wake(gpios->irq[i]); in mctrl_gpio_disable_irq_wake()