summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/et8ek8/et8ek8_reg.h
blob: 07f1873a9c3d3a332eb6217e204d712c988b3925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * et8ek8_reg.h
 *
 * Copyright (C) 2008 Nokia Corporation
 *
 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
 *          Tuukka Toivonen <tuukkat76@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

#ifndef ET8EK8REGS_H
#define ET8EK8REGS_H

#include <linux/i2c.h>
#include <linux/types.h>
#include <linux/videodev2.h>
#include <linux/v4l2-subdev.h>

struct v4l2_mbus_framefmt;
struct v4l2_subdev_pad_mbus_code_enum;

struct et8ek8_mode {
	/* Physical sensor resolution and current image window */
	u16 sensor_width;
	u16 sensor_height;
	u16 sensor_window_origin_x;
	u16 sensor_window_origin_y;
	u16 sensor_window_width;
	u16 sensor_window_height;

	/* Image data coming from sensor (after scaling) */
	u16 width;
	u16 height;
	u16 window_origin_x;
	u16 window_origin_y;
	u16 window_width;
	u16 window_height;

	u32 pixel_clock;		/* in Hz */
	u32 ext_clock;			/* in Hz */
	struct v4l2_fract timeperframe;
	u32 max_exp;			/* Maximum exposure value */
	u32 bus_format;			/* MEDIA_BUS_FMT_ */
	u32 sensitivity;		/* 16.16 fixed point */
};

#define ET8EK8_REG_8BIT			1
#define ET8EK8_REG_16BIT		2
#define ET8EK8_REG_DELAY		100
#define ET8EK8_REG_TERM			0xff
struct et8ek8_reg {
	u16 type;
	u16 reg;			/* 16-bit offset */
	u32 val;			/* 8/16/32-bit value */
};

/* Possible struct smia_reglist types. */
#define ET8EK8_REGLIST_STANDBY		0
#define ET8EK8_REGLIST_POWERON		1
#define ET8EK8_REGLIST_RESUME		2
#define ET8EK8_REGLIST_STREAMON		3
#define ET8EK8_REGLIST_STREAMOFF	4
#define ET8EK8_REGLIST_DISABLED		5

#define ET8EK8_REGLIST_MODE		10

#define ET8EK8_REGLIST_LSC_ENABLE	100
#define ET8EK8_REGLIST_LSC_DISABLE	101
#define ET8EK8_REGLIST_ANR_ENABLE	102
#define ET8EK8_REGLIST_ANR_DISABLE	103

struct et8ek8_reglist {
	u32 type;
	struct et8ek8_mode mode;
	struct et8ek8_reg regs[];
};

#define ET8EK8_MAX_LEN			32
struct et8ek8_meta_reglist {
	char version[ET8EK8_MAX_LEN];
	union {
		struct et8ek8_reglist *ptr;
	} reglist[];
};

extern struct et8ek8_meta_reglist meta_reglist;

#endif /* ET8EK8REGS */