• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * include/linux/amlogic/media/vout/lcd/lcd_extern.h
3  *
4  * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #ifndef _INC_AML_LCD_EXTERN_H_
19 #define _INC_AML_LCD_EXTERN_H_
20 #include <linux/amlogic/media/vout/lcd/aml_lcd.h>
21 
22 enum lcd_extern_type_e {
23 	LCD_EXTERN_I2C = 0,
24 	LCD_EXTERN_SPI,
25 	LCD_EXTERN_MIPI,
26 	LCD_EXTERN_MAX,
27 };
28 
29 #define LCD_EXTERN_INIT_ON_MAX        3000
30 #define LCD_EXTERN_INIT_OFF_MAX       100
31 
32 
33 #define LCD_EXTERN_GPIO_NUM_MAX       6
34 #define LCD_EXTERN_INDEX_INVALID      0xff
35 #define LCD_EXTERN_NAME_LEN_MAX       30
36 struct lcd_extern_config_s {
37 	unsigned char index;
38 	char name[LCD_EXTERN_NAME_LEN_MAX];
39 	enum lcd_extern_type_e type;
40 	unsigned char status;
41 	unsigned char pinmux_valid;
42 	unsigned char pinmux_gpio_off;
43 	unsigned char key_valid;
44 	unsigned char addr_sel; /* internal used */
45 
46 	unsigned char i2c_addr;
47 	unsigned char i2c_addr2;
48 	unsigned char i2c_addr3;
49 	unsigned char i2c_addr4;
50 	unsigned char i2c_bus;
51 	unsigned char i2c_sck_gpio;
52 	unsigned char i2c_sda_gpio;
53 
54 	unsigned char spi_gpio_cs;
55 	unsigned char spi_gpio_clk;
56 	unsigned char spi_gpio_data;
57 	unsigned char spi_clk_pol;
58 	unsigned short spi_clk_freq; /*KHz */
59 	unsigned short spi_delay_us;
60 
61 	unsigned char cmd_size;
62 	unsigned char table_init_loaded; /* internal use */
63 	unsigned int table_init_on_cnt;
64 	unsigned int table_init_off_cnt;
65 	unsigned char *table_init_on;
66 	unsigned char *table_init_off;
67 };
68 
69 /* global API */
70 struct aml_lcd_extern_driver_s {
71 	struct lcd_extern_config_s *config;
72 	int (*reg_read)(unsigned char reg, unsigned char *buf);
73 	int (*reg_write)(unsigned char *buf, unsigned int len);
74 	int (*power_on)(void);
75 	int (*power_off)(void);
76 	struct pinctrl *pin;
77 	unsigned int pinmux_flag;
78 };
79 
80 #define LCD_EXT_I2C_DEV_MAX    10
81 struct aml_lcd_extern_i2c_dev_s {
82 	char name[30];
83 	struct i2c_client *client;
84 };
85 
86 extern struct aml_lcd_extern_driver_s *aml_lcd_extern_get_driver(int index);
87 
88 #endif
89 
90