Lines Matching refs:stmpe
32 struct stmpe *stmpe; member
44 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_get() local
45 u8 reg = stmpe->regs[STMPE_IDX_GPMR_LSB + (offset / 8)]; in stmpe_gpio_get()
49 ret = stmpe_reg_read(stmpe, reg); in stmpe_gpio_get()
59 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_set() local
61 u8 reg = stmpe->regs[which + (offset / 8)]; in stmpe_gpio_set()
68 if (stmpe->regs[STMPE_IDX_GPSR_LSB] == stmpe->regs[STMPE_IDX_GPCR_LSB]) in stmpe_gpio_set()
69 stmpe_set_bits(stmpe, reg, mask, val ? mask : 0); in stmpe_gpio_set()
71 stmpe_reg_write(stmpe, reg, mask); in stmpe_gpio_set()
78 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_get_direction() local
79 u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB] - (offset / 8); in stmpe_gpio_get_direction()
83 ret = stmpe_reg_read(stmpe, reg); in stmpe_gpio_get_direction()
97 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_direction_output() local
98 u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB + (offset / 8)]; in stmpe_gpio_direction_output()
103 return stmpe_set_bits(stmpe, reg, mask, mask); in stmpe_gpio_direction_output()
110 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_direction_input() local
111 u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB + (offset / 8)]; in stmpe_gpio_direction_input()
114 return stmpe_set_bits(stmpe, reg, mask, 0); in stmpe_gpio_direction_input()
120 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_request() local
125 return stmpe_set_altfunc(stmpe, BIT(offset), STMPE_BLOCK_GPIO); in stmpe_gpio_request()
152 if (stmpe_gpio->stmpe->partnum == STMPE801 || in stmpe_gpio_irq_set_type()
153 stmpe_gpio->stmpe->partnum == STMPE1600) in stmpe_gpio_irq_set_type()
181 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_irq_sync_unlock() local
182 int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); in stmpe_gpio_irq_sync_unlock()
201 if (stmpe->partnum == STMPE1600) { in stmpe_gpio_irq_sync_unlock()
202 stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]); in stmpe_gpio_irq_sync_unlock()
203 stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]); in stmpe_gpio_irq_sync_unlock()
208 if ((stmpe->partnum == STMPE801 || in stmpe_gpio_irq_sync_unlock()
209 stmpe->partnum == STMPE1600) && in stmpe_gpio_irq_sync_unlock()
221 stmpe_reg_write(stmpe, stmpe->regs[regmap[i][j]], new); in stmpe_gpio_irq_sync_unlock()
255 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_dbg_show_one() local
259 u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB + bank]; in stmpe_dbg_show_one()
264 ret = stmpe_reg_read(stmpe, dir_reg); in stmpe_dbg_show_one()
300 switch (stmpe->partnum) { in stmpe_dbg_show_one()
306 edge_det_reg = stmpe->regs[STMPE_IDX_GPEDR_LSB + bank]; in stmpe_dbg_show_one()
307 ret = stmpe_reg_read(stmpe, edge_det_reg); in stmpe_dbg_show_one()
313 rise_reg = stmpe->regs[STMPE_IDX_GPRER_LSB + bank]; in stmpe_dbg_show_one()
314 fall_reg = stmpe->regs[STMPE_IDX_GPFER_LSB + bank]; in stmpe_dbg_show_one()
316 ret = stmpe_reg_read(stmpe, rise_reg); in stmpe_dbg_show_one()
320 ret = stmpe_reg_read(stmpe, fall_reg); in stmpe_dbg_show_one()
327 irqen_reg = stmpe->regs[STMPE_IDX_IEGPIOR_LSB + bank]; in stmpe_dbg_show_one()
334 ret = stmpe_reg_read(stmpe, irqen_reg); in stmpe_dbg_show_one()
374 struct stmpe *stmpe = stmpe_gpio->stmpe; in stmpe_gpio_irq() local
376 int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); in stmpe_gpio_irq()
389 if (stmpe->partnum == STMPE1600) in stmpe_gpio_irq()
390 statmsbreg = stmpe->regs[STMPE_IDX_ISGPIOR_LSB]; in stmpe_gpio_irq()
392 statmsbreg = stmpe->regs[STMPE_IDX_ISGPIOR_MSB]; in stmpe_gpio_irq()
394 ret = stmpe_block_read(stmpe, statmsbreg, num_banks, status); in stmpe_gpio_irq()
399 int bank = (stmpe_gpio->stmpe->partnum == STMPE1600) ? i : in stmpe_gpio_irq()
423 if (stmpe->partnum != STMPE801 && stmpe->partnum != STMPE1600 && in stmpe_gpio_irq()
424 stmpe->partnum != STMPE1801) { in stmpe_gpio_irq()
425 stmpe_reg_write(stmpe, statmsbreg + i, status[i]); in stmpe_gpio_irq()
426 stmpe_reg_write(stmpe, in stmpe_gpio_irq()
427 stmpe->regs[STMPE_IDX_GPEDR_MSB] + i, in stmpe_gpio_irq()
452 static void stmpe_gpio_disable(void *stmpe) in stmpe_gpio_disable() argument
454 stmpe_disable(stmpe, STMPE_BLOCK_GPIO); in stmpe_gpio_disable()
459 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); in stmpe_gpio_probe() local
464 if (stmpe->num_gpios > MAX_GPIOS) { in stmpe_gpio_probe()
476 stmpe_gpio->stmpe = stmpe; in stmpe_gpio_probe()
478 stmpe_gpio->chip.ngpio = stmpe->num_gpios; in stmpe_gpio_probe()
494 ret = stmpe_enable(stmpe, STMPE_BLOCK_GPIO); in stmpe_gpio_probe()
498 ret = devm_add_action_or_reset(&pdev->dev, stmpe_gpio_disable, stmpe); in stmpe_gpio_probe()