Lines Matching refs:f3a

39 				  struct f3a_data *f3a, unsigned int button)  in rmi_f3a_report_button()  argument
41 u16 key_code = f3a->gpio_key_map[button]; in rmi_f3a_report_button()
42 bool key_down = !(f3a->data_regs[0] & BIT(button)); in rmi_f3a_report_button()
44 if (f3a->trackstick_buttons && in rmi_f3a_report_button()
47 rmi_f03_overwrite_button(f3a->f03, key_code, key_down); in rmi_f3a_report_button()
52 input_report_key(f3a->input, key_code, key_down); in rmi_f3a_report_button()
59 struct f3a_data *f3a = dev_get_drvdata(&fn->dev); in rmi_f3a_attention() local
65 if (drvdata->attn_data.size < f3a->register_count) { in rmi_f3a_attention()
70 memcpy(f3a->data_regs, drvdata->attn_data.data, in rmi_f3a_attention()
71 f3a->register_count); in rmi_f3a_attention()
72 drvdata->attn_data.data += f3a->register_count; in rmi_f3a_attention()
73 drvdata->attn_data.size -= f3a->register_count; in rmi_f3a_attention()
76 f3a->data_regs, f3a->register_count); in rmi_f3a_attention()
85 for (i = 0; i < f3a->gpio_count; i++) in rmi_f3a_attention()
86 if (f3a->gpio_key_map[i] != KEY_RESERVED) in rmi_f3a_attention()
87 rmi_f3a_report_button(fn, f3a, i); in rmi_f3a_attention()
88 if (f3a->trackstick_buttons) in rmi_f3a_attention()
89 rmi_f03_commit_buttons(f3a->f03); in rmi_f3a_attention()
96 struct f3a_data *f3a = dev_get_drvdata(&fn->dev); in rmi_f3a_config() local
101 if (!f3a) in rmi_f3a_config()
106 f3a->f03 = rmi_find_function(fn->rmi_dev, 0x03); in rmi_f3a_config()
107 f3a->trackstick_buttons = f3a->f03 != NULL; in rmi_f3a_config()
115 static bool rmi_f3a_is_valid_button(int button, struct f3a_data *f3a, in rmi_f3a_is_valid_button() argument
122 static int rmi_f3a_map_gpios(struct rmi_function *fn, struct f3a_data *f3a, in rmi_f3a_map_gpios() argument
127 struct input_dev *input = f3a->input; in rmi_f3a_map_gpios()
132 int button_count = min_t(u8, f3a->gpio_count, TRACKSTICK_RANGE_END); in rmi_f3a_map_gpios()
134 f3a->gpio_key_map = devm_kcalloc(&fn->dev, in rmi_f3a_map_gpios()
136 sizeof(f3a->gpio_key_map[0]), in rmi_f3a_map_gpios()
138 if (!f3a->gpio_key_map) { in rmi_f3a_map_gpios()
144 if (!rmi_f3a_is_valid_button(i, f3a, query1_regs, ctrl1_regs)) in rmi_f3a_map_gpios()
150 f3a->gpio_key_map[i] = trackstick_button++; in rmi_f3a_map_gpios()
152 f3a->gpio_key_map[i] = button; in rmi_f3a_map_gpios()
157 input->keycode = f3a->gpio_key_map; in rmi_f3a_map_gpios()
158 input->keycodesize = sizeof(f3a->gpio_key_map[0]); in rmi_f3a_map_gpios()
159 input->keycodemax = f3a->gpio_count; in rmi_f3a_map_gpios()
167 static int rmi_f3a_initialize(struct rmi_function *fn, struct f3a_data *f3a) in rmi_f3a_initialize() argument
181 f3a->gpio_count = buf & RMI_F3A_GPIO_COUNT; in rmi_f3a_initialize()
182 f3a->register_count = DIV_ROUND_UP(f3a->gpio_count, 8); in rmi_f3a_initialize()
186 query1, f3a->register_count); in rmi_f3a_initialize()
194 ctrl1, f3a->register_count); in rmi_f3a_initialize()
200 error = rmi_f3a_map_gpios(fn, f3a, query1, ctrl1); in rmi_f3a_initialize()
211 struct f3a_data *f3a; in rmi_f3a_probe() local
219 f3a = devm_kzalloc(&fn->dev, sizeof(*f3a), GFP_KERNEL); in rmi_f3a_probe()
220 if (!f3a) in rmi_f3a_probe()
223 f3a->input = drv_data->input; in rmi_f3a_probe()
225 error = rmi_f3a_initialize(fn, f3a); in rmi_f3a_probe()
229 dev_set_drvdata(&fn->dev, f3a); in rmi_f3a_probe()