• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/input/keyboard/

Lines Matching defs:chip

55 static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val)
59 error = i2c_smbus_write_word_data(chip->client, reg << 1, val);
61 dev_err(&chip->client->dev,
70 static int tca6416_read_reg(struct tca6416_keypad_chip *chip, int reg, u16 *val)
74 retval = i2c_smbus_read_word_data(chip->client, reg << 1);
76 dev_err(&chip->client->dev, "%s failed, reg: %d, error: %d\n",
85 static void tca6416_keys_scan(struct tca6416_keypad_chip *chip)
87 struct input_dev *input = chip->input;
91 error = tca6416_read_reg(chip, TCA6416_INPUT, &reg_val);
95 reg_val &= chip->pinmask;
98 val = reg_val ^ chip->reg_input;
99 chip->reg_input = reg_val;
103 struct tca6416_button *button = &chip->buttons[pin_index];
112 if (chip->pinmask & (1 << i))
122 struct tca6416_keypad_chip *chip = dev_id;
124 tca6416_keys_scan(chip);
131 struct tca6416_keypad_chip *chip =
134 tca6416_keys_scan(chip);
135 schedule_delayed_work(&chip->dwork, msecs_to_jiffies(100));
140 struct tca6416_keypad_chip *chip = input_get_drvdata(dev);
143 tca6416_keys_scan(chip);
145 if (chip->use_polling)
146 schedule_delayed_work(&chip->dwork, msecs_to_jiffies(100));
148 enable_irq(chip->irqnum);
155 struct tca6416_keypad_chip *chip = input_get_drvdata(dev);
157 if (chip->use_polling)
158 cancel_delayed_work_sync(&chip->dwork);
160 disable_irq(chip->irqnum);
163 static int __devinit tca6416_setup_registers(struct tca6416_keypad_chip *chip)
167 error = tca6416_read_reg(chip, TCA6416_OUTPUT, &chip->reg_output);
171 error = tca6416_read_reg(chip, TCA6416_DIRECTION, &chip->reg_direction);
176 error = tca6416_write_reg(chip, TCA6416_DIRECTION,
177 chip->reg_direction | chip->pinmask);
181 error = tca6416_read_reg(chip, TCA6416_DIRECTION, &chip->reg_direction);
185 error = tca6416_read_reg(chip, TCA6416_INPUT, &chip->reg_input);
189 chip->reg_input &= chip->pinmask;
198 struct tca6416_keypad_chip *chip;
216 chip = kzalloc(sizeof(struct tca6416_keypad_chip) +
220 if (!chip || !input) {
225 chip->client = client;
226 chip->input = input;
227 chip->pinmask = pdata->pinmask;
228 chip->use_polling = pdata->use_polling;
230 INIT_DELAYED_WORK(&chip->dwork, tca6416_keys_work_func);
251 chip->buttons[i] = pdata->buttons[i];
256 input_set_drvdata(input, chip);
260 * we can't share this chip with another i2c master.
262 error = tca6416_setup_registers(chip);
266 if (!chip->use_polling) {
268 chip->irqnum = gpio_to_irq(client->irq);
270 chip->irqnum = client->irq;
272 error = request_threaded_irq(chip->irqnum, NULL,
275 "tca6416-keypad", chip);
279 chip->irqnum, error);
282 disable_irq(chip->irqnum);
292 i2c_set_clientdata(client, chip);
297 if (!chip->use_polling) {
298 free_irq(chip->irqnum, chip);
299 enable_irq(chip->irqnum);
303 kfree(chip);
309 struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
311 if (!chip->use_polling) {
312 free_irq(chip->irqnum, chip);
313 enable_irq(chip->irqnum);
316 input_unregister_device(chip->input);
317 kfree(chip);