summaryrefslogtreecommitdiff
path: root/include/amlogic/aml_bl_extern.h (plain)
blob: 89207c6634b5fc1d8e7e2b3aab220ddd48b58d0b
1/*
2 * include/amlogic/aml_bl_extern.h
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 named License,
7 * or 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 */
15
16#ifndef _INC_AML_BL_EXTERN_H_
17#define _INC_AML_BL_EXTERN_H_
18
19enum bl_extern_type_e {
20 BL_EXTERN_I2C = 0,
21 BL_EXTERN_SPI,
22 BL_EXTERN_MIPI,
23 BL_EXTERN_MAX,
24};
25
26#define BL_EXTERN_I2C_BUS_A 0
27#define BL_EXTERN_I2C_BUS_B 1
28#define BL_EXTERN_I2C_BUS_C 2
29#define BL_EXTERN_I2C_BUS_D 3
30#define BL_EXTERN_I2C_BUS_AO 4
31
32#define BL_EXTERN_I2C_BUS_0 BL_EXTERN_I2C_BUS_A
33#define BL_EXTERN_I2C_BUS_1 BL_EXTERN_I2C_BUS_B
34#define BL_EXTERN_I2C_BUS_2 BL_EXTERN_I2C_BUS_C
35#define BL_EXTERN_I2C_BUS_3 BL_EXTERN_I2C_BUS_D
36#define BL_EXTERN_I2C_BUS_4 BL_EXTERN_I2C_BUS_AO
37#define BL_EXTERN_I2C_BUS_MAX 5
38
39#define BL_EXTERN_INIT_ON_MAX 200
40#define BL_EXTERN_INIT_OFF_MAX 50
41
42#define BL_EXTERN_GPIO_NUM_MAX 6
43#define BL_EXTERN_INDEX_INVALID 0xff
44#define BL_EXTERN_NAME_LEN_MAX 30
45struct bl_extern_config_s {
46 unsigned char index;
47 char name[BL_EXTERN_NAME_LEN_MAX];
48 enum bl_extern_type_e type;
49 unsigned char i2c_addr;
50 unsigned char i2c_bus;
51 unsigned int dim_min;
52 unsigned int dim_max;
53
54 unsigned char init_loaded;
55 unsigned char cmd_size;
56 unsigned char *init_on;
57 unsigned char *init_off;
58 unsigned int init_on_cnt;
59 unsigned int init_off_cnt;
60};
61
62/* global API */
63#define BL_EXT_DRIVER_MAX 10
64struct aml_bl_extern_driver_s {
65 int (*power_on)(void);
66 int (*power_off)(void);
67 int (*set_level)(unsigned int level);
68 void (*config_print)(void);
69 int (*device_power_on)(void);
70 int (*device_power_off)(void);
71 int (*device_bri_update)(unsigned int level);
72 struct bl_extern_config_s *config;
73};
74
75extern struct aml_bl_extern_driver_s *aml_bl_extern_get_driver(void);
76extern int aml_bl_extern_device_load(char *dtaddr, int index);
77extern struct bl_extern_config_s bl_extern_config_dtf;
78#ifdef CONFIG_AML_LCD_TABLET
79extern int dsi_write_cmd(unsigned char *payload);
80#endif
81
82#endif
83
84