xref: /linux/drivers/media/i2c/et8ek8/et8ek8_reg.h (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  * et8ek8_reg.h
3  *
4  * Copyright (C) 2008 Nokia Corporation
5  *
6  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
7  *          Tuukka Toivonen <tuukkat76@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  */
18 
19 #ifndef ET8EK8REGS_H
20 #define ET8EK8REGS_H
21 
22 #include <linux/i2c.h>
23 #include <linux/types.h>
24 #include <linux/videodev2.h>
25 #include <linux/v4l2-subdev.h>
26 
27 struct v4l2_mbus_framefmt;
28 struct v4l2_subdev_pad_mbus_code_enum;
29 
30 struct et8ek8_mode {
31 	/* Physical sensor resolution and current image window */
32 	u16 sensor_width;
33 	u16 sensor_height;
34 	u16 sensor_window_origin_x;
35 	u16 sensor_window_origin_y;
36 	u16 sensor_window_width;
37 	u16 sensor_window_height;
38 
39 	/* Image data coming from sensor (after scaling) */
40 	u16 width;
41 	u16 height;
42 	u16 window_origin_x;
43 	u16 window_origin_y;
44 	u16 window_width;
45 	u16 window_height;
46 
47 	u32 pixel_clock;		/* in Hz */
48 	u32 ext_clock;			/* in Hz */
49 	struct v4l2_fract timeperframe;
50 	u32 max_exp;			/* Maximum exposure value */
51 	u32 bus_format;			/* MEDIA_BUS_FMT_ */
52 	u32 sensitivity;		/* 16.16 fixed point */
53 };
54 
55 #define ET8EK8_REG_8BIT			1
56 #define ET8EK8_REG_16BIT		2
57 #define ET8EK8_REG_DELAY		100
58 #define ET8EK8_REG_TERM			0xff
59 struct et8ek8_reg {
60 	u16 type;
61 	u16 reg;			/* 16-bit offset */
62 	u32 val;			/* 8/16/32-bit value */
63 };
64 
65 /* Possible struct smia_reglist types. */
66 #define ET8EK8_REGLIST_STANDBY		0
67 #define ET8EK8_REGLIST_POWERON		1
68 #define ET8EK8_REGLIST_RESUME		2
69 #define ET8EK8_REGLIST_STREAMON		3
70 #define ET8EK8_REGLIST_STREAMOFF	4
71 #define ET8EK8_REGLIST_DISABLED		5
72 
73 #define ET8EK8_REGLIST_MODE		10
74 
75 #define ET8EK8_REGLIST_LSC_ENABLE	100
76 #define ET8EK8_REGLIST_LSC_DISABLE	101
77 #define ET8EK8_REGLIST_ANR_ENABLE	102
78 #define ET8EK8_REGLIST_ANR_DISABLE	103
79 
80 struct et8ek8_reglist {
81 	u32 type;
82 	struct et8ek8_mode mode;
83 	struct et8ek8_reg regs[];
84 };
85 
86 #define ET8EK8_MAX_LEN			32
87 struct et8ek8_meta_reglist {
88 	char version[ET8EK8_MAX_LEN];
89 	union {
90 		struct et8ek8_reglist *ptr;
91 	} reglist[];
92 };
93 
94 extern struct et8ek8_meta_reglist meta_reglist;
95 
96 #endif /* ET8EK8REGS */
97