diff mbox series

[meta-oe,2/2] panel-mipi-dbi.bbclass: initial addition of the firmware blob class

Message ID 20241101130137.2474093-2-l.goehrs@pengutronix.de
State Accepted
Headers show
Series [meta-oe,1/2] panel-mipi-dbi: initial addition of the firmware blob assembler | expand

Commit Message

Leonard Göhrs Nov. 1, 2024, 1:01 p.m. UTC
The `panel-mipi-dbi.bbclass` can be used to build a firmware file for use
with the `panel-mipi-dbi` Linux driver.

The class uses the `mipi-dbi-cmd` from `panel-mipi-dbi-native` to
assemble a human readable list of init commands into a firmware file
for use with the `panel-mipi-dbi` Linux driver.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 meta-oe/classes/panel-mipi-dbi.bbclass | 48 ++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 meta-oe/classes/panel-mipi-dbi.bbclass
diff mbox series

Patch

diff --git a/meta-oe/classes/panel-mipi-dbi.bbclass b/meta-oe/classes/panel-mipi-dbi.bbclass
new file mode 100644
index 000000000..7ceebc72e
--- /dev/null
+++ b/meta-oe/classes/panel-mipi-dbi.bbclass
@@ -0,0 +1,48 @@ 
+# SPDX-License-Identifier: MIT
+#
+# Copyright Pengutronix <yocto@pengutronix.de>
+#
+# Class to generate firmware files for use with the `panel-mipi-dbi` Linux
+# driver.
+#
+# The firmware source file contains a list of commands to send to the display
+# controller in order to initialize it:
+#
+#   $ cat shineworld,lh133k.txt
+#   command 0x11 # exit sleep mode
+#   delay 120
+#
+#   # Enable color inversion
+#   command 0x21 # INVON
+#   ...
+#
+# A recipe to compile such a command list into a firmware blob for use with
+# the `panel-mipi-dbi` driver looks something like this:
+#
+#   $ cat panel-shineworld-lh133k.bb
+#   inherit panel-mipi-dbi
+#
+#   SRC_URI = "file://${PANEL_FIRMWARE}"
+#
+#   PANEL_FIRMWARE = "shineworld,lh133k.txt"
+#   ...
+
+DEPENDS = "panel-mipi-dbi-native"
+
+PANEL_FIRMWARE_BIN ?= "${@d.getVar('PANEL_FIRMWARE').removesuffix('.txt')}.bin"
+
+do_configure[noexec] = "1"
+
+do_compile () {
+    mipi-dbi-cmd \
+        "${B}/${PANEL_FIRMWARE_BIN}" \
+        "${UNPACKDIR}/${PANEL_FIRMWARE}"
+}
+
+do_install () {
+    install -m 0644 -D \
+        "${B}/${PANEL_FIRMWARE_BIN}" \
+        "${D}${nonarch_base_libdir}/firmware/${PANEL_FIRMWARE_BIN}"
+}
+
+FILES:${PN} = "${nonarch_base_libdir}/firmware/"