| // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| /* |
| * Copyright (c) 2019 Amlogic, Inc. All rights reserved. |
| */ |
| |
| #include <common.h> |
| #include <amlogic/media/vout/lcd/aml_lcd.h> |
| |
| /*************************************************** |
| * lcd_0 |
| ***************************************************/ |
| static char lcd0_cpu_gpio[LCD_CPU_GPIO_NUM_MAX][LCD_CPU_GPIO_NAME_MAX] = { |
| "gpio_test_n0", /* panel vcc */ |
| "invalid", /* ending flag */ |
| }; |
| |
| static char lcd0_bl_gpio[BL_GPIO_NUM_MAX][LCD_CPU_GPIO_NAME_MAX] = { |
| "GPIOH_1", /* enable */ |
| "GPIOD_5", /* pwm_ao_h */ |
| "invalid", /* ending flag */ |
| }; |
| |
| static struct lcd_power_step_s lcd0_power_on_step[] = { |
| {LCD_POWER_TYPE_CPU, 0, 1, 50,}, /* panel vcc */ |
| {LCD_POWER_TYPE_SIGNAL, 0, 0, 0,}, |
| {LCD_POWER_TYPE_MAX, 0, 0, 0,}, /* ending flag */ |
| }; |
| |
| static struct lcd_power_step_s lcd0_power_off_step[] = { |
| {LCD_POWER_TYPE_SIGNAL, 0, 0, 10,}, |
| {LCD_POWER_TYPE_CPU, 0, 0, 500,}, /* panel vcc */ |
| {LCD_POWER_TYPE_MAX, 0, 0, 0,}, /* ending flag */ |
| }; |
| |
| struct ext_lcd_config_s ext_lcd0_config[LCD_NUM_MAX] = { |
| {"edp_0", LCD_EDP, 8, |
| /* basic timing */ |
| 1920, 1080, 2200, 1120, 44, 148, 0, 5, 30, 0, |
| /* clk_attr */ |
| 1, 0, 1, Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, |
| /* edp_attr */ |
| 2, 1, 0, 0, 0, 0, 0, 0, 0x5, 0x1, |
| NULL, NULL, |
| /* power step */ |
| lcd0_power_on_step, lcd0_power_off_step, |
| /* backlight */ |
| 60, 255, 10, 128, 128, |
| BL_CTRL_PWM, 0, 1, 0, 60, 60, |
| BL_PWM_POSITIVE, BL_PWM_AO_H, 2000, 100, 25, 1, 0, |
| Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, Rsv_val, |
| Rsv_val, Rsv_val, Rsv_val, Rsv_val, |
| 10, 10, Rsv_val}, |
| |
| {.panel_type = "invalid"}, |
| }; |
| |
| static struct lcd_pinmux_ctrl_s lcd0_pinmux_ctrl[LCD_PINMX_MAX] = { |
| { |
| .name = "lcd_edp_pin", //GPIOY_10 |
| .pinmux_set = {{0x14, 0x00000400}, {LCD_PINMUX_END, 0x0} }, |
| |
| .pinmux_clr = {{0x14, 0x00000f00}, {LCD_PINMUX_END, 0x0} }, |
| }, |
| { |
| .name = "invalid", |
| }, |
| }; |
| |
| static struct lcd_pinmux_ctrl_s lcd0_bl_pinmux_ctrl[BL_PINMUX_MAX] = { |
| { |
| .name = "bl_pwm_on_pin", /*GPIOD_5*/ |
| .pinmux_set = {{0xa, 0x00200000}, {LCD_PINMUX_END, 0x0} }, |
| |
| .pinmux_clr = {{0xa, 0x00f00000}, {LCD_PINMUX_END, 0x0} }, |
| }, |
| { |
| .name = "invalid", |
| }, |
| }; |
| |
| #ifdef CONFIG_AML_LCD_EXTERN |
| static char lcd_ext_gpio[LCD_EXTERN_GPIO_NUM_MAX][LCD_CPU_GPIO_NAME_MAX] = { |
| "invalid", /* ending flag */ |
| }; |
| |
| static unsigned char init_on_table[LCD_EXTERN_INIT_ON_MAX] = { |
| 0xff, 0, /* ending */ |
| }; |
| |
| static unsigned char init_off_table[LCD_EXTERN_INIT_OFF_MAX] = { |
| 0xff, 0, /* ending */ |
| }; |
| |
| struct lcd_extern_common_s ext_common_dft = { |
| .lcd_ext_key_valid = 0, |
| .lcd_ext_num = 1, |
| .pinmux_set = {{LCD_PINMUX_END, 0x0} }, |
| .pinmux_clr = {{LCD_PINMUX_END, 0x0} }, |
| }; |
| |
| struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = { |
| { |
| .index = 0, |
| .name = "invalid", |
| /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MAX */ |
| .type = LCD_EXTERN_MAX, |
| .status = 0, /* 0=disable, 1=enable */ |
| .i2c_addr = 0x20, /* 7bit i2c address */ |
| .i2c_addr2 = 0x74, /* 7bit i2c address, 0xff for none */ |
| /* LCD_EXTERN_I2C_BUS_0/1/2/3/4 */ |
| .i2c_bus = LCD_EXTERN_I2C_BUS_1, |
| .cmd_size = 0xff, |
| .table_init_on = init_on_table, |
| .table_init_off = init_off_table, |
| }, |
| { |
| .index = LCD_EXTERN_INDEX_INVALID, |
| }, |
| }; |
| #endif |
| |
| /*************************************************** |
| * lcd default config |
| ***************************************************/ |
| static struct lcd_dft_config_s lcd_dft_conf = { |
| .lcd_gpio = lcd0_cpu_gpio, |
| .key_valid = 0, |
| .clk_path = 0, |
| .mode = LCD_MODE_TABLET, |
| .ext_lcd = ext_lcd0_config, |
| .lcd_pinmux = lcd0_pinmux_ctrl, |
| |
| #ifdef CONFIG_AML_LCD_EXTERN |
| .ext_gpio = lcd_ext_gpio[0], |
| .ext_common = &ext_common_dft, |
| .ext_conf = ext_config_dtf, |
| #endif |
| .bl_gpio = lcd0_bl_gpio, |
| .bl_pinmux = lcd0_bl_pinmux_ctrl, |
| }; |
| |
| void lcd_config_bsp_init(void) |
| { |
| struct aml_lcd_data_s *pdata = aml_lcd_get_data(); |
| |
| if (pdata) |
| pdata->dft_conf[0] = &lcd_dft_conf; |
| } |