-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Adding dave2d driver support on lvgl for Renesas RA devices #97163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
duynguyenxa
wants to merge
6
commits into
zephyrproject-rtos:main
Choose a base branch
from
renesas:renesas_drw_driver_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+253
−11
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e7fdd1
manifest: Update revision for renesas hal and lvgl
duynguyenxa f84b1f6
drivers: misc: Initial support for drw driver on Renesas RA
duynguyenxa c594331
dts: arm: renesas: Add DRW nodes for RA8D1 and RA8P1 SoCs
duynguyenxa 6dc091f
boards: renesas: Add support for drw driver on RA8
duynguyenxa b03706b
boards: shields: adjust GLCDC panel timing parameters
duynguyenxa a37e85d
samples: modules: lvgl: update for ek_ra8p1 and ek_ra8d1
duynguyenxa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_library() | ||
|
||
zephyr_library_sources_ifdef(CONFIG_RENESAS_RA_DRW renesas_ra_drw.c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2025 Renesas Electronics Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Renesas DRW (D/AVE 2D) config options | ||
|
||
menuconfig RENESAS_DRW | ||
bool "Renesas DRW Driver" | ||
depends on SOC_FAMILY_RENESAS_RA | ||
help | ||
Enable config options for Renesas DRW driver | ||
|
||
if RENESAS_DRW | ||
|
||
config RENESAS_DRW_INIT_PRIORITY | ||
int "Renesas DRW initialization priority" | ||
default KERNEL_INIT_PRIORITY_DEVICE | ||
help | ||
System initialization priority for Renesas DRW drivers. | ||
|
||
source "drivers/misc/renesas_drw/Kconfig.renesas_ra_drw" | ||
|
||
endif # RENESAS_DRW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2025 Renesas Electronics Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config RENESAS_RA_DRW | ||
bool "Renesas RA DRW Driver" | ||
depends on DT_HAS_RENESAS_RA_DRW_ENABLED | ||
select USE_RA_FSP_DRW | ||
default y | ||
help | ||
Enable config options for Renesas DRW driver | ||
|
||
if RENESAS_RA_DRW | ||
config RENESAS_DAVE2D_RUNTIME_HEAP_SIZE | ||
int "Renesas DAVE2D runtime heap size" | ||
default 8192 | ||
help | ||
Set the size of the runtime heap for DAVE2D driver. | ||
This heap is used for dynamic memory allocation during runtime. | ||
|
||
endif # RENESAS_RA_DRW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright (c) 2025 Renesas Electronics Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#define DT_DRV_COMPAT renesas_ra_drw | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/irq.h> | ||
#include <soc.h> | ||
#include <r_drw_base.h> | ||
#include <r_drw_cfg.h> | ||
|
||
#define DRW_PRV_IRQCTL_DLISTIRQ_ENABLE BIT(1) | ||
#define DRW_PRV_IRQCTL_ENUMIRQ_CLEAR BIT(2) | ||
#define DRW_PRV_IRQCTL_DLISTIRQ_CLEAR BIT(3) | ||
#define DRW_PRV_IRQCTL_BUSIRQ_CLEAR BIT(5) | ||
#define DRW_PRV_IRQCTL_ALLIRQ_DISABLE_AND_CLEAR \ | ||
(DRW_PRV_IRQCTL_BUSIRQ_CLEAR | DRW_PRV_IRQCTL_DLISTIRQ_CLEAR | DRW_PRV_IRQCTL_ENUMIRQ_CLEAR) | ||
#define DRW_PRV_IRQCTL_ALLIRQ_CLEAR_AND_DLISTIRQ_ENABLE \ | ||
(DRW_PRV_IRQCTL_BUSIRQ_CLEAR | DRW_PRV_IRQCTL_DLISTIRQ_CLEAR | \ | ||
DRW_PRV_IRQCTL_ENUMIRQ_CLEAR | DRW_PRV_IRQCTL_DLISTIRQ_ENABLE) | ||
#define DRW_PRV_STATUS_DLISTIRQ_TRIGGERED (1U << 5) | ||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(drw), okay) | ||
#define VECTOR_NUMBER_DRW_INT DT_IRQN(DT_NODELABEL(drw)) | ||
#else | ||
#error "Device tree node 'drw' not found or disabled (status != okay)" | ||
#endif | ||
|
||
static struct k_sem d1_queryirq_sem; | ||
K_HEAP_DEFINE(drw_heap_runtime, CONFIG_RENESAS_DAVE2D_RUNTIME_HEAP_SIZE); | ||
|
||
d1_int_t d1_initirq_intern(d1_device_flex *handle) | ||
{ | ||
if (VECTOR_NUMBER_DRW_INT >= 0) { | ||
/* Clear all the D/AVE 2D IRQs and enable Display list IRQ. */ | ||
R_FSP_IsrContextSet((IRQn_Type)VECTOR_NUMBER_DRW_INT, handle); | ||
irq_enable(VECTOR_NUMBER_DRW_INT); | ||
R_DRW->IRQCTL = DRW_PRV_IRQCTL_ALLIRQ_CLEAR_AND_DLISTIRQ_ENABLE; | ||
} | ||
|
||
return (k_sem_init(&d1_queryirq_sem, 0, 1) == 0); | ||
} | ||
|
||
d1_int_t d1_shutdownirq_intern(d1_device_flex *handle) | ||
{ | ||
ARG_UNUSED(handle); | ||
|
||
/* Disable D/AVE 2D interrupt in NVIC. */ | ||
irq_disable(VECTOR_NUMBER_DRW_INT); | ||
|
||
/* Clear all the D/AVE 2D IRQs and disable Display list IRQ. */ | ||
R_DRW->IRQCTL = DRW_PRV_IRQCTL_ALLIRQ_DISABLE_AND_CLEAR; | ||
|
||
return 1; | ||
} | ||
|
||
d1_int_t d1_queryirq(d1_device *handle, d1_int_t irqmask, d1_int_t timeout) | ||
{ | ||
/* Wait for dlist processing to complete. */ | ||
return (k_sem_take(&d1_queryirq_sem, K_MSEC(timeout)) == 0); | ||
} | ||
|
||
void *d1_malloc(d1_uint_t size) | ||
{ | ||
return k_heap_alloc(&drw_heap_runtime, size, K_NO_WAIT); | ||
} | ||
|
||
void d1_free(void *ptr) | ||
{ | ||
k_heap_free(&drw_heap_runtime, ptr); | ||
} | ||
|
||
void drw_zephyr_irq_handler(const struct device *dev) | ||
{ | ||
uint32_t int_status; | ||
IRQn_Type irq = R_FSP_CurrentIrqGet(); /* Get current IRQ number */ | ||
|
||
int_status = R_DRW->STATUS; /* Read D/AVE 2D interrupt status */ | ||
/* Clear all D/AVE 2D interrupts except for Display List IRQ enable */ | ||
R_DRW->IRQCTL = DRW_PRV_IRQCTL_ALLIRQ_CLEAR_AND_DLISTIRQ_ENABLE; | ||
|
||
if (int_status & DRW_PRV_STATUS_DLISTIRQ_TRIGGERED) { | ||
d1_device_flex *p_d1_handle = (d1_device_flex *)R_FSP_IsrContextGet(irq); | ||
|
||
if (p_d1_handle != NULL) { | ||
uint32_t **pp_dlist_indirect_start = | ||
(uint32_t **)p_d1_handle->pp_dlist_indirect_start; | ||
if (p_d1_handle->dlist_indirect_enable && | ||
*pp_dlist_indirect_start != NULL) { | ||
R_DRW->DLISTSTART = *pp_dlist_indirect_start; | ||
p_d1_handle->pp_dlist_indirect_start++; | ||
} else { | ||
k_sem_give(&d1_queryirq_sem); | ||
} | ||
} | ||
} | ||
/* Clear IRQ status. */ | ||
R_BSP_IrqStatusClear(irq); | ||
} | ||
|
||
#define DRW_INIT(inst) \ | ||
static int drw_renesas_ra_configure_func_##inst(void) \ | ||
{ \ | ||
R_ICU->IELSR[DT_INST_IRQ_BY_NAME(inst, drw, irq)] = ELC_EVENT_DRW_INT; \ | ||
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, drw, irq), \ | ||
DT_INST_IRQ_BY_NAME(inst, drw, priority), drw_zephyr_irq_handler, \ | ||
DEVICE_DT_INST_GET(inst), 0); \ | ||
return 0; \ | ||
} \ | ||
static int renesas_drw_init_##inst(const struct device *dev) \ | ||
{ \ | ||
ARG_UNUSED(dev); \ | ||
return drw_renesas_ra_configure_func_##inst(); \ | ||
} \ | ||
DEVICE_DT_INST_DEFINE(inst, renesas_drw_init_##inst, NULL, NULL, NULL, POST_KERNEL, \ | ||
CONFIG_RENESAS_DRW_INIT_PRIORITY, NULL); | ||
|
||
DT_INST_FOREACH_STATUS_OKAY(DRW_INIT) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) 2025 Renesas Electronics Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: Renesas RA DRW | ||
|
||
compatible: "renesas,ra-drw" | ||
|
||
include: base.yaml | ||
|
||
properties: | ||
interrupts: | ||
required: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
samples/modules/lvgl/demos/boards/ek_ra8p1_r7ka8p1kflcac_cm85.overlay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2025 Renesas Electronics Corporation | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&flash0 { | ||
reg = <0x2000000 0x100000>; | ||
}; | ||
|
||
&flash1 { | ||
status = "disabled"; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DT_INST and its foreach version is also responsible to manage the allocation of the driver instance and runtime data, there are examples on how to instantiate singleton devices ( check the video input subsystems) but I'd rather to leave this as is because the runtime result will be the same of using a cusom singleton initialization flow.