Lines Matching +full:gpo +full:- +full:config +full:-

1 // SPDX-License-Identifier: GPL-2.0+
23 * GPO 0...12 General Purpose Output
24 * GPIO 0...14 General Purpose I/O (Open-Drain)
76 * 14..26 GPO 0..12
91 /* Real GPO bits cannot be put in output direction */ in vx855gpio_direction_input()
93 return -EINVAL; in vx855gpio_direction_input()
96 spin_lock_irqsave(&vg->lock, flags); in vx855gpio_direction_input()
97 reg_out = inl(vg->io_gpo); in vx855gpio_direction_input()
98 reg_out |= gpio_o_bit(nr - NR_VX855_GPInO); in vx855gpio_direction_input()
99 outl(reg_out, vg->io_gpo); in vx855gpio_direction_input()
100 spin_unlock_irqrestore(&vg->lock, flags); in vx855gpio_direction_input()
112 reg_in = inl(vg->io_gpi); in vx855gpio_get()
116 /* GPO don't have an input bit, we need to read it in vx855gpio_get()
118 reg_in = inl(vg->io_gpo); in vx855gpio_get()
119 if (reg_in & gpo_o_bit(nr - NR_VX855_GPI)) in vx855gpio_get()
122 reg_in = inl(vg->io_gpi); in vx855gpio_get()
123 if (reg_in & gpio_i_bit(nr - NR_VX855_GPInO)) in vx855gpio_get()
141 spin_lock_irqsave(&vg->lock, flags); in vx855gpio_set()
142 reg_out = inl(vg->io_gpo); in vx855gpio_set()
145 reg_out |= gpo_o_bit(nr - NR_VX855_GPI); in vx855gpio_set()
147 reg_out &= ~gpo_o_bit(nr - NR_VX855_GPI); in vx855gpio_set()
150 reg_out |= gpio_o_bit(nr - NR_VX855_GPInO); in vx855gpio_set()
152 reg_out &= ~gpio_o_bit(nr - NR_VX855_GPInO); in vx855gpio_set()
154 outl(reg_out, vg->io_gpo); in vx855gpio_set()
155 spin_unlock_irqrestore(&vg->lock, flags); in vx855gpio_set()
163 return -EINVAL; in vx855gpio_direction_output()
165 /* True GPO don't need to be switched to output mode, in vx855gpio_direction_output()
166 * and GPIO are open-drain, i.e. also need no switching, in vx855gpio_direction_output()
174 unsigned long config) in vx855gpio_set_config() argument
176 enum pin_config_param param = pinconf_to_config_param(config); in vx855gpio_set_config()
178 /* The GPI cannot be single-ended */ in vx855gpio_set_config()
180 return -EINVAL; in vx855gpio_set_config()
182 /* The GPO's are push-pull */ in vx855gpio_set_config()
185 return -ENOTSUPP; in vx855gpio_set_config()
191 return -ENOTSUPP; in vx855gpio_set_config()
211 struct gpio_chip *c = &vg->gpio; in vx855gpio_gpio_setup()
213 c->label = "VX855 South Bridge"; in vx855gpio_gpio_setup()
214 c->owner = THIS_MODULE; in vx855gpio_gpio_setup()
215 c->direction_input = vx855gpio_direction_input; in vx855gpio_gpio_setup()
216 c->direction_output = vx855gpio_direction_output; in vx855gpio_gpio_setup()
217 c->get = vx855gpio_get; in vx855gpio_gpio_setup()
218 c->set = vx855gpio_set; in vx855gpio_gpio_setup()
219 c->set_config = vx855gpio_set_config; in vx855gpio_gpio_setup()
220 c->dbg_show = NULL; in vx855gpio_gpio_setup()
221 c->base = 0; in vx855gpio_gpio_setup()
222 c->ngpio = NR_VX855_GP; in vx855gpio_gpio_setup()
223 c->can_sleep = false; in vx855gpio_gpio_setup()
224 c->names = vx855gpio_names; in vx855gpio_gpio_setup()
237 return -EBUSY; in vx855gpio_probe()
239 vg = devm_kzalloc(&pdev->dev, sizeof(*vg), GFP_KERNEL); in vx855gpio_probe()
241 return -ENOMEM; in vx855gpio_probe()
245 dev_info(&pdev->dev, "found VX855 GPIO controller\n"); in vx855gpio_probe()
246 vg->io_gpi = res_gpi->start; in vx855gpio_probe()
247 vg->io_gpo = res_gpo->start; in vx855gpio_probe()
248 spin_lock_init(&vg->lock); in vx855gpio_probe()
252 * and in the case of the OLPC XO-1.5, some of those ports are used in vx855gpio_probe()
258 if (!devm_request_region(&pdev->dev, res_gpi->start, in vx855gpio_probe()
260 dev_warn(&pdev->dev, in vx855gpio_probe()
263 if (!devm_request_region(&pdev->dev, res_gpo->start, in vx855gpio_probe()
265 dev_warn(&pdev->dev, in vx855gpio_probe()
266 "GPO I/O resource busy, probably claimed by ACPI\n"); in vx855gpio_probe()
270 return devm_gpiochip_add_data(&pdev->dev, &vg->gpio, vg); in vx855gpio_probe()