Lines Matching full:panel

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