Lines Matching +full:fn +full:- +full:keymap

1 // SPDX-License-Identifier: GPL-2.0-only
13 u32 *keymap; member
17 static int rmi_f1a_parse_device_properties(struct rmi_function *fn, struct f1a_data *f1a) in rmi_f1a_parse_device_properties() argument
20 struct device *dev = &fn->dev; in rmi_f1a_parse_device_properties()
30 error = n_keys < 0 ? n_keys : -EINVAL; in rmi_f1a_parse_device_properties()
39 return -ENOMEM; in rmi_f1a_parse_device_properties()
49 f1a->keymap = buttonmap; in rmi_f1a_parse_device_properties()
50 f1a->num_keys = n_keys; in rmi_f1a_parse_device_properties()
57 struct rmi_function *fn = ctx; in rmi_f1a_attention() local
58 struct f1a_data *f1a = dev_get_drvdata(&fn->dev); in rmi_f1a_attention()
63 error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr, in rmi_f1a_attention()
66 dev_err(&fn->dev, "Failed to read object data. Code: %d.\n", in rmi_f1a_attention()
71 for (key = 0; key < f1a->num_keys; key++) in rmi_f1a_attention()
72 input_report_key(f1a->input, f1a->keymap[key], in rmi_f1a_attention()
78 static int rmi_f1a_config(struct rmi_function *fn) in rmi_f1a_config() argument
80 struct f1a_data *f1a = dev_get_drvdata(&fn->dev); in rmi_f1a_config()
81 struct rmi_driver *drv = fn->rmi_dev->driver; in rmi_f1a_config()
83 if (f1a->num_keys) in rmi_f1a_config()
84 drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); in rmi_f1a_config()
89 static int rmi_f1a_initialize(struct rmi_function *fn, struct f1a_data *f1a) in rmi_f1a_initialize() argument
94 error = rmi_f1a_parse_device_properties(fn, f1a); in rmi_f1a_initialize()
98 for (i = 0; i < f1a->num_keys; i++) in rmi_f1a_initialize()
99 input_set_capability(f1a->input, EV_KEY, f1a->keymap[i]); in rmi_f1a_initialize()
101 f1a->input->keycode = f1a->keymap; in rmi_f1a_initialize()
102 f1a->input->keycodemax = f1a->num_keys; in rmi_f1a_initialize()
103 f1a->input->keycodesize = sizeof(f1a->keymap[0]); in rmi_f1a_initialize()
108 static int rmi_f1a_probe(struct rmi_function *fn) in rmi_f1a_probe() argument
110 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_f1a_probe()
111 struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); in rmi_f1a_probe()
115 if (!drv_data->input) { in rmi_f1a_probe()
116 dev_info(&fn->dev, "F1A: no input device found, ignoring\n"); in rmi_f1a_probe()
117 return -ENXIO; in rmi_f1a_probe()
120 f1a = devm_kzalloc(&fn->dev, sizeof(*f1a), GFP_KERNEL); in rmi_f1a_probe()
122 return -ENOMEM; in rmi_f1a_probe()
124 f1a->input = drv_data->input; in rmi_f1a_probe()
126 error = rmi_f1a_initialize(fn, f1a); in rmi_f1a_probe()
130 dev_set_drvdata(&fn->dev, f1a); in rmi_f1a_probe()