1 #ifndef __SCALER_CORE_H__
2 #define __SCALER_CORE_H__
3 #include <linux/platform_device.h>
5 #include <linux/cdev.h>
6 #include <linux/file.h>
7 #include <linux/list.h>
10 struct scaler_platform_data;
17 enum scaler_output_type {
18 SCALER_OUT_INVALID = 0,
27 enum scaler_input_type {
28 SCALER_IN_INVALID = 0,
41 enum scaler_bus_type {
42 SCALER_BUS_TYPE_INVALID = 0,
50 * the function of scaler, for example convertor or switch
52 enum scaler_function_type {
53 SCALER_FUNC_INVALID = 0,
54 SCALER_FUNC_CONVERTOR, //转换器
55 SCALER_FUNC_SWITCH, //切换开关多选一输出
56 SCALER_FUNC_FULL, //全功能
60 struct scaler_output_port {
65 int led_gpio; //working led
66 enum scaler_output_type type;
67 struct list_head next;
70 struct scaler_input_port {
75 int led_gpio; //working led
76 enum scaler_input_type type;
77 struct list_head next;
80 struct scaler_chip_dev {
82 char name[I2C_NAME_SIZE];
83 struct i2c_client *client;
85 struct scaler_platform_data *pdata;
87 enum scaler_function_type func_type;
88 struct list_head iports;
89 struct list_head oports;
90 enum scaler_input_type cur_in_type;
91 enum scaler_output_type cur_out_type;
95 //enable chip to process image
97 //disable chip to process image
99 void (*reset)(char active);
100 void (*suspend)(void);
101 void (*resume)(void);
104 int (*read)(unsigned short reg, int bytes, void *dest);
105 int (*write)(unsigned short reg, int bytes, void *src);
106 int (*parse_cmd)(unsigned int cmd, unsigned long arg);
107 int (*update_firmware)(void *data);
109 //scaler chip dev list
110 struct list_head next;
113 struct scaler_platform_data {
116 int status_gpio; //check chip if work on lower power mode or normal mode.
123 int ddc_sel_level; //ddc dev default select by defined the first input port in iports
124 int vga_hsync_gpio; //detect vga-in v\hsync clk by gpio
129 enum scaler_function_type func_type;
132 struct scaler_input_port *iports;
133 struct scaler_output_port *oports;
137 int (*init_hw)(void);
138 int (*exit_hw)(void);
141 struct scaler_device {
147 struct display_edid edid;
149 struct list_head chips;
153 int scaler_init_platform(struct scaler_platform_data *pdata);
154 struct scaler_chip_dev *alloc_scaler_chip(void);
155 //free chip memory and port memory
156 void free_scaler_chip(struct scaler_chip_dev *chip);
157 int init_scaler_chip(struct scaler_chip_dev *chip, struct scaler_platform_data *pdata);
158 int register_scaler_chip(struct scaler_chip_dev *chip);
159 int unregister_scaler_chip(struct scaler_chip_dev *chip);
162 int scaler_switch_default_screen(void);
163 struct fb_videmode *scaler_get_cmode(void);
166 #define SCALER_IOCTL_MAGIC 'a'
167 #define SCALER_IOCTL_POWER _IOW(SCALER_IOCTL_MAGIC, 0x00, char)
168 #define SCALER_IOCTL_GET_CUR_INPUT _IOR(SCALER_IOCTL_MAGIC, 0x01, int)
169 #define SCALER_IOCTL_SET_CUR_INPUT _IOW(SCALER_IOCTL_MAGIC, 0x02, int)