blob: 50af0573737b08b2a4628b86e39affb56fe3e7e4 [file] [log] [blame]
Gjorgji Rosikopulosfc0ddf52016-01-13 21:52:37 +02001/*
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 Rosikopulos24ac4fa2016-01-17 19:52:20 +020013/* 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 Rosikopulosfc0ddf52016-01-13 21:52:37 +020018struct 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
27struct gb_camera_ops {
28 ssize_t (*capabilities)(void *priv, char *buf, size_t len);
Gjorgji Rosikopulos24ac4fa2016-01-17 19:52:20 +020029 int (*configure_streams)(void *priv, unsigned int *nstreams,
30 unsigned int *flags, struct gb_camera_stream *streams);
Gjorgji Rosikopulosfc0ddf52016-01-13 21:52:37 +020031 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
40int gb_camera_register(struct gb_camera_ops *ops, void *priv);
41
42#endif /* __GB_CAMERA_H */