aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-rmi.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 28579d783155..e2a43a1d3aa3 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -274,6 +274,46 @@ static inline int rmi_read(struct hid_device *hdev, u16 addr, void *buf)
274 return rmi_read_block(hdev, addr, buf, 1); 274 return rmi_read_block(hdev, addr, buf, 1);
275} 275}
276 276
277static int rmi_write_block(struct hid_device *hdev, u16 addr, void *buf,
278 const int len)
279{
280 struct rmi_data *data = hid_get_drvdata(hdev);
281 int ret;
282
283 mutex_lock(&data->page_mutex);
284
285 if (RMI_PAGE(addr) != data->page) {
286 ret = rmi_set_page(hdev, RMI_PAGE(addr));
287 if (ret < 0)
288 goto exit;
289 }
290
291 data->writeReport[0] = RMI_WRITE_REPORT_ID;
292 data->writeReport[1] = len;
293 data->writeReport[2] = addr & 0xFF;
294 data->writeReport[3] = (addr >> 8) & 0xFF;
295 memcpy(&data->writeReport[4], buf, len);
296
297 ret = rmi_write_report(hdev, data->writeReport,
298 data->output_report_size);
299 if (ret < 0) {
300 dev_err(&hdev->dev,
301 "failed to write request output report (%d)\n",
302 ret);
303 goto exit;
304 }
305 ret = 0;
306
307exit:
308 mutex_unlock(&data->page_mutex);
309 return ret;
310}
311
312static inline int rmi_write(struct hid_device *hdev, u16 addr, void *buf)
313{
314 return rmi_write_block(hdev, addr, buf, 1);
315}
316
277static void rmi_f11_process_touch(struct rmi_data *hdata, int slot, 317static void rmi_f11_process_touch(struct rmi_data *hdata, int slot,
278 u8 finger_state, u8 *touch_data) 318 u8 finger_state, u8 *touch_data)
279{ 319{