Lines Matching defs:panel

15 #define DEVICE_NAME		"ibm-panel"
26 static u8 ibm_panel_calculate_checksum(struct ibm_panel *panel)
32 for (i = 0; i < sizeof(panel->command) - 1; ++i) {
33 sum += panel->command[i];
47 static void ibm_panel_process_command(struct ibm_panel *panel)
52 if (panel->command[0] != 0xff && panel->command[1] != 0xf0) {
53 dev_dbg(&panel->input->dev, "command invalid: %02x %02x\n",
54 panel->command[0], panel->command[1]);
58 chksum = ibm_panel_calculate_checksum(panel);
59 if (chksum != panel->command[sizeof(panel->command) - 1]) {
60 dev_dbg(&panel->input->dev,
62 panel->command[sizeof(panel->command) - 1]);
66 button = panel->command[2] & 0xf;
68 input_report_key(panel->input, panel->keycodes[button],
69 !(panel->command[2] & 0x80));
70 input_sync(panel->input);
72 dev_dbg(&panel->input->dev, "unknown button %u\n",
81 struct ibm_panel *panel = i2c_get_clientdata(client);
83 dev_dbg(&panel->input->dev, "event: %u data: %02x\n", event, *val);
85 spin_lock_irqsave(&panel->lock, flags);
89 if (panel->idx == sizeof(panel->command))
90 ibm_panel_process_command(panel);
92 dev_dbg(&panel->input->dev,
93 "command incorrect size %u\n", panel->idx);
96 panel->idx = 0;
99 if (panel->idx < sizeof(panel->command))
100 panel->command[panel->idx++] = *val;
107 panel->idx = U8_MAX;
117 spin_unlock_irqrestore(&panel->lock, flags);
124 struct ibm_panel *panel;
128 panel = devm_kzalloc(&client->dev, sizeof(*panel), GFP_KERNEL);
129 if (!panel)
132 spin_lock_init(&panel->lock);
134 panel->input = devm_input_allocate_device(&client->dev);
135 if (!panel->input)
138 panel->input->name = client->name;
139 panel->input->id.bustype = BUS_I2C;
143 panel->keycodes,
150 panel->keycodes[0] = BTN_NORTH;
151 panel->keycodes[1] = BTN_SOUTH;
152 panel->keycodes[2] = BTN_SELECT;
156 input_set_capability(panel->input, EV_KEY, panel->keycodes[i]);
158 error = input_register_device(panel->input);
165 i2c_set_clientdata(client, panel);
182 { .compatible = "ibm,op-panel" },