spidev
This commit is contained in:
1 parent
78f2b0f688
commit
c54c28505a
4 files changed
+316
-144
No files matched your search
+6
-1
@@ -91,4 +91,9 @@ CONFIG_PACKAGE_wireguard-tools=y
|
||||
# CONFIG_TARGET_ROOTFS_EXT4FS is not set
|
||||
CONFIG_PACKAGE_libdrm=y
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_BUSYBOX_CONFIG_FBSET=y
|
||||
CONFIG_BUSYBOX_CONFIG_FBSET=y
|
||||
|
||||
CONFIG_PACKAGE_python3=y
|
||||
CONFIG_PACKAGE_python3-spidev=y
|
||||
CONFIG_PACKAGE_spi-tools=y
|
||||
CONFIG_PACKAGE_libgpiod-tools=y
|
||||
+3
-1
@@ -1050,4 +1050,6 @@ CONFIG_PWM_PM8916=y
|
||||
CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM=y # Para acceso directo
|
||||
|
||||
CONFIG_FRAMEBUFFER_CONSOLE=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
|
||||
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
|
||||
|
||||
CONFIG_SPI_SPIDEV=y
|
||||
@@ -1,15 +1,43 @@
|
||||
Index: arch/arm64/boot/dts/qcom/msm8916-generic-mf68e.dts
|
||||
===================================================================
|
||||
--- a/arch/arm64/boot/dts/qcom/msm8916-generic-mf68e.dts
|
||||
From: OpenWRT Builder <builder@openwrt.org>
|
||||
Date: Mon, 13 Oct 2025 16:40:00 +0200
|
||||
Subject: [PATCH] arm64: dts: qcom: Add MSM8916 MF68E device with ST7735S display
|
||||
|
||||
Add device tree for MF68E 4G LTE Mobile WiFi Router with ST7735S display support.
|
||||
|
||||
Features:
|
||||
- ST7735S 128x128 display via SPI0
|
||||
- PWM backlight via PM8916 MPP4
|
||||
- Battery monitoring
|
||||
- GPIO LEDs and buttons
|
||||
- SPIDEV support for debugging (commented out)
|
||||
|
||||
Signed-off-by: OpenWRT Builder <builder@openwrt.org>
|
||||
---
|
||||
arch/arm64/boot/dts/qcom/Makefile | 1 +
|
||||
.../dts/qcom/msm8916-generic-mf68e.dts | 257 ++++++++++++++++++
|
||||
2 files changed, 258 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/qcom/msm8916-generic-mf68e.dts
|
||||
|
||||
--- a/arch/arm64/boot/dts/qcom/Makefile
|
||||
+++ b/arch/arm64/boot/dts/qcom/Makefile
|
||||
@@ -25,6 +25,7 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-alcatel-idol347.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-asus-z00l.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-huawei-g7.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-longcheer-l8150.dtb
|
||||
+dtb-$(CONFIG_ARCH_QCOM) += msm8916-generic-mf68e.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-mtp.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-a3u-eur.dtb
|
||||
dtb-$(CONFIG_ARCH_QCOM) += msm8916-samsung-a5u-eur.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/qcom/msm8916-generic-mf68e.dts
|
||||
@@ -0,0 +1,139 @@
|
||||
@@ -0,0 +1,257 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "msm8916-ufi.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
|
||||
+#include <dt-bindings/leds/common.h>
|
||||
+
|
||||
+/ {
|
||||
+ model = "MF68E 4G LTE Mobile WiFi Router";
|
||||
@@ -28,117 +56,235 @@ Index: arch/arm64/boot/dts/qcom/msm8916-generic-mf68e.dts
|
||||
+ <4063000 75>, <4006000 70>, <3972000 65>,
|
||||
+ <3931000 60>, <3880000 55>, <3841000 50>,
|
||||
+ <3817000 45>, <3798000 40>, <3783000 35>,
|
||||
+ <3767000 30>, <3747000 25>, <3729000 20>,
|
||||
+ <3700000 16>, <3687000 13>, <3683000 11>,
|
||||
+ <3681000 10>, <3680000 9>, <3678000 8>,
|
||||
+ <3674000 7>, <3666000 6>, <3641000 5>,
|
||||
+ <3597000 4>, <3537000 3>, <3457000 2>,
|
||||
+ <3336000 1>, <3000000 0>;
|
||||
+ };
|
||||
+
|
||||
+ usb_id: usb-id {
|
||||
+ compatible = "linux,extcon-usb-gpio";
|
||||
+ id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&usb_id_default>;
|
||||
+ <3767000 30>, <3752000 25>, <3732000 20>,
|
||||
+ <3712000 16>, <3694000 13>, <3681000 11>,
|
||||
+ <3675000 10>, <3673000 9>, <3664000 8>,
|
||||
+ <3655000 7>, <3642000 6>, <3628000 5>,
|
||||
+ <3611000 4>, <3573000 3>, <3531000 2>,
|
||||
+ <3495000 1>, <3400000 0>;
|
||||
+ };
|
||||
+
|
||||
+ backlight: backlight {
|
||||
+ compatible = "pwm-backlight";
|
||||
+ pwms = <&pm8916_pwm 0 100000>;
|
||||
+ brightness-levels = <255 128 64 32 16 8 4 0>;
|
||||
+ brightness-levels = <0 255>;
|
||||
+ num-interpolated-steps = <255>;
|
||||
+ default-brightness-level = <1>;
|
||||
+ default-brightness-level = <128>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&blsp_spi3 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ panel@0 {
|
||||
+ compatible = "sitronix,st7735s";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <32000000>;
|
||||
+
|
||||
+ reset-gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
|
||||
+ dc-gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>;
|
||||
+ backlight = <&backlight>;
|
||||
+
|
||||
+ vdd-supply = <&pm8916_l17>;
|
||||
+ vddio-supply = <&pm8916_l6>;
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ pinctrl-0 = <&button_default>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&panel_default>;
|
||||
+
|
||||
+ label = "GPIO Buttons";
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "Reset";
|
||||
+ gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ pinctrl-0 = <&gpio_leds_default>;
|
||||
+ pinctrl-names = "default";
|
||||
+
|
||||
+ led-0 {
|
||||
+ gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
|
||||
+ color = <LED_COLOR_ID_BLUE>;
|
||||
+ function = LED_FUNCTION_WLAN;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>;
|
||||
+ color = <LED_COLOR_ID_BLUE>;
|
||||
+ function = LED_FUNCTION_WAN;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-2 {
|
||||
+ gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>;
|
||||
+ color = <LED_COLOR_ID_GREEN>;
|
||||
+ function = LED_FUNCTION_POWER;
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pm8916_l6 {
|
||||
+ regulator-always-on;
|
||||
+&battery {
|
||||
+ monitored-battery = <&bat>;
|
||||
+};
|
||||
+
|
||||
+&pm8916_rpm_regulators {
|
||||
+ pm8916_l17: l17 {
|
||||
+ regulator-min-microvolt = <2850000>;
|
||||
+ regulator-max-microvolt = <2850000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+&button_default {
|
||||
+ pins = "gpio37";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <2>;
|
||||
+ bias-pull-up;
|
||||
+};
|
||||
+
|
||||
+&gpio_leds_default {
|
||||
+ pins = "gpio20", "gpio21", "gpio22";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <2>;
|
||||
+ bias-disable;
|
||||
+};
|
||||
+
|
||||
+&mpss_mem {
|
||||
+ reg = <0x0 0x86800000 0x0 0x5500000>;
|
||||
+};
|
||||
+
|
||||
+&pm8916_pwm {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_out>;
|
||||
+};
|
||||
+
|
||||
+&pm8916_mpps {
|
||||
+ pwm_out: mpp4-state {
|
||||
+ pins = "mpp4";
|
||||
+ function = "digital";
|
||||
+ output-low;
|
||||
+ qcom,dtest = <1>;
|
||||
+ power-source = <PM8916_MPP_VPH>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pm8916_bms {
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+ monitored-battery = <&bat>;
|
||||
+ power-supplies = <&pm8916_charger>;
|
||||
+};
|
||||
+
|
||||
+&pm8916_charger {
|
||||
+&pm8916_codec {
|
||||
+ qcom,micbias-lvl = <2800>;
|
||||
+ qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
|
||||
+ qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
|
||||
+ qcom,hphl-jack-type-normally-open;
|
||||
+};
|
||||
+
|
||||
+&sdhc_1 {
|
||||
+ status = "okay";
|
||||
+ monitored-battery = <&bat>;
|
||||
+ qcom,fast-charge-safe-current = <900000>;
|
||||
+ qcom,fast-charge-safe-voltage = <4350000>;
|
||||
+};
|
||||
+
|
||||
+&sdhc_2 {
|
||||
+ status = "okay";
|
||||
+ non-removable;
|
||||
+};
|
||||
+
|
||||
+&sound {
|
||||
+ audio-routing =
|
||||
+ "AMIC1", "MIC BIAS Internal1",
|
||||
+ "AMIC2", "MIC BIAS External1",
|
||||
+ "AMIC3", "MIC BIAS External1";
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ status = "okay";
|
||||
+ extcon = <&usb_id>, <&usb_id>;
|
||||
+ dr_mode = "peripheral";
|
||||
+ extcon = <&usb_id>;
|
||||
+};
|
||||
+
|
||||
+&usb_hs_phy {
|
||||
+ extcon = <&usb_id>;
|
||||
+};
|
||||
+
|
||||
+&sdhc_1 {
|
||||
+ status = "okay";
|
||||
+&wcnss {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wcnss_iris {
|
||||
+ compatible = "qcom,wcn3620";
|
||||
+};
|
||||
+
|
||||
+&tlmm {
|
||||
+ panel_default: panel-default-state {
|
||||
+ pins = "gpio25", "gpio23";
|
||||
+ /*
|
||||
+ * GPIO 0,1,2,3: SPI0 for ST7735S display
|
||||
+ * GPIO 23: DC (Data/Command) for display
|
||||
+ * GPIO 25: Reset for display
|
||||
+ */
|
||||
+ spi0_default: spi0-default-state {
|
||||
+ pins = "gpio0", "gpio1", "gpio3";
|
||||
+ function = "blsp_spi1";
|
||||
+ drive-strength = <8>;
|
||||
+ bias-disable;
|
||||
+ };
|
||||
+
|
||||
+ spi0_cs_default: spi0-cs-default-state {
|
||||
+ pins = "gpio2";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <8>;
|
||||
+ bias-disable;
|
||||
+ output-high;
|
||||
+ output-high;
|
||||
+ };
|
||||
+
|
||||
+ usb_id_default: usb-id-default-state {
|
||||
+ pins = "gpio110";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <8>;
|
||||
+ bias-pull-up;
|
||||
+ display_pins: display-state {
|
||||
+ reset-pins {
|
||||
+ pins = "gpio25";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <8>;
|
||||
+ bias-disable;
|
||||
+ output-high;
|
||||
+ };
|
||||
+
|
||||
+ dc-pins {
|
||||
+ pins = "gpio23";
|
||||
+ function = "gpio";
|
||||
+ drive-strength = <8>;
|
||||
+ bias-disable;
|
||||
+ output-high;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pm8916_mpps {
|
||||
+ /*
|
||||
+ * MPP4 is used for PWM backlight control
|
||||
+ * Configured for digital output to drive PWM
|
||||
+ */
|
||||
+ pwm_out: mpp4-state {
|
||||
+ pins = "mpp4";
|
||||
+ function = "digital";
|
||||
+ power-source = <PM8916_MPP_VPH>;
|
||||
+ output-low;
|
||||
+ qcom,dtest = <1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * SPI0 Bus - ST7735S Display Controller
|
||||
+ * Physical panel: 132x132 pixels
|
||||
+ * Visible area: 128x128 pixels
|
||||
+ * Interface: 4-wire SPI (MOSI, MISO, SCK, CS)
|
||||
+ * Additional: DC (GPIO23), Reset (GPIO25)
|
||||
+ */
|
||||
+&spi0 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-0 = <&spi0_default &spi0_cs_default &display_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+
|
||||
+ cs-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>;
|
||||
+
|
||||
+ /* display@0 {
|
||||
+ compatible = "sitronix,st7735s";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <16000000>;
|
||||
+
|
||||
+ reset-gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
|
||||
+ dc-gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ /*
|
||||
+ * Power supplies from PM8916
|
||||
+ * L17: 2.85V for display VDD
|
||||
+ * L6: 1.8V for display VDDIO
|
||||
+ */
|
||||
+ VDD-supply = <&pm8916_l17>;
|
||||
+ VDDIO-supply = <&pm8916_l6>;
|
||||
+
|
||||
+ backlight = <&backlight>;
|
||||
+ rotation = <0>;
|
||||
+ };*/
|
||||
+
|
||||
+ /*
|
||||
+ * SPIDEV for debugging - uncomment to enable direct SPI access
|
||||
+ * WARNING: Comment out display@0 node above when using spidev
|
||||
+ *
|
||||
+ * Usage:
|
||||
+ * ls /dev/spidev0.0
|
||||
+ * spi-tools test /dev/spidev0.0
|
||||
+ */
|
||||
+
|
||||
+ spidev@0 {
|
||||
+ compatible = "rohm,dh2228fv";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <1000000>;
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
@@ -1,5 +1,18 @@
|
||||
Index: drivers/gpu/drm/tiny/Kconfig
|
||||
===================================================================
|
||||
From: OpenWRT Builder <builder@openwrt.org>
|
||||
Date: Mon, 13 Oct 2025 16:30:00 +0200
|
||||
Subject: [PATCH] drm/tiny: Add Sitronix ST7735S display driver
|
||||
|
||||
Add DRM driver for Sitronix ST7735S display panels with Android
|
||||
MSM8916 initialization sequence.
|
||||
|
||||
Signed-off-by: OpenWRT Builder <builder@openwrt.org>
|
||||
---
|
||||
drivers/gpu/drm/tiny/Kconfig | 14 ++
|
||||
drivers/gpu/drm/tiny/Makefile | 1 +
|
||||
drivers/gpu/drm/tiny/st7735s.c | 351 +++++++++++++++++++++++++++++++++
|
||||
3 files changed, 366 insertions(+)
|
||||
create mode 100644 drivers/gpu/drm/tiny/st7735s.c
|
||||
|
||||
--- a/drivers/gpu/drm/tiny/Kconfig
|
||||
+++ b/drivers/gpu/drm/tiny/Kconfig
|
||||
@@ -213,3 +213,17 @@ config TINYDRM_ST7735R
|
||||
@@ -20,8 +33,6 @@ Index: drivers/gpu/drm/tiny/Kconfig
|
||||
+ * Generic ST7735S 128x128 Color TFT
|
||||
+
|
||||
+ If M is selected the module will be called st7735s.
|
||||
Index: drivers/gpu/drm/tiny/Makefile
|
||||
===================================================================
|
||||
--- a/drivers/gpu/drm/tiny/Makefile
|
||||
+++ b/drivers/gpu/drm/tiny/Makefile
|
||||
@@ -16,3 +16,4 @@ obj-$(CONFIG_TINYDRM_MI0283QT) += mi028
|
||||
@@ -29,16 +40,16 @@ Index: drivers/gpu/drm/tiny/Makefile
|
||||
obj-$(CONFIG_TINYDRM_ST7586) += st7586.o
|
||||
obj-$(CONFIG_TINYDRM_ST7735R) += st7735r.o
|
||||
+obj-$(CONFIG_TINYDRM_ST7735S) += st7735s.o
|
||||
Index: drivers/gpu/drm/tiny/st7735s.c
|
||||
===================================================================
|
||||
--- a/drivers/gpu/drm/tiny/st7735s.c
|
||||
@@ -0,0 +1,308 @@
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/tiny/st7735s.c
|
||||
@@ -0,0 +1,317 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * DRM driver for Sitronix ST7735S display panels
|
||||
+ *
|
||||
+ * Copyright 2025
|
||||
+ * Based on st7735r driver by David Lechner <david@lechnology.com>
|
||||
+ * Android MSM8916 initialization sequence
|
||||
+ */
|
||||
+
|
||||
+#include <linux/backlight.h>
|
||||
@@ -89,6 +100,10 @@ Index: drivers/gpu/drm/tiny/st7735s.c
|
||||
+ const struct st7735s_cfg *cfg;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Android DTS initialization sequence from MSM8916
|
||||
+ * Order is critical - do not modify
|
||||
+ */
|
||||
+static void st7735s_pipe_enable(struct drm_simple_display_pipe *pipe,
|
||||
+ struct drm_crtc_state *crtc_state,
|
||||
+ struct drm_plane_state *plane_state)
|
||||
@@ -98,100 +113,106 @@ Index: drivers/gpu/drm/tiny/st7735s.c
|
||||
+ dbidev);
|
||||
+ struct mipi_dbi *dbi = &dbidev->dbi;
|
||||
+ int ret, idx;
|
||||
+ u8 addr_mode;
|
||||
+
|
||||
+ if (!drm_dev_enter(pipe->crtc.dev, &idx))
|
||||
+ return;
|
||||
+
|
||||
+ DRM_DEBUG_KMS("\n");
|
||||
+ pr_info("st7735s: === BEGIN ANDROID SEQUENCE ===\n");
|
||||
+
|
||||
+ ret = mipi_dbi_poweron_reset(dbidev);
|
||||
+ if (ret)
|
||||
+ if (ret) {
|
||||
+ pr_err("st7735s: poweron_reset failed: %d\n", ret);
|
||||
+ goto out_exit;
|
||||
+ }
|
||||
+
|
||||
+ /* Initialization sequence based on Qualcomm MSM8916 Android DTS */
|
||||
+
|
||||
+ /* Exit sleep mode will be called by poweron_reset */
|
||||
+ /* 1. EXIT_SLEEP_MODE (0x11) - delay 150ms (0x96) */
|
||||
+ pr_info("st7735s: [1/19] EXIT_SLEEP_MODE (0x11)\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE);
|
||||
+ msleep(150);
|
||||
+
|
||||
+ /* Frame rate control - normal mode */
|
||||
+ /* 2. SET_ADDRESS_MODE (0x36) - 0x00 */
|
||||
+ pr_info("st7735s: [2/19] SET_ADDRESS_MODE (0x36) = 0x00\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
|
||||
+
|
||||
+ /* 3. SET_COLUMN_ADDRESS (0x2a) - 0,0,0,131 */
|
||||
+ pr_info("st7735s: [3/19] SET_COLUMN_ADDRESS (0x2a) = 0,0,0,131\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
||||
+ 0x00, 0x00, 0x00, 0x83);
|
||||
+
|
||||
+ /* 4. SET_PAGE_ADDRESS (0x2b) - 0,0,0,131 */
|
||||
+ pr_info("st7735s: [4/19] SET_PAGE_ADDRESS (0x2b) = 0,0,0,131\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
|
||||
+ 0x00, 0x00, 0x00, 0x83);
|
||||
+
|
||||
+ /* 5. SET_PIXEL_FORMAT (0x3a) - 0x05 (16-bit RGB565) */
|
||||
+ pr_info("st7735s: [5/19] SET_PIXEL_FORMAT (0x3a) = 0x05\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, 0x05);
|
||||
+
|
||||
+ /* 6. FRMCTR1 (0xb1) - 0x05,0x3c,0x3c */
|
||||
+ pr_info("st7735s: [6/19] FRMCTR1 (0xb1)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_FRMCTR1, 0x05, 0x3c, 0x3c);
|
||||
+
|
||||
+ /* Frame rate control - idle mode */
|
||||
+ /* 7. FRMCTR2 (0xb2) - 0x05,0x3c,0x3c */
|
||||
+ pr_info("st7735s: [7/19] FRMCTR2 (0xb2)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_FRMCTR2, 0x05, 0x3c, 0x3c);
|
||||
+
|
||||
+ /* Frame rate control - partial mode */
|
||||
+ /* 8. FRMCTR3 (0xb3) - 0x05,0x3c,0x3c,0x05,0x3c,0x3c */
|
||||
+ pr_info("st7735s: [8/19] FRMCTR3 (0xb3)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_FRMCTR3, 0x05, 0x3c, 0x3c,
|
||||
+ 0x05, 0x3c, 0x3c);
|
||||
+
|
||||
+ /* Display inversion control */
|
||||
+ /* 9. INVCTR (0xb4) - 0x03 */
|
||||
+ pr_info("st7735s: [9/19] INVCTR (0xb4) = 0x03\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_INVCTR, 0x03);
|
||||
+
|
||||
+ /* Power control */
|
||||
+ /* 10. PWCTR1 (0xc0) - 0x0e,0x0e,0x04 */
|
||||
+ pr_info("st7735s: [10/19] PWCTR1 (0xc0)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_PWCTR1, 0x0e, 0x0e, 0x04);
|
||||
+
|
||||
+ /* 11. PWCTR2 (0xc1) - 0xc0 */
|
||||
+ pr_info("st7735s: [11/19] PWCTR2 (0xc1) = 0xc0\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_PWCTR2, 0xc0);
|
||||
+
|
||||
+ /* 12. PWCTR3 (0xc2) - 0x0d,0x00 */
|
||||
+ pr_info("st7735s: [12/19] PWCTR3 (0xc2)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_PWCTR3, 0x0d, 0x00);
|
||||
+
|
||||
+ /* 13. PWCTR4 (0xc3) - 0x8d,0x2a */
|
||||
+ pr_info("st7735s: [13/19] PWCTR4 (0xc3)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_PWCTR4, 0x8d, 0x2a);
|
||||
+
|
||||
+ /* 14. PWCTR5 (0xc4) - 0x8d,0xee */
|
||||
+ pr_info("st7735s: [14/19] PWCTR5 (0xc4)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_PWCTR5, 0x8d, 0xee);
|
||||
+
|
||||
+ /* VCOM control */
|
||||
+ /* 15. VMCTR1 (0xc5) - 0x0c */
|
||||
+ pr_info("st7735s: [15/19] VMCTR1 (0xc5) = 0x0c\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_VMCTR1, 0x0c);
|
||||
+
|
||||
+ /* Memory access control */
|
||||
+ switch (dbidev->rotation) {
|
||||
+ default:
|
||||
+ addr_mode = ST7735S_MX | ST7735S_MY;
|
||||
+ break;
|
||||
+ case 90:
|
||||
+ addr_mode = ST7735S_MX | ST7735S_MV;
|
||||
+ break;
|
||||
+ case 180:
|
||||
+ addr_mode = 0;
|
||||
+ break;
|
||||
+ case 270:
|
||||
+ addr_mode = ST7735S_MY | ST7735S_MV;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->cfg->rgb)
|
||||
+ addr_mode |= ST7735S_RGB;
|
||||
+
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
|
||||
+
|
||||
+ /* Pixel format: 16-bit color (RGB565) */
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT,
|
||||
+ MIPI_DCS_PIXEL_FMT_16BIT);
|
||||
+
|
||||
+ /* Positive gamma correction */
|
||||
+ /* 16. GAMCTRP1 (0xe0) - Positive Gamma */
|
||||
+ pr_info("st7735s: [16/19] GAMCTRP1 (0xe0)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_GAMCTRP1,
|
||||
+ 0x0c, 0x1c, 0x0f, 0x18, 0x36, 0x2f, 0x27, 0x2a,
|
||||
+ 0x27, 0x25, 0x2d, 0x3c, 0x00, 0x05, 0x03, 0x10);
|
||||
+
|
||||
+ /* Negative gamma correction */
|
||||
+ /* 17. GAMCTRN1 (0xe1) - Negative Gamma */
|
||||
+ pr_info("st7735s: [17/19] GAMCTRN1 (0xe1)\n");
|
||||
+ mipi_dbi_command(dbi, ST7735S_GAMCTRN1,
|
||||
+ 0x0c, 0x1a, 0x09, 0x09, 0x26, 0x22, 0x1e, 0x25,
|
||||
+ 0x25, 0x25, 0x2e, 0x3b, 0x00, 0x05, 0x03, 0x10);
|
||||
+
|
||||
+ /* Display inversion ON */
|
||||
+ /* 18. ENTER_INVERT_MODE (0x21) */
|
||||
+ pr_info("st7735s: [18/19] ENTER_INVERT_MODE (0x21)\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_ENTER_INVERT_MODE);
|
||||
+
|
||||
+ /* Column address set: 0-131 (132 pixels physical) */
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
|
||||
+ 0x00, 0x00, 0x00, 0x83);
|
||||
+
|
||||
+ /* Page address set: 0-131 (132 pixels physical) */
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
|
||||
+ 0x00, 0x00, 0x00, 0x83);
|
||||
+
|
||||
+ /* Exit sleep mode */
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE);
|
||||
+ msleep(120);
|
||||
+
|
||||
+ /* Display on */
|
||||
+ /* 19. SET_DISPLAY_ON (0x29) - delay 120ms (0x78) */
|
||||
+ pr_info("st7735s: [19/19] SET_DISPLAY_ON (0x29)\n");
|
||||
+ mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON);
|
||||
+ msleep(120);
|
||||
+
|
||||
+ pr_info("st7735s: === SEQUENCE COMPLETE, calling flush ===\n");
|
||||
+ mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
|
||||
+ pr_info("st7735s: === FLUSH DONE ===\n");
|
||||
+
|
||||
+out_exit:
|
||||
+ drm_dev_exit(idx);
|
||||
@@ -203,16 +224,14 @@ Index: drivers/gpu/drm/tiny/st7735s.c
|
||||
+
|
||||
+/*
|
||||
+ * Configuration for 128x128 visible area on 132x132 physical panel
|
||||
+ * Offsets calculated to center the visible area:
|
||||
+ * left_offset = (132 - 128) / 2 = 2
|
||||
+ * top_offset = 1 (fine-tuned for alignment)
|
||||
+ * Offsets calculated to center the visible area
|
||||
+ */
|
||||
+static const struct st7735s_cfg st7735s_128x128_cfg = {
|
||||
+ .mode = { DRM_SIMPLE_MODE(128, 128, 22, 22) },
|
||||
+ .left_offset = 2,
|
||||
+ .top_offset = 1,
|
||||
+ .write_only = false,
|
||||
+ .rgb = false, /* BGR order by default */
|
||||
+ .rgb = false,
|
||||
+};
|
||||
+
|
||||
+DEFINE_DRM_GEM_DMA_FOPS(st7735s_fops);
|
||||
|
||||
Reference in new issue
Block a user