From 7f50914afc23cdede235e9cc47ea82ced257a6a7 Mon Sep 17 00:00:00 2001 From: Evoke Zhang Date: Tue, 16 Jan 2018 18:42:47 +0800 Subject: [PATCH] drm: add drm driver lcd support PD#160546: add drm driver lcd support Change-Id: I3b5fa4c10b4ac542ccdfa8691e692e849f071145 Signed-off-by: Evoke Zhang --- MAINTAINERS | 5 + .../dts/amlogic/gxl_p212_1g_buildroot.dts | 1 + .../dts/amlogic/gxl_p212_2g_buildroot.dts | 1 + .../boot/dts/amlogic/mesongxl_p212-panel.dtsi | 71 ++ .../boot/dts/amlogic/mesongxm_q200-panel.dtsi | 3 +- drivers/amlogic/drm/Kconfig | 13 + drivers/amlogic/drm/Makefile | 4 + drivers/amlogic/drm/am_meson_lcd.c | 670 ++++++++++++++++++ drivers/amlogic/drm/am_meson_lcd.h | 27 + drivers/amlogic/drm/meson_drv.c | 4 + drivers/amlogic/media/vout/lcd/lcd_vout.c | 2 +- .../linux/amlogic/media/vout/lcd/lcd_notify.h | 1 + 12 files changed, 800 insertions(+), 2 deletions(-) create mode 100644 arch/arm64/boot/dts/amlogic/mesongxl_p212-panel.dtsi create mode 100644 drivers/amlogic/drm/am_meson_lcd.c create mode 100644 drivers/amlogic/drm/am_meson_lcd.h diff --git a/MAINTAINERS b/MAINTAINERS index 4fe68662429f..630133073ea0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14274,6 +14274,11 @@ AMLOGIC ADD LCD_EXTERN P070ACB DRIVER M: Weiming Liu F: drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c +AMLOGIC DRM LCD DRIVER +M: evoke.zhang +F: drivers/amlogic/drm/am_meson_lcd.c +F: drivers/amlogic/drm/am_meson_lcd.h + AMLOGIC ADD SOUND EXTERNAL LOOPBACK FEATURE M: Peipeng Zhao F: Documentation/devicetree/bindings/amlogic/axg-sound-loopback.txt diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts index b167eac7493d..08ee87e3c902 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g_buildroot.dts @@ -19,6 +19,7 @@ #include "mesongxl.dtsi" #include "meson_drm.dtsi" +#include "mesongxl_p212-panel.dtsi" / { model = "Amlogic"; amlogic-dt-id = "gxl_p212_1g"; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts index 5df91ce2c4f7..a044e01fb1ad 100644 --- a/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g_buildroot.dts @@ -20,6 +20,7 @@ #include #include "mesongxl.dtsi" #include "meson_drm.dtsi" +#include "mesongxl_p212-panel.dtsi" / { model = "Amlogic"; amlogic-dt-id = "gxl_p212_2g"; diff --git a/arch/arm64/boot/dts/amlogic/mesongxl_p212-panel.dtsi b/arch/arm64/boot/dts/amlogic/mesongxl_p212-panel.dtsi new file mode 100644 index 000000000000..0d125f4f0bbf --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/mesongxl_p212-panel.dtsi @@ -0,0 +1,71 @@ +/* + * arch/arm64/boot/dts/amlogic/mesongxl_p212-panel.dtsi + * + * Copyright (C) 2016 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + */ + +/ { + lcd{ + compatible = "amlogic, lcd-gxl"; + dev_name = "lcd"; + mode = "tablet"; + status = "okay"; + key_valid = <0>; + /* clocks = <&clkc CLKID_VCLK2_ENCL + * &clkc CLKID_VCLK2_VENCL>; + * clock-names = "vencl_top_gate", + * "vencl_int_gate"; + */ + reg = <0x0 0xc8834400 0x0 0x100>; + pinctrl_version = <1>; /* for uboot */ + + /* power type: + * (0=cpu_gpio, 1=pmu_gpio, 2=signal,3=extern, 0xff=ending) + * power index: + * (point gpios_index, or extern_index,0xff=invalid) + * power value:(0=output low, 1=output high, 2=input) + * power delay:(unit in ms) + */ + /*lcd_cpu-gpios = <&gpio GPIOX_3 1>;*/ + /*lcd_cpu_gpio_names = "GPIOX_3";*/ + + lcd_0{ + model_name = "LCD720P"; + interface = "ttl"; + basic_setting = <1280 720 /*h_active, v_active*/ + 1650 750 /*h_period, v_period*/ + 8 /*lcd_bits */ + 16 9>; /*screen_widht, screen_height*/ + lcd_timing = <40 220 1 /*hs_width, hs_bp, hs_pol*/ + 5 20 1>; /*vs_width, vs_bp, vs_pol*/ + clk_attr = <0 /*fr_adj_type(0=clk, 1=htotal, 2=vtotal)*/ + 0 /*clk_ss_level*/ + 1 /*clk_auto_generate*/ + 74250000>; /*pixel_clk(unit in Hz)*/ + ttl_attr = <0 /*clk_pol*/ + 1 /*de_valid*/ + 1 /*hvsync_valid*/ + 0 /*rb_swap*/ + 0>; /*bit_swap*/ + + /* power step: type, index, value, delay(ms) */ + power_on_step = <2 0 0 0 + 0xff 0 0 0>; /*ending*/ + power_off_step = <2 0 0 50 + 0xff 0 0 0>; /*ending*/ + backlight_index = <0xff>; + }; + }; +};/* end of panel */ + diff --git a/arch/arm64/boot/dts/amlogic/mesongxm_q200-panel.dtsi b/arch/arm64/boot/dts/amlogic/mesongxm_q200-panel.dtsi index 509271548fad..a2adb8921711 100644 --- a/arch/arm64/boot/dts/amlogic/mesongxm_q200-panel.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesongxm_q200-panel.dtsi @@ -17,7 +17,7 @@ / { lcd{ - compatible = "amlogic, lcd"; + compatible = "amlogic, lcd-gxm"; dev_name = "lcd"; mode = "tablet"; status = "okay"; @@ -27,6 +27,7 @@ * clock-names = "vencl_top_gate", * "vencl_int_gate"; */ + reg = <0x0 0xc8834400 0x0 0x100>; pinctrl_version = <1>; /* for uboot */ pinctrl-names = "ttl_6bit_hvsync_de_on","ttl_6bit_hvsync_on", "ttl_6bit_de_on","ttl_8bit_hvsync_de_on", diff --git a/drivers/amlogic/drm/Kconfig b/drivers/amlogic/drm/Kconfig index 2a2a7d8e360c..f265305d3f11 100644 --- a/drivers/amlogic/drm/Kconfig +++ b/drivers/amlogic/drm/Kconfig @@ -17,6 +17,19 @@ config DRM_MESON_BYPASS_MODE We add bypass mode to implment drm based on amlogic existing driver, it should be easier and more robust. +config DRM_MESON_PANEL + bool "support drm panel function for meson drm display." + default y + depends on DRM_MESON + depends on AMLOGIC_LCD + select DRM_PANEL + select DRM_MIPI_DSI + help + add drm panel support. + use internal amlogic media vout lcd driver. + We should confirm AMLOGIC_LCD is configured if + DRM_MESON_PANEL is selected. + config DRM_MESON_USE_ION bool "gem use ion to alloc/free graphic buffer." default y diff --git a/drivers/amlogic/drm/Makefile b/drivers/amlogic/drm/Makefile index 658f28428804..15f5dea10caa 100644 --- a/drivers/amlogic/drm/Makefile +++ b/drivers/amlogic/drm/Makefile @@ -16,4 +16,8 @@ ifeq ($(CONFIG_DRM_MESON_EMULATE_FBDEV),y) meson-y += am_meson_fbdev.o endif +ifeq ($(CONFIG_DRM_MESON_PANEL),y) + meson-y += am_meson_lcd.o +endif + obj-$(CONFIG_DRM_MESON) += meson.o diff --git a/drivers/amlogic/drm/am_meson_lcd.c b/drivers/amlogic/drm/am_meson_lcd.c new file mode 100644 index 000000000000..88b35c00ca5c --- /dev/null +++ b/drivers/amlogic/drm/am_meson_lcd.c @@ -0,0 +1,670 @@ +/* + * drivers/amlogic/drm/am_meson_lcd.c + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include