From 4574de5cee2b9e601a9131f4c8f89dc5a7ac36c2 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Sun, 2 Nov 2025 19:12:27 +0800 Subject: [PATCH] =?utf8?q?=E5=90=88=E5=85=A5sws=E8=B0=83=E8=AF=95pathc?= =?utf8?q?=EF=BC=8C=E9=99=8D=E4=BD=8E=E9=9B=B7=E9=B8=9FLCD=20MIPICLK?= =?utf8?q?=EF=BC=8C=E6=89=93=E5=BC=80n9=20230=20=E4=BD=8E=E7=94=B5?= =?utf8?q?=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../msg_center/src/msg_center_customer.cpp | 2 +- .../msg_center/src/msg_center_customer.cpp | 2 +- .../msg_center/src/msg_center_customer.cpp | 2 +- .../acore/system/hdbcfg/mss_cmd_db.xml | 4 + .../drivers/drivers/driver/lcd/lcd_config.c | 1986 +++++++++++------ .../chips/brandy/dfx/dfx_system_init.c | 2 + .../middleware/chips/brandy/dfx/diag_audio.c | 88 + .../middleware/chips/brandy/dfx/diag_audio.h | 8 + .../brandy/dfx/include/soc_diag_cmd_id.h | 2 + .../nv/nv_config/cfg/eng/acore/app.json | 10 + .../nv/nv_config/cfg/user/acore/app.json | 10 + .../brandy/nv/nv_config/include/common.h | 7 + .../brandy/nv/nv_config/include/key_id.h | 9 + .../services/gpu/drv/dpu/hal/dpu_hal_crg.c | 6 +- .../wrapper/audio_manager_c_wrapper.cpp | 94 +- .../sample/wrapper/audio_manager_c_wrapper.h | 4 + .../brandy/common/include/plugin_common.h | 2 + .../plugins/brandy/common/src/plugin_common.c | 42 +- .../brandy/primary/primary_sub_port_out.c | 1 + 19 files changed, 1515 insertions(+), 766 deletions(-) diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index c39a6e195..e003c5626 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -675,7 +675,7 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req) void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !"); - #if 0 + #if 1 uint8 *x= (uint8 *)(req->data); const power_display_svr_api_t *display_api = power_display_svr_get_api(); diff --git a/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp index fbda45db1..f09ea4f8a 100644 --- a/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp @@ -677,7 +677,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !"); - #if 0 + #if 1 uint8 *x= (uint8 *)(req->data); const power_display_svr_api_t *display_api = power_display_svr_get_api(); diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp index a1a56e21e..06cf214f1 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp @@ -675,7 +675,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: LowPower Alarm !"); - #if 0 + #if 1 uint8 *x= (uint8 *)(req->data); const power_display_svr_api_t *display_api = power_display_svr_get_api(); diff --git a/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml b/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml index 07b05e1fd..b4e57bba0 100644 --- a/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml +++ b/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml @@ -248,6 +248,10 @@ + + + + diff --git a/code/sdk/drivers/drivers/driver/lcd/lcd_config.c b/code/sdk/drivers/drivers/driver/lcd/lcd_config.c index 3e8f5737f..416089d5e 100644 --- a/code/sdk/drivers/drivers/driver/lcd/lcd_config.c +++ b/code/sdk/drivers/drivers/driver/lcd/lcd_config.c @@ -1,744 +1,1242 @@ -/* - * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Lcd driver configuration. - * Author: @CompanyNameTag - * Create: 2022-03-05 - */ - -#include -#include "common_def.h" -#include "lcd_config.h" - -#define LCD_EDO_502X410_SCREEN_ID 0xFFFF //CH13613 -#define LCD_EDO_466X466_SCREEN_ID 0x1133 -#define LCD_JD_360X360_SCREEN_ID 0x5598 -#define LCD_EDO_454X454_SCREEN_ID 0xf00 -#define LCD_BOE_454X454_SCREEN_ID 0x500 -#define LCD_SH_240X296_SCREEN_ID 0x101 -#define LCD_BOE_194X368_SCREEN_ID 0x4a00 -/* manufacturer id - driver version id - driver id (don't care for the moment) */ -#define LCD_ST7367_360X480_SCREEN_ID 0xFFFFFF - -const combo_dev_cfg_t g_panel_st7367_360x480_60_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_VIDEO, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 2, // hsa 2 pixels - .hbp_pixels = 20, // hbp 20 pixels - .hact_pixels = 360, // hact 360 pixels - .hfp_pixels = 20, // hfp 20 pixels - .vsa_lines = 1, // vsa 1 lines - .vbp_lines = 6, // vbp 6 lines - .vact_lines = 480, // vact 480 lines - .vfp_lines = 6, // vfp 6 lines - }, - .phy_data_rate = 288, // 288Mbps - .pixel_clk = 12000, // 12000KHz -}; - -/* -pixel_clk 需要大于 sync_info 中的(hsa+hbp+hact+hfp)* -(vsa+vbp+vact+vfp)* 60 / 1000 (帧率配置 60fps) - -. phy_data_rate=pixel_clk * 24 / 1000, 如果计算出来的值大于 500,需要调 -整降低帧率,减小 pixel_clk。 - -当修改了 pixel_clk 时,需要同步修改 -“middleware\services\gpu\drv\dpu\hal\dpu_hal_crg.c”中函数 -dpu_crg_set_vedio_mclk_div_ctl 的 dpu_mclk_div 值,该值的后两位需要与 -pixel_clk 的 16 进制值保持一致,如下 pixel_clk=20000kHZ,换算为 MHZ 为 20, -对应的 16 进制为 0x14。 -*/ -const combo_dev_cfg_t g_panel_502x410_50_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_CMD, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 4, // hsa 4 pixels - .hbp_pixels = 32, // hbp 32 pixels - .hact_pixels = 410, // hact 410 pixels - .hfp_pixels = 32, // hfp 32 pixels - .vsa_lines = 2, // vsa 4 lines - .vbp_lines = 7, // vbp 7 lines - .vact_lines = 502, // vact 502 lines - .vfp_lines = 7, // vfp 7 lines - }, - //pixel_clk*24/1000 - .phy_data_rate = 300, // 480Mbps - // (4+32+32+410)*(2+7+7+502)*50/1000 - .pixel_clk = 12380, // 20000KHz -}; -const combo_dev_cfg_t g_panel_466x466_60_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_CMD, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 10, // hsa 10 pixels - .hbp_pixels = 10, // hbp 10 pixels - .hact_pixels = 466, // hact 454 pixels - .hfp_pixels = 10, // hfp 10 pixels - .vsa_lines = 4, // vsa 4 lines - .vbp_lines = 12, // vbp 12 lines - .vact_lines = 466, // vact 454 lines - .vfp_lines = 10, // vfp 10 lines - }, - .phy_data_rate = 480, // 480Mbps - .pixel_clk = 20000, // 20000KHz -}; - -const combo_dev_cfg_t g_panel_360x360_60_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_CMD, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 8, // hsa 10 pixels - .hbp_pixels = 40, // hbp 10 pixels - .hact_pixels = 360, // hact 454 pixels - .hfp_pixels = 40, // hfp 10 pixels - .vsa_lines = 2, // vsa 4 lines - .vbp_lines = 14, // vbp 12 lines - .vact_lines = 360, // vact 454 lines - .vfp_lines = 16, // vfp 10 lines - }, - .phy_data_rate = 480, // 480Mbps - .pixel_clk = 20000, // 20000KHz -}; - -const combo_dev_cfg_t g_panel_454x454_60_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_CMD, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 10, // hsa 10 pixels - .hbp_pixels = 10, // hbp 10 pixels - .hact_pixels = 454, // hact 454 pixels - .hfp_pixels = 10, // hfp 10 pixels - .vsa_lines = 4, // vsa 4 lines - .vbp_lines = 12, // vbp 12 lines - .vact_lines = 454, // vact 454 lines - .vfp_lines = 10, // vfp 10 lines - }, - .phy_data_rate = 480, // 480Mbps - .pixel_clk = 20000, // 20000KHz -}; - -const combo_dev_cfg_t g_panel_240x296_60_config = { - .devno = 0, - .lane_id = {0, -1}, - .out_mode = OUT_MODE_DSI_CMD, - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hsa_pixels = 4, // hsa 14 pixels hpw - .hbp_pixels = 11, // hbp 11 pixels HBP - .hact_pixels = 368, // hact 240 pixels HPX - .hfp_pixels = 14, // hfp 14 pixels hfp - .vsa_lines = 2, // vsa 2 lines vpw - .vbp_lines = 6, // vbp 6 lines vbp - .vact_lines = 448, // vact 296 lines vpx - .vfp_lines = 8, // vfp 8 lines vfp - }, - .phy_data_rate = 480, // 480Mbps - .pixel_clk = 20000, // 20000KHz -}; - -const combo_dev_cfg_t g_panel_194x368_qspi_config = { - .out_format = OUT_FORMAT_RGB_24BIT, - .sync_info = { - .hact_pixels = 194, // hact 368 pixels - .vact_lines = 368, // vact 368 lines - }, -}; - - -const lcd_cmd_sequ g_common_466x466_cmd_display_off[] = { -#if defined(BOARD_W9) || defined(BOARD_N9) - {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 10}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ - {1, 2, {0x4f, 0x01}, 100}, /* sleep in */ -#else - {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 0}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ - {1, 2, {0x4f, 0x01}, 0}, /* ��deepstandby ״̬ */ -#endif -}; - -#ifdef LCD_JD9885 - -/* display off sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_display_off[] = { - {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 0}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ -}; - -/* sleep in sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_sleep_in[] = { - {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 0}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ -}; - -/* sleep in sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_sleep_out[] = { - {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x11}, 120}, /* sleep out */ - {1, 1, {0x29}, 0}, /* display on */ -}; - -/* idle in sequence for EDO and BOE 454*454 lcd */ -lcd_cmd_sequ g_common_cmd_idle_in[] = { - {1, 2, {0xde, 0x00}, 0}, - {1, 1, {0x39}, 0}, -}; - -/* idle out sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_idle_out[] = { - {1, 2, {0xde, 0x00}, 0}, - {1, 1, {0x38}, 0}, -}; - -/* te on sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_te_on[] = { - {1, 2, {0xde, 0x00}, 0}, - {1, 1, {0x35}, 0}, -}; - -/* te off sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_te_off[] = { - {1, 2, {0xde, 0x00}, 0}, - {1, 1, {0x34}, 0}, -}; - -/* set brightness sequence for EDO and BOE 454*454 lcd */ -lcd_cmd_sequ g_common_cmd_brightness[] = { - {1, 2, {0xde, 0x00}, 0}, - {1, 2, {0x51, 0xff}, 0}, -}; -#else - -/* display off sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_display_off[] = { - {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 0}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ -}; - -/* sleep in sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_sleep_in[] = { - {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x28}, 0}, /* display off */ - {1, 1, {0x10}, 120}, /* sleep in */ -}; - -/* sleep in sequence for common lcd */ -const lcd_cmd_sequ g_common_cmd_sleep_out[] = { - {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ - {1, 1, {0x11}, 120}, /* sleep out */ - {1, 1, {0x29}, 0}, /* display on */ -}; - -/* idle in sequence for EDO and BOE 454*454 lcd */ -lcd_cmd_sequ g_common_cmd_idle_in[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 1, {0x39}, 0}, -}; - -/* idle out sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_idle_out[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 1, {0x38}, 0}, -}; - -/* te on sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_te_on[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 1, {0x35}, 0}, -}; - -/* te off sequence for EDO and BOE 454*454 lcd */ -const lcd_cmd_sequ g_common_cmd_te_off[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 1, {0x34}, 0}, -}; - -/* set brightness sequence for EDO and BOE 454*454 lcd */ -lcd_cmd_sequ g_common_cmd_brightness[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 2, {0x51, 0xff}, 0}, -}; -#endif -/* init sequence for ST7367 360*480 lcd */ -const lcd_cmd_sequ g_st7367_360x480_screen_init_on[] = { - {1, 2, {0xF0, 0xC3}, 0}, - {1, 2, {0xF0, 0x96}, 0}, - {1, 2, {0xF0, 0xA5}, 0}, - {1, 5, {0xC1, 0x11, 0x08, 0xAD, 0x13}, 0}, - {1, 5, {0xC2, 0x11, 0x08, 0xAD, 0x13}, 0}, - {1, 5, {0xC3, 0x22, 0x02, 0x44, 0x04}, 0}, - {1, 5, {0xC4, 0x44, 0x04, 0x44, 0x04}, 0}, - {1, 3, {0xC5, 0x4E, 0x80}, 0}, /* #VCOM 0.975 2025 4 28 */ - {1, 2, {0xD6, 0x00}, 0}, - {1, 2, {0xD7, 0x00}, 0}, - {1, 15, {0xE0, 0xD0, 0x08, 0x0D, 0x0A, 0x08, 0x05, 0x35, 0x33, 0x4C, 0x08, 0x13, 0x14, 0x2D, 0x32}, 0}, - {1, 15, {0xE1, 0xD0, 0x08, 0x0D, 0x0A, 0x08, 0x05, 0x35, 0x33, 0x4C, 0x08, 0x13, 0x14, 0x2D, 0x32}, 0}, - {1, 15, {0xE5, 0x58, 0xF5, 0x66, 0x33, 0x22, 0x25, 0x10, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77}, 0}, - {1, 15, {0xE6, 0x58, 0xF5, 0x66, 0x33, 0x22, 0x25, 0x10, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77}, 0}, - {1, 7, {0xEC, 0x00, 0x55, 0x00, 0x00, 0x00, 0x08}, 0}, - {1, 2, {0x36, 0x0C}, 0}, - {1, 2, {0x3A, 0x07}, 0}, - {1, 2, {0xB2, 0x09}, 0}, - {1, 2, {0xB3, 0x01}, 0}, - {1, 2, {0xB4, 0x01}, 0}, - {1, 5, {0xB5, 0x00, 0x08, 0x00, 0x08}, 0}, - {1, 3, {0xB6, 0xEF, 0x2C}, 0}, - {1, 3, {0xA4, 0xC0, 0x63}, 0}, - {1, 10, {0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x2A, 0xBA, 0x02}, 0}, - {1, 10, {0xA6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x2A, 0xBA, 0x02}, 0}, - {1, 8, {0xBA, 0x58, 0x1A, 0x45, 0x02, 0x22, 0x01, 0x00}, 0}, /* #2025 5 9 Modify STV0 */ - {1, 9, {0xBB, 0x00, 0x20, 0x00, 0x25, 0x83, 0x87, 0x18, 0x00}, 0}, - {1, 9, {0xBC, 0x00, 0x24, 0x00, 0x25, 0x83, 0x87, 0x18, 0x00}, 0}, - {1, 12, {0xBD, 0x21, 0x12, 0x99, 0xFF, 0x45, 0x36, 0x63, 0x54, 0xAB, 0xFF, 0x07}, 0}, - {1, 2, {0xED, 0xC3}, 0}, - {1, 4, {0xE4, 0x40, 0x0F, 0x2F}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {1, 1, {0x21}, 0}, - {1, 1, {0x11}, 120}, - {1, 1, {0x29}, 120}, - {1, 2, {0x35, 0x00}, 100}, -}; - -const lcd_cmd_sequ g_edo_502x410_screen_init_on[] = { - {1, 5, {0x2A, 0x00, 0x04, 0x01, 0x9d}, 0}, - {1, 5, {0x2B, 0x00, 0x00, 0x01, 0xf5}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {1, 2, {0x36, 0x00}, 0}, - {1, 2, {0x67, 0x01}, 0}, - {1, 2, {0x68, 0x01}, 0}, - {1, 2, {0x11, 0x00}, 120}, - {1, 2, {0x29, 0x00}, 120}, -}; -const lcd_cmd_sequ g_edo_466x466_screen_init_on[] = { - {1, 2, {0xfe, 0x00}, 0}, - {1, 2, {0x3a, 0x77}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {1, 2, {0x53, 0x20}, 0}, - // {1, 2, {0x51, 0xff}, 0}, - {1, 2, {0x63, 0xff}, 0}, - {1, 5, {0x2A, 0x00, 0x06, 0x01, 0xd7}, 0}, - {1, 5, {0x2B, 0x00, 0x00, 0x01, 0xd1}, 0}, - {1, 3, {0x44, 0x01, 0xc5}, 0}, - {1, 1, {0x11}, 120}, - {1, 1, {0x29}, 0}, -}; - -/* init sequence for EDO 454*454 lcd */ -const lcd_cmd_sequ g_edo_454x454_screen_init_on[] = { - {1, 2, {0xfe, 0x01}, 0}, - {1, 2, {0x30, 0x43}, 0}, /* set LCD frequency to 15HZ */ - {1, 2, {0xfe, 0x00}, 0}, - {1, 2, {0x3a, 0x77}, 0}, - {1, 2, {0x53, 0x20}, 0}, - {1, 2, {0x51, 0xff}, 0}, - {0, 5, {0x2a, 0x00, 0x0e, 0x01, 0xd3}, 0}, - {0, 5, {0x2b, 0x00, 0x00, 0x01, 0xc5}, 0}, - {1, 3, {0x44, 0x01, 0xc5}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {1, 1, {0x11}, 120}, - {1, 1, {0x29}, 0}, -}; - -/* init sequence for BOE 454*454 lcd */ -const lcd_cmd_sequ g_boe_454x454_screen_init_on[] = { - {1, 2, {0xfe, 0x0d}, 0}, - {1, 2, {0x01, 0x00}, 0}, - {1, 2, {0x03, 0x00}, 0}, - {1, 2, {0x1b, 0x00}, 0}, - {1, 2, {0x1d, 0x00}, 0}, - {1, 2, {0x37, 0x00}, 0}, - {1, 2, {0x39, 0x00}, 0}, - {1, 2, {0x52, 0x58}, 0}, - {1, 2, {0x53, 0x00}, 0}, - - {1, 2, {0xfe, 0x01}, 0}, - {1, 2, {0x72, 0x05}, 0}, - {1, 2, {0x73, 0x16}, 0}, - {1, 2, {0x74, 0x0c}, 0}, - - {1, 2, {0xfe, 0x01}, 0}, - {1, 2, {0x18, 0x55}, 0}, - {1, 2, {0xc5, 0x10}, 0}, - {1, 2, {0x72, 0x0e}, 0}, - {1, 2, {0x73, 0x1c}, 0}, - - {1, 2, {0xfe, 0x07}, 0}, - {1, 2, {0x15, 0x04}, 0}, - {1, 2, {0xfe, 0x01}, 0}, - {1, 2, {0x0a, 0xf8}, 0}, - - {1, 2, {0xfe, 0x00}, 0}, - {1, 2, {0x51, 0xff}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {0, 5, {0x2a, 0x00, 0x0c, 0x01, 0xd1}, 0}, - {0, 5, {0x2b, 0x00, 0x00, 0x01, 0xc5}, 0}, - {1, 2, {0x53, 0x20}, 0}, - {1, 1, {0x11}, 120}, - {1, 1, {0x29}, 0}, -}; - -const lcd_cmd_sequ g_sh_240x296_screen_init_on[] = { - {1, 1, {0x11}, 5}, - {1, 5, {0x2a, 0x00, 0x00, 0x01, 0x6f}, 1}, - {1, 5, {0x2b, 0x00, 0x00, 0x01, 0xbf}, 1}, - {1, 3, {0x44, 0x01, 0xbf}, 1}, - {1, 2, {0x35, 0x00}, 1}, - {1, 2, {0x3a, 0x77}, 1}, - {1, 2, {0x53, 0x20}, 80}, - {1, 1, {0x29}, 0}, -}; - -const lcd_cmd_sequ g_boe_194x368_screen_init_on[] = { - {0, 2, {0xfe, 0x00}, 0}, - {0, 3, {0x44, 0x00, 0xB7}, 0}, - {0, 2, {0x3a, 0x77}, 0}, - {0, 2, {0x51, 0x80}, 0}, - {0, 2, {0x35, 0x0}, 0}, - {0, 5, {0x2a, 0x00, 0x00, 0x00, 0xc1}, 0}, - {0, 1, {0x11}, 120}, - {0, 1, {0x29}, 100}, - {0, 1, {0x39}, 0}, -}; - - -const lcd_cmd_sequ g_jd_360x360_screen_init_on[] = { - {1, 2, {0xDE, 0x00}, 0}, - {1, 3, {0xDF, 0x98, 0x55}, 0}, - {1, 3, {0xCE, 0x0D, 0x00}, 0}, - // {1, 2, {0xC2, 0x38}, 0}, - {1, 2, {0xB2, 0x30}, 0}, - {1, 5, {0xB7, 0x01, 0x35, 0x01, 0x5D}, 0}, - {1, 7, {0xBB, 0x1B, 0x64, 0xE3, 0x34, 0x3E, 0xF3}, 0}, - {1, 5, {0xBC, 0x00, 0x18, 0xF3, 0xC0}, 0}, - {1, 3, {0xC0, 0x22, 0xC1}, 0}, - {1, 12, {0xC3, 0x00, 0x02, 0x2A, 0x0B, 0x08, 0x47, 0x08, 0x04, 0x62, 0x30, 0x30}, 0}, - {1, 12, {0xC4, 0x40, 0x00, 0xAD, 0x68, 0x43, 0x07, 0x04, 0x16, 0x43, 0x07, 0x04}, 0}, - {1, 33, {0xC8, 0x3F, 0x2E, 0x24, 0x1F, 0x20, 0x21, 0x1D, 0x1D, 0x1D, 0x1C, 0x19, 0x0E, 0x0B, 0x07, 0x03, 0x02, 0x3F, 0x2E, 0x24, 0x1F, 0x20, 0x21, 0x1D, 0x1D, 0x1D, 0x1C, 0x19, 0x0E, 0x0B, 0x07, 0x03, 0x02}, 0}, - {1, 3, {0xD3, 0x28, 0x13}, 0}, - {1, 3, {0xD7, 0x18, 0x31}, 0}, - {1, 7, {0xD9, 0x00, 0x00, 0xFF, 0x00, 0xF0, 0x00}, 0}, - {1, 2, {0xDE, 0x01}, 0}, - {1, 9, {0xB7, 0x13, 0xE7, 0x64, 0x39, 0x06, 0x36, 0x19, 0x1C}, 0}, - {1, 2, {0xBE, 0x00}, 0}, - {1, 5, {0xC1, 0x04, 0x4A, 0x90, 0x08}, 0}, - {1, 5, {0xC2, 0x00, 0x16, 0xDA, 0xE7}, 0}, - {1, 3, {0xC4, 0x72, 0x12}, 0}, - {1, 7, {0xC7, 0x00, 0x00, 0x09, 0x3D, 0x09, 0x3D}, 0}, - {1, 7, {0xC8, 0x00, 0x00, 0x0B, 0x3D, 0x16, 0x39}, 0}, - {1, 6, {0xC9, 0x00, 0x0A, 0x08, 0x06, 0x04}, 0}, - {1, 6, {0xCA, 0x1E, 0x1F, 0x10, 0x17, 0x18}, 0}, - {1, 6, {0xCB, 0x01, 0x0B, 0x09, 0x07, 0x05}, 0}, - {1, 6, {0xCC, 0x1E, 0x1F, 0x11, 0x17, 0x18}, 0}, - {1, 6, {0xCD, 0x31, 0x25, 0x27, 0x29, 0x2B}, 0}, - {1, 6, {0xCE, 0x3F, 0x3E, 0x21, 0x37, 0x38}, 0}, - {1, 6, {0xCF, 0x30, 0x24, 0x26, 0x28, 0x2A}, 0}, - {1, 6, {0xD0, 0x3F, 0x3E, 0x20, 0x37, 0x38}, 0}, - {1, 6, {0xD1, 0x06, 0x30, 0xA5, 0xDB, 0x30}, 0}, - {1, 7, {0xD3, 0x3B, 0x08, 0x00, 0x00, 0x00, 0x00}, 0}, - {1, 7, {0xD4, 0x67, 0x00, 0x00, 0x01, 0x00, 0x01}, 0}, - {1, 8, {0xD5, 0x10, 0x10, 0x07, 0x07, 0x0F, 0x94, 0x26}, 0}, - {1, 4, {0xD6, 0x00, 0x00, 0x40}, 0}, - {1, 4, {0xD7, 0x01, 0x84, 0x20}, 0}, - {1, 2, {0xDE, 0x02}, 0}, - {1, 2, {0xB6, 0x1C}, 0}, - {1, 2, {0xDE, 0x00}, 0}, - {1, 2, {0x4D, 0x00}, 0}, - {1, 2, {0x4E, 0x00}, 0}, - {1, 2, {0x4F, 0x00}, 0}, - {1, 2, {0x4C, 0x01}, 10}, - {1, 2, {0x4C, 0x00}, 0}, - {1, 5, {0x2A, 0x00, 0x00, 0x01, 0x68}, 0}, - {1, 5, {0x2B, 0x00, 0x00, 0x01, 0x68}, 0}, - {1, 2, {0x35, 0x00}, 0}, - {1, 2, {0x36, 0x00}, 0}, - /* {1, 2, {0x3A, 0x55}, 0}, */ - {1, 1, {0x11}, 120}, - {1, 1, {0x29}, 10}, -}; - -const lcd_cmds_sequ g_display_off_cmds = { - .cmd = g_common_cmd_display_off, - .cmd_cnt = array_size(g_common_cmd_display_off), -}; - -const lcd_cmds_sequ g_466x466_display_off_cmds = { - .cmd = g_common_466x466_cmd_display_off, - .cmd_cnt = array_size(g_common_466x466_cmd_display_off), -}; - -const lcd_cmds_sequ g_idle_in_cmds = { - .cmd = g_common_cmd_idle_in, - .cmd_cnt = array_size(g_common_cmd_idle_in), -}; - -const lcd_cmds_sequ g_idle_out_cmds = { - .cmd = g_common_cmd_idle_out, - .cmd_cnt = array_size(g_common_cmd_idle_out), -}; - -const lcd_cmds_sequ g_te_on_cmds = { - .cmd = g_common_cmd_te_on, - .cmd_cnt = array_size(g_common_cmd_te_on), -}; - -const lcd_cmds_sequ g_te_off_cmds = { - .cmd = g_common_cmd_te_off, - .cmd_cnt = array_size(g_common_cmd_te_off), -}; - -const lcd_cmds_sequ g_brightness_cmds = { - .cmd = g_common_cmd_brightness, - .cmd_cnt = array_size(g_common_cmd_brightness), -}; - -const lcd_cmds_sequ g_st7367_360x480_screen_init_on_cmds = { - .cmd = g_st7367_360x480_screen_init_on, - .cmd_cnt = array_size(g_st7367_360x480_screen_init_on), -}; - -const lcd_cmds_sequ g_edo_502x410_screen_init_on_cmds = { - .cmd = g_edo_502x410_screen_init_on, - .cmd_cnt = array_size(g_edo_502x410_screen_init_on), -}; -const lcd_cmds_sequ g_edo_466x466_screen_init_on_cmds = { - .cmd = g_edo_466x466_screen_init_on, - .cmd_cnt = array_size(g_edo_466x466_screen_init_on), -}; - -const lcd_cmds_sequ g_jd_360x360_screen_init_on_cmds = { - .cmd = g_jd_360x360_screen_init_on, - .cmd_cnt = array_size(g_jd_360x360_screen_init_on), -}; - -const lcd_cmds_sequ g_edo_454x454_screen_init_on_cmds = { - .cmd = g_edo_454x454_screen_init_on, - .cmd_cnt = array_size(g_edo_454x454_screen_init_on), -}; - -const lcd_cmds_sequ g_boe_454x454_screen_init_on_cmds = { - .cmd = g_boe_454x454_screen_init_on, - .cmd_cnt = array_size(g_boe_454x454_screen_init_on), -}; - -const lcd_cmds_sequ g_sh_240x296_screen_init_on_cmds = { - .cmd = g_sh_240x296_screen_init_on, - .cmd_cnt = array_size(g_sh_240x296_screen_init_on), -}; - -const lcd_cmds_sequ g_boe_194x368_screen_init_on_cmds = { - .cmd = g_boe_194x368_screen_init_on, - .cmd_cnt = array_size(g_boe_194x368_screen_init_on), -}; - -const lcd_cmds_sequ g_sleep_in_cmds = { - .cmd = g_common_cmd_sleep_in, - .cmd_cnt = array_size(g_common_cmd_sleep_in), -}; - -const lcd_cmds_sequ g_sleep_out_cmds = { - .cmd = g_common_cmd_sleep_out, - .cmd_cnt = array_size(g_common_cmd_sleep_out), -}; - - -const lcd_drv_cfg g_lcd_driver_ops[] = { - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_st7367_360x480_60_config, - .x_start = 0, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_ST7367_360X480_SCREEN_ID, - .display_on_cmds = &g_st7367_360x480_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_502x410_50_config, - .x_start = 0x04, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_EDO_502X410_SCREEN_ID, - .display_on_cmds = &g_edo_502x410_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_466x466_60_config, - .x_start = 0x6, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_EDO_466X466_SCREEN_ID, - .display_on_cmds = &g_edo_466x466_screen_init_on_cmds, - .display_off_cmds = &g_466x466_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_360x360_60_config, - .x_start = 0, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_JD_360X360_SCREEN_ID, - .display_on_cmds = &g_jd_360x360_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_454x454_60_config, - .x_start = 0xe, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_EDO_454X454_SCREEN_ID, - .display_on_cmds = &g_edo_454x454_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_454x454_60_config, - .x_start = 0xc, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_BOE_454X454_SCREEN_ID, - .display_on_cmds = &g_boe_454x454_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_MIPI, - .bus_cfg = &g_panel_240x296_60_config, - .x_start = 0, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_SH_240X296_SCREEN_ID, - .display_on_cmds = &g_sh_240x296_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0xda, - .lcd_id_info.read_len = 3, - }, - { - .bus_type = BUS_DISPLAY_QSPI, - .bus_cfg = &g_panel_194x368_qspi_config, - .x_start = 0, - .y_start = 0, - .fps = 60, - .lcd_id = LCD_BOE_194X368_SCREEN_ID, - .display_on_cmds = &g_boe_194x368_screen_init_on_cmds, - .display_off_cmds = &g_display_off_cmds, - .enter_idle_cmds = &g_idle_in_cmds, - .exit_idle_cmds = &g_idle_out_cmds, - .te_on_cmds = &g_te_on_cmds, - .te_off_cmds = &g_te_off_cmds, - .set_brightnes_cmds = &g_brightness_cmds, - .sleep_in_cmds = &g_sleep_in_cmds, - .sleep_out_cmds = &g_sleep_out_cmds, - .lcd_id_info.reg_addr = 0x04, - .lcd_id_info.read_len = 3, - } -}; - -lcd_drv_cfg *lcd_get_driver_ops(void) -{ - return g_lcd_driver_ops; -} - -uint32_t lcd_get_ops_num(void) -{ - return array_size(g_lcd_driver_ops); -} - -combo_dev_cfg_t *lcd_get_bus_escape_config(void) -{ - return g_lcd_driver_ops[0].bus_cfg; -} - -lcd_drv_cfg *lcd_get_driver_config(uint32_t id) -{ - uint32_t i; - if (id == 0) { - return NULL; - } - - for (i = 0; i < array_size(g_lcd_driver_ops); i++) { - if (g_lcd_driver_ops[i].lcd_id == id) { - return &(g_lcd_driver_ops[i]); - } - } - - return NULL; -} +/* + * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. + * Description: Lcd driver configuration. + * Author: @CompanyNameTag + * Create: 2022-03-05 + */ + +#include +#include "common_def.h" +#include "lcd_config.h" + +#define LCD_EDO_502X410_SCREEN_ID 0xFFFF //CH13613 +#define LCD_EDO_466X466_SCREEN_ID 0x1133 +#define LCD_FD272_466X466_SCREEN_ID 0x20 +#define LCD_JD_360X360_SCREEN_ID 0x5598 +#define LCD_EDO_454X454_SCREEN_ID 0xf00 +#define LCD_BOE_454X454_SCREEN_ID 0x500 +#define LCD_SH_240X296_SCREEN_ID 0x101 +#define LCD_BOE_194X368_SCREEN_ID 0x4a00 +/* manufacturer id - driver version id - driver id (don't care for the moment) */ +#define LCD_ST7367_360X480_SCREEN_ID 0xFFFFFF + +const combo_dev_cfg_t g_panel_st7367_360x480_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_VIDEO, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 2, // hsa 2 pixels + .hbp_pixels = 20, // hbp 20 pixels + .hact_pixels = 360, // hact 360 pixels + .hfp_pixels = 20, // hfp 20 pixels + .vsa_lines = 1, // vsa 1 lines + .vbp_lines = 6, // vbp 6 lines + .vact_lines = 480, // vact 480 lines + .vfp_lines = 6, // vfp 6 lines + }, + .phy_data_rate = 288, // 288Mbps + .pixel_clk = 12000, // 12000KHz +}; + +/* +pixel_clk 需要大于 sync_info 中的(hsa+hbp+hact+hfp)* +(vsa+vbp+vact+vfp)* 60 / 1000 (帧率配置 60fps) + +. phy_data_rate=pixel_clk * 24 / 1000, 如果计算出来的值大于 500,需要调 +整降低帧率,减小 pixel_clk。 + +当修改了 pixel_clk 时,需要同步修改 +“middleware\services\gpu\drv\dpu\hal\dpu_hal_crg.c”中函数 +dpu_crg_set_vedio_mclk_div_ctl 的 dpu_mclk_div 值,该值的后两位需要与 +pixel_clk 的 16 进制值保持一致,如下 pixel_clk=20000kHZ,换算为 MHZ 为 20, +对应的 16 进制为 0x14。 +*/ +const combo_dev_cfg_t g_panel_502x410_50_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 4, // hsa 4 pixels + .hbp_pixels = 32, // hbp 32 pixels + .hact_pixels = 410, // hact 410 pixels + .hfp_pixels = 32, // hfp 32 pixels + .vsa_lines = 2, // vsa 4 lines + .vbp_lines = 7, // vbp 7 lines + .vact_lines = 502, // vact 502 lines + .vfp_lines = 7, // vfp 7 lines + }, + //pixel_clk*24/1000 + .phy_data_rate = 300, // 480Mbps + // (4+32+32+410)*(2+7+7+502)*50/1000 + .pixel_clk = 12380, // 20000KHz +}; +const combo_dev_cfg_t g_panel_466x466_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 10, // hsa 10 pixels + .hbp_pixels = 10, // hbp 10 pixels + .hact_pixels = 466, // hact 454 pixels + .hfp_pixels = 10, // hfp 10 pixels + .vsa_lines = 4, // vsa 4 lines + .vbp_lines = 12, // vbp 12 lines + .vact_lines = 466, // vact 454 lines + .vfp_lines = 10, // vfp 10 lines + }, + .phy_data_rate = 480, // 480Mbps + .pixel_clk = 20000, // 20000KHz +}; + +const combo_dev_cfg_t g_fd272_466x466_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 4, // hsa 10 pixels + .hbp_pixels = 50, // hbp 10 pixels + .hact_pixels = 466, // hact 454 pixels + .hfp_pixels = 50, // hfp 10 pixels + .vsa_lines = 2, // vsa 4 lines + .vbp_lines = 8, // vbp 12 lines + .vact_lines = 466, // vact 454 lines + .vfp_lines = 6, // vfp 10 lines + }, + .phy_data_rate = 396, // 480Mbps + .pixel_clk = 16485, // 20000KHz +}; + + +const combo_dev_cfg_t g_panel_360x360_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 8, // hsa 10 pixels + .hbp_pixels = 40, // hbp 10 pixels + .hact_pixels = 360, // hact 454 pixels + .hfp_pixels = 40, // hfp 10 pixels + .vsa_lines = 2, // vsa 4 lines + .vbp_lines = 14, // vbp 12 lines + .vact_lines = 360, // vact 454 lines + .vfp_lines = 16, // vfp 10 lines + }, + .phy_data_rate = 288, // 480Mbps + .pixel_clk = 12000, // 20000KHz +}; + +const combo_dev_cfg_t g_panel_454x454_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 10, // hsa 10 pixels + .hbp_pixels = 10, // hbp 10 pixels + .hact_pixels = 454, // hact 454 pixels + .hfp_pixels = 10, // hfp 10 pixels + .vsa_lines = 4, // vsa 4 lines + .vbp_lines = 12, // vbp 12 lines + .vact_lines = 454, // vact 454 lines + .vfp_lines = 10, // vfp 10 lines + }, + .phy_data_rate = 480, // 480Mbps + .pixel_clk = 20000, // 20000KHz +}; + +const combo_dev_cfg_t g_panel_240x296_60_config = { + .devno = 0, + .lane_id = {0, -1}, + .out_mode = OUT_MODE_DSI_CMD, + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hsa_pixels = 4, // hsa 14 pixels hpw + .hbp_pixels = 11, // hbp 11 pixels HBP + .hact_pixels = 368, // hact 240 pixels HPX + .hfp_pixels = 14, // hfp 14 pixels hfp + .vsa_lines = 2, // vsa 2 lines vpw + .vbp_lines = 6, // vbp 6 lines vbp + .vact_lines = 448, // vact 296 lines vpx + .vfp_lines = 8, // vfp 8 lines vfp + }, + .phy_data_rate = 480, // 480Mbps + .pixel_clk = 20000, // 20000KHz +}; + +const combo_dev_cfg_t g_panel_194x368_qspi_config = { + .out_format = OUT_FORMAT_RGB_24BIT, + .sync_info = { + .hact_pixels = 194, // hact 368 pixels + .vact_lines = 368, // vact 368 lines + }, +}; + + +const lcd_cmd_sequ g_common_466x466_cmd_display_off[] = { +#if defined(BOARD_W9) || defined(BOARD_N9) + {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 10}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ + {1, 2, {0x4f, 0x01}, 100}, /* sleep in */ +#else + {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 0}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ + {1, 2, {0x4f, 0x01}, 0}, /* ��deepstandby ״̬ */ +#endif +}; + +#ifdef LCD_JD9885 + +/* display off sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_display_off[] = { + {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 0}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ +}; + +/* sleep in sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_sleep_in[] = { + {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 0}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ +}; + +/* sleep in sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_sleep_out[] = { + {1, 2, {0xde, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x11}, 120}, /* sleep out */ + {1, 1, {0x29}, 0}, /* display on */ +}; + +/* idle in sequence for EDO and BOE 454*454 lcd */ +lcd_cmd_sequ g_common_cmd_idle_in[] = { + {1, 2, {0xde, 0x00}, 0}, + {1, 1, {0x39}, 0}, +}; + +/* idle out sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_idle_out[] = { + {1, 2, {0xde, 0x00}, 0}, + {1, 1, {0x38}, 0}, +}; + +/* te on sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_te_on[] = { + {1, 2, {0xde, 0x00}, 0}, + {1, 1, {0x35}, 0}, +}; + +/* te off sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_te_off[] = { + {1, 2, {0xde, 0x00}, 0}, + {1, 1, {0x34}, 0}, +}; + +/* set brightness sequence for EDO and BOE 454*454 lcd */ +lcd_cmd_sequ g_common_cmd_brightness[] = { + {1, 2, {0xde, 0x00}, 0}, + {1, 2, {0x51, 0xff}, 0}, +}; +#else + +/* display off sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_display_off[] = { + {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 0}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ +}; + +/* sleep in sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_sleep_in[] = { + {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x28}, 0}, /* display off */ + {1, 1, {0x10}, 120}, /* sleep in */ +}; + +/* sleep in sequence for common lcd */ +const lcd_cmd_sequ g_common_cmd_sleep_out[] = { + {1, 2, {0xfe, 0x00}, 0}, /* select default cmd page */ + {1, 1, {0x11}, 120}, /* sleep out */ + {1, 1, {0x29}, 0}, /* display on */ +}; + +/* idle in sequence for EDO and BOE 454*454 lcd */ +lcd_cmd_sequ g_common_cmd_idle_in[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 1, {0x39}, 0}, +}; + +/* idle out sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_idle_out[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 1, {0x38}, 0}, +}; + +/* te on sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_te_on[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 1, {0x35}, 0}, +}; + +/* te off sequence for EDO and BOE 454*454 lcd */ +const lcd_cmd_sequ g_common_cmd_te_off[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 1, {0x34}, 0}, +}; + +/* set brightness sequence for EDO and BOE 454*454 lcd */ +lcd_cmd_sequ g_common_cmd_brightness[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 2, {0x51, 0xff}, 0}, +}; +#endif +/* init sequence for ST7367 360*480 lcd */ +const lcd_cmd_sequ g_st7367_360x480_screen_init_on[] = { + {1, 2, {0xF0, 0xC3}, 0}, + {1, 2, {0xF0, 0x96}, 0}, + {1, 2, {0xF0, 0xA5}, 0}, + {1, 5, {0xC1, 0x11, 0x08, 0xAD, 0x13}, 0}, + {1, 5, {0xC2, 0x11, 0x08, 0xAD, 0x13}, 0}, + {1, 5, {0xC3, 0x22, 0x02, 0x44, 0x04}, 0}, + {1, 5, {0xC4, 0x44, 0x04, 0x44, 0x04}, 0}, + {1, 3, {0xC5, 0x4E, 0x80}, 0}, /* #VCOM 0.975 2025 4 28 */ + {1, 2, {0xD6, 0x00}, 0}, + {1, 2, {0xD7, 0x00}, 0}, + {1, 15, {0xE0, 0xD0, 0x08, 0x0D, 0x0A, 0x08, 0x05, 0x35, 0x33, 0x4C, 0x08, 0x13, 0x14, 0x2D, 0x32}, 0}, + {1, 15, {0xE1, 0xD0, 0x08, 0x0D, 0x0A, 0x08, 0x05, 0x35, 0x33, 0x4C, 0x08, 0x13, 0x14, 0x2D, 0x32}, 0}, + {1, 15, {0xE5, 0x58, 0xF5, 0x66, 0x33, 0x22, 0x25, 0x10, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77}, 0}, + {1, 15, {0xE6, 0x58, 0xF5, 0x66, 0x33, 0x22, 0x25, 0x10, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77}, 0}, + {1, 7, {0xEC, 0x00, 0x55, 0x00, 0x00, 0x00, 0x08}, 0}, + {1, 2, {0x36, 0x0C}, 0}, + {1, 2, {0x3A, 0x07}, 0}, + {1, 2, {0xB2, 0x09}, 0}, + {1, 2, {0xB3, 0x01}, 0}, + {1, 2, {0xB4, 0x01}, 0}, + {1, 5, {0xB5, 0x00, 0x08, 0x00, 0x08}, 0}, + {1, 3, {0xB6, 0xEF, 0x2C}, 0}, + {1, 3, {0xA4, 0xC0, 0x63}, 0}, + {1, 10, {0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x2A, 0xBA, 0x02}, 0}, + {1, 10, {0xA6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x2A, 0xBA, 0x02}, 0}, + {1, 8, {0xBA, 0x58, 0x1A, 0x45, 0x02, 0x22, 0x01, 0x00}, 0}, /* #2025 5 9 Modify STV0 */ + {1, 9, {0xBB, 0x00, 0x20, 0x00, 0x25, 0x83, 0x87, 0x18, 0x00}, 0}, + {1, 9, {0xBC, 0x00, 0x24, 0x00, 0x25, 0x83, 0x87, 0x18, 0x00}, 0}, + {1, 12, {0xBD, 0x21, 0x12, 0x99, 0xFF, 0x45, 0x36, 0x63, 0x54, 0xAB, 0xFF, 0x07}, 0}, + {1, 2, {0xED, 0xC3}, 0}, + {1, 4, {0xE4, 0x40, 0x0F, 0x2F}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {1, 1, {0x21}, 0}, + {1, 1, {0x11}, 120}, + {1, 1, {0x29}, 120}, + {1, 2, {0x35, 0x00}, 100}, +}; + +const lcd_cmd_sequ g_edo_502x410_screen_init_on[] = { + {1, 5, {0x2A, 0x00, 0x04, 0x01, 0x9d}, 0}, + {1, 5, {0x2B, 0x00, 0x00, 0x01, 0xf5}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {1, 2, {0x36, 0x00}, 0}, + {1, 2, {0x67, 0x01}, 0}, + {1, 2, {0x68, 0x01}, 0}, + {1, 2, {0x11, 0x00}, 120}, + {1, 2, {0x29, 0x00}, 120}, +}; +const lcd_cmd_sequ g_edo_466x466_screen_init_on[] = { + {1, 2, {0xfe, 0x00}, 0}, + {1, 2, {0x3a, 0x77}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {1, 2, {0x53, 0x20}, 0}, + // {1, 2, {0x51, 0xff}, 0}, + {1, 2, {0x63, 0xff}, 0}, + {1, 5, {0x2A, 0x00, 0x06, 0x01, 0xd7}, 0}, + {1, 5, {0x2B, 0x00, 0x00, 0x01, 0xd1}, 0}, + {1, 3, {0x44, 0x01, 0xc5}, 0}, + {1, 1, {0x11}, 120}, + {1, 1, {0x29}, 0}, +}; + + +const lcd_cmd_sequ g_fd272_466x466_screen_init_on[] = { +{1, 2, {0xFE,0x20}, 0}, +{1, 2, {0xF4,0x5A}, 0}, +{1, 2, {0xF5,0x59}, 0}, + +// === ID code === +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0xD8,0x22}, 0}, +{1, 2, {0xD9,0x00}, 0}, +{1, 2, {0xDA,0x00}, 0}, + +// //======================== QSPI setting ============================ +// {1, 2, {0xFE,0x20}, 0}, +// {1, 2, {0x19,0x10}, 0}, //QSPI setting, MIPI MIPI_WR(0x39,0xemove +// {1, 2, {0x1C,0xA0}, 0}, //QSPI setting, MIPI MIPI_WR(0x39,0xemove + +// === Timing Gen === +{1, 2, {0xFE,0x20}, 0}, +{1, 2, {0x1A,0x15}, 0}, +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x01,0x01}, 0}, +{1, 2, {0x02,0x74}, 0}, +{1, 2, {0x59,0x02}, 0}, +{1, 2, {0x5A,0x15}, 0}, +{1, 2, {0x5B,0x08}, 0}, +{1, 2, {0x5C,0x08}, 0}, +{1, 2, {0x70,0x02}, 0}, +{1, 2, {0x71,0x15}, 0}, +{1, 2, {0x72,0x08}, 0}, +{1, 2, {0x73,0x08}, 0}, + +// // === AOD setting=== +// {1, 2, {0xFE,0x40}, 0}, +// {1, 2, {0x5D,0x24}, 0}, +// {1, 2, {0x60,0x08}, 0}, +// {1, 2, {0x61,0x05}, 0}, +// {1, 2, {0x62,0xA5}, 0}, +// {1, 2, {0x0C,0xD7}, 0}, +// {1, 2, {0x0D,0xF0}, 0}, + +// === PoweMIPI_WR(0x39,0x Settings === +{1, 2, {0xFE,0xE0}, 0}, +{1, 2, {0x00,0x1E}, 0}, +{1, 2, {0x01,0x02}, 0}, +{1, 2, {0x02,0x00}, 0}, +{1, 2, {0x04,0x00}, 0}, +{1, 2, {0x06,0x14}, 0}, +{1, 2, {0x08,0x03}, 0}, +{1, 2, {0x09,0x1E}, 0}, +{1, 2, {0x0A,0x02}, 0}, +{1, 2, {0x0B,0x00}, 0}, +{1, 2, {0x0C,0x00}, 0}, +{1, 2, {0x0E,0x14}, 0}, +{1, 2, {0x0F,0x03}, 0}, +{1, 2, {0x10,0x1E}, 0}, +{1, 2, {0x11,0x20}, 0}, +{1, 2, {0x24,0x01}, 0}, +{1, 2, {0x21,0x99}, 0}, +{1, 2, {0x2D,0x99}, 0}, +{1, 2, {0x32,0x99}, 0}, +{1, 2, {0x26,0x41}, 0}, +{1, 2, {0x22,0x1A}, 0}, +{1, 2, {0x23,0x15}, 0}, +{1, 2, {0x30,0x01}, 0}, +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x57,0x43}, 0}, +{1, 2, {0x58,0x33}, 0}, +{1, 2, {0x6E,0x43}, 0}, +{1, 2, {0x6F,0x33}, 0}, +{1, 2, {0x74,0x43}, 0}, +{1, 2, {0x75,0x33}, 0}, + +// === swi foSGM38046 === +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x12,0xFE}, 0}, +{1, 2, {0x13,0x09}, 0}, +{1, 2, {0xC9,0x4A}, 0}, //noMIPI_WR(0x39,0xmal ELVSS=-2.4V +{1, 2, {0x96,0x1C}, 0}, //noMIPI_WR(0x39,0xmal ELVDD=4.6V +{1, 2, {0x97,0x02}, 0}, +{1, 2, {0xA5,0xFF}, 0}, +{1, 2, {0xAA,0x1C}, 0}, //HBM ELVDD=4.6V +{1, 2, {0xAB,0x3D}, 0}, //HBM ELVSS=-3.7V +{1, 2, {0x98,0x00}, 0}, +{1, 2, {0xA7,0x1C}, 0}, //AOD ELVDD=4.6V +{1, 2, {0xA9,0x4A}, 0}, //AOD ELVSS=-2.4V + +//swie timing setting fo SGM38046 +{1, 2, {0xFE,0x80}, 0}, +{1, 2, {0x66,0x22}, 0}, +{1, 2, {0x67,0x10}, 0}, +{1, 2, {0x68,0x0E}, 0}, +// === GOA mapping ===); +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0x9B,0x0C}, 0}, +{1, 2, {0x9C,0x0D}, 0}, +{1, 2, {0x9D,0x0E}, 0}, +{1, 2, {0x9E,0x11}, 0}, +{1, 2, {0x9F,0x10}, 0}, +{1, 2, {0xA0,0x0F}, 0}, +{1, 2, {0xA2,0x19}, 0}, +{1, 2, {0xA3,0x19}, 0}, +{1, 2, {0xA4,0x19}, 0}, +{1, 2, {0xA5,0x19}, 0}, +{1, 2, {0xA6,0x19}, 0}, +{1, 2, {0xA7,0x19}, 0}, +{1, 2, {0xA9,0x19}, 0}, +{1, 2, {0xAA,0x01}, 0}, +{1, 2, {0xAB,0x00}, 0}, +{1, 2, {0xAC,0x09}, 0}, +{1, 2, {0xAD,0x19}, 0}, +{1, 2, {0xAE,0x19}, 0}, +{1, 2, {0xAF,0x19}, 0}, +{1, 2, {0xB0,0x19}, 0}, +{1, 2, {0xB1,0x19}, 0}, +{1, 2, {0xB2,0x19}, 0}, +{1, 2, {0xB3,0x19}, 0}, +{1, 2, {0xB4,0x19}, 0}, +{1, 2, {0xB5,0x19}, 0}, +{1, 2, {0xB6,0x19}, 0}, +{1, 2, {0xB7,0x19}, 0}, +{1, 2, {0xB8,0x19}, 0}, +{1, 2, {0xB9,0x19}, 0}, +{1, 2, {0xBA,0x19}, 0}, +{1, 2, {0xBB,0x19}, 0}, +{1, 2, {0xBC,0x19}, 0}, +{1, 2, {0xBD,0xE3}, 0}, +{1, 2, {0xBE,0x02}, 0}, +{1, 2, {0xBF,0x08}, 0}, +{1, 2, {0xC0,0x19}, 0}, +{1, 2, {0xC1,0x39}, 0}, +{1, 2, {0xC2,0x19}, 0}, +{1, 2, {0xC3,0x19}, 0}, +{1, 2, {0xC4,0x19}, 0}, +{1, 2, {0xC5,0x19}, 0}, +{1, 2, {0xC6,0x19}, 0}, +{1, 2, {0xC7,0x19}, 0}, +{1, 2, {0xC8,0x19}, 0}, + +// === souMIPI_WR(0x39,0xce/mux sequence === +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x4C,0x22}, 0}, +{1, 2, {0x53,0xA0}, 0}, + +// === SD/SW_Toggle_Sequence_ContMIPI_WR(0x39,0xol === +{1, 2, {0xFE,0xF0}, 0}, +{1, 2, {0x72,0x14}, 0}, +{1, 2, {0x73,0x41}, 0}, +{1, 2, {0x74,0x36}, 0}, +{1, 2, {0x75,0x63}, 0}, +{1, 2, {0x76,0x25}, 0}, +{1, 2, {0x77,0x52}, 0}, +{1, 2, {0x78,0x14}, 0}, +{1, 2, {0x79,0x41}, 0}, +{1, 2, {0x7A,0x36}, 0}, +{1, 2, {0x7B,0x63}, 0}, +{1, 2, {0x7C,0x25}, 0}, +{1, 2, {0x7D,0x52}, 0}, +{1, 2, {0x7E,0x36}, 0}, +{1, 2, {0x7F,0x63}, 0}, +{1, 2, {0x80,0x25}, 0}, +{1, 2, {0x81,0x52}, 0}, +{1, 2, {0x82,0x14}, 0}, +{1, 2, {0x83,0x41}, 0}, +{1, 2, {0x84,0x36}, 0}, +{1, 2, {0x85,0x63}, 0}, +{1, 2, {0x86,0x25}, 0}, +{1, 2, {0x87,0x52}, 0}, +{1, 2, {0x88,0x14}, 0}, +{1, 2, {0x89,0x41}, 0}, + +// === GIP Setting === +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0x00,0xC8}, 0}, +{1, 2, {0x01,0x08}, 0}, +{1, 2, {0x02,0x02}, 0}, +{1, 2, {0x03,0x00}, 0}, +{1, 2, {0x04,0x00}, 0}, +{1, 2, {0x05,0x00}, 0}, +{1, 2, {0x06,0x12}, 0}, +{1, 2, {0x07,0x0A}, 0}, +{1, 2, {0x09,0xC8}, 0}, +{1, 2, {0x0A,0x08}, 0}, +{1, 2, {0x0B,0x02}, 0}, +{1, 2, {0x0C,0x00}, 0}, +{1, 2, {0x0D,0x00}, 0}, +{1, 2, {0x0E,0x01}, 0}, +{1, 2, {0x0F,0x12}, 0}, +{1, 2, {0x10,0x0A}, 0}, +{1, 2, {0x12,0xC0}, 0}, +{1, 2, {0x13,0x08}, 0}, +{1, 2, {0x14,0x02}, 0}, +{1, 2, {0x15,0x00}, 0}, +{1, 2, {0x16,0x08}, 0}, +{1, 2, {0x17,0x02}, 0}, +{1, 2, {0x18,0x1D}, 0}, +{1, 2, {0x19,0x00}, 0}, +{1, 2, {0x1B,0xC0}, 0}, +{1, 2, {0x1C,0x08}, 0}, +{1, 2, {0x1D,0x02}, 0}, +{1, 2, {0x1E,0x00}, 0}, +{1, 2, {0x1F,0x08}, 0}, +{1, 2, {0x20,0x03}, 0}, +{1, 2, {0x21,0x1D}, 0}, +{1, 2, {0x22,0x00}, 0}, +{1, 2, {0x4C,0x80}, 0}, +{1, 2, {0x4D,0x00}, 0}, +{1, 2, {0x4E,0x01}, 0}, +{1, 2, {0x4F,0x08}, 0}, +{1, 2, {0x50,0x01}, 0}, +{1, 2, {0x51,0x1D}, 0}, +{1, 2, {0x52,0x1F}, 0}, +{1, 2, {0x53,0xC6}, 0}, +{1, 2, {0x54,0x00}, 0}, +{1, 2, {0x55,0x02}, 0}, +{1, 2, {0x56,0x12}, 0}, +{1, 2, {0x58,0x00}, 0}, +{1, 2, {0x65,0xF1}, 0}, +{1, 2, {0x66,0x48}, 0}, +{1, 2, {0x67,0x00}, 0}, + +// === MUX Sequence ContMIPI_WR(0x39,0xol === +{1, 2, {0xFE,0xF0}, 0}, +{1, 2, {0xA3,0x00}, 0}, +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0x76,0x07}, 0}, +{1, 2, {0x77,0x00}, 0}, +{1, 2, {0x78,0x03}, 0}, +{1, 2, {0x68,0x07}, 0}, +{1, 2, {0x69,0x07}, 0}, +{1, 2, {0x6A,0x07}, 0}, +{1, 2, {0x6B,0x07}, 0}, +{1, 2, {0x6C,0x07}, 0}, +{1, 2, {0x6D,0x07}, 0}, +{1, 2, {0xFE,0xF0}, 0}, +{1, 2, {0xA9,0x23}, 0}, +{1, 2, {0xAA,0x23}, 0}, +{1, 2, {0xAB,0x23}, 0}, +{1, 2, {0xAC,0x23}, 0}, +{1, 2, {0xAD,0x23}, 0}, +{1, 2, {0xAE,0x23}, 0}, +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0x93,0x07}, 0}, +{1, 2, {0x94,0x00}, 0}, +{1, 2, {0x96,0x03}, 0}, +{1, 2, {0xDB,0x07}, 0}, +{1, 2, {0xDC,0x07}, 0}, +{1, 2, {0xDD,0x07}, 0}, +{1, 2, {0xDE,0x07}, 0}, +{1, 2, {0xDF,0x07}, 0}, +{1, 2, {0xE0,0x07}, 0}, +{1, 2, {0xE7,0x23}, 0}, +{1, 2, {0xE8,0x23}, 0}, +{1, 2, {0xE9,0x23}, 0}, +{1, 2, {0xEA,0x23}, 0}, +{1, 2, {0xEB,0x23}, 0}, +{1, 2, {0xEC,0x23}, 0}, + +// === PoweMIPI_WR(0x39,0x on/off sequence Blank peMIPI_WR(0x39,0xiod contMIPI_WR(0x39,0xol === +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0xD1,0xF0}, 0}, +{1, 2, {0xD2,0xFF}, 0}, +{1, 2, {0xD3,0xF0}, 0}, +{1, 2, {0xD4,0xFF}, 0}, +{1, 2, {0xD5,0xA0}, 0}, +{1, 2, {0xD6,0xAA}, 0}, +{1, 2, {0xD7,0xF0}, 0}, +{1, 2, {0xD8,0xFF}, 0}, + +// === SouMIPI_WR(0x39,0xce === +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x4D,0x2A}, 0}, +{1, 2, {0x4E,0x00}, 0}, +{1, 2, {0x4F,0x00}, 0}, +{1, 2, {0x50,0x00}, 0}, +{1, 2, {0x51,0xF3}, 0}, +{1, 2, {0x52,0x23}, 0}, +{1, 2, {0x6B,0xF3}, 0}, +{1, 2, {0x6C,0x13}, 0}, +{1, 2, {0x8F,0xFF}, 0}, +{1, 2, {0x90,0xFF}, 0}, +{1, 2, {0x91,0x3F}, 0}, +{1, 2, {0xA2,0x10}, 0}, +{1, 2, {0x07,0x21}, 0}, +{1, 2, {0x35,0x81}, 0}, + +// === gamma setting === +{1, 3, {0x39,0xFE,0x40}, 0}, +{1, 3, {0x39,0x33,0x10}, 0}, +{1, 3, {0x39,0x34,0xC1}, 0}, +{1, 3, {0x39,0xFE,0x50}, 0}, +{1, 3, {0x39,0xA9,0x58}, 0}, +{1, 3, {0x39,0xAA,0x58}, 0}, +{1, 3, {0x39,0xAB,0x01}, 0}, +{1, 3, {0x39,0xFE,0x60}, 0}, +{1, 3, {0x39,0xA9,0x58}, 0}, +{1, 3, {0x39,0xAA,0x48}, 0}, +{1, 3, {0x39,0xAB,0x01}, 0}, + +//=== Watchedge === +{1, 2, {0xFE,0x90}, 0}, +{1, 2, {0x15,0x00}, 0}, +{1, 2, {0xB0,0x00}, 0}, +{1, 2, {0xA4,0xF1}, 0}, +{1, 2, {0xA5,0xE9}, 0}, +{1, 2, {0xA6,0x00}, 0}, +{1, 2, {0xA7,0xE9}, 0}, +{1, 2, {0xA9,0xE9}, 0}, +{1, 2, {0xAA,0x80}, 0}, +{1, 2, {0xAB,0x47}, 0}, +{1, 2, {0xAC,0xFF}, 0}, +{1, 2, {0xAE,0x0C}, 0}, +{1, 2, {0x45,0x00}, 0}, + +//=== SCC === +{1, 2, {0xFE,0x90}, 0}, +{1, 2, {0x4E,0x1F}, 0}, +{1, 2, {0x4F,0x09}, 0}, +{1, 2, {0x50,0xDA}, 0}, +{1, 2, {0x51,0x80}, 0}, +{1, 2, {0x52,0x86}, 0}, +{1, 2, {0x53,0x00}, 0}, +{1, 2, {0x54,0x10}, 0}, +{1, 2, {0x55,0x00}, 0}, +{1, 2, {0x56,0x00}, 0}, +{1, 2, {0x57,0x00}, 0}, +{1, 2, {0x58,0x00}, 0}, +{1, 2, {0x59,0x00}, 0}, +{1, 2, {0x5A,0x0A}, 0}, +{1, 2, {0x5B,0x10}, 0}, +{1, 2, {0x5C,0x00}, 0}, +{1, 2, {0x5D,0x86}, 0}, +{1, 2, {0x5E,0x40}, 0}, +{1, 2, {0x5F,0x00}, 0}, +{1, 2, {0x60,0x00}, 0}, +{1, 2, {0x61,0x0A}, 0}, +{1, 2, {0x62,0x10}, 0}, +{1, 2, {0x63,0x00}, 0}, +{1, 2, {0x64,0x00}, 0}, +{1, 2, {0x65,0x00}, 0}, +{1, 2, {0x66,0x00}, 0}, +{1, 2, {0x67,0x00}, 0}, +{1, 2, {0x68,0x4A}, 0}, +{1, 2, {0x69,0x00}, 0}, +{1, 2, {0x6A,0x00}, 0}, +{1, 2, {0x6B,0x06}, 0}, +{1, 2, {0x6C,0x00}, 0}, +{1, 2, {0x6D,0x06}, 0}, +{1, 2, {0x6E,0x00}, 0}, +{1, 2, {0x6F,0x10}, 0}, +{1, 2, {0x70,0x0A}, 0}, +{1, 2, {0x71,0x00}, 0}, +{1, 2, {0x72,0x00}, 0}, +{1, 2, {0x73,0x00}, 0}, +{1, 2, {0x74,0x00}, 0}, +{1, 2, {0x75,0x00}, 0}, +{1, 2, {0x76,0x10}, 0}, +{1, 2, {0x77,0x0A}, 0}, +{1, 2, {0x78,0x86}, 0}, +{1, 2, {0x79,0x40}, 0}, +{1, 2, {0x7A,0x00}, 0}, +{1, 2, {0x7B,0x80}, 0}, +{1, 2, {0x7C,0x80}, 0}, +{1, 2, {0x7D,0x10}, 0}, +{1, 2, {0x7E,0x00}, 0}, +{1, 2, {0x7F,0x00}, 0}, +{1, 2, {0x80,0x00}, 0}, +{1, 2, {0x81,0x00}, 0}, +{1, 2, {0x82,0x00}, 0}, +{1, 2, {0x83,0x40}, 0}, +{1, 2, {0x84,0x0A}, 0}, +{1, 2, {0x85,0x00}, 0}, +{1, 2, {0x86,0x06}, 0}, +{1, 2, {0x87,0x00}, 0}, +{1, 2, {0x88,0x40}, 0}, +{1, 2, {0x89,0x00}, 0}, +{1, 2, {0x8A,0x10}, 0}, +{1, 2, {0x8B,0x84}, 0}, +{1, 2, {0x8C,0x00}, 0}, +{1, 2, {0x8D,0x00}, 0}, +{1, 2, {0x8E,0x00}, 0}, +{1, 2, {0x8F,0x08}, 0}, +{1, 2, {0x90,0x04}, 0}, +{1, 2, {0x91,0x10}, 0}, +{1, 2, {0x92,0x04}, 0}, +{1, 2, {0x93,0x00}, 0}, +{1, 2, {0x94,0x00}, 0}, +{1, 2, {0x95,0x00}, 0}, +{1, 2, {0x96,0x00}, 0}, +{1, 2, {0x97,0x44}, 0}, +{1, 2, {0x98,0x10}, 0}, +{1, 2, {0x99,0x00}, 0}, +{1, 2, {0x9A,0x08}, 0}, +{1, 2, {0x9B,0x00}, 0}, +{1, 2, {0x9C,0x08}, 0}, +{1, 2, {0x9D,0x00}, 0}, +{1, 2, {0x9E,0x44}, 0}, +{1, 2, {0x9F,0x04}, 0}, +{1, 2, {0xA0,0x00}, 0}, +{1, 2, {0xA2,0x00}, 0}, + +// === PoweMIPI_WR(0x39,0x saving === +{1, 2, {0xFE,0x70}, 0}, +{1, 2, {0x98,0x74}, 0}, +{1, 2, {0xC9,0x02}, 0}, +{1, 2, {0xCA,0x02}, 0}, +{1, 2, {0xCB,0x02}, 0}, +{1, 2, {0xCC,0x02}, 0}, +{1, 2, {0xCD,0x02}, 0}, +{1, 2, {0xCE,0x82}, 0}, +{1, 2, {0xCF,0x02}, 0}, +{1, 2, {0xD0,0x42}, 0}, +{1, 2, {0xFE,0xE0}, 0}, +{1, 2, {0x19,0x43}, 0}, +{1, 2, {0x1E,0x43}, 0}, +{1, 2, {0x1C,0x41}, 0}, +{1, 2, {0x18,0x00}, 0}, +{1, 2, {0x1B,0x0C}, 0}, +{1, 2, {0x1A,0x9A}, 0}, +{1, 2, {0x1D,0xDA}, 0}, +{1, 2, {0x28,0x58}, 0}, +{1, 2, {0x05,0x04}, 0}, +{1, 2, {0x0D,0x04}, 0}, +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x54,0xAC}, 0}, +{1, 2, {0x55,0xA0}, 0}, +{1, 2, {0x48,0xAA}, 0}, +{1, 2, {0xFE,0x90}, 0}, +{1, 2, {0x31,0x08}, 0}, + +//=== CMD1 setting === +// MIPI_WR(0x39,0xFE,0x00); +//MIPI_WR(0x39,0xC4,0x80); //SPI setting, mipi MIPI_WR(0x39,0xemove +//MIPI_WR(0x39,0x3A,0x55); //55 MIPI_WR(0x39,0xGB565, 77 MIPI_WR(0x39,0xGB888 +{1, 2, {0x35,0x00}, 0}, +{1, 2, {0x53,0x20}, 0}, +{1, 2, {0x51,0xFF}, 0}, +{1, 2, {0x63,0xFF}, 0}, +{1, 5, {0x2A,0x00,0x08,0x01,0xD9}, 0}, // paMIPI_WR(0x39,0xitial update +{1, 5, {0x2B,0x00,0x00,0x01,0xD1}, 0}, // paMIPI_WR(0x39,0xtial update +{1, 1, {0x11}, 120}, + +{1, 2, {0xFE,0x20}, 0}, +{1, 2, {0xF4,0x5A}, 0}, +{1, 2, {0xF5,0x59}, 0}, +{1, 2, {0xFE,0x40}, 0}, +{1, 2, {0x08,0x0A}, 0}, + +{1, 1, {0x29}, 0}, +}; + + +/* init sequence for EDO 454*454 lcd */ +const lcd_cmd_sequ g_edo_454x454_screen_init_on[] = { + {1, 2, {0xfe, 0x01}, 0}, + {1, 2, {0x30, 0x43}, 0}, /* set LCD frequency to 15HZ */ + {1, 2, {0xfe, 0x00}, 0}, + {1, 2, {0x3a, 0x77}, 0}, + {1, 2, {0x53, 0x20}, 0}, + {1, 2, {0x51, 0xff}, 0}, + {0, 5, {0x2a, 0x00, 0x0e, 0x01, 0xd3}, 0}, + {0, 5, {0x2b, 0x00, 0x00, 0x01, 0xc5}, 0}, + {1, 3, {0x44, 0x01, 0xc5}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {1, 1, {0x11}, 120}, + {1, 1, {0x29}, 0}, +}; + +/* init sequence for BOE 454*454 lcd */ +const lcd_cmd_sequ g_boe_454x454_screen_init_on[] = { + {1, 2, {0xfe, 0x0d}, 0}, + {1, 2, {0x01, 0x00}, 0}, + {1, 2, {0x03, 0x00}, 0}, + {1, 2, {0x1b, 0x00}, 0}, + {1, 2, {0x1d, 0x00}, 0}, + {1, 2, {0x37, 0x00}, 0}, + {1, 2, {0x39, 0x00}, 0}, + {1, 2, {0x52, 0x58}, 0}, + {1, 2, {0x53, 0x00}, 0}, + + {1, 2, {0xfe, 0x01}, 0}, + {1, 2, {0x72, 0x05}, 0}, + {1, 2, {0x73, 0x16}, 0}, + {1, 2, {0x74, 0x0c}, 0}, + + {1, 2, {0xfe, 0x01}, 0}, + {1, 2, {0x18, 0x55}, 0}, + {1, 2, {0xc5, 0x10}, 0}, + {1, 2, {0x72, 0x0e}, 0}, + {1, 2, {0x73, 0x1c}, 0}, + + {1, 2, {0xfe, 0x07}, 0}, + {1, 2, {0x15, 0x04}, 0}, + {1, 2, {0xfe, 0x01}, 0}, + {1, 2, {0x0a, 0xf8}, 0}, + + {1, 2, {0xfe, 0x00}, 0}, + {1, 2, {0x51, 0xff}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {0, 5, {0x2a, 0x00, 0x0c, 0x01, 0xd1}, 0}, + {0, 5, {0x2b, 0x00, 0x00, 0x01, 0xc5}, 0}, + {1, 2, {0x53, 0x20}, 0}, + {1, 1, {0x11}, 120}, + {1, 1, {0x29}, 0}, +}; + +const lcd_cmd_sequ g_sh_240x296_screen_init_on[] = { + {1, 1, {0x11}, 5}, + {1, 5, {0x2a, 0x00, 0x00, 0x01, 0x6f}, 1}, + {1, 5, {0x2b, 0x00, 0x00, 0x01, 0xbf}, 1}, + {1, 3, {0x44, 0x01, 0xbf}, 1}, + {1, 2, {0x35, 0x00}, 1}, + {1, 2, {0x3a, 0x77}, 1}, + {1, 2, {0x53, 0x20}, 80}, + {1, 1, {0x29}, 0}, +}; + +const lcd_cmd_sequ g_boe_194x368_screen_init_on[] = { + {0, 2, {0xfe, 0x00}, 0}, + {0, 3, {0x44, 0x00, 0xB7}, 0}, + {0, 2, {0x3a, 0x77}, 0}, + {0, 2, {0x51, 0x80}, 0}, + {0, 2, {0x35, 0x0}, 0}, + {0, 5, {0x2a, 0x00, 0x00, 0x00, 0xc1}, 0}, + {0, 1, {0x11}, 120}, + {0, 1, {0x29}, 100}, + {0, 1, {0x39}, 0}, +}; + + +const lcd_cmd_sequ g_jd_360x360_screen_init_on[] = { + {1, 2, {0xDE, 0x00}, 0}, + {1, 3, {0xDF, 0x98, 0x55}, 0}, + {1, 3, {0xCE, 0x0D, 0x00}, 0}, + // {1, 2, {0xC2, 0x38}, 0}, + {1, 2, {0xB2, 0x30}, 0}, + {1, 5, {0xB7, 0x01, 0x35, 0x01, 0x5D}, 0}, + {1, 7, {0xBB, 0x1B, 0x64, 0xE3, 0x34, 0x3E, 0xF3}, 0}, + {1, 5, {0xBC, 0x00, 0x18, 0xF3, 0xC0}, 0}, + {1, 3, {0xC0, 0x22, 0xC1}, 0}, + {1, 12, {0xC3, 0x00, 0x02, 0x2A, 0x0B, 0x08, 0x47, 0x08, 0x04, 0x62, 0x30, 0x30}, 0}, + {1, 12, {0xC4, 0x40, 0x00, 0xAD, 0x68, 0x43, 0x07, 0x04, 0x16, 0x43, 0x07, 0x04}, 0}, + {1, 33, {0xC8, 0x3F, 0x2E, 0x24, 0x1F, 0x20, 0x21, 0x1D, 0x1D, 0x1D, 0x1C, 0x19, 0x0E, 0x0B, 0x07, 0x03, 0x02, 0x3F, 0x2E, 0x24, 0x1F, 0x20, 0x21, 0x1D, 0x1D, 0x1D, 0x1C, 0x19, 0x0E, 0x0B, 0x07, 0x03, 0x02}, 0}, + {1, 3, {0xD3, 0x28, 0x13}, 0}, + {1, 3, {0xD7, 0x18, 0x31}, 0}, + {1, 7, {0xD9, 0x00, 0x00, 0xFF, 0x00, 0xF0, 0x00}, 0}, + {1, 2, {0xDE, 0x01}, 0}, + {1, 9, {0xB7, 0x13, 0xE7, 0x64, 0x39, 0x06, 0x36, 0x19, 0x1C}, 0}, + {1, 2, {0xBE, 0x00}, 0}, + {1, 5, {0xC1, 0x04, 0x4A, 0x90, 0x08}, 0}, + {1, 5, {0xC2, 0x00, 0x16, 0xDA, 0xE7}, 0}, + {1, 3, {0xC4, 0x72, 0x12}, 0}, + {1, 7, {0xC7, 0x00, 0x00, 0x09, 0x3D, 0x09, 0x3D}, 0}, + {1, 7, {0xC8, 0x00, 0x00, 0x0B, 0x3D, 0x16, 0x39}, 0}, + {1, 6, {0xC9, 0x00, 0x0A, 0x08, 0x06, 0x04}, 0}, + {1, 6, {0xCA, 0x1E, 0x1F, 0x10, 0x17, 0x18}, 0}, + {1, 6, {0xCB, 0x01, 0x0B, 0x09, 0x07, 0x05}, 0}, + {1, 6, {0xCC, 0x1E, 0x1F, 0x11, 0x17, 0x18}, 0}, + {1, 6, {0xCD, 0x31, 0x25, 0x27, 0x29, 0x2B}, 0}, + {1, 6, {0xCE, 0x3F, 0x3E, 0x21, 0x37, 0x38}, 0}, + {1, 6, {0xCF, 0x30, 0x24, 0x26, 0x28, 0x2A}, 0}, + {1, 6, {0xD0, 0x3F, 0x3E, 0x20, 0x37, 0x38}, 0}, + {1, 6, {0xD1, 0x06, 0x30, 0xA5, 0xDB, 0x30}, 0}, + {1, 7, {0xD3, 0x3B, 0x08, 0x00, 0x00, 0x00, 0x00}, 0}, + {1, 7, {0xD4, 0x67, 0x00, 0x00, 0x01, 0x00, 0x01}, 0}, + {1, 8, {0xD5, 0x10, 0x10, 0x07, 0x07, 0x0F, 0x94, 0x26}, 0}, + {1, 4, {0xD6, 0x00, 0x00, 0x40}, 0}, + {1, 4, {0xD7, 0x01, 0x84, 0x20}, 0}, + {1, 2, {0xDE, 0x02}, 0}, + {1, 2, {0xB6, 0x1C}, 0}, + {1, 2, {0xDE, 0x00}, 0}, + {1, 2, {0x4D, 0x00}, 0}, + {1, 2, {0x4E, 0x00}, 0}, + {1, 2, {0x4F, 0x00}, 0}, + {1, 2, {0x4C, 0x01}, 10}, + {1, 2, {0x4C, 0x00}, 0}, + {1, 5, {0x2A, 0x00, 0x00, 0x01, 0x68}, 0}, + {1, 5, {0x2B, 0x00, 0x00, 0x01, 0x68}, 0}, + {1, 2, {0x35, 0x00}, 0}, + {1, 2, {0x36, 0x00}, 0}, + /* {1, 2, {0x3A, 0x55}, 0}, */ + {1, 1, {0x11}, 120}, + {1, 1, {0x29}, 10}, +}; + +const lcd_cmds_sequ g_display_off_cmds = { + .cmd = g_common_cmd_display_off, + .cmd_cnt = array_size(g_common_cmd_display_off), +}; + +const lcd_cmds_sequ g_466x466_display_off_cmds = { + .cmd = g_common_466x466_cmd_display_off, + .cmd_cnt = array_size(g_common_466x466_cmd_display_off), +}; + +const lcd_cmds_sequ g_idle_in_cmds = { + .cmd = g_common_cmd_idle_in, + .cmd_cnt = array_size(g_common_cmd_idle_in), +}; + +const lcd_cmds_sequ g_idle_out_cmds = { + .cmd = g_common_cmd_idle_out, + .cmd_cnt = array_size(g_common_cmd_idle_out), +}; + +const lcd_cmds_sequ g_te_on_cmds = { + .cmd = g_common_cmd_te_on, + .cmd_cnt = array_size(g_common_cmd_te_on), +}; + +const lcd_cmds_sequ g_te_off_cmds = { + .cmd = g_common_cmd_te_off, + .cmd_cnt = array_size(g_common_cmd_te_off), +}; + +const lcd_cmds_sequ g_brightness_cmds = { + .cmd = g_common_cmd_brightness, + .cmd_cnt = array_size(g_common_cmd_brightness), +}; + +const lcd_cmds_sequ g_st7367_360x480_screen_init_on_cmds = { + .cmd = g_st7367_360x480_screen_init_on, + .cmd_cnt = array_size(g_st7367_360x480_screen_init_on), +}; + +const lcd_cmds_sequ g_edo_502x410_screen_init_on_cmds = { + .cmd = g_edo_502x410_screen_init_on, + .cmd_cnt = array_size(g_edo_502x410_screen_init_on), +}; +const lcd_cmds_sequ g_edo_466x466_screen_init_on_cmds = { + .cmd = g_edo_466x466_screen_init_on, + .cmd_cnt = array_size(g_edo_466x466_screen_init_on), +}; + +const lcd_cmds_sequ g_fd272_466x466_screen_init_on_cmds = { + .cmd = g_fd272_466x466_screen_init_on, + .cmd_cnt = array_size(g_fd272_466x466_screen_init_on), +}; + + +const lcd_cmds_sequ g_jd_360x360_screen_init_on_cmds = { + .cmd = g_jd_360x360_screen_init_on, + .cmd_cnt = array_size(g_jd_360x360_screen_init_on), +}; + +const lcd_cmds_sequ g_edo_454x454_screen_init_on_cmds = { + .cmd = g_edo_454x454_screen_init_on, + .cmd_cnt = array_size(g_edo_454x454_screen_init_on), +}; + +const lcd_cmds_sequ g_boe_454x454_screen_init_on_cmds = { + .cmd = g_boe_454x454_screen_init_on, + .cmd_cnt = array_size(g_boe_454x454_screen_init_on), +}; + +const lcd_cmds_sequ g_sh_240x296_screen_init_on_cmds = { + .cmd = g_sh_240x296_screen_init_on, + .cmd_cnt = array_size(g_sh_240x296_screen_init_on), +}; + +const lcd_cmds_sequ g_boe_194x368_screen_init_on_cmds = { + .cmd = g_boe_194x368_screen_init_on, + .cmd_cnt = array_size(g_boe_194x368_screen_init_on), +}; + +const lcd_cmds_sequ g_sleep_in_cmds = { + .cmd = g_common_cmd_sleep_in, + .cmd_cnt = array_size(g_common_cmd_sleep_in), +}; + +const lcd_cmds_sequ g_sleep_out_cmds = { + .cmd = g_common_cmd_sleep_out, + .cmd_cnt = array_size(g_common_cmd_sleep_out), +}; + + +const lcd_drv_cfg g_lcd_driver_ops[] = { + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_st7367_360x480_60_config, + .x_start = 0, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_ST7367_360X480_SCREEN_ID, + .display_on_cmds = &g_st7367_360x480_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_502x410_50_config, + .x_start = 0x04, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_EDO_502X410_SCREEN_ID, + .display_on_cmds = &g_edo_502x410_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_466x466_60_config, + .x_start = 0x6, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_EDO_466X466_SCREEN_ID, + .display_on_cmds = &g_edo_466x466_screen_init_on_cmds, + .display_off_cmds = &g_466x466_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_fd272_466x466_60_config, + .x_start = 0x6, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_FD272_466X466_SCREEN_ID, + .display_on_cmds = &g_fd272_466x466_screen_init_on_cmds, + .display_off_cmds = &g_466x466_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_360x360_60_config, + .x_start = 0, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_JD_360X360_SCREEN_ID, + .display_on_cmds = &g_jd_360x360_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_454x454_60_config, + .x_start = 0xe, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_EDO_454X454_SCREEN_ID, + .display_on_cmds = &g_edo_454x454_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_454x454_60_config, + .x_start = 0xc, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_BOE_454X454_SCREEN_ID, + .display_on_cmds = &g_boe_454x454_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_MIPI, + .bus_cfg = &g_panel_240x296_60_config, + .x_start = 0, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_SH_240X296_SCREEN_ID, + .display_on_cmds = &g_sh_240x296_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0xda, + .lcd_id_info.read_len = 3, + }, + { + .bus_type = BUS_DISPLAY_QSPI, + .bus_cfg = &g_panel_194x368_qspi_config, + .x_start = 0, + .y_start = 0, + .fps = 60, + .lcd_id = LCD_BOE_194X368_SCREEN_ID, + .display_on_cmds = &g_boe_194x368_screen_init_on_cmds, + .display_off_cmds = &g_display_off_cmds, + .enter_idle_cmds = &g_idle_in_cmds, + .exit_idle_cmds = &g_idle_out_cmds, + .te_on_cmds = &g_te_on_cmds, + .te_off_cmds = &g_te_off_cmds, + .set_brightnes_cmds = &g_brightness_cmds, + .sleep_in_cmds = &g_sleep_in_cmds, + .sleep_out_cmds = &g_sleep_out_cmds, + .lcd_id_info.reg_addr = 0x04, + .lcd_id_info.read_len = 3, + } +}; + +lcd_drv_cfg *lcd_get_driver_ops(void) +{ + return g_lcd_driver_ops; +} + +uint32_t lcd_get_ops_num(void) +{ + return array_size(g_lcd_driver_ops); +} + +combo_dev_cfg_t *lcd_get_bus_escape_config(void) +{ + return g_lcd_driver_ops[0].bus_cfg; +} + +lcd_drv_cfg *lcd_get_driver_config(uint32_t id) +{ + uint32_t i; + if (id == 0) { + return NULL; + } + + for (i = 0; i < array_size(g_lcd_driver_ops); i++) { + if (g_lcd_driver_ops[i].lcd_id == id) { + return &(g_lcd_driver_ops[i]); + } + } + + return NULL; +} diff --git a/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c b/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c index 12f39ca36..dd4f0b888 100644 --- a/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c +++ b/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c @@ -114,6 +114,8 @@ const diag_cmd_reg_obj_t g_diag_default_cmd_tbl[] = { #ifdef SUPPORT_MEDIA_AUDIO_MANAGER { DIAG_CMD_AUDIO_SEE_EFFECT_REQ, DIAG_CMD_AUDIO_SEE_EFFECT_REQ, diag_see_param_trans }, { DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ, DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ, diag_see_param_save }, + { DIAG_CMD_AUDIO_SWS_EFFECT_REQ, DIAG_CMD_AUDIO_SEE_EFFECT_REQ, diag_aef_param_trans }, + { DIAG_CMD_AUDIO_SAVE_SWS_EFFECT_REQ, DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ, diag_aef_param_save }, #endif }; diff --git a/code/sdk/middleware/chips/brandy/dfx/diag_audio.c b/code/sdk/middleware/chips/brandy/dfx/diag_audio.c index d9163347f..8ca325292 100644 --- a/code/sdk/middleware/chips/brandy/dfx/diag_audio.c +++ b/code/sdk/middleware/chips/brandy/dfx/diag_audio.c @@ -109,4 +109,92 @@ errcode_t diag_see_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_par audio_unused(cmd_param_size); return op; } + +/* debugkit menu点击read/write用于获取或设置AEF参数 */ +errcode_t diag_aef_param_trans(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option) +{ + errcode_t ret; + uint8_t *param = (uint8_t *)cmd_param; + if (cmd_param_size < NV_AUDIO_AEF_PARAM_SIZE) { + PRINT("[audio][diag][aef] cmd_param_size invalid\r\n"); + return ERRCODE_FAIL; + } + + if (param[GET_SEE_PARAM_FIRST_POS] != DEBUGKITS_READ_PARAM_TAG) { + /* set param , this func return 0 when success */ + ret = AudioManagerSetAefParam(SND_PORT_AEF_TYPE, (uint8_t *)param, NV_AUDIO_AEF_PARAM_SIZE); + if (ret != ERRCODE_SUCC) { + PRINT("[audio][diag][aef] set param fail, errcode:%d\r\n", ret); + return ERRCODE_FAIL; + } else { + PRINT("[audio][diag][aef] set param success !\r\n"); + } + } else { + /* get param , this func return 0 when success */ + ret = AudioManagerGetAefParam(SND_PORT_AEF_TYPE, (uint8_t *)param, NV_AUDIO_AEF_PARAM_SIZE); + if (ret != ERRCODE_SUCC) { + PRINT("[audio][diag][aef] get param fail, errcode:%d\r\n", ret); + return ERRCODE_FAIL; + } else { + PRINT("[audio][diag][aef] get param success !\r\n"); + } + } + return uapi_diag_report_packet(cmd_id, option, (uint8_t *)cmd_param, NV_AUDIO_AEF_PARAM_SIZE, true); +} + +static errcode_t audio_manager_save_aef_param(uint8_t *aef_param, uint16_t len) +{ + if (aef_param == NULL || len != sizeof(audio_aef_param_t)) { + PRINT("[audio_manager_save_aef_param]sea_param null or len invalid"); + return ERRCODE_INVALID_PARAM; + } + +#ifdef CONFIG_NV_FEATURE_SUPPORT + errcode_t nv_op = uapi_nv_write((uint16_t)NV_ID_AUDIO_AEF_SWS_PARAM, aef_param, len); + if (nv_op != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } +#endif + return ERRCODE_SUCC; +} + +/* debugkit menu点击Save保存所有AEF参数 */ +errcode_t diag_aef_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option) +{ + PRINT("[audio][diag][aef] diag_aef_param_save comes\r\n"); + audio_aef_param_t *nv_data = (audio_aef_param_t *)malloc(sizeof(audio_aef_param_t)); + if (nv_data == NULL) { + PRINT("[audio][diag][aef] nv malloc fail\r\n"); + return ERRCODE_MALLOC; + } + (void)memset_s(nv_data, sizeof(audio_aef_param_t), 0, sizeof(audio_aef_param_t)); + + nv_data->size = NV_AUDIO_AEF_PARAM_SIZE; + errcode_t ret = AudioManagerGetAefParam(SND_PORT_AEF_TYPE, (uint8_t *)nv_data->data, + NV_AUDIO_AEF_PARAM_SIZE * sizeof(uint8_t)); + if (ret != ERRCODE_SUCC) { + free(nv_data); + PRINT("[audio][diag][save] get aef param fail\r\n"); + return ERRCODE_FAIL; + } + + errcode_t nv_op = audio_manager_save_aef_param((uint8_t *)nv_data, (uint16_t)sizeof(audio_aef_param_t)); + if (nv_op != ERRCODE_SUCC) { + free(nv_data); + PRINT("[audio][diag] save aef param nv fail\r\n"); + return ERRCODE_FAIL; + } + free(nv_data); + + errcode_t op = uapi_diag_report_packet(cmd_id, option, &ret, sizeof(uint8_t), true); + if (op != ERRCODE_SUCC) { + PRINT("[audio][diag] read rpt fail %u\r\n", op); + } else { + PRINT("[audio][diag][aef] read rpt success\r\n"); + } + audio_unused(cmd_param); + audio_unused(cmd_param_size); + return op; +} + #endif /* SUPPORT_MEDIA_AUDIO_MANAGER */ \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/dfx/diag_audio.h b/code/sdk/middleware/chips/brandy/dfx/diag_audio.h index 2494da26f..413afe7b4 100644 --- a/code/sdk/middleware/chips/brandy/dfx/diag_audio.h +++ b/code/sdk/middleware/chips/brandy/dfx/diag_audio.h @@ -13,12 +13,20 @@ #include "diag.h" #define NV_AUDIO_VQE_PARAM_SIZE 53 +#define NV_AUDIO_AEF_PARAM_SIZE 162 typedef struct { uint32_t size; uint32_t data[NV_AUDIO_VQE_PARAM_SIZE]; } audio_vqe_param_t; +typedef struct { + uint32_t size; + uint8_t data[NV_AUDIO_AEF_PARAM_SIZE]; +} audio_aef_param_t; + errcode_t diag_see_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); errcode_t diag_see_param_trans(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); +errcode_t diag_aef_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); +errcode_t diag_aef_param_trans(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); #endif \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h b/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h index 815babfa3..516af18c3 100644 --- a/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h @@ -53,8 +53,10 @@ #define DIAG_CMD_AUDIO_HAID_REQ diag_cmd_id_comb(0x24) #define DIAG_CMD_AUDIO_SWS_EFFECT_REQ diag_cmd_id_comb(0x25) #define DIAG_CMD_AUDIO_SEE_EFFECT_REQ diag_cmd_id_comb(0x26) +#define DIAG_CMD_AUDIO_SAVE_SWS_EFFECT_REQ diag_cmd_id_comb(0x2E) #define DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ diag_cmd_id_comb(0x2f) + /* NV read and write commands [0x30, 0x33] */ #define DIAG_CMD_NV_RD diag_cmd_id_comb(0x30) #define DIAG_CMD_NV_WR diag_cmd_id_comb(0x31) diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json index 7b85e9959..321155d8c 100644 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json @@ -89,6 +89,16 @@ 654734439, 1, 0, 0, 0, 0, 0, 10551272, 655336, 4286447619, 64536, 500, 16384, 3277, 0, 66049, 0, 16711166, 2, 34145024, 33751810, 0]] + }, + "audio_aef_sws_param":{ + "key_id": "0x320E", + "key_status": "alive", + "structure_type": "audio_aef_param_t", + "attributions": 1, + "value": [81, [14, 316, 20, 25700, 3084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25700, 25700, 25700, 25700, 25700, 25700, 25700, 25700, + 25700, 25700, 25700, 25700, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, + 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 300, 400, 600, 900, 1400, 2000, 3000, 5000, 8000, 9000, + 12000, 16000, 300, 400, 600, 900, 1400, 2000, 3000, 5000, 8000, 9000, 12000, 16000, 5, 100, 0, 195]] } } } diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json index 05cb8c948..c2a381022 100644 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json @@ -89,6 +89,16 @@ 654734439, 1, 0, 0, 0, 0, 0, 10551272, 655336, 4286447619, 64536, 500, 16384, 3277, 0, 66049, 0, 16711166, 2, 34145024, 33751810, 0]] + }, + "audio_aef_sws_param":{ + "key_id": "0x320E", + "key_status": "alive", + "structure_type": "audio_aef_param_t", + "attributions": 1, + "value": [81, [14, 316, 20, 25700, 3084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25700, 25700, 25700, 25700, 25700, 25700, 25700, 25700, + 25700, 25700, 25700, 25700, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, + 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 300, 400, 600, 900, 1400, 2000, 3000, 5000, 8000, 9000, + 12000, 16000, 300, 400, 600, 900, 1400, 2000, 3000, 5000, 8000, 9000, 12000, 16000, 5, 100, 0, 195]] } } } diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/include/common.h b/code/sdk/middleware/chips/brandy/nv/nv_config/include/common.h index a5635b850..601d49dd9 100644 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/include/common.h +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/include/common.h @@ -102,6 +102,13 @@ typedef struct { uint32_t data[NV_AUDIO_VQE_PARAM_SIZE]; } audio_vqe_param_t; +/* SWS aef prams */ +#define NV_AUDIO_AEF_PARAM_SIZE 162 +typedef struct { + uint32_t size; + uint16_t data[NV_AUDIO_AEF_PARAM_SIZE]; +} audio_aef_param_t; + /* sys language id */ typedef struct { uint8_t language_id; diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/include/key_id.h b/code/sdk/middleware/chips/brandy/nv/nv_config/include/key_id.h index cafc78637..e1f4ffe8f 100644 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/include/key_id.h +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/include/key_id.h @@ -1,3 +1,11 @@ +/* + * @Author: penglei 1624952103@qq.com + * @Date: 2025-07-29 09:33:56 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2025-11-02 15:48:44 + * @FilePath: /FD230/code/sdk/middleware/chips/brandy/nv/nv_config/include/key_id.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ /* * Copyright (c) @CompanyNameMagicTag 2023-2023. All rights reserved. * Description: NV - key_id. @@ -36,6 +44,7 @@ /* user normal key_id [0x3000,0x4000) */ #define NV_ID_AUDIO_VQE_PARAM 0x320C /* 3A params for VOIP scene, audio_vqe_param_t */ #define NV_ID_AUDIO_VQE_KWS_PARAM 0x320D /* 3A params for KWS scene, audio_vqe_param_t */ +#define NV_ID_AUDIO_AEF_SWS_PARAM 0x320E /* 3A params for SWS scene, audio_aef_param_t */ /* reserved key_id [0x4000,0xFFFF) */ #define NV_ID_SAMPLE_0 0x4000 /* Eg. */ diff --git a/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal_crg.c b/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal_crg.c index 2fc9273f9..d253f4fe2 100644 --- a/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal_crg.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal_crg.c @@ -70,7 +70,11 @@ td_void dpu_crg_set_vedio_mclk_div_ctl(td_bool mclk_cken) #ifdef GPU_SUPPORT_VIDEO_MODE mclk_div_ctl.bits.dpu_mclk_div = 0x412600C; /* 147M * 12/147 = 12M */ #else - mclk_div_ctl.bits.dpu_mclk_div = 0x4126014; /* 147M * 20/147 = 20M */ +#ifdef LCD_JD9885 + mclk_div_ctl.bits.dpu_mclk_div = 0x412600C; /* 147M * 20/147 = 20M */ +#else + mclk_div_ctl.bits.dpu_mclk_div = 0x4126014; +#endif #endif mclk_div_ctl.bits.dpu_mclk_cken = mclk_cken; uapi_reg_write(CRG_VEDIO_CRG_MCLK_DIV_CTL, mclk_div_ctl.u32); diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp index 397deea97..dedc71859 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp @@ -44,7 +44,7 @@ extern "C" { #define VQE_PARAM_SIZE (NV_AUDIO_VQE_PARAM_SIZE * sizeof(uint32_t)) #define SEA_BUFFER_SIZE (VQE_PARAM_SIZE + VQE_PREFIX_LEN) #define AEF_BUFFER_SIZE (PEQ_PARAM_SIZE + PEQ_PREFIX_LEN) -#define PEQ_PREFIX_LEN 50 +#define AEF_BUFFER_LEN 256 static AudioManager& g_amInstance = AudioManager::GetInstance(); static std::shared_ptr g_streamIn = nullptr; @@ -217,7 +217,7 @@ int32_t AudioStreamInObtainBuffer(uint8_t *data, uint32_t *size) if (ret < 0) { return AUDIO_ERROR; } - *size = (uint32_t)ret; + *size = static_cast(ret); return AUDIO_SUCCESS; } @@ -372,7 +372,7 @@ int32_t AudioStreamOutStreamWrite(const uint8_t *data, uint32_t size) int32_t AudioStreamOutStop(void) { - int32_t ret = g_streamOut->Pause(); + int32_t ret = g_streamOut->Stop(); if (ret != AUDIO_SUCCESS) { ALOGE("audio stream out stop failed 0x%x", ret); return AUDIO_ERROR; @@ -529,12 +529,12 @@ int32_t AudioManagerA2dpSinkSetAefEnable(int32_t effectType, bool enable) int32_t AudioManagerSetSeaParam(const uint8_t *seaParam, uint16_t len) { - if (seaParam == NULL) { + if (seaParam == nullptr) { ALOGE("sea_param null"); return AUDIO_INVALID_PARAMS; } char *seaBuf = (char *)malloc(SEA_BUFFER_SIZE); - if (seaBuf == NULL) { + if (seaBuf == nullptr) { ALOGE("malloc fail"); return AUDIO_NO_MEM; } @@ -561,18 +561,18 @@ int32_t AudioManagerSetSeaParam(const uint8_t *seaParam, uint16_t len) return AUDIO_ERROR; } free(seaBuf); - ALOGE("set param success!"); + ALOGI("set param success!"); return AUDIO_SUCCESS; } int32_t AudioManagerGetSeaParam(uint8_t *seaParam, uint16_t len) { - if (seaParam == NULL) { + if (seaParam == nullptr) { ALOGE("sea_param null"); return AUDIO_INVALID_PARAMS; } char *seaBuf = (char *)malloc(SEA_BUFFER_SIZE); - if (seaBuf == NULL) { + if (seaBuf == nullptr) { ALOGE("malloc fail"); return AUDIO_NO_MEM; } @@ -599,7 +599,7 @@ int32_t AudioManagerGetSeaParam(uint8_t *seaParam, uint16_t len) return AUDIO_ERROR; } free(seaBuf); - ALOGE("get param success!"); + ALOGI("get param success!"); return AUDIO_SUCCESS; } @@ -616,6 +616,82 @@ static void WaitA2dpStartWhenDelay(AudioManagerA2dpContext *a2dpContext) } } +int32_t AudioManagerSetAefParam(int32_t effectType, const uint8_t *aefParam, uint16_t len) +{ + if (aefParam == nullptr) { + ALOGE("aef_param null"); + return AUDIO_INVALID_PARAMS; + } + char *aefBuf = (char *)malloc(AEF_BUFFER_LEN); + if (aefBuf == nullptr) { + ALOGE("malloc fail"); + return AUDIO_NO_MEM; + } + if (memset_s(aefBuf, AEF_BUFFER_LEN, 0, AEF_BUFFER_LEN) != EOK) { + ALOGE("memset_s fail"); + free(aefBuf); + return AUDIO_NO_MEM; + } + int32_t prefixLen = sprintf_s(aefBuf, AEF_BUFFER_LEN, "%s = %d#%u:", "setaefparam", effectType, len); + if (prefixLen < 0) { + ALOGE("sprintf_s failed"); + free(aefBuf); + return AUDIO_ERROR; + } + if (memcpy_s(aefBuf + prefixLen, AEF_BUFFER_LEN - prefixLen, aefParam, len) != EOK) { + ALOGE("memcpy_s failed"); + free(aefBuf); + return AUDIO_ERROR; + } + int32_t ret = g_amInstance.SetParam(AUDIO_DOWN_LINK, aefBuf, AEF_BUFFER_LEN); + if (ret != AUDIO_SUCCESS) { + ALOGE("set param failed"); + free(aefBuf); + return AUDIO_ERROR; + } + free(aefBuf); + ALOGI("set param success!"); + return AUDIO_SUCCESS; +} + +int32_t AudioManagerGetAefParam(int32_t effectType, uint8_t *aefParam, uint16_t len) +{ + if (aefParam == nullptr) { + ALOGE("aef_param null"); + return AUDIO_INVALID_PARAMS; + } + char *aefBuf = (char *)malloc(AEF_BUFFER_LEN); + if (aefBuf == nullptr) { + ALOGE("malloc fail"); + return AUDIO_NO_MEM; + } + if (memset_s(aefBuf, AEF_BUFFER_LEN, 0, AEF_BUFFER_LEN) != EOK) { + ALOGE("memset_s fail"); + free(aefBuf); + return AUDIO_NO_MEM; + } + int32_t prefixLen = sprintf_s(aefBuf, AEF_BUFFER_LEN, "%s = %d#%u:", "getaefparam", effectType, len); + if (prefixLen < 0) { + ALOGE("sprintf_s failed"); + free(aefBuf); + return AUDIO_ERROR; + } + int32_t ret = g_amInstance.GetParam(AUDIO_DOWN_LINK, aefBuf, AEF_BUFFER_LEN); + if (ret != AUDIO_SUCCESS) { + ALOGE("get param failed"); + free(aefBuf); + return AUDIO_ERROR; + } + if (memcpy_s(aefParam, AEF_BUFFER_LEN, aefBuf, len) != EOK) { + ALOGE("memcpy_s failed"); + free(aefBuf); + return AUDIO_ERROR; + } + free(aefBuf); + ALOGI("get param success!"); + return AUDIO_SUCCESS; +} + static int32_t DisConnectBluetoothA2dpDevice(void) { if (CheckA2dpSourceConnectState()) { diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h index 0b7935a15..19344add5 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h @@ -96,6 +96,10 @@ int32_t AudioManagerSetSeaParam(const uint8_t *seaParam, uint16_t len); int32_t AudioManagerGetSeaParam(uint8_t *seaParam, uint16_t len); +int32_t AudioManagerSetAefParam(int32_t effectType, const uint8_t *aefParam, uint16_t len); + +int32_t AudioManagerGetAefParam(int32_t effectType, uint8_t *aefParam, uint16_t len); + int32_t AudioManagerA2dpSinkSetParam(AudioFormatConfig config); int32_t AudioManagerA2dpSinkCreate(void); diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h index 69ae4f904..7afbe27ec 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h @@ -123,6 +123,8 @@ int32_t GetExternAIAttr(uapi_ai_attr *aiAttr); int32_t GetExternAOAttr(uapi_snd_attr *sndAttr); +void SetAefExtraParam(td_handle soundHandle); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c index 06e4aa7cb..0126bbcb0 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c @@ -44,6 +44,7 @@ static bool g_isCanCreateAenc = true; static MediaHalMutexHandle g_audioSdkInitLock = NULL; #ifdef SUPPORT_NV static audio_vqe_param_t g_vqeParam = { 0 }; +static audio_aef_param_t g_aefParam = { 0 }; static uint8_t g_productTestMode = 0; #endif #define VOLUME_UNIT 100 @@ -111,6 +112,25 @@ bool AudioConvertAudioFormatToCodecId(enum AudioFormat audioFormat, uapi_acodec_ return false; } +static void AudioNvRead(void) +{ + uint16_t len = 0; + errcode_t nvRet = uapi_nv_read(NV_ID_FTM_CONFIG, sizeof(uint8_t), &len, &g_productTestMode); + if (nvRet != ERRCODE_SUCC) { + g_productTestMode = 0; + } + nvRet = uapi_nv_read(NV_ID_AUDIO_VQE_PARAM, (uint16_t)sizeof(audio_vqe_param_t), &len, (uint8_t *)&g_vqeParam); + if (nvRet != MEDIA_HAL_OK) { + MEDIA_HAL_LOGW(MODULE_NAME, "nv read sea param faild!"); + } + if(SND_PORT_AEF_TYPE == UAPI_AEF_TYPE_SWS1) { + nvRet = uapi_nv_read(NV_ID_AUDIO_AEF_SWS_PARAM , (uint16_t)sizeof(audio_aef_param_t), &len, (uint8_t *)&g_aefParam); + if (nvRet != MEDIA_HAL_OK) { + MEDIA_HAL_LOGW(MODULE_NAME, "nv read aef param faild!"); + } + } +} + static int32_t AudioSDKInputInit(void) { int32_t ret; @@ -122,15 +142,7 @@ static int32_t AudioSDKInputInit(void) #ifdef AUDIO_SEA_SUPPORT #ifdef SUPPORT_NV - uint16_t len = 0; - errcode_t nvRet = uapi_nv_read(NV_ID_FTM_CONFIG, sizeof(uint8_t), &len, &g_productTestMode); - if (nvRet != ERRCODE_SUCC) { - g_productTestMode = 0; - } - nvRet = uapi_nv_read(NV_ID_AUDIO_VQE_PARAM, (uint16_t)sizeof(audio_vqe_param_t), &len, (uint8_t *)&g_vqeParam); - if (nvRet != MEDIA_HAL_OK) { - MEDIA_HAL_LOGW(MODULE_NAME, "nv read sea param faild!"); - } + AudioNvRead(); #endif MEDIA_HAL_DOFUNC_TIME(ret = uapi_sea_init()); if (ret != MEDIA_HAL_OK) { @@ -382,6 +394,18 @@ static int32_t SetSeaExtraParam(td_handle seaHandle) return MEDIA_HAL_OK; } +void SetAefExtraParam(td_handle soundHandle) +{ + if(SND_PORT_AEF_TYPE == UAPI_AEF_TYPE_SWS1) { + uint32_t size = g_aefParam.size * (uint32_t)sizeof(g_aefParam.data[0]); + int32_t ret = uapi_snd_set_aef_param(soundHandle, BUILTIN_SND_OUT_PORT, SND_PORT_AEF_TYPE, + (const td_void *)g_aefParam.data, (td_u32)size); + if (ret != MEDIA_HAL_OK) { + MEDIA_HAL_LOGE(MODULE_NAME, "uapi set aef param faild, ret: 0x%x", ret); + } + } +} + static int32_t SetSeaAfeAttr(td_handle seaHandle) { if (g_productTestMode == 0) { diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c index 091e8fc5a..36814369f 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c @@ -351,6 +351,7 @@ static int32_t SetAefProfile(SubPortOutContext *portOutCtx, const enum AudioCate if (ret != MEDIA_HAL_OK) { MEDIA_HAL_LOGE(MODULE_NAME, "uapi_snd_set_port_aef_enable(%d) failed: 0x%x", SND_PORT_AEF_TYPE, ret); } + SetAefExtraParam(portOutCtx->sndHandle); return MEDIA_HAL_OK; } -- 2.17.1