Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e61a2a71 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Greg Kroah-Hartman
Browse files

greybus: Add camera protocol definition



Define the camera data protocol ID and all the protocol operations data
structures.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 8e3fba55
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ enum greybus_protocol {
	/* 0x0a is unused */
	GREYBUS_PROTOCOL_SPI		= 0x0b,
	GREYBUS_PROTOCOL_DISPLAY	= 0x0c,
	GREYBUS_PROTOCOL_CAMERA		= 0x0d,
	GREYBUS_PROTOCOL_CAMERA_MGMT	= 0x0d,
	GREYBUS_PROTOCOL_SENSOR		= 0x0e,
	GREYBUS_PROTOCOL_LIGHTS		= 0x0f,
	GREYBUS_PROTOCOL_VIBRATOR	= 0x10,
@@ -44,6 +44,7 @@ enum greybus_protocol {
	GREYBUS_PROTOCOL_AUDIO_DATA	= 0x13,
	GREYBUS_PROTOCOL_SVC            = 0x14,
	GREYBUS_PROTOCOL_FIRMWARE	= 0x15,
	GREYBUS_PROTOCOL_CAMERA_DATA	= 0x16,
		/* ... */
	GREYBUS_PROTOCOL_RAW		= 0xfe,
	GREYBUS_PROTOCOL_VENDOR		= 0xff,
+71 −0
Original line number Diff line number Diff line
@@ -1100,6 +1100,77 @@ struct gb_sdio_event_request {
#define GB_SDIO_WP		0x04
} __packed;

/* Camera */

#define GB_CAMERA_VERSION_MAJOR			0x00
#define GB_CAMERA_VERSION_MINOR			0x01

/* Greybus Camera request types */
#define GB_CAMERA_TYPE_CAPABILITIES		0x02
#define GB_CAMERA_TYPE_CONFIGURE_STREAMS	0x03
#define GB_CAMERA_TYPE_CAPTURE			0x04
#define GB_CAMERA_TYPE_FLUSH			0x05
#define GB_CAMERA_TYPE_METADATA			0x06

#define GB_CAMERA_MAX_STREAMS			4
#define GB_CAMERA_MAX_SETTINGS_SIZE		8192

/* Greybus Camera Configure Streams request payload */
struct gb_camera_stream_config_request {
	__le16 width;
	__le16 height;
	__le16 format;
	__le16 padding;
} __packed;

struct gb_camera_configure_streams_request {
	__le16 num_streams;
	__le16 padding;
	struct gb_camera_stream_config_request config[0];
} __packed;

/* Greybus Camera Configure Streams response payload */
struct gb_camera_stream_config_response {
	__le16 width;
	__le16 height;
	__le16 format;
	__u8 virtual_channel;
	__u8 data_type[2];
	__u8 padding[3];
	__le32 max_size;
} __packed;

struct gb_camera_configure_streams_response {
	__le16 num_streams;
#define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED	0x01
	u8 flags;
	u8 padding;
	struct gb_camera_stream_config_response config[0];
} __packed;

/* Greybus Camera Capture request payload - response has no payload */
struct gb_camera_capture_request {
	__le32 request_id;
	u8 streams;
	u8 padding;
	__le16 num_frames;
	u8 settings[0];
} __packed;

/* Greybus Camera Flush response payload - request has no payload */
struct gb_camera_flush_response {
	__le32 request_id;
} __packed;

/* Greybus Camera Metadata request payload - operation has no response */
struct gb_camera_metadata_request {
	__le32 request_id;
	__le16 frame_number;
	__u8 stream;
	__u8 padding;
	u8 metadata[0];
} __packed;

/* Lights */

#define GB_LIGHTS_VERSION_MAJOR 0x00