Lines Matching refs:block
134 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_request() local
136 if (block->config_regs[offset] == 0) /* GPIO is not available */ in sch311x_gpio_request()
139 if (!request_region(block->runtime_reg + block->config_regs[offset], in sch311x_gpio_request()
142 block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_request()
150 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_free() local
152 if (block->config_regs[offset] == 0) /* GPIO is not available */ in sch311x_gpio_free()
155 release_region(block->runtime_reg + block->config_regs[offset], 1); in sch311x_gpio_free()
160 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_get() local
163 spin_lock(&block->lock); in sch311x_gpio_get()
164 data = inb(block->runtime_reg + block->data_reg); in sch311x_gpio_get()
165 spin_unlock(&block->lock); in sch311x_gpio_get()
170 static void __sch311x_gpio_set(struct sch311x_gpio_block *block, in __sch311x_gpio_set() argument
173 u8 data = inb(block->runtime_reg + block->data_reg); in __sch311x_gpio_set()
178 outb(data, block->runtime_reg + block->data_reg); in __sch311x_gpio_set()
184 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_set() local
186 spin_lock(&block->lock); in sch311x_gpio_set()
187 __sch311x_gpio_set(block, offset, value); in sch311x_gpio_set()
188 spin_unlock(&block->lock); in sch311x_gpio_set()
193 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_direction_in() local
196 spin_lock(&block->lock); in sch311x_gpio_direction_in()
197 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_in()
199 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_in()
200 spin_unlock(&block->lock); in sch311x_gpio_direction_in()
208 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_direction_out() local
211 spin_lock(&block->lock); in sch311x_gpio_direction_out()
213 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_out()
215 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_direction_out()
216 __sch311x_gpio_set(block, offset, value); in sch311x_gpio_direction_out()
218 spin_unlock(&block->lock); in sch311x_gpio_direction_out()
224 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_get_direction() local
227 spin_lock(&block->lock); in sch311x_gpio_get_direction()
228 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_get_direction()
229 spin_unlock(&block->lock); in sch311x_gpio_get_direction()
240 struct sch311x_gpio_block *block = gpiochip_get_data(chip); in sch311x_gpio_set_config() local
246 spin_lock(&block->lock); in sch311x_gpio_set_config()
247 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
249 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
250 spin_unlock(&block->lock); in sch311x_gpio_set_config()
253 spin_lock(&block->lock); in sch311x_gpio_set_config()
254 data = inb(block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
256 outb(data, block->runtime_reg + block->config_regs[offset]); in sch311x_gpio_set_config()
257 spin_unlock(&block->lock); in sch311x_gpio_set_config()
269 struct sch311x_gpio_block *block; in sch311x_gpio_probe() local
287 block = &priv->blocks[i]; in sch311x_gpio_probe()
289 spin_lock_init(&block->lock); in sch311x_gpio_probe()
291 block->chip.label = DRV_NAME; in sch311x_gpio_probe()
292 block->chip.owner = THIS_MODULE; in sch311x_gpio_probe()
293 block->chip.request = sch311x_gpio_request; in sch311x_gpio_probe()
294 block->chip.free = sch311x_gpio_free; in sch311x_gpio_probe()
295 block->chip.direction_input = sch311x_gpio_direction_in; in sch311x_gpio_probe()
296 block->chip.direction_output = sch311x_gpio_direction_out; in sch311x_gpio_probe()
297 block->chip.get_direction = sch311x_gpio_get_direction; in sch311x_gpio_probe()
298 block->chip.set_config = sch311x_gpio_set_config; in sch311x_gpio_probe()
299 block->chip.get = sch311x_gpio_get; in sch311x_gpio_probe()
300 block->chip.set = sch311x_gpio_set; in sch311x_gpio_probe()
301 block->chip.ngpio = 8; in sch311x_gpio_probe()
302 block->chip.parent = &pdev->dev; in sch311x_gpio_probe()
303 block->chip.base = sch311x_gpio_blocks[i].base; in sch311x_gpio_probe()
304 block->config_regs = sch311x_gpio_blocks[i].config_regs; in sch311x_gpio_probe()
305 block->data_reg = sch311x_gpio_blocks[i].data_reg; in sch311x_gpio_probe()
306 block->runtime_reg = pdata->runtime_reg; in sch311x_gpio_probe()
308 err = gpiochip_add_data(&block->chip, block); in sch311x_gpio_probe()