mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 09:52:31 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -202,6 +202,7 @@ struct mtk_dsi {
|
||||
struct mtk_phy_timing phy_timing;
|
||||
int refcount;
|
||||
bool enabled;
|
||||
bool lanes_ready;
|
||||
u32 irq_data;
|
||||
wait_queue_head_t irq_wait_queue;
|
||||
const struct mtk_dsi_driver_data *driver_data;
|
||||
@@ -644,18 +645,11 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
|
||||
mtk_dsi_reset_engine(dsi);
|
||||
mtk_dsi_phy_timconfig(dsi);
|
||||
|
||||
mtk_dsi_rxtx_control(dsi);
|
||||
usleep_range(30, 100);
|
||||
mtk_dsi_reset_dphy(dsi);
|
||||
mtk_dsi_ps_control_vact(dsi);
|
||||
mtk_dsi_set_vm_cmd(dsi);
|
||||
mtk_dsi_config_vdo_timing(dsi);
|
||||
mtk_dsi_set_interrupt_enable(dsi);
|
||||
|
||||
mtk_dsi_clk_ulp_mode_leave(dsi);
|
||||
mtk_dsi_lane0_ulp_mode_leave(dsi);
|
||||
mtk_dsi_clk_hs_mode(dsi, 0);
|
||||
|
||||
return 0;
|
||||
err_disable_engine_clk:
|
||||
clk_disable_unprepare(dsi->engine_clk);
|
||||
@@ -687,6 +681,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
|
||||
mtk_dsi_reset_engine(dsi);
|
||||
mtk_dsi_lane0_ulp_mode_enter(dsi);
|
||||
mtk_dsi_clk_ulp_mode_enter(dsi);
|
||||
/* set the lane number as 0 to pull down mipi */
|
||||
writel(0, dsi->regs + DSI_TXRX_CTRL);
|
||||
|
||||
mtk_dsi_disable(dsi);
|
||||
|
||||
@@ -694,21 +690,31 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
|
||||
clk_disable_unprepare(dsi->digital_clk);
|
||||
|
||||
phy_power_off(dsi->phy);
|
||||
|
||||
dsi->lanes_ready = false;
|
||||
}
|
||||
|
||||
static void mtk_dsi_lane_ready(struct mtk_dsi *dsi)
|
||||
{
|
||||
if (!dsi->lanes_ready) {
|
||||
dsi->lanes_ready = true;
|
||||
mtk_dsi_rxtx_control(dsi);
|
||||
usleep_range(30, 100);
|
||||
mtk_dsi_reset_dphy(dsi);
|
||||
mtk_dsi_clk_ulp_mode_leave(dsi);
|
||||
mtk_dsi_lane0_ulp_mode_leave(dsi);
|
||||
mtk_dsi_clk_hs_mode(dsi, 0);
|
||||
msleep(20);
|
||||
/* The reaction time after pulling up the mipi signal for dsi_rx */
|
||||
}
|
||||
}
|
||||
|
||||
static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (dsi->enabled)
|
||||
return;
|
||||
|
||||
ret = mtk_dsi_poweron(dsi);
|
||||
if (ret < 0) {
|
||||
DRM_ERROR("failed to power on dsi\n");
|
||||
return;
|
||||
}
|
||||
|
||||
mtk_dsi_lane_ready(dsi);
|
||||
mtk_dsi_set_mode(dsi);
|
||||
mtk_dsi_clk_hs_mode(dsi, 1);
|
||||
|
||||
@@ -722,8 +728,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
|
||||
if (!dsi->enabled)
|
||||
return;
|
||||
|
||||
mtk_dsi_poweroff(dsi);
|
||||
|
||||
dsi->enabled = false;
|
||||
}
|
||||
|
||||
@@ -746,24 +750,53 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
drm_display_mode_to_videomode(adjusted, &dsi->vm);
|
||||
}
|
||||
|
||||
static void mtk_dsi_bridge_disable(struct drm_bridge *bridge)
|
||||
static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct mtk_dsi *dsi = bridge_to_dsi(bridge);
|
||||
|
||||
mtk_output_dsi_disable(dsi);
|
||||
}
|
||||
|
||||
static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)
|
||||
static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct mtk_dsi *dsi = bridge_to_dsi(bridge);
|
||||
|
||||
if (dsi->refcount == 0)
|
||||
return;
|
||||
|
||||
mtk_output_dsi_enable(dsi);
|
||||
}
|
||||
|
||||
static void mtk_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct mtk_dsi *dsi = bridge_to_dsi(bridge);
|
||||
int ret;
|
||||
|
||||
ret = mtk_dsi_poweron(dsi);
|
||||
if (ret < 0)
|
||||
DRM_ERROR("failed to power on dsi\n");
|
||||
}
|
||||
|
||||
static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct mtk_dsi *dsi = bridge_to_dsi(bridge);
|
||||
|
||||
mtk_dsi_poweroff(dsi);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
|
||||
.attach = mtk_dsi_bridge_attach,
|
||||
.disable = mtk_dsi_bridge_disable,
|
||||
.enable = mtk_dsi_bridge_enable,
|
||||
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
|
||||
.atomic_disable = mtk_dsi_bridge_atomic_disable,
|
||||
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
|
||||
.atomic_enable = mtk_dsi_bridge_atomic_enable,
|
||||
.atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
|
||||
.atomic_post_disable = mtk_dsi_bridge_atomic_post_disable,
|
||||
.atomic_reset = drm_atomic_helper_bridge_reset,
|
||||
.mode_set = mtk_dsi_bridge_mode_set,
|
||||
};
|
||||
|
||||
@@ -891,24 +924,35 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
|
||||
u8 read_data[16];
|
||||
void *src_addr;
|
||||
u8 irq_flag = CMD_DONE_INT_FLAG;
|
||||
u32 dsi_mode;
|
||||
int ret;
|
||||
|
||||
if (readl(dsi->regs + DSI_MODE_CTRL) & MODE) {
|
||||
DRM_ERROR("dsi engine is not command mode\n");
|
||||
return -EINVAL;
|
||||
dsi_mode = readl(dsi->regs + DSI_MODE_CTRL);
|
||||
if (dsi_mode & MODE) {
|
||||
mtk_dsi_stop(dsi);
|
||||
ret = mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
|
||||
if (ret)
|
||||
goto restore_dsi_mode;
|
||||
}
|
||||
|
||||
if (MTK_DSI_HOST_IS_READ(msg->type))
|
||||
irq_flag |= LPRX_RD_RDY_INT_FLAG;
|
||||
|
||||
if (mtk_dsi_host_send_cmd(dsi, msg, irq_flag) < 0)
|
||||
return -ETIME;
|
||||
mtk_dsi_lane_ready(dsi);
|
||||
|
||||
if (!MTK_DSI_HOST_IS_READ(msg->type))
|
||||
return 0;
|
||||
ret = mtk_dsi_host_send_cmd(dsi, msg, irq_flag);
|
||||
if (ret)
|
||||
goto restore_dsi_mode;
|
||||
|
||||
if (!MTK_DSI_HOST_IS_READ(msg->type)) {
|
||||
recv_cnt = 0;
|
||||
goto restore_dsi_mode;
|
||||
}
|
||||
|
||||
if (!msg->rx_buf) {
|
||||
DRM_ERROR("dsi receive buffer size may be NULL\n");
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto restore_dsi_mode;
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
@@ -933,7 +977,13 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
|
||||
DRM_INFO("dsi get %d byte data from the panel address(0x%x)\n",
|
||||
recv_cnt, *((u8 *)(msg->tx_buf)));
|
||||
|
||||
return recv_cnt;
|
||||
restore_dsi_mode:
|
||||
if (dsi_mode & MODE) {
|
||||
mtk_dsi_set_mode(dsi);
|
||||
mtk_dsi_start(dsi);
|
||||
}
|
||||
|
||||
return ret < 0 ? ret : recv_cnt;
|
||||
}
|
||||
|
||||
static const struct mipi_dsi_host_ops mtk_dsi_ops = {
|
||||
|
||||
Reference in New Issue
Block a user