Files
davidycchen ec5b56897b touchscreen: heatmap: fix build break of variable length array used
drivers/input/touchscreen/heatmap.c:79:24: error: variable length array used [-Werror,-Wvla]
strength_t temp_buffer[total_bytes];

Bug: 139783401
Test: Use v4l-heatmap-viewer.apk(provided in bug) to check touch heatmap is workable.

Change-Id: I640a711a4065f2909e4aa0738eae2b1e36c817d5
Signed-off-by: davidycchen <davidycchen@google.com>
(cherry picked from commit 752bb006b9865a0268b5dd3c677d03c0873f8e84)
2019-12-13 06:19:24 +00:00

55 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
typedef int16_t strength_t;
struct v4l2_heatmap {
struct device *parent_dev;
/* Can be NULL. Used to get the input device name */
struct input_dev *input_dev;
struct v4l2_device device;
struct v4l2_pix_format format;
struct video_device vdev;
struct vb2_queue queue;
struct mutex lock;
unsigned int input_index;
size_t width;
size_t height;
/* The 'frame' storage is managed by the heatmap module.
* The data inside frame is written inside read_frame(..)
* and is read inside heatmap_read(..).
*/
strength_t *frame;
struct v4l2_fract timeperframe;
/* Used to protect access to the buffer queue */
spinlock_t heatmap_lock;
/* guarded by heatmap_lock */
struct list_head heatmap_buffer_list;
/*
* Function read_frame must be provided by the driver.
* This function should write the video frame into the
* 'frame' field of struct v4l2_heatmap.
* It should return 'true' on successful heatmap read
* and 'false' on failure.
*/
bool (*read_frame)(struct v4l2_heatmap *v4l2);
};
int heatmap_probe(struct v4l2_heatmap *v4l2);
void heatmap_remove(struct v4l2_heatmap *v4l2);
/**
* Read the heatmap and populate an available buffer with data.
* The timestamp provided to this function will be used as the frame time.
* Designed to be called from interrupt context.
* This function should be called from the driver. Internally, it will call
* read_frame(..) provided by the driver to read the actual data.
*/
void heatmap_read(struct v4l2_heatmap *v4l2, uint64_t timestamp);