^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2012-2020 Synaptics Incorporated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/rmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "rmi_driver.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define RMI_F3A_MAX_GPIO_COUNT 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define RMI_F3A_MAX_REG_SIZE DIV_ROUND_UP(RMI_F3A_MAX_GPIO_COUNT, 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /* Defs for Query 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define RMI_F3A_GPIO_COUNT 0x7F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define RMI_F3A_DATA_REGS_MAX_SIZE RMI_F3A_MAX_REG_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define TRACKSTICK_RANGE_START 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define TRACKSTICK_RANGE_END 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct f3a_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* Query Data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) u8 gpio_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u8 register_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) u8 data_regs[RMI_F3A_DATA_REGS_MAX_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u16 *gpio_key_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct rmi_function *f03;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) bool trackstick_buttons;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static void rmi_f3a_report_button(struct rmi_function *fn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct f3a_data *f3a, unsigned int button)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u16 key_code = f3a->gpio_key_map[button];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) bool key_down = !(f3a->data_regs[0] & BIT(button));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) if (f3a->trackstick_buttons &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) button >= TRACKSTICK_RANGE_START &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) button <= TRACKSTICK_RANGE_END) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) rmi_f03_overwrite_button(f3a->f03, key_code, key_down);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) rmi_dbg(RMI_DEBUG_FN, &fn->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) "%s: call input report key (0x%04x) value (0x%02x)",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __func__, key_code, key_down);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) input_report_key(f3a->input, key_code, key_down);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static irqreturn_t rmi_f3a_attention(int irq, void *ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct rmi_function *fn = ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct f3a_data *f3a = dev_get_drvdata(&fn->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) if (drvdata->attn_data.data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (drvdata->attn_data.size < f3a->register_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) dev_warn(&fn->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) "F3A interrupted, but data is missing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) memcpy(f3a->data_regs, drvdata->attn_data.data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) f3a->register_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) drvdata->attn_data.data += f3a->register_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) drvdata->attn_data.size -= f3a->register_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) f3a->data_regs, f3a->register_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) dev_err(&fn->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) "%s: Failed to read F3a data registers: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __func__, error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return IRQ_RETVAL(error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) for (i = 0; i < f3a->gpio_count; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (f3a->gpio_key_map[i] != KEY_RESERVED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) rmi_f3a_report_button(fn, f3a, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (f3a->trackstick_buttons)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) rmi_f03_commit_buttons(f3a->f03);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static int rmi_f3a_config(struct rmi_function *fn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct f3a_data *f3a = dev_get_drvdata(&fn->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct rmi_driver *drv = fn->rmi_dev->driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) const struct rmi_device_platform_data *pdata =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) rmi_get_platform_data(fn->rmi_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) if (!f3a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if (pdata->gpio_data.trackstick_buttons) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* Try [re-]establish link to F03. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) f3a->f03 = rmi_find_function(fn->rmi_dev, 0x03);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) f3a->trackstick_buttons = f3a->f03 != NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) drv->set_irq_bits(fn->rmi_dev, fn->irq_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) static bool rmi_f3a_is_valid_button(int button, struct f3a_data *f3a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) u8 *query1_regs, u8 *ctrl1_regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* gpio exist && direction input */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) return (query1_regs[0] & BIT(button)) && !(ctrl1_regs[0] & BIT(button));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static int rmi_f3a_map_gpios(struct rmi_function *fn, struct f3a_data *f3a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) u8 *query1_regs, u8 *ctrl1_regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) const struct rmi_device_platform_data *pdata =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) rmi_get_platform_data(fn->rmi_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct input_dev *input = f3a->input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned int button = BTN_LEFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) unsigned int trackstick_button = BTN_LEFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) bool button_mapped = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) int button_count = min_t(u8, f3a->gpio_count, TRACKSTICK_RANGE_END);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) f3a->gpio_key_map = devm_kcalloc(&fn->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) button_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) sizeof(f3a->gpio_key_map[0]),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) if (!f3a->gpio_key_map) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) dev_err(&fn->dev, "Failed to allocate gpio map memory.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) for (i = 0; i < button_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) if (!rmi_f3a_is_valid_button(i, f3a, query1_regs, ctrl1_regs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (pdata->gpio_data.trackstick_buttons &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) i >= TRACKSTICK_RANGE_START &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) i < TRACKSTICK_RANGE_END) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) f3a->gpio_key_map[i] = trackstick_button++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) } else if (!pdata->gpio_data.buttonpad || !button_mapped) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) f3a->gpio_key_map[i] = button;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) input_set_capability(input, EV_KEY, button++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) button_mapped = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) input->keycode = f3a->gpio_key_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) input->keycodesize = sizeof(f3a->gpio_key_map[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) input->keycodemax = f3a->gpio_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) if (pdata->gpio_data.buttonpad || (button - BTN_LEFT == 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static int rmi_f3a_initialize(struct rmi_function *fn, struct f3a_data *f3a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) u8 query1[RMI_F3A_MAX_REG_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) u8 ctrl1[RMI_F3A_MAX_REG_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) u8 buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) error = rmi_read(fn->rmi_dev, fn->fd.query_base_addr, &buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (error < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) dev_err(&fn->dev, "Failed to read general info register: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) f3a->gpio_count = buf & RMI_F3A_GPIO_COUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) f3a->register_count = DIV_ROUND_UP(f3a->gpio_count, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /* Query1 -> gpio exist */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) query1, f3a->register_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) dev_err(&fn->dev, "Failed to read query1 register\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /* Ctrl1 -> gpio direction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) error = rmi_read_block(fn->rmi_dev, fn->fd.control_base_addr + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) ctrl1, f3a->register_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) dev_err(&fn->dev, "Failed to read control1 register\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) error = rmi_f3a_map_gpios(fn, f3a, query1, ctrl1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static int rmi_f3a_probe(struct rmi_function *fn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct rmi_device *rmi_dev = fn->rmi_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) struct f3a_data *f3a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if (!drv_data->input) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) dev_info(&fn->dev, "F3A: no input device found, ignoring\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) f3a = devm_kzalloc(&fn->dev, sizeof(*f3a), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) if (!f3a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) f3a->input = drv_data->input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) error = rmi_f3a_initialize(fn, f3a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) dev_set_drvdata(&fn->dev, f3a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct rmi_function_handler rmi_f3a_handler = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) .name = "rmi4_f3a",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) .func = 0x3a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .probe = rmi_f3a_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .config = rmi_f3a_config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .attention = rmi_f3a_attention,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) };