1 /*
2  * Copyright (C) 2008-2009 Texas Instruments Inc
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  * ccdc device API
19  */
20 #ifndef _CCDC_HW_DEVICE_H
21 #define _CCDC_HW_DEVICE_H
22 
23 #ifdef __KERNEL__
24 #include <linux/videodev2.h>
25 #include <linux/device.h>
26 #include <media/davinci/vpfe_types.h>
27 #include <media/davinci/ccdc_types.h>
28 
29 /*
30  * ccdc hw operations
31  */
32 struct ccdc_hw_ops {
33 	/* Pointer to initialize function to initialize ccdc device */
34 	int (*open) (struct device *dev);
35 	/* Pointer to deinitialize function */
36 	int (*close) (struct device *dev);
37 	/* set ccdc base address */
38 	void (*set_ccdc_base)(void *base, int size);
39 	/* Pointer to function to enable or disable ccdc */
40 	void (*enable) (int en);
41 	/* reset sbl. only for 6446 */
42 	void (*reset) (void);
43 	/* enable output to sdram */
44 	void (*enable_out_to_sdram) (int en);
45 	/* Pointer to function to set hw parameters */
46 	int (*set_hw_if_params) (struct vpfe_hw_if_param *param);
47 	/* get interface parameters */
48 	int (*get_hw_if_params) (struct vpfe_hw_if_param *param);
49 	/*
50 	 * Pointer to function to set parameters. Used
51 	 * for implementing VPFE_S_CCDC_PARAMS
52 	 */
53 	int (*set_params) (void *params);
54 	/*
55 	 * Pointer to function to get parameter. Used
56 	 * for implementing VPFE_G_CCDC_PARAMS
57 	 */
58 	int (*get_params) (void *params);
59 	/* Pointer to function to configure ccdc */
60 	int (*configure) (void);
61 
62 	/* Pointer to function to set buffer type */
63 	int (*set_buftype) (enum ccdc_buftype buf_type);
64 	/* Pointer to function to get buffer type */
65 	enum ccdc_buftype (*get_buftype) (void);
66 	/* Pointer to function to set frame format */
67 	int (*set_frame_format) (enum ccdc_frmfmt frm_fmt);
68 	/* Pointer to function to get frame format */
69 	enum ccdc_frmfmt (*get_frame_format) (void);
70 	/* enumerate hw pix formats */
71 	int (*enum_pix)(u32 *hw_pix, int i);
72 	/* Pointer to function to set buffer type */
73 	u32 (*get_pixel_format) (void);
74 	/* Pointer to function to get pixel format. */
75 	int (*set_pixel_format) (u32 pixfmt);
76 	/* Pointer to function to set image window */
77 	int (*set_image_window) (struct v4l2_rect *win);
78 	/* Pointer to function to set image window */
79 	void (*get_image_window) (struct v4l2_rect *win);
80 	/* Pointer to function to get line length */
81 	unsigned int (*get_line_length) (void);
82 
83 	/* Query CCDC control IDs */
84 	int (*queryctrl)(struct v4l2_queryctrl *qctrl);
85 	/* Set CCDC control */
86 	int (*set_control)(struct v4l2_control *ctrl);
87 	/* Get CCDC control */
88 	int (*get_control)(struct v4l2_control *ctrl);
89 
90 	/* Pointer to function to set frame buffer address */
91 	void (*setfbaddr) (unsigned long addr);
92 	/* Pointer to function to get field id */
93 	int (*getfid) (void);
94 };
95 
96 struct ccdc_hw_device {
97 	/* ccdc device name */
98 	char name[32];
99 	/* module owner */
100 	struct module *owner;
101 	/* hw ops */
102 	struct ccdc_hw_ops hw_ops;
103 };
104 
105 /* Used by CCDC module to register & unregister with vpfe capture driver */
106 int vpfe_register_ccdc_device(struct ccdc_hw_device *dev);
107 void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev);
108 
109 #endif
110 #endif
111