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>
15 enum scaler_output_type {
16 SCALER_OUT_INVALID = 0,
25 enum scaler_input_type {
26 SCALER_IN_INVALID = 0,
39 enum scaler_bus_type {
40 SCALER_BUS_TYPE_INVALID = 0,
48 * the function of scaler, for example convertor or switch
50 enum scaler_function_type {
51 SCALER_FUNC_INVALID = 0,
52 SCALER_FUNC_CONVERTOR, //转换器
53 SCALER_FUNC_SWITCH, //切换开关多选一输出
54 SCALER_FUNC_FULL, //全功能
58 struct scaler_output_port {
63 unsigned led_gpio; //working led
64 enum scaler_output_type type;
65 struct list_head next;
68 struct scaler_input_port {
73 unsigned led_gpio; //working led
74 enum scaler_input_type type;
75 struct list_head next;
78 struct scaler_chip_dev {
80 char name[I2C_NAME_SIZE];
81 struct i2c_client *client;
83 enum scaler_function_type func_type;
89 int reg_size; //8bit = 1, 16bit = 2, 24bit = 3,32bit = 4.
91 struct list_head oports; //config all support output type by make menuconfig
92 struct list_head iports; //config all support input type by make menuconfig
93 enum scaler_input_type cur_in_type;
94 enum scaler_output_type cur_out_type;
96 //init hardware(gpio etc.)
100 //enable chip to process image
102 //disable chip to process image
104 void (*reset)(char active);
105 void (*suspend)(void);
106 void (*resume)(void);
109 int (*read)(unsigned short reg, int bytes, void *dest);
110 int (*write)(unsigned short reg, int bytes, void *src);
111 int (*parse_cmd)(unsigned int cmd, void *arg);
112 int (*update_firmware)(void *data);
114 //scaler chip dev list
115 struct list_head next;
118 struct scaler_platform_data {
122 int status_gpio; //check chip if work on lower power mode or normal mode.
123 //config input indicator lamp
124 unsigned in_leds_gpio[SCALER_IN_NUMS];
125 //config output indicator lamp
126 unsigned out_leds_gpio[SCALER_OUT_NUMS];
130 enum scaler_function_type func_type;
133 enum scaler_input_type *iports;
134 enum scaler_output_type *oports;
137 enum scaler_input_type default_in;
138 enum scaler_output_type default_out;
140 int (*init_hw)(void);
141 int (*exit_hw)(void);
144 struct scaler_device {
149 struct display_edid edid;
151 struct list_head chips;
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);
159 int register_scaler_chip(struct scaler_chip_dev *chip);
160 int unregister_scaler_chip(struct scaler_chip_dev *chip);
162 #define SCALER_IOCTL_MAGIC 's'
163 #define SCALER_IOCTL_POWER _IOW(SCALER_IOCTL_MAGIC, 0x00, char)
164 #define SCALER_IOCTL_GET_CUR_INPUT _IOR(SCALER_IOCTL_MAGIC, 0x01, int port_id)
165 #define SCALER_IOCTL_SET_CUR_INPUT _IOW(SCALER_IOCTL_MAGIC, 0x02, int port_id)