Lines Matching full:block
43 struct sch311x_gpio_block { /* one GPIO block runtime data */
48 spinlock_t lock; /* lock for this GPIO block */
138 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_request() local
140 if (block->config_regs[offset] == 0) /* GPIO is not available */ in sch311x_gpio_request()
143 if (!request_region(block->runtime_reg + block->config_regs[offset], in sch311x_gpio_request()
146 block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_request()
154 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_free() local
156 if (block->config_regs[offset] == 0) /* GPIO is not available */ in sch311x_gpio_free()
159 release_region(block->runtime_reg + block->config_regs[offset], 1); in sch311x_gpio_free()
164 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_get() local
167 spin_lock(&block->lock); in sch311x_gpio_get()
168 data = inb(block->runtime_reg + block->data_reg); in sch311x_gpio_get()
169 spin_unlock(&block->lock); in sch311x_gpio_get()
174 static void __sch311x_gpio_set(struct sch311x_gpio_block *block, in __sch311x_gpio_set() argument
177 u8 data = inb(block->runtime_reg + block->data_reg); in __sch311x_gpio_set()
182 outb(data, block->runtime_reg + block->data_reg); in __sch311x_gpio_set()
188 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_set() local
190 spin_lock(&block->lock); in sch311x_gpio_set()
191 __sch311x_gpio_set(block, offset, value); in sch311x_gpio_set()
192 spin_unlock(&block->lock); in sch311x_gpio_set()
197 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_direction_in() local
200 spin_lock(&block->lock); in sch311x_gpio_direction_in()
201 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_in()
203 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_in()
204 spin_unlock(&block->lock); in sch311x_gpio_direction_in()
212 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_direction_out() local
215 spin_lock(&block->lock); in sch311x_gpio_direction_out()
217 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_out()
219 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_out()
220 __sch311x_gpio_set(block, offset, value); in sch311x_gpio_direction_out()
222 spin_unlock(&block->lock); in sch311x_gpio_direction_out()
228 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_get_direction() local
231 spin_lock(&block->lock); in sch311x_gpio_get_direction()
232 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_get_direction()
233 spin_unlock(&block->lock); in sch311x_gpio_get_direction()
241 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_set_config() local
247 spin_lock(&block->lock); in sch311x_gpio_set_config()
248 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
250 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
251 spin_unlock(&block->lock); in sch311x_gpio_set_config()
254 spin_lock(&block->lock); in sch311x_gpio_set_config()
255 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
257 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
258 spin_unlock(&block->lock); in sch311x_gpio_set_config()
270 struct sch311x_gpio_block *block; in sch311x_gpio_probe() local
288 block = &priv->blocks[i]; in sch311x_gpio_probe()
290 spin_lock_init(&block->lock); in sch311x_gpio_probe()
292 block->chip.label = DRV_NAME; in sch311x_gpio_probe()
293 block->chip.owner = THIS_MODULE; in sch311x_gpio_probe()
294 block->chip.request = sch311x_gpio_request; in sch311x_gpio_probe()
295 block->chip.free = sch311x_gpio_free; in sch311x_gpio_probe()
296 block->chip.direction_input = sch311x_gpio_direction_in; in sch311x_gpio_probe()
297 block->chip.direction_output = sch311x_gpio_direction_out; in sch311x_gpio_probe()
298 block->chip.get_direction = sch311x_gpio_get_direction; in sch311x_gpio_probe()
299 block->chip.set_config = sch311x_gpio_set_config; in sch311x_gpio_probe()
300 block->chip.get = sch311x_gpio_get; in sch311x_gpio_probe()
301 block->chip.set = sch311x_gpio_set; in sch311x_gpio_probe()
302 block->chip.ngpio = 8; in sch311x_gpio_probe()
303 block->chip.parent = &pdev->dev; in sch311x_gpio_probe()
304 block->chip.base = sch311x_gpio_blocks[i].base; in sch311x_gpio_probe()
305 block->config_regs = sch311x_gpio_blocks[i].config_regs; in sch311x_gpio_probe()
306 block->data_reg = sch311x_gpio_blocks[i].data_reg; in sch311x_gpio_probe()
307 block->runtime_reg = pdata->runtime_reg; in sch311x_gpio_probe()
309 err = gpiochip_add_data(&block->chip, block); in sch311x_gpio_probe()
316 "SMSC SCH311x GPIO block %d registered.\n", i); in sch311x_gpio_probe()
336 "SMSC SCH311x GPIO block %d unregistered.\n", i); in sch311x_gpio_remove()