From 0394419db583f485a0e6b9ddcfcb296de948b810 Mon Sep 17 00:00:00 2001 From: azkali Date: Mon, 28 Aug 2023 13:25:09 +0200 Subject: [PATCH] panel: dsi-nx: Add dsi-nx panel driver dsi-nx is a new blanket driver for panels on the Nintendo Switch. The Switch boots Linux via the "hekate" custom bootloader, which performs panel initialization and passes panel info to kernel. This driver is based on panel-jdi-lpm062m326a by SwitchR. --- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-nx-dsi.c | 767 +++++++++++++++++++++++++++ 3 files changed, 777 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-nx-dsi.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index fff7535d186a..c95a92f1a1e2 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -282,6 +282,15 @@ config DRM_PANEL_JDI_LPM102A188A The panel has a 2560×1800 resolution. It provides a MIPI DSI interface to the host. +config DRM_PANEL_NX_DSI + tristate "Nintendo Switch 720x1280 DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for the DSI panels + used in the Nintendo Switch. + config DRM_PANEL_JDI_LT070ME05000 tristate "JDI LT070ME05000 WUXGA DSI panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 495873236f81..a2446f511910 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o +obj-$(CONFIG_DRM_PANEL_NX_DSI) += panel-nx-dsi.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o obj-$(CONFIG_DRM_PANEL_ORISETECH_OTA5601A) += panel-orisetech-ota5601a.o diff --git a/drivers/gpu/drm/panel/panel-nx-dsi.c b/drivers/gpu/drm/panel/panel-nx-dsi.c new file mode 100644 index 000000000000..4d6cdf8d4e0a --- /dev/null +++ b/drivers/gpu/drm/panel/panel-nx-dsi.c @@ -0,0 +1,767 @@ +/* + * Copyright (C) 2018 SwtcR + * Copyright (C) 2023-2024 Azkali + * + * Based on Sharp ls043t1le01 panel driver by Werner Johansson + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include + +#include