• Home
  • Raw
  • Download

Lines Matching full:touchkey

3  * TM2 touchkey device driver
26 #define TM2_TOUCHKEY_DEV_NAME "tm2-touchkey"
89 struct tm2_touchkey_data *touchkey = in tm2_touchkey_led_brightness_set() local
96 data = touchkey->variant->cmd_led_off; in tm2_touchkey_led_brightness_set()
99 data = touchkey->variant->cmd_led_on; in tm2_touchkey_led_brightness_set()
102 if (!touchkey->variant->fixed_regulator) in tm2_touchkey_led_brightness_set()
103 regulator_set_voltage(touchkey->vdd, volt, volt); in tm2_touchkey_led_brightness_set()
105 return touchkey->variant->no_reg ? in tm2_touchkey_led_brightness_set()
106 i2c_smbus_write_byte(touchkey->client, data) : in tm2_touchkey_led_brightness_set()
107 i2c_smbus_write_byte_data(touchkey->client, in tm2_touchkey_led_brightness_set()
108 touchkey->variant->base_reg, data); in tm2_touchkey_led_brightness_set()
111 static int tm2_touchkey_power_enable(struct tm2_touchkey_data *touchkey) in tm2_touchkey_power_enable() argument
115 error = regulator_bulk_enable(ARRAY_SIZE(touchkey->regulators), in tm2_touchkey_power_enable()
116 touchkey->regulators); in tm2_touchkey_power_enable()
128 struct tm2_touchkey_data *touchkey = data; in tm2_touchkey_power_disable() local
130 regulator_bulk_disable(ARRAY_SIZE(touchkey->regulators), in tm2_touchkey_power_disable()
131 touchkey->regulators); in tm2_touchkey_power_disable()
136 struct tm2_touchkey_data *touchkey = devid; in tm2_touchkey_irq_handler() local
141 if (touchkey->variant->no_reg) in tm2_touchkey_irq_handler()
142 data = i2c_smbus_read_byte(touchkey->client); in tm2_touchkey_irq_handler()
144 data = i2c_smbus_read_byte_data(touchkey->client, in tm2_touchkey_irq_handler()
145 touchkey->variant->keycode_reg); in tm2_touchkey_irq_handler()
147 dev_err(&touchkey->client->dev, in tm2_touchkey_irq_handler()
153 if (index < 0 || index >= touchkey->num_keycodes) { in tm2_touchkey_irq_handler()
154 dev_warn(&touchkey->client->dev, in tm2_touchkey_irq_handler()
160 for (i = 0; i < touchkey->num_keycodes; i++) in tm2_touchkey_irq_handler()
161 input_report_key(touchkey->input_dev, in tm2_touchkey_irq_handler()
162 touchkey->keycodes[i], 0); in tm2_touchkey_irq_handler()
164 input_report_key(touchkey->input_dev, in tm2_touchkey_irq_handler()
165 touchkey->keycodes[index], 1); in tm2_touchkey_irq_handler()
168 input_sync(touchkey->input_dev); in tm2_touchkey_irq_handler()
171 if (touchkey->variant->fixed_regulator && in tm2_touchkey_irq_handler()
174 if (touchkey->led_dev.brightness == LED_OFF) in tm2_touchkey_irq_handler()
175 tm2_touchkey_led_brightness_set(&touchkey->led_dev, in tm2_touchkey_irq_handler()
186 struct tm2_touchkey_data *touchkey; in tm2_touchkey_probe() local
196 touchkey = devm_kzalloc(&client->dev, sizeof(*touchkey), GFP_KERNEL); in tm2_touchkey_probe()
197 if (!touchkey) in tm2_touchkey_probe()
200 touchkey->client = client; in tm2_touchkey_probe()
201 i2c_set_clientdata(client, touchkey); in tm2_touchkey_probe()
203 touchkey->variant = of_device_get_match_data(&client->dev); in tm2_touchkey_probe()
205 touchkey->regulators[0].supply = "vcc"; in tm2_touchkey_probe()
206 touchkey->regulators[1].supply = "vdd"; in tm2_touchkey_probe()
208 ARRAY_SIZE(touchkey->regulators), in tm2_touchkey_probe()
209 touchkey->regulators); in tm2_touchkey_probe()
216 touchkey->vdd = touchkey->regulators[1].consumer; in tm2_touchkey_probe()
218 touchkey->num_keycodes = of_property_read_variable_u32_array(np, in tm2_touchkey_probe()
219 "linux,keycodes", touchkey->keycodes, 0, in tm2_touchkey_probe()
220 ARRAY_SIZE(touchkey->keycodes)); in tm2_touchkey_probe()
221 if (touchkey->num_keycodes <= 0) { in tm2_touchkey_probe()
223 touchkey->keycodes[0] = KEY_PHONE; in tm2_touchkey_probe()
224 touchkey->keycodes[1] = KEY_BACK; in tm2_touchkey_probe()
225 touchkey->num_keycodes = 2; in tm2_touchkey_probe()
228 error = tm2_touchkey_power_enable(touchkey); in tm2_touchkey_probe()
235 tm2_touchkey_power_disable, touchkey); in tm2_touchkey_probe()
243 touchkey->input_dev = devm_input_allocate_device(&client->dev); in tm2_touchkey_probe()
244 if (!touchkey->input_dev) { in tm2_touchkey_probe()
249 touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME; in tm2_touchkey_probe()
250 touchkey->input_dev->id.bustype = BUS_I2C; in tm2_touchkey_probe()
252 for (i = 0; i < touchkey->num_keycodes; i++) in tm2_touchkey_probe()
253 input_set_capability(touchkey->input_dev, EV_KEY, in tm2_touchkey_probe()
254 touchkey->keycodes[i]); in tm2_touchkey_probe()
256 error = input_register_device(touchkey->input_dev); in tm2_touchkey_probe()
266 TM2_TOUCHKEY_DEV_NAME, touchkey); in tm2_touchkey_probe()
274 touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME; in tm2_touchkey_probe()
275 touchkey->led_dev.brightness = LED_ON; in tm2_touchkey_probe()
276 touchkey->led_dev.max_brightness = LED_ON; in tm2_touchkey_probe()
277 touchkey->led_dev.brightness_set_blocking = in tm2_touchkey_probe()
280 error = devm_led_classdev_register(&client->dev, &touchkey->led_dev); in tm2_touchkey_probe()
283 "failed to register touchkey led: %d\n", error); in tm2_touchkey_probe()
287 if (touchkey->variant->fixed_regulator) in tm2_touchkey_probe()
288 tm2_touchkey_led_brightness_set(&touchkey->led_dev, LED_ON); in tm2_touchkey_probe()
296 struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client); in tm2_touchkey_suspend() local
299 tm2_touchkey_power_disable(touchkey); in tm2_touchkey_suspend()
307 struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client); in tm2_touchkey_resume() local
312 ret = tm2_touchkey_power_enable(touchkey); in tm2_touchkey_resume()
330 .compatible = "cypress,tm2-touchkey",
333 .compatible = "cypress,midas-touchkey",
336 .compatible = "cypress,aries-touchkey",
339 .compatible = "coreriver,tc360-touchkey",
359 MODULE_DESCRIPTION("Samsung touchkey driver");