greybus: Add camera protocol definition
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 15 Dec 2015 01:18:05 +0000 (03:18 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Dec 2015 02:12:30 +0000 (18:12 -0800)
Define the camera data protocol ID and all the protocol operations data
structures.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_manifest.h
drivers/staging/greybus/greybus_protocols.h

index 947b71c..32602b1 100644 (file)
@@ -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,
index d3f957f..f024acd 100644 (file)
@@ -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