Searched refs:stmpe (Results 1 - 10 of 10) sorted by relevance

/linux-4.1.27/drivers/mfd/
H A Dstmpe.c2 * ST Microelectronics MFD: stmpe's driver
24 #include "stmpe.h"
26 static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks) __stmpe_enable() argument
28 return stmpe->variant->enable(stmpe, blocks, true); __stmpe_enable()
31 static int __stmpe_disable(struct stmpe *stmpe, unsigned int blocks) __stmpe_disable() argument
33 return stmpe->variant->enable(stmpe, blocks, false); __stmpe_disable()
36 static int __stmpe_reg_read(struct stmpe *stmpe, u8 reg) __stmpe_reg_read() argument
40 ret = stmpe->ci->read_byte(stmpe, reg); __stmpe_reg_read()
42 dev_err(stmpe->dev, "failed to read reg %#x: %d\n", reg, ret); __stmpe_reg_read()
44 dev_vdbg(stmpe->dev, "rd: reg %#x => data %#x\n", reg, ret); __stmpe_reg_read()
49 static int __stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 val) __stmpe_reg_write() argument
53 dev_vdbg(stmpe->dev, "wr: reg %#x <= %#x\n", reg, val); __stmpe_reg_write()
55 ret = stmpe->ci->write_byte(stmpe, reg, val); __stmpe_reg_write()
57 dev_err(stmpe->dev, "failed to write reg %#x: %d\n", reg, ret); __stmpe_reg_write()
62 static int __stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val) __stmpe_set_bits() argument
66 ret = __stmpe_reg_read(stmpe, reg); __stmpe_set_bits()
73 return __stmpe_reg_write(stmpe, reg, ret); __stmpe_set_bits()
76 static int __stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length, __stmpe_block_read() argument
81 ret = stmpe->ci->read_block(stmpe, reg, length, values); __stmpe_block_read()
83 dev_err(stmpe->dev, "failed to read regs %#x: %d\n", reg, ret); __stmpe_block_read()
85 dev_vdbg(stmpe->dev, "rd: reg %#x (%d) => ret %#x\n", reg, length, ret); __stmpe_block_read()
86 stmpe_dump_bytes("stmpe rd: ", values, length); __stmpe_block_read()
91 static int __stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length, __stmpe_block_write() argument
96 dev_vdbg(stmpe->dev, "wr: regs %#x (%d)\n", reg, length); __stmpe_block_write()
97 stmpe_dump_bytes("stmpe wr: ", values, length); __stmpe_block_write()
99 ret = stmpe->ci->write_block(stmpe, reg, length, values); __stmpe_block_write()
101 dev_err(stmpe->dev, "failed to write regs %#x: %d\n", reg, ret); __stmpe_block_write()
108 * @stmpe: Device to work on
111 int stmpe_enable(struct stmpe *stmpe, unsigned int blocks) stmpe_enable() argument
115 mutex_lock(&stmpe->lock); stmpe_enable()
116 ret = __stmpe_enable(stmpe, blocks); stmpe_enable()
117 mutex_unlock(&stmpe->lock); stmpe_enable()
125 * @stmpe: Device to work on
128 int stmpe_disable(struct stmpe *stmpe, unsigned int blocks) stmpe_disable() argument
132 mutex_lock(&stmpe->lock); stmpe_disable()
133 ret = __stmpe_disable(stmpe, blocks); stmpe_disable()
134 mutex_unlock(&stmpe->lock); stmpe_disable()
142 * @stmpe: Device to read from
145 int stmpe_reg_read(struct stmpe *stmpe, u8 reg) stmpe_reg_read() argument
149 mutex_lock(&stmpe->lock); stmpe_reg_read()
150 ret = __stmpe_reg_read(stmpe, reg); stmpe_reg_read()
151 mutex_unlock(&stmpe->lock); stmpe_reg_read()
159 * @stmpe: Device to write to
163 int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 val) stmpe_reg_write() argument
167 mutex_lock(&stmpe->lock); stmpe_reg_write()
168 ret = __stmpe_reg_write(stmpe, reg, val); stmpe_reg_write()
169 mutex_unlock(&stmpe->lock); stmpe_reg_write()
177 * @stmpe: Device to write to
182 int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val) stmpe_set_bits() argument
186 mutex_lock(&stmpe->lock); stmpe_set_bits()
187 ret = __stmpe_set_bits(stmpe, reg, mask, val); stmpe_set_bits()
188 mutex_unlock(&stmpe->lock); stmpe_set_bits()
196 * @stmpe: Device to read from
201 int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length, u8 *values) stmpe_block_read() argument
205 mutex_lock(&stmpe->lock); stmpe_block_read()
206 ret = __stmpe_block_read(stmpe, reg, length, values); stmpe_block_read()
207 mutex_unlock(&stmpe->lock); stmpe_block_read()
215 * @stmpe: Device to write to
220 int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length, stmpe_block_write() argument
225 mutex_lock(&stmpe->lock); stmpe_block_write()
226 ret = __stmpe_block_write(stmpe, reg, length, values); stmpe_block_write()
227 mutex_unlock(&stmpe->lock); stmpe_block_write()
235 * @stmpe: Device to configure
245 int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins, enum stmpe_block block) stmpe_set_altfunc() argument
247 struct stmpe_variant_info *variant = stmpe->variant; stmpe_set_altfunc()
248 u8 regaddr = stmpe->regs[STMPE_IDX_GPAFR_U_MSB]; stmpe_set_altfunc()
250 int numregs = DIV_ROUND_UP(stmpe->num_gpios * af_bits, 8); stmpe_set_altfunc()
259 mutex_lock(&stmpe->lock); stmpe_set_altfunc()
261 ret = __stmpe_enable(stmpe, STMPE_BLOCK_GPIO); stmpe_set_altfunc()
265 ret = __stmpe_block_read(stmpe, regaddr, numregs, regs); stmpe_set_altfunc()
269 af = variant->get_altfunc(stmpe, block); stmpe_set_altfunc()
282 ret = __stmpe_block_write(stmpe, regaddr, numregs, regs); stmpe_set_altfunc()
285 mutex_unlock(&stmpe->lock); stmpe_set_altfunc()
302 .name = "stmpe-gpio",
303 .of_compatible = "st,stmpe-gpio",
309 .name = "stmpe-gpio",
310 .of_compatible = "st,stmpe-gpio",
330 .name = "stmpe-keypad",
331 .of_compatible = "st,stmpe-keypad",
366 static int stmpe801_enable(struct stmpe *stmpe, unsigned int blocks, stmpe801_enable() argument
414 .name = "stmpe-ts",
415 .of_compatible = "st,stmpe-ts",
454 static int stmpe811_enable(struct stmpe *stmpe, unsigned int blocks, stmpe811_enable() argument
468 return __stmpe_set_bits(stmpe, STMPE811_REG_SYS_CTRL2, mask, stmpe811_enable()
472 static int stmpe811_get_altfunc(struct stmpe *stmpe, enum stmpe_block block) stmpe811_get_altfunc() argument
563 static int stmpe_autosleep(struct stmpe *stmpe, int autosleep_timeout) stmpe_autosleep() argument
567 if (!stmpe->variant->enable_autosleep) stmpe_autosleep()
570 mutex_lock(&stmpe->lock); stmpe_autosleep()
571 ret = stmpe->variant->enable_autosleep(stmpe, autosleep_timeout); stmpe_autosleep()
572 mutex_unlock(&stmpe->lock); stmpe_autosleep()
578 * Both stmpe 1601/2403 support same layout for autosleep
580 static int stmpe1601_autosleep(struct stmpe *stmpe, stmpe1601_autosleep() argument
588 dev_err(stmpe->dev, "invalid timeout\n"); stmpe1601_autosleep()
592 ret = __stmpe_set_bits(stmpe, STMPE1601_REG_SYS_CTRL2, stmpe1601_autosleep()
598 return __stmpe_set_bits(stmpe, STMPE1601_REG_SYS_CTRL2, stmpe1601_autosleep()
603 static int stmpe1601_enable(struct stmpe *stmpe, unsigned int blocks, stmpe1601_enable() argument
623 return __stmpe_set_bits(stmpe, STMPE1601_REG_SYS_CTRL, mask, stmpe1601_enable()
627 static int stmpe1601_get_altfunc(struct stmpe *stmpe, enum stmpe_block block) stmpe1601_get_altfunc() argument
689 static int stmpe1801_enable(struct stmpe *stmpe, unsigned int blocks, stmpe1801_enable() argument
699 return __stmpe_set_bits(stmpe, STMPE1801_REG_INT_EN_MASK_LOW, mask, stmpe1801_enable()
703 static int stmpe1801_reset(struct stmpe *stmpe) stmpe1801_reset() argument
708 ret = __stmpe_set_bits(stmpe, STMPE1801_REG_SYS_CTRL, stmpe1801_reset()
715 ret = __stmpe_reg_read(stmpe, STMPE1801_REG_SYS_CTRL); stmpe1801_reset()
776 static int stmpe24xx_enable(struct stmpe *stmpe, unsigned int blocks, stmpe24xx_enable() argument
787 return __stmpe_set_bits(stmpe, STMPE24XX_REG_SYS_CTRL, mask, stmpe24xx_enable()
791 static int stmpe24xx_get_altfunc(struct stmpe *stmpe, enum stmpe_block block) stmpe24xx_get_altfunc() argument
857 struct stmpe *stmpe = data; stmpe_irq() local
858 struct stmpe_variant_info *variant = stmpe->variant; stmpe_irq()
866 int base = irq_create_mapping(stmpe->domain, 0); stmpe_irq()
873 israddr = stmpe->regs[STMPE_IDX_ISR_LSB]; stmpe_irq()
875 israddr = stmpe->regs[STMPE_IDX_ISR_MSB]; stmpe_irq()
877 ret = stmpe_block_read(stmpe, israddr, num, isr); stmpe_irq()
886 status &= stmpe->ier[bank]; stmpe_irq()
894 int nestedirq = irq_create_mapping(stmpe->domain, line); stmpe_irq()
900 stmpe_reg_write(stmpe, israddr + i, clear); stmpe_irq()
908 struct stmpe *stmpe = irq_data_get_irq_chip_data(data); stmpe_irq_lock() local
910 mutex_lock(&stmpe->irq_lock); stmpe_irq_lock()
915 struct stmpe *stmpe = irq_data_get_irq_chip_data(data); stmpe_irq_sync_unlock() local
916 struct stmpe_variant_info *variant = stmpe->variant; stmpe_irq_sync_unlock()
921 u8 new = stmpe->ier[i]; stmpe_irq_sync_unlock()
922 u8 old = stmpe->oldier[i]; stmpe_irq_sync_unlock()
927 stmpe->oldier[i] = new; stmpe_irq_sync_unlock()
928 stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_IER_LSB] - i, new); stmpe_irq_sync_unlock()
931 mutex_unlock(&stmpe->irq_lock); stmpe_irq_sync_unlock()
936 struct stmpe *stmpe = irq_data_get_irq_chip_data(data); stmpe_irq_mask() local
941 stmpe->ier[regoffset] &= ~mask; stmpe_irq_mask()
946 struct stmpe *stmpe = irq_data_get_irq_chip_data(data); stmpe_irq_unmask() local
951 stmpe->ier[regoffset] |= mask; stmpe_irq_unmask()
955 .name = "stmpe",
965 struct stmpe *stmpe = d->host_data; stmpe_irq_map() local
968 if (stmpe->variant->id_val != STMPE801_ID) stmpe_irq_map()
971 irq_set_chip_data(virq, stmpe); stmpe_irq_map()
998 static int stmpe_irq_init(struct stmpe *stmpe, struct device_node *np) stmpe_irq_init() argument
1001 int num_irqs = stmpe->variant->num_irqs; stmpe_irq_init()
1003 stmpe->domain = irq_domain_add_simple(np, num_irqs, base, stmpe_irq_init()
1004 &stmpe_irq_ops, stmpe); stmpe_irq_init()
1005 if (!stmpe->domain) { stmpe_irq_init()
1006 dev_err(stmpe->dev, "Failed to create irqdomain\n"); stmpe_irq_init()
1013 static int stmpe_chip_init(struct stmpe *stmpe) stmpe_chip_init() argument
1015 unsigned int irq_trigger = stmpe->pdata->irq_trigger; stmpe_chip_init()
1016 int autosleep_timeout = stmpe->pdata->autosleep_timeout; stmpe_chip_init()
1017 struct stmpe_variant_info *variant = stmpe->variant; stmpe_chip_init()
1023 ret = stmpe_block_read(stmpe, stmpe->regs[STMPE_IDX_CHIP_ID], stmpe_chip_init()
1030 dev_err(stmpe->dev, "unknown chip id: %#x\n", id); stmpe_chip_init()
1034 dev_info(stmpe->dev, "%s detected, chip id: %#x\n", variant->name, id); stmpe_chip_init()
1037 ret = stmpe_disable(stmpe, ~0); stmpe_chip_init()
1042 ret = stmpe1801_reset(stmpe); stmpe_chip_init()
1047 if (stmpe->irq >= 0) { stmpe_chip_init()
1069 if (stmpe->pdata->autosleep) { stmpe_chip_init()
1070 ret = stmpe_autosleep(stmpe, autosleep_timeout); stmpe_chip_init()
1075 return stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_ICR_LSB], icr); stmpe_chip_init()
1078 static int stmpe_add_device(struct stmpe *stmpe, const struct mfd_cell *cell) stmpe_add_device() argument
1080 return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, stmpe_add_device()
1081 NULL, 0, stmpe->domain); stmpe_add_device()
1084 static int stmpe_devices_init(struct stmpe *stmpe) stmpe_devices_init() argument
1086 struct stmpe_variant_info *variant = stmpe->variant; stmpe_devices_init()
1087 unsigned int platform_blocks = stmpe->pdata->blocks; stmpe_devices_init()
1107 ret = stmpe_add_device(stmpe, block->cell); stmpe_devices_init()
1113 dev_warn(stmpe->dev, stmpe_devices_init()
1125 pdata->id = of_alias_get_id(np, "stmpe-i2c"); stmpe_of_probe()
1163 struct stmpe *stmpe; stmpe_probe() local
1180 stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL); stmpe_probe()
1181 if (!stmpe) stmpe_probe()
1184 mutex_init(&stmpe->irq_lock); stmpe_probe()
1185 mutex_init(&stmpe->lock); stmpe_probe()
1187 stmpe->dev = ci->dev; stmpe_probe()
1188 stmpe->client = ci->client; stmpe_probe()
1189 stmpe->pdata = pdata; stmpe_probe()
1190 stmpe->ci = ci; stmpe_probe()
1191 stmpe->partnum = partnum; stmpe_probe()
1192 stmpe->variant = stmpe_variant_info[partnum]; stmpe_probe()
1193 stmpe->regs = stmpe->variant->regs; stmpe_probe()
1194 stmpe->num_gpios = stmpe->variant->num_gpios; stmpe_probe()
1195 stmpe->vcc = devm_regulator_get_optional(ci->dev, "vcc"); stmpe_probe()
1196 if (!IS_ERR(stmpe->vcc)) { stmpe_probe()
1197 ret = regulator_enable(stmpe->vcc); stmpe_probe()
1201 stmpe->vio = devm_regulator_get_optional(ci->dev, "vio"); stmpe_probe()
1202 if (!IS_ERR(stmpe->vio)) { stmpe_probe()
1203 ret = regulator_enable(stmpe->vio); stmpe_probe()
1207 dev_set_drvdata(stmpe->dev, stmpe); stmpe_probe()
1210 ci->init(stmpe); stmpe_probe()
1214 GPIOF_DIR_IN, "stmpe"); stmpe_probe()
1216 dev_err(stmpe->dev, "failed to request IRQ GPIO: %d\n", stmpe_probe()
1221 stmpe->irq = gpio_to_irq(pdata->irq_gpio); stmpe_probe()
1223 stmpe->irq = ci->irq; stmpe_probe()
1226 if (stmpe->irq < 0) { stmpe_probe()
1228 dev_info(stmpe->dev, stmpe_probe()
1230 stmpe->variant->name); stmpe_probe()
1231 if (!stmpe_noirq_variant_info[stmpe->partnum]) { stmpe_probe()
1232 dev_err(stmpe->dev, stmpe_probe()
1234 stmpe->variant->name); stmpe_probe()
1237 stmpe->variant = stmpe_noirq_variant_info[stmpe->partnum]; stmpe_probe()
1239 pdata->irq_trigger = irq_get_trigger_type(stmpe->irq); stmpe_probe()
1242 ret = stmpe_chip_init(stmpe); stmpe_probe()
1246 if (stmpe->irq >= 0) { stmpe_probe()
1247 ret = stmpe_irq_init(stmpe, np); stmpe_probe()
1251 ret = devm_request_threaded_irq(ci->dev, stmpe->irq, NULL, stmpe_probe()
1253 "stmpe", stmpe); stmpe_probe()
1255 dev_err(stmpe->dev, "failed to request IRQ: %d\n", stmpe_probe()
1261 ret = stmpe_devices_init(stmpe); stmpe_probe()
1265 dev_err(stmpe->dev, "failed to add children\n"); stmpe_probe()
1266 mfd_remove_devices(stmpe->dev); stmpe_probe()
1271 int stmpe_remove(struct stmpe *stmpe) stmpe_remove() argument
1273 if (!IS_ERR(stmpe->vio)) stmpe_remove()
1274 regulator_disable(stmpe->vio); stmpe_remove()
1275 if (!IS_ERR(stmpe->vcc)) stmpe_remove()
1276 regulator_disable(stmpe->vcc); stmpe_remove()
1278 mfd_remove_devices(stmpe->dev); stmpe_remove()
1286 struct stmpe *stmpe = dev_get_drvdata(dev); stmpe_suspend() local
1288 if (stmpe->irq >= 0 && device_may_wakeup(dev)) stmpe_suspend()
1289 enable_irq_wake(stmpe->irq); stmpe_suspend()
1296 struct stmpe *stmpe = dev_get_drvdata(dev); stmpe_resume() local
1298 if (stmpe->irq >= 0 && device_may_wakeup(dev)) stmpe_resume()
1299 disable_irq_wake(stmpe->irq); stmpe_resume()
H A Dstmpe-spi.c2 * ST Microelectronics MFD: stmpe's spi client specific driver
15 #include "stmpe.h"
19 static int spi_reg_read(struct stmpe *stmpe, u8 reg) spi_reg_read() argument
21 struct spi_device *spi = stmpe->client; spi_reg_read()
27 static int spi_reg_write(struct stmpe *stmpe, u8 reg, u8 val) spi_reg_write() argument
29 struct spi_device *spi = stmpe->client; spi_reg_write()
35 static int spi_block_read(struct stmpe *stmpe, u8 reg, u8 length, u8 *values) spi_block_read() argument
40 ret = spi_reg_read(stmpe, reg + i); spi_block_read()
49 static int spi_block_write(struct stmpe *stmpe, u8 reg, u8 length, spi_block_write() argument
55 ret = spi_reg_write(stmpe, reg, *(values + i - 1)); spi_block_write()
63 static void spi_init(struct stmpe *stmpe) spi_init() argument
65 struct spi_device *spi = stmpe->client; spi_init()
70 if (stmpe->variant->id_val == 0x0811) spi_init()
71 spi_reg_write(stmpe, STMPE811_REG_SPI_CFG, spi->mode); spi_init()
106 struct stmpe *stmpe = spi_get_drvdata(spi); stmpe_spi_remove() local
108 return stmpe_remove(stmpe); stmpe_spi_remove()
124 .name = "stmpe-spi",
H A Dstmpe-i2c.c2 * ST Microelectronics MFD: stmpe's i2c client specific driver
18 #include "stmpe.h"
20 static int i2c_reg_read(struct stmpe *stmpe, u8 reg) i2c_reg_read() argument
22 struct i2c_client *i2c = stmpe->client; i2c_reg_read()
27 static int i2c_reg_write(struct stmpe *stmpe, u8 reg, u8 val) i2c_reg_write() argument
29 struct i2c_client *i2c = stmpe->client; i2c_reg_write()
34 static int i2c_block_read(struct stmpe *stmpe, u8 reg, u8 length, u8 *values) i2c_block_read() argument
36 struct i2c_client *i2c = stmpe->client; i2c_block_read()
41 static int i2c_block_write(struct stmpe *stmpe, u8 reg, u8 length, i2c_block_write() argument
44 struct i2c_client *i2c = stmpe->client; i2c_block_write()
95 struct stmpe *stmpe = dev_get_drvdata(&i2c->dev); stmpe_i2c_remove() local
97 return stmpe_remove(stmpe); stmpe_i2c_remove()
114 .name = "stmpe-i2c",
H A Dstmpe.h13 #include <linux/mfd/stmpe.h>
73 int (*enable)(struct stmpe *stmpe, unsigned int blocks, bool enable);
74 int (*get_altfunc)(struct stmpe *stmpe, enum stmpe_block block);
75 int (*enable_autosleep)(struct stmpe *stmpe, int autosleep_timeout);
92 int (*read_byte)(struct stmpe *stmpe, u8 reg);
93 int (*write_byte)(struct stmpe *stmpe, u8 reg, u8 val);
94 int (*read_block)(struct stmpe *stmpe, u8 reg, u8 len, u8 *values);
95 int (*write_block)(struct stmpe *stmpe, u8 reg, u8 len,
97 void (*init)(struct stmpe *stmpe);
101 int stmpe_remove(struct stmpe *stmpe);
H A DMakefile29 obj-$(CONFIG_MFD_STMPE) += stmpe.o
30 obj-$(CONFIG_STMPE_I2C) += stmpe-i2c.o
31 obj-$(CONFIG_STMPE_SPI) += stmpe-spi.o
/linux-4.1.27/drivers/gpio/
H A Dgpio-stmpe.c15 #include <linux/mfd/stmpe.h>
30 struct stmpe *stmpe; member in struct:stmpe_gpio
47 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_get() local
48 u8 reg = stmpe->regs[STMPE_IDX_GPMR_LSB] - (offset / 8); stmpe_gpio_get()
52 ret = stmpe_reg_read(stmpe, reg); stmpe_gpio_get()
62 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_set() local
64 u8 reg = stmpe->regs[which] - (offset / 8); stmpe_gpio_set()
71 if (stmpe->regs[STMPE_IDX_GPSR_LSB] == stmpe->regs[STMPE_IDX_GPCR_LSB]) stmpe_gpio_set()
72 stmpe_set_bits(stmpe, reg, mask, val ? mask : 0); stmpe_gpio_set()
74 stmpe_reg_write(stmpe, reg, mask); stmpe_gpio_set()
81 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_direction_output() local
82 u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB] - (offset / 8); stmpe_gpio_direction_output()
87 return stmpe_set_bits(stmpe, reg, mask, mask); stmpe_gpio_direction_output()
94 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_direction_input() local
95 u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB] - (offset / 8); stmpe_gpio_direction_input()
98 return stmpe_set_bits(stmpe, reg, mask, 0); stmpe_gpio_direction_input()
104 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_request() local
109 return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO); stmpe_gpio_request()
113 .label = "stmpe",
135 if (stmpe_gpio->stmpe->partnum == STMPE801) stmpe_gpio_irq_set_type()
163 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_irq_sync_unlock() local
164 int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); stmpe_gpio_irq_sync_unlock()
174 if ((stmpe->partnum == STMPE801) && stmpe_gpio_irq_sync_unlock()
186 stmpe_reg_write(stmpe, stmpe->regs[regmap[i]] - j, new); stmpe_gpio_irq_sync_unlock()
220 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_dbg_show_one() local
222 int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); stmpe_dbg_show_one()
224 u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB] - (offset / 8); stmpe_dbg_show_one()
229 ret = stmpe_reg_read(stmpe, dir_reg); stmpe_dbg_show_one()
239 u8 edge_det_reg = stmpe->regs[STMPE_IDX_GPEDR_MSB] + num_banks - 1 - (offset / 8); stmpe_dbg_show_one()
240 u8 rise_reg = stmpe->regs[STMPE_IDX_GPRER_LSB] - (offset / 8); stmpe_dbg_show_one()
241 u8 fall_reg = stmpe->regs[STMPE_IDX_GPFER_LSB] - (offset / 8); stmpe_dbg_show_one()
242 u8 irqen_reg = stmpe->regs[STMPE_IDX_IEGPIOR_LSB] - (offset / 8); stmpe_dbg_show_one()
248 ret = stmpe_reg_read(stmpe, edge_det_reg); stmpe_dbg_show_one()
252 ret = stmpe_reg_read(stmpe, rise_reg); stmpe_dbg_show_one()
256 ret = stmpe_reg_read(stmpe, fall_reg); stmpe_dbg_show_one()
260 ret = stmpe_reg_read(stmpe, irqen_reg); stmpe_dbg_show_one()
287 .name = "stmpe-gpio",
298 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_irq() local
299 u8 statmsbreg = stmpe->regs[STMPE_IDX_ISGPIOR_MSB]; stmpe_gpio_irq()
300 int num_banks = DIV_ROUND_UP(stmpe->num_gpios, 8); stmpe_gpio_irq()
305 ret = stmpe_block_read(stmpe, statmsbreg, num_banks, status); stmpe_gpio_irq()
328 stmpe_reg_write(stmpe, statmsbreg + i, status[i]); stmpe_gpio_irq()
331 if (stmpe->partnum != STMPE801) stmpe_gpio_irq()
332 stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_GPEDR_MSB] stmpe_gpio_irq()
341 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); stmpe_gpio_probe() local
356 stmpe_gpio->stmpe = stmpe; stmpe_gpio_probe()
358 stmpe_gpio->chip.ngpio = stmpe->num_gpios; stmpe_gpio_probe()
374 ret = stmpe_enable(stmpe, STMPE_BLOCK_GPIO); stmpe_gpio_probe()
387 "stmpe-gpio", stmpe_gpio); stmpe_gpio_probe()
414 stmpe_disable(stmpe, STMPE_BLOCK_GPIO); stmpe_gpio_probe()
424 struct stmpe *stmpe = stmpe_gpio->stmpe; stmpe_gpio_remove() local
427 stmpe_disable(stmpe, STMPE_BLOCK_GPIO); stmpe_gpio_remove()
434 .driver.name = "stmpe-gpio",
/linux-4.1.27/include/linux/mfd/
H A Dstmpe.h38 * obtained by indexing stmpe->regs with one of the following.
67 * struct stmpe - STMPE MFD structure
80 * @irq: irq number for stmpe
86 struct stmpe { struct
106 extern int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 data);
107 extern int stmpe_reg_read(struct stmpe *stmpe, u8 reg);
108 extern int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
110 extern int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
112 extern int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val);
113 extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins,
115 extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks);
116 extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
166 * @autosleep: bool to enable/disable stmpe autosleep
/linux-4.1.27/drivers/input/touchscreen/
H A Dstmpe-ts.c27 #include <linux/mfd/stmpe.h>
63 #define STMPE_TS_NAME "stmpe-ts"
67 struct stmpe *stmpe; member in struct:stmpe_touch
82 static int __stmpe_reset_fifo(struct stmpe *stmpe) __stmpe_reset_fifo() argument
86 ret = stmpe_set_bits(stmpe, STMPE_REG_FIFO_STA, __stmpe_reset_fifo()
91 return stmpe_set_bits(stmpe, STMPE_REG_FIFO_STA, __stmpe_reset_fifo()
103 int_sta = stmpe_reg_read(ts->stmpe, STMPE_REG_INT_STA); stmpe_work()
114 int_sta = stmpe_reg_read(ts->stmpe, STMPE_REG_INT_STA); stmpe_work()
119 __stmpe_reset_fifo(ts->stmpe); stmpe_work()
144 stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, stmpe_ts_handler()
147 stmpe_block_read(ts->stmpe, STMPE_REG_TSC_DATA_XYZ, 4, data_set); stmpe_ts_handler()
160 __stmpe_reset_fifo(ts->stmpe); stmpe_ts_handler()
163 stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, stmpe_ts_handler()
176 struct stmpe *stmpe = ts->stmpe; stmpe_init_hw() local
179 ret = stmpe_enable(stmpe, STMPE_BLOCK_TOUCHSCREEN | STMPE_BLOCK_ADC); stmpe_init_hw()
189 ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1, stmpe_init_hw()
196 ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2, stmpe_init_hw()
207 ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg_mask, tsc_cfg); stmpe_init_hw()
213 ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z, stmpe_init_hw()
220 ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_I_DRIVE, stmpe_init_hw()
228 ret = stmpe_reg_write(stmpe, STMPE_REG_FIFO_TH, 1); stmpe_init_hw()
234 ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CTRL, stmpe_init_hw()
249 ret = __stmpe_reset_fifo(ts->stmpe); stmpe_ts_open()
253 return stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, stmpe_ts_open()
263 stmpe_set_bits(ts->stmpe, STMPE_REG_TSC_CTRL, stmpe_ts_close()
270 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); stmpe_ts_get_platform_info() local
274 ts->stmpe = stmpe; stmpe_ts_get_platform_info()
276 if (stmpe->pdata && stmpe->pdata->ts) { stmpe_ts_get_platform_info()
277 ts_pdata = stmpe->pdata->ts; stmpe_ts_get_platform_info()
379 stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN); stmpe_ts_remove()
H A DMakefile62 obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
/linux-4.1.27/drivers/input/keyboard/
H A Dstmpe-keypad.c14 #include <linux/mfd/stmpe.h>
108 * @stmpe: pointer to parent STMPE device
121 struct stmpe *stmpe; member in struct:stmpe_keypad
135 struct stmpe *stmpe = keypad->stmpe; stmpe_keypad_read_data() local
140 return stmpe_block_read(stmpe, STMPE_KPC_DATA_BYTE0, stmpe_keypad_read_data()
144 ret = stmpe_reg_read(stmpe, STMPE_KPC_DATA_BYTE0 + i); stmpe_keypad_read_data()
191 struct stmpe *stmpe = keypad->stmpe; stmpe_keypad_altfunc_init() local
192 u8 pureg = stmpe->regs[STMPE_IDX_GPPUR_LSB]; stmpe_keypad_altfunc_init()
229 ret = stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); stmpe_keypad_altfunc_init()
242 ret = stmpe_reg_read(stmpe, pureg); stmpe_keypad_altfunc_init()
250 ret = stmpe_reg_write(stmpe, pureg, val); stmpe_keypad_altfunc_init()
259 struct stmpe *stmpe = keypad->stmpe; stmpe_keypad_chip_init() local
268 ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); stmpe_keypad_chip_init()
276 ret = stmpe_reg_write(stmpe, STMPE_KPC_COL, keypad->cols); stmpe_keypad_chip_init()
280 ret = stmpe_reg_write(stmpe, STMPE_KPC_ROW_LSB, keypad->rows); stmpe_keypad_chip_init()
285 ret = stmpe_set_bits(stmpe, STMPE_KPC_ROW_MSB, stmpe_keypad_chip_init()
292 ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, stmpe_keypad_chip_init()
298 return stmpe_set_bits(stmpe, STMPE_KPC_CTRL_LSB, stmpe_keypad_chip_init()
324 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); stmpe_keypad_probe() local
342 keypad->stmpe = stmpe; stmpe_keypad_probe()
343 keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; stmpe_keypad_probe()
380 IRQF_ONESHOT, "stmpe-keypad", keypad); stmpe_keypad_probe()
402 stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD); stmpe_keypad_remove()
408 .driver.name = "stmpe-keypad",

Completed in 223 milliseconds