Gjorgji Rosikopulos | fc0ddf5 | 2016-01-13 21:52:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Greybus Camera protocol driver. |
| 3 | * |
| 4 | * Copyright 2015 Google Inc. |
| 5 | * |
| 6 | * Released under the GPLv2 only. |
| 7 | */ |
| 8 | #ifndef __GB_CAMERA_H |
| 9 | #define __GB_CAMERA_H |
| 10 | |
| 11 | #include <linux/v4l2-mediabus.h> |
| 12 | |
Gjorgji Rosikopulos | 24ac4fa | 2016-01-17 19:52:20 +0200 | [diff] [blame] | 13 | /* Input flags need to be set from the caller */ |
| 14 | #define GB_CAMERA_IN_FLAG_TEST (1 << 0) |
| 15 | /* Output flags returned */ |
| 16 | #define GB_CAMERA_OUT_FLAG_ADJUSTED (1 << 0) |
| 17 | |
Gjorgji Rosikopulos | fc0ddf5 | 2016-01-13 21:52:37 +0200 | [diff] [blame] | 18 | struct gb_camera_stream { |
| 19 | unsigned int width; |
| 20 | unsigned int height; |
| 21 | enum v4l2_mbus_pixelcode pixel_code; |
| 22 | unsigned int vc; |
| 23 | unsigned int dt[2]; |
| 24 | unsigned int max_size; |
| 25 | }; |
| 26 | |
| 27 | struct gb_camera_ops { |
| 28 | ssize_t (*capabilities)(void *priv, char *buf, size_t len); |
Gjorgji Rosikopulos | 24ac4fa | 2016-01-17 19:52:20 +0200 | [diff] [blame] | 29 | int (*configure_streams)(void *priv, unsigned int *nstreams, |
| 30 | unsigned int *flags, struct gb_camera_stream *streams); |
Gjorgji Rosikopulos | fc0ddf5 | 2016-01-13 21:52:37 +0200 | [diff] [blame] | 31 | int (*capture)(void *priv, u32 request_id, |
| 32 | unsigned int streams, unsigned int num_frames, |
| 33 | size_t settings_size, const void *settings); |
| 34 | int (*flush)(void *priv, u32 *request_id); |
| 35 | }; |
| 36 | |
| 37 | #define gb_camera_call(f, p, op, args...) \ |
| 38 | (((f)->op) ? (f)->op(p, ##args) : -ENOIOCTLCMD) |
| 39 | |
| 40 | int gb_camera_register(struct gb_camera_ops *ops, void *priv); |
| 41 | |
| 42 | #endif /* __GB_CAMERA_H */ |