Lines Matching refs:gpio
140 struct pcf857x *gpio = gpiochip_get_data(chip); in pcf857x_input() local
143 mutex_lock(&gpio->lock); in pcf857x_input()
144 gpio->out |= (1 << offset); in pcf857x_input()
145 status = gpio->write(gpio->client, gpio->out); in pcf857x_input()
146 mutex_unlock(&gpio->lock); in pcf857x_input()
153 struct pcf857x *gpio = gpiochip_get_data(chip); in pcf857x_get() local
156 value = gpio->read(gpio->client); in pcf857x_get()
162 struct pcf857x *gpio = gpiochip_get_data(chip); in pcf857x_output() local
166 mutex_lock(&gpio->lock); in pcf857x_output()
168 gpio->out |= bit; in pcf857x_output()
170 gpio->out &= ~bit; in pcf857x_output()
171 status = gpio->write(gpio->client, gpio->out); in pcf857x_output()
172 mutex_unlock(&gpio->lock); in pcf857x_output()
186 struct pcf857x *gpio = data; in pcf857x_irq() local
189 status = gpio->read(gpio->client); in pcf857x_irq()
195 mutex_lock(&gpio->lock); in pcf857x_irq()
196 change = (gpio->status ^ status) & gpio->irq_enabled; in pcf857x_irq()
197 gpio->status = status; in pcf857x_irq()
198 mutex_unlock(&gpio->lock); in pcf857x_irq()
200 for_each_set_bit(i, &change, gpio->chip.ngpio) in pcf857x_irq()
201 handle_nested_irq(irq_find_mapping(gpio->chip.irqdomain, i)); in pcf857x_irq()
213 struct pcf857x *gpio = irq_data_get_irq_chip_data(data); in pcf857x_irq_set_wake() local
217 if (gpio->irq_parent) { in pcf857x_irq_set_wake()
218 error = irq_set_irq_wake(gpio->irq_parent, on); in pcf857x_irq_set_wake()
220 dev_dbg(&gpio->client->dev, in pcf857x_irq_set_wake()
222 gpio->irq_parent); in pcf857x_irq_set_wake()
223 gpio->irq_parent = 0; in pcf857x_irq_set_wake()
231 struct pcf857x *gpio = irq_data_get_irq_chip_data(data); in pcf857x_irq_enable() local
233 gpio->irq_enabled |= (1 << data->hwirq); in pcf857x_irq_enable()
238 struct pcf857x *gpio = irq_data_get_irq_chip_data(data); in pcf857x_irq_disable() local
240 gpio->irq_enabled &= ~(1 << data->hwirq); in pcf857x_irq_disable()
245 struct pcf857x *gpio = irq_data_get_irq_chip_data(data); in pcf857x_irq_bus_lock() local
247 mutex_lock(&gpio->lock); in pcf857x_irq_bus_lock()
252 struct pcf857x *gpio = irq_data_get_irq_chip_data(data); in pcf857x_irq_bus_sync_unlock() local
254 mutex_unlock(&gpio->lock); in pcf857x_irq_bus_sync_unlock()
276 struct pcf857x *gpio; in pcf857x_probe() local
288 gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); in pcf857x_probe()
289 if (!gpio) in pcf857x_probe()
292 mutex_init(&gpio->lock); in pcf857x_probe()
294 gpio->chip.base = pdata ? pdata->gpio_base : -1; in pcf857x_probe()
295 gpio->chip.can_sleep = true; in pcf857x_probe()
296 gpio->chip.parent = &client->dev; in pcf857x_probe()
297 gpio->chip.owner = THIS_MODULE; in pcf857x_probe()
298 gpio->chip.get = pcf857x_get; in pcf857x_probe()
299 gpio->chip.set = pcf857x_set; in pcf857x_probe()
300 gpio->chip.direction_input = pcf857x_input; in pcf857x_probe()
301 gpio->chip.direction_output = pcf857x_output; in pcf857x_probe()
302 gpio->chip.ngpio = id->driver_data; in pcf857x_probe()
315 if (gpio->chip.ngpio == 8) { in pcf857x_probe()
316 gpio->write = i2c_write_le8; in pcf857x_probe()
317 gpio->read = i2c_read_le8; in pcf857x_probe()
333 } else if (gpio->chip.ngpio == 16) { in pcf857x_probe()
334 gpio->write = i2c_write_le16; in pcf857x_probe()
335 gpio->read = i2c_read_le16; in pcf857x_probe()
352 gpio->chip.label = client->name; in pcf857x_probe()
354 gpio->client = client; in pcf857x_probe()
355 i2c_set_clientdata(client, gpio); in pcf857x_probe()
372 gpio->out = ~n_latch; in pcf857x_probe()
373 gpio->status = gpio->out; in pcf857x_probe()
375 status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio); in pcf857x_probe()
381 status = gpiochip_irqchip_add(&gpio->chip, &pcf857x_irq_chip, in pcf857x_probe()
392 dev_name(&client->dev), gpio); in pcf857x_probe()
396 gpiochip_set_chained_irqchip(&gpio->chip, &pcf857x_irq_chip, in pcf857x_probe()
398 gpio->irq_parent = client->irq; in pcf857x_probe()
406 gpio->chip.base, gpio->chip.ngpio, in pcf857x_probe()
426 struct pcf857x *gpio = i2c_get_clientdata(client); in pcf857x_remove() local
431 gpio->chip.base, gpio->chip.ngpio, in pcf857x_remove()
445 struct pcf857x *gpio = i2c_get_clientdata(client); in pcf857x_shutdown() local
448 gpio->write(gpio->client, BIT(gpio->chip.ngpio) - 1); in pcf857x_shutdown()