Lines Matching +full:rmi4 +full:- +full:f01

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2011-2016 Synaptics Incorporated
46 * purpose. For example F11 is a 2D touch sensor while F01 is a generic
64 return dev->type == &rmi_device_type; in rmi_is_physical_device()
68 * rmi_register_transport_device - register a transport device connection
70 * on a bus (such as SPI, I2C, and so on) to the RMI4 sensor.
82 return -ENOMEM; in rmi_register_transport_device()
84 device_initialize(&rmi_dev->dev); in rmi_register_transport_device()
86 rmi_dev->xport = xport; in rmi_register_transport_device()
87 rmi_dev->number = atomic_inc_return(&transport_device_count) - 1; in rmi_register_transport_device()
89 dev_set_name(&rmi_dev->dev, "rmi4-%02d", rmi_dev->number); in rmi_register_transport_device()
91 rmi_dev->dev.bus = &rmi_bus_type; in rmi_register_transport_device()
92 rmi_dev->dev.type = &rmi_device_type; in rmi_register_transport_device()
93 rmi_dev->dev.parent = xport->dev; in rmi_register_transport_device()
95 xport->rmi_dev = rmi_dev; in rmi_register_transport_device()
97 error = device_add(&rmi_dev->dev); in rmi_register_transport_device()
101 rmi_dbg(RMI_DEBUG_CORE, xport->dev, in rmi_register_transport_device()
103 dev_name(rmi_dev->xport->dev), dev_name(&rmi_dev->dev)); in rmi_register_transport_device()
108 put_device(&rmi_dev->dev); in rmi_register_transport_device()
114 * rmi_unregister_transport_device - unregister a transport device connection
120 struct rmi_device *rmi_dev = xport->rmi_dev; in rmi_unregister_transport_device()
122 device_del(&rmi_dev->dev); in rmi_unregister_transport_device()
123 put_device(&rmi_dev->dev); in rmi_unregister_transport_device()
144 return dev->type == &rmi_function_type; in rmi_is_function_device()
152 return fn->fd.function_number == handler->func; in rmi_function_match()
159 struct device_node *node = fn->rmi_dev->xport->dev->of_node; in rmi_function_of_probe()
161 snprintf(of_name, sizeof(of_name), "rmi4-f%02x", in rmi_function_of_probe()
162 fn->fd.function_number); in rmi_function_of_probe()
163 fn->dev.of_node = of_get_child_by_name(node, of_name); in rmi_function_of_probe()
171 .name = "rmi4",
177 struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev); in rmi_create_function_irq()
180 for (i = 0; i < fn->num_of_irqs; i++) { in rmi_create_function_irq()
181 set_bit(fn->irq_pos + i, fn->irq_mask); in rmi_create_function_irq()
183 fn->irq[i] = irq_create_mapping(drvdata->irqdomain, in rmi_create_function_irq()
184 fn->irq_pos + i); in rmi_create_function_irq()
186 irq_set_chip_data(fn->irq[i], fn); in rmi_create_function_irq()
187 irq_set_chip_and_handler(fn->irq[i], &rmi_irq_chip, in rmi_create_function_irq()
189 irq_set_nested_thread(fn->irq[i], 1); in rmi_create_function_irq()
191 error = devm_request_threaded_irq(&fn->dev, fn->irq[i], NULL, in rmi_create_function_irq()
192 handler->attention, IRQF_ONESHOT, in rmi_create_function_irq()
193 dev_name(&fn->dev), fn); in rmi_create_function_irq()
195 dev_err(&fn->dev, "Error %d registering IRQ\n", error); in rmi_create_function_irq()
207 to_rmi_function_handler(dev->driver); in rmi_function_probe()
212 if (handler->probe) { in rmi_function_probe()
213 error = handler->probe(fn); in rmi_function_probe()
218 if (fn->num_of_irqs && handler->attention) { in rmi_function_probe()
231 to_rmi_function_handler(dev->driver); in rmi_function_remove()
233 if (handler->remove) in rmi_function_remove()
234 handler->remove(fn); in rmi_function_remove()
241 struct rmi_device *rmi_dev = fn->rmi_dev; in rmi_register_function()
244 device_initialize(&fn->dev); in rmi_register_function()
246 dev_set_name(&fn->dev, "%s.fn%02x", in rmi_register_function()
247 dev_name(&rmi_dev->dev), fn->fd.function_number); in rmi_register_function()
249 fn->dev.parent = &rmi_dev->dev; in rmi_register_function()
250 fn->dev.type = &rmi_function_type; in rmi_register_function()
251 fn->dev.bus = &rmi_bus_type; in rmi_register_function()
253 error = device_add(&fn->dev); in rmi_register_function()
255 dev_err(&rmi_dev->dev, in rmi_register_function()
257 dev_name(&fn->dev)); in rmi_register_function()
261 rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Registered F%02X.\n", in rmi_register_function()
262 fn->fd.function_number); in rmi_register_function()
267 put_device(&fn->dev); in rmi_register_function()
275 rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n", in rmi_unregister_function()
276 fn->fd.function_number); in rmi_unregister_function()
278 device_del(&fn->dev); in rmi_unregister_function()
279 of_node_put(fn->dev.of_node); in rmi_unregister_function()
281 for (i = 0; i < fn->num_of_irqs; i++) in rmi_unregister_function()
282 irq_dispose_mapping(fn->irq[i]); in rmi_unregister_function()
284 put_device(&fn->dev); in rmi_unregister_function()
288 * __rmi_register_function_handler - register a handler for an RMI function
301 struct device_driver *driver = &handler->driver; in __rmi_register_function_handler()
304 driver->bus = &rmi_bus_type; in __rmi_register_function_handler()
305 driver->owner = owner; in __rmi_register_function_handler()
306 driver->mod_name = mod_name; in __rmi_register_function_handler()
307 driver->probe = rmi_function_probe; in __rmi_register_function_handler()
308 driver->remove = rmi_function_remove; in __rmi_register_function_handler()
313 driver->name, error); in __rmi_register_function_handler()
322 * rmi_unregister_function_handler - unregister given RMI function handler
330 driver_unregister(&handler->driver); in rmi_unregister_function_handler()
349 .name = "rmi4",
384 for (i = start_idx; i >= 0; i--) in __rmi_unregister_function_handlers()
390 __rmi_unregister_function_handlers(ARRAY_SIZE(fn_handlers) - 1); in rmi_unregister_function_handlers()
402 __func__, fn_handlers[i]->func, ret); in rmi_register_function_handlers()
410 __rmi_unregister_function_handlers(i - 1); in rmi_register_function_handlers()
420 retval = of_property_read_u32(dev->of_node, prop, &val); in rmi_of_property_read_u32()
421 if (retval && (!optional && retval == -EINVAL)) { in rmi_of_property_read_u32()