• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * et8ek8_reg.h
4  *
5  * Copyright (C) 2008 Nokia Corporation
6  *
7  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
8  *          Tuukka Toivonen <tuukkat76@gmail.com>
9  */
10 
11 #ifndef ET8EK8REGS_H
12 #define ET8EK8REGS_H
13 
14 #include <linux/i2c.h>
15 #include <linux/types.h>
16 #include <linux/videodev2.h>
17 #include <linux/v4l2-subdev.h>
18 
19 struct v4l2_mbus_framefmt;
20 struct v4l2_subdev_pad_mbus_code_enum;
21 
22 struct et8ek8_mode {
23 	/* Physical sensor resolution and current image window */
24 	u16 sensor_width;
25 	u16 sensor_height;
26 	u16 sensor_window_origin_x;
27 	u16 sensor_window_origin_y;
28 	u16 sensor_window_width;
29 	u16 sensor_window_height;
30 
31 	/* Image data coming from sensor (after scaling) */
32 	u16 width;
33 	u16 height;
34 	u16 window_origin_x;
35 	u16 window_origin_y;
36 	u16 window_width;
37 	u16 window_height;
38 
39 	u32 pixel_clock;		/* in Hz */
40 	u32 ext_clock;			/* in Hz */
41 	struct v4l2_fract timeperframe;
42 	u32 max_exp;			/* Maximum exposure value */
43 	u32 bus_format;			/* MEDIA_BUS_FMT_ */
44 	u32 sensitivity;		/* 16.16 fixed point */
45 };
46 
47 #define ET8EK8_REG_8BIT			1
48 #define ET8EK8_REG_16BIT		2
49 #define ET8EK8_REG_DELAY		100
50 #define ET8EK8_REG_TERM			0xff
51 struct et8ek8_reg {
52 	u16 type;
53 	u16 reg;			/* 16-bit offset */
54 	u32 val;			/* 8/16/32-bit value */
55 };
56 
57 /* Possible struct smia_reglist types. */
58 #define ET8EK8_REGLIST_STANDBY		0
59 #define ET8EK8_REGLIST_POWERON		1
60 #define ET8EK8_REGLIST_RESUME		2
61 #define ET8EK8_REGLIST_STREAMON		3
62 #define ET8EK8_REGLIST_STREAMOFF	4
63 #define ET8EK8_REGLIST_DISABLED		5
64 
65 #define ET8EK8_REGLIST_MODE		10
66 
67 #define ET8EK8_REGLIST_LSC_ENABLE	100
68 #define ET8EK8_REGLIST_LSC_DISABLE	101
69 #define ET8EK8_REGLIST_ANR_ENABLE	102
70 #define ET8EK8_REGLIST_ANR_DISABLE	103
71 
72 struct et8ek8_reglist {
73 	u32 type;
74 	struct et8ek8_mode mode;
75 	struct et8ek8_reg regs[];
76 };
77 
78 #define ET8EK8_MAX_LEN			32
79 struct et8ek8_meta_reglist {
80 	char version[ET8EK8_MAX_LEN];
81 	union {
82 		struct et8ek8_reglist *ptr;
83 	} reglist[];
84 };
85 
86 extern struct et8ek8_meta_reglist meta_reglist;
87 
88 #endif /* ET8EK8REGS */
89