1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

input: Implemented touchpanel uclass for touchpanel devices

Touchapnel devices are useful in u-boot for implementation of boot
menu user interfaces on tablets and other touch based devices.

This uclass implements start, stop and get_touches interface methods.

Signed-off-by: Ondrej Jirman <megous@megous.com>
This commit is contained in:
Ondrej Jirman
2018-10-23 16:55:36 +02:00
committed by Ondrej Jirman
parent 320e366321
commit 88e72e2d24
5 changed files with 139 additions and 0 deletions

61
include/touchpanel.h Normal file
View File

@@ -0,0 +1,61 @@
#ifndef __TOUCHPANEL_H
#define __TOUCHPANEL_H
/**
* struct touchpanel_priv - information about a touchpanel, for the uclass
*
* @sdev: stdio device
*/
struct touchpanel_priv {
int size_x;
int size_y;
};
struct touchpanel_touch {
int id;
int x;
int y;
};
/**
* struct touchpanel_ops - touchpanel device operations
*/
struct touchpanel_ops {
/**
* start() - enable the touchpanel to be ready for use
*
* @dev: Device to enable
* @return 0 if OK, -ve on error
*/
int (*start)(struct udevice *dev);
/**
* stop() - disable the touchpanel when no-longer needed
*
* @dev: Device to disable
* @return 0 if OK, -ve on error
*/
int (*stop)(struct udevice *dev);
/**
* get_touches() - get list of active touches
*
* @dev: Device to read from
* @touches: Array where to store touches. If NULL, the driver will
* only return number of touches available.
* @max_touches: Size of an touches array
* @return -EAGAIN if no touch is available, otherwise number of touches
* available.
*/
int (*get_touches)(struct udevice *dev,
struct touchpanel_touch* touches, int max_touches);
};
#define touchpanel_get_ops(dev) ((struct touchpanel_ops *)(dev)->driver->ops)
int touchpanel_start(struct udevice *dev);
int touchpanel_stop(struct udevice *dev);
int touchpanel_get_touches(struct udevice *dev,
struct touchpanel_touch* touches, int max_touches);
#endif /* __TOUCHPANEL_H */