Lines Matching full:gpios
45 void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl) in mctrl_gpio_set() argument
52 if (gpios == NULL) in mctrl_gpio_set()
56 if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_set()
57 desc_array[count] = gpios->gpio[i]; in mctrl_gpio_set()
66 struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, in mctrl_gpio_to_gpiod() argument
69 if (gpios == NULL) in mctrl_gpio_to_gpiod()
72 return gpios->gpio[gidx]; in mctrl_gpio_to_gpiod()
76 unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) in mctrl_gpio_get() argument
80 if (gpios == NULL) in mctrl_gpio_get()
84 if (gpios->gpio[i] && !mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_get()
85 if (gpiod_get_value(gpios->gpio[i])) in mctrl_gpio_get()
97 mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) in mctrl_gpio_get_outputs() argument
101 if (gpios == NULL) in mctrl_gpio_get_outputs()
105 if (gpios->gpio[i] && mctrl_gpio_flags_is_dir_out(i)) { in mctrl_gpio_get_outputs()
106 if (gpiod_get_value(gpios->gpio[i])) in mctrl_gpio_get_outputs()
119 struct mctrl_gpios *gpios; in mctrl_gpio_init_noauto() local
122 gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL); in mctrl_gpio_init_noauto()
123 if (!gpios) in mctrl_gpio_init_noauto()
131 gpio_str = kasprintf(GFP_KERNEL, "%s-gpios", in mctrl_gpio_init_noauto()
141 gpios->gpio[i] = in mctrl_gpio_init_noauto()
147 if (IS_ERR(gpios->gpio[i])) in mctrl_gpio_init_noauto()
148 return ERR_CAST(gpios->gpio[i]); in mctrl_gpio_init_noauto()
151 return gpios; in mctrl_gpio_init_noauto()
158 struct mctrl_gpios *gpios = context; in mctrl_gpio_irq_handle() local
159 struct uart_port *port = gpios->port; in mctrl_gpio_irq_handle()
160 u32 mctrl = gpios->mctrl_prev; in mctrl_gpio_irq_handle()
164 mctrl_gpio_get(gpios, &mctrl); in mctrl_gpio_irq_handle()
168 mctrl_diff = mctrl ^ gpios->mctrl_prev; in mctrl_gpio_irq_handle()
169 gpios->mctrl_prev = mctrl; in mctrl_gpio_irq_handle()
194 struct mctrl_gpios *gpios; in mctrl_gpio_init() local
197 gpios = mctrl_gpio_init_noauto(port->dev, idx); in mctrl_gpio_init()
198 if (IS_ERR(gpios)) in mctrl_gpio_init()
199 return gpios; in mctrl_gpio_init()
201 gpios->port = port; in mctrl_gpio_init()
206 if (!gpios->gpio[i] || mctrl_gpio_flags_is_dir_out(i)) in mctrl_gpio_init()
209 ret = gpiod_to_irq(gpios->gpio[i]); in mctrl_gpio_init()
216 gpios->irq[i] = ret; in mctrl_gpio_init()
219 irq_set_status_flags(gpios->irq[i], IRQ_NOAUTOEN); in mctrl_gpio_init()
221 ret = devm_request_irq(port->dev, gpios->irq[i], in mctrl_gpio_init()
224 gpios); in mctrl_gpio_init()
234 return gpios; in mctrl_gpio_init()
238 void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios) in mctrl_gpio_free() argument
242 if (gpios == NULL) in mctrl_gpio_free()
246 if (gpios->irq[i]) in mctrl_gpio_free()
247 devm_free_irq(gpios->port->dev, gpios->irq[i], gpios); in mctrl_gpio_free()
249 if (gpios->gpio[i]) in mctrl_gpio_free()
250 devm_gpiod_put(dev, gpios->gpio[i]); in mctrl_gpio_free()
252 devm_kfree(dev, gpios); in mctrl_gpio_free()
256 void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios) in mctrl_gpio_enable_ms() argument
260 if (gpios == NULL) in mctrl_gpio_enable_ms()
264 if (gpios->mctrl_on) in mctrl_gpio_enable_ms()
267 gpios->mctrl_on = true; in mctrl_gpio_enable_ms()
269 /* get initial status of modem lines GPIOs */ in mctrl_gpio_enable_ms()
270 mctrl_gpio_get(gpios, &gpios->mctrl_prev); in mctrl_gpio_enable_ms()
273 if (!gpios->irq[i]) in mctrl_gpio_enable_ms()
276 enable_irq(gpios->irq[i]); in mctrl_gpio_enable_ms()
281 void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) in mctrl_gpio_disable_ms() argument
285 if (gpios == NULL) in mctrl_gpio_disable_ms()
288 if (!gpios->mctrl_on) in mctrl_gpio_disable_ms()
291 gpios->mctrl_on = false; in mctrl_gpio_disable_ms()
294 if (!gpios->irq[i]) in mctrl_gpio_disable_ms()
297 disable_irq(gpios->irq[i]); in mctrl_gpio_disable_ms()