rmi_f54.c (446279168e030fd0ed68e2bba336bef8bb3da352) rmi_f54.c (a9f08ad7adb3d2f90e11efbb40a1246ef95b0c04)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2012-2015 Synaptics Incorporated
4 * Copyright (C) 2016 Zodiac Inflight Innovations
5 */
6
7#include <linux/kernel.h>
8#include <linux/rmi.h>

--- 376 unchanged lines hidden (view full) ---

385 .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
386};
387
388static int rmi_f54_vidioc_querycap(struct file *file, void *priv,
389 struct v4l2_capability *cap)
390{
391 struct f54_data *f54 = video_drvdata(file);
392
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2012-2015 Synaptics Incorporated
4 * Copyright (C) 2016 Zodiac Inflight Innovations
5 */
6
7#include <linux/kernel.h>
8#include <linux/rmi.h>

--- 376 unchanged lines hidden (view full) ---

385 .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
386};
387
388static int rmi_f54_vidioc_querycap(struct file *file, void *priv,
389 struct v4l2_capability *cap)
390{
391 struct f54_data *f54 = video_drvdata(file);
392
393 strlcpy(cap->driver, F54_NAME, sizeof(cap->driver));
394 strlcpy(cap->card, SYNAPTICS_INPUT_DEVICE_NAME, sizeof(cap->card));
393 strscpy(cap->driver, F54_NAME, sizeof(cap->driver));
394 strscpy(cap->card, SYNAPTICS_INPUT_DEVICE_NAME, sizeof(cap->card));
395 snprintf(cap->bus_info, sizeof(cap->bus_info),
396 "rmi4:%s", dev_name(&f54->fn->dev));
397
398 return 0;
399}
400
401static int rmi_f54_vidioc_enum_input(struct file *file, void *priv,
402 struct v4l2_input *i)
403{
404 struct f54_data *f54 = video_drvdata(file);
405 enum rmi_f54_report_type reptype;
406
407 reptype = rmi_f54_get_reptype(f54, i->index);
408 if (reptype == F54_REPORT_NONE)
409 return -EINVAL;
410
411 i->type = V4L2_INPUT_TYPE_TOUCH;
412
395 snprintf(cap->bus_info, sizeof(cap->bus_info),
396 "rmi4:%s", dev_name(&f54->fn->dev));
397
398 return 0;
399}
400
401static int rmi_f54_vidioc_enum_input(struct file *file, void *priv,
402 struct v4l2_input *i)
403{
404 struct f54_data *f54 = video_drvdata(file);
405 enum rmi_f54_report_type reptype;
406
407 reptype = rmi_f54_get_reptype(f54, i->index);
408 if (reptype == F54_REPORT_NONE)
409 return -EINVAL;
410
411 i->type = V4L2_INPUT_TYPE_TOUCH;
412
413 strlcpy(i->name, rmi_f54_report_type_names[reptype], sizeof(i->name));
413 strscpy(i->name, rmi_f54_report_type_names[reptype], sizeof(i->name));
414 return 0;
415}
416
417static int rmi_f54_set_input(struct f54_data *f54, unsigned int i)
418{
419 struct rmi_device *rmi_dev = f54->fn->rmi_dev;
420 struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev);
421 u8 rx = drv_data->num_rx_electrodes ? : f54->num_rx_electrodes;

--- 269 unchanged lines hidden (view full) ---

691 f54->workqueue = create_singlethread_workqueue("rmi4-poller");
692 if (!f54->workqueue)
693 return -ENOMEM;
694
695 rmi_f54_create_input_map(f54);
696 rmi_f54_set_input(f54, 0);
697
698 /* register video device */
414 return 0;
415}
416
417static int rmi_f54_set_input(struct f54_data *f54, unsigned int i)
418{
419 struct rmi_device *rmi_dev = f54->fn->rmi_dev;
420 struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev);
421 u8 rx = drv_data->num_rx_electrodes ? : f54->num_rx_electrodes;

--- 269 unchanged lines hidden (view full) ---

691 f54->workqueue = create_singlethread_workqueue("rmi4-poller");
692 if (!f54->workqueue)
693 return -ENOMEM;
694
695 rmi_f54_create_input_map(f54);
696 rmi_f54_set_input(f54, 0);
697
698 /* register video device */
699 strlcpy(f54->v4l2.name, F54_NAME, sizeof(f54->v4l2.name));
699 strscpy(f54->v4l2.name, F54_NAME, sizeof(f54->v4l2.name));
700 ret = v4l2_device_register(&fn->dev, &f54->v4l2);
701 if (ret) {
702 dev_err(&fn->dev, "Unable to register video dev.\n");
703 goto remove_wq;
704 }
705
706 /* initialize the queue */
707 mutex_init(&f54->lock);

--- 50 unchanged lines hidden ---
700 ret = v4l2_device_register(&fn->dev, &f54->v4l2);
701 if (ret) {
702 dev_err(&fn->dev, "Unable to register video dev.\n");
703 goto remove_wq;
704 }
705
706 /* initialize the queue */
707 mutex_init(&f54->lock);

--- 50 unchanged lines hidden ---