Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support
@ 2019-05-31  9:46 Brian Masney
  2019-05-31  9:46 ` [PATCH v3 1/6] drm/msm: add dirty framebuffer helper Brian Masney
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

This patch series adds working display support to the LG Nexus 5
(hammerhead) phone.

Changes since v2:
- Dropped two drm/msm bug fix patches that have been merged separately.
- New patch: 'add support for per-CRTC max_vblank_count on mdp5'.
  Special thanks to Jeffrey Hugo for helping to track down this issue.
- Add panel_pin to msm8974-hammerhead device tree. Dropped Linus
  Walleij's reviewed-by on this patch due to this change.

Changes since v1:
- Shortened problem description above. I'll reply to this email and send
  a full dmesg with the boot log with debugging turned on.
- Dropped patch 'fix null pointer dereference in
  msm_atomic_prepare_fb()'
- New patch: Remove resv fields from msm_gem_object struct that was
  incorrectly being referenced by the prepare_fb callbacks.
- Add drm_plane_enable_fb_damage_clips() to plane init for mdp4, mdp5,
  and dpu1.
- Add Linus Walleij's reviewed-by to patches 3-6

My status page at https://masneyb.github.io/nexus-5-upstream/
describes what is working so far with the upstream kernel on the Nexus
5.

Brian Masney (6):
  drm/msm: add dirty framebuffer helper
  drm/msm: add support for per-CRTC max_vblank_count on mdp5
  ARM: qcom_defconfig: add display-related options
  ARM: dts: qcom: msm8974-hammerhead: add support for backlight
  ARM: dts: msm8974: add display support
  ARM: dts: qcom: msm8974-hammerhead: add support for display

 .../qcom-msm8974-lge-nexus5-hammerhead.dts    |  92 ++++++++++++
 arch/arm/boot/dts/qcom-msm8974.dtsi           | 132 ++++++++++++++++++
 arch/arm/configs/qcom_defconfig               |   5 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     |   3 +
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c    |   3 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c     |  16 ++-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c      |   2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c    |   3 +
 drivers/gpu/drm/msm/msm_fb.c                  |   2 +
 9 files changed, 256 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/6] drm/msm: add dirty framebuffer helper
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-05-31  9:46 ` [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5 Brian Masney
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

Use drm_atomic_helper_dirtyfb() as the dirty callback in the
msm_framebuffer_funcs struct. Call drm_plane_enable_fb_damage_clips()
when the planes are initialized in mdp4, mdp5, and dpu1.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  | 3 +++
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 3 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +++
 drivers/gpu/drm/msm/msm_fb.c               | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index d831cedb55ec..2ea42f50401f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -21,6 +21,7 @@
 #include <linux/debugfs.h>
 #include <linux/dma-buf.h>
 
+#include <drm/drm_damage_helper.h>
 #include <drm/drm_atomic_uapi.h>
 
 #include "msm_drv.h"
@@ -1535,6 +1536,8 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
 	if (ret)
 		DPU_ERROR("failed to install zpos property, rc = %d\n", ret);
 
+	drm_plane_enable_fb_damage_clips(plane);
+
 	/* success! finalize initialization */
 	drm_plane_helper_add(plane, &dpu_plane_helper_funcs);
 
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
index 005066f7154d..2d46d1126283 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
@@ -15,6 +15,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <drm/drm_damage_helper.h>
 #include "mdp4_kms.h"
 
 #define DOWN_SCALE_MAX	8
@@ -391,6 +392,8 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
 
 	mdp4_plane_install_properties(plane, &plane->base);
 
+	drm_plane_enable_fb_damage_clips(plane);
+
 	return plane;
 
 fail:
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
index 9d9fb6c5fd68..9a9ae44655b4 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
@@ -16,6 +16,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <drm/drm_damage_helper.h>
 #include <drm/drm_print.h>
 #include "mdp5_kms.h"
 
@@ -1095,6 +1096,8 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
 
 	mdp5_plane_install_properties(plane, &plane->base);
 
+	drm_plane_enable_fb_damage_clips(plane);
+
 	return plane;
 
 fail:
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 68fa2c8f61e6..a816ceb58716 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -16,6 +16,7 @@
  */
 
 #include <drm/drm_crtc.h>
+#include <drm/drm_damage_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_probe_helper.h>
 
@@ -35,6 +36,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
 static const struct drm_framebuffer_funcs msm_framebuffer_funcs = {
 	.create_handle = drm_gem_fb_create_handle,
 	.destroy = drm_gem_fb_destroy,
+	.dirty = drm_atomic_helper_dirtyfb,
 };
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
  2019-05-31  9:46 ` [PATCH v3 1/6] drm/msm: add dirty framebuffer helper Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-06-03 14:54   ` Jeffrey Hugo
  2019-05-31  9:46 ` [PATCH v3 3/6] ARM: qcom_defconfig: add display-related options Brian Masney
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

The mdp5 drm/kms driver currently does not work on command-mode DSI
panels due to 'vblank wait timed out' errors. This causes a latency
of seconds, or tens of seconds in some cases, before content is shown
on the panel. This hardware does not have the something that we can use
as a frame counter available when running in command mode, so we need to
fall back to using timestamps by setting the max_vblank_count to zero.
This can be done on a per-CRTC basis, so the convert mdp5 to use
drm_crtc_set_max_vblank_count().

This change was tested on a LG Nexus 5 (hammerhead) phone.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Suggested-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 +++++++++++++++-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index c3751c95b452..6fde1097844f 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -450,6 +450,18 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
 	mdp5_crtc->enabled = false;
 }
 
+static void mdp5_crtc_vblank_on(struct drm_crtc *crtc)
+{
+	struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
+	struct mdp5_interface *intf = mdp5_cstate->pipeline.intf;
+	u32 count;
+
+	count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff;
+	drm_crtc_set_max_vblank_count(crtc, count);
+
+	drm_crtc_vblank_on(crtc);
+}
+
 static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
 				    struct drm_crtc_state *old_state)
 {
@@ -486,7 +498,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
 	}
 
 	/* Restore vblank irq handling after power is enabled */
-	drm_crtc_vblank_on(crtc);
+	mdp5_crtc_vblank_on(crtc);
 
 	mdp5_crtc_mode_set_nofb(crtc);
 
@@ -1039,6 +1051,8 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc)
 		mdp5_crtc_destroy_state(crtc, crtc->state);
 
 	__drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
+
+	drm_crtc_vblank_reset(crtc);
 }
 
 static const struct drm_crtc_funcs mdp5_crtc_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 97179bec8902..fcb0b0455abe 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -750,7 +750,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
 	dev->driver->get_scanout_position = mdp5_get_scanoutpos;
 	dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
-	dev->max_vblank_count = 0xffffffff;
+	dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
 	dev->vblank_disable_immediate = true;
 
 	return kms;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 3/6] ARM: qcom_defconfig: add display-related options
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
  2019-05-31  9:46 ` [PATCH v3 1/6] drm/msm: add dirty framebuffer helper Brian Masney
  2019-05-31  9:46 ` [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5 Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-05-31  9:46 ` [PATCH v3 4/6] ARM: dts: qcom: msm8974-hammerhead: add support for backlight Brian Masney
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

Add the CMA (Contiguous Memory Allocator) for the MSM DRM/KMS driver,
the simple panel, and the TI LM3630A driver in order to support the
display on the LG Nexus 5 (hammerhead) phone.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/configs/qcom_defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig
index c1854751c99a..4f02636f832e 100644
--- a/arch/arm/configs/qcom_defconfig
+++ b/arch/arm/configs/qcom_defconfig
@@ -37,6 +37,7 @@ CONFIG_ARM_CPUIDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_CMA=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -146,12 +147,14 @@ CONFIG_REGULATOR_QCOM_SMD_RPM=y
 CONFIG_REGULATOR_QCOM_SPMI=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_DRM=y
+CONFIG_DRM_PANEL_SIMPLE=y
 CONFIG_FB=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 # CONFIG_LCD_CLASS_DEVICE is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
 # CONFIG_BACKLIGHT_GENERIC is not set
+CONFIG_BACKLIGHT_LM3630A=y
 CONFIG_BACKLIGHT_LP855X=y
 CONFIG_SOUND=y
 CONFIG_SND=y
@@ -262,6 +265,8 @@ CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
+CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=256
 CONFIG_PRINTK_TIME=y
 CONFIG_DYNAMIC_DEBUG=y
 CONFIG_DEBUG_INFO=y
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 4/6] ARM: dts: qcom: msm8974-hammerhead: add support for backlight
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
                   ` (2 preceding siblings ...)
  2019-05-31  9:46 ` [PATCH v3 3/6] ARM: qcom_defconfig: add display-related options Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-05-31  9:46 ` [PATCH v3 5/6] ARM: dts: msm8974: add display support Brian Masney
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

Add necessary device tree nodes for the main LCD backlight.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
index 1fd9f429f34a..51889d66b55a 100644
--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
+++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
@@ -290,6 +290,16 @@
 			};
 		};
 
+		i2c11_pins: i2c11 {
+			mux {
+				pins = "gpio83", "gpio84";
+				function = "blsp_i2c11";
+
+				drive-strength = <2>;
+				bias-disable;
+			};
+		};
+
 		i2c12_pins: i2c12 {
 			mux {
 				pins = "gpio87", "gpio88";
@@ -400,6 +410,30 @@
 		};
 	};
 
+	i2c@f9967000 {
+		status = "ok";
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c11_pins>;
+		clock-frequency = <355000>;
+		qcom,src-freq = <50000000>;
+
+		led-controller@38 {
+			compatible = "ti,lm3630a";
+			status = "ok";
+			reg = <0x38>;
+
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				reg = <0>;
+				led-sources = <0 1>;
+				label = "lcd-backlight";
+				default-brightness = <200>;
+			};
+		};
+	};
+
 	i2c@f9968000 {
 		status = "ok";
 		pinctrl-names = "default";
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 5/6] ARM: dts: msm8974: add display support
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
                   ` (3 preceding siblings ...)
  2019-05-31  9:46 ` [PATCH v3 4/6] ARM: dts: qcom: msm8974-hammerhead: add support for backlight Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-05-31  9:46 ` [PATCH v3 6/6] ARM: dts: qcom: msm8974-hammerhead: add support for display Brian Masney
  2019-06-16 18:42 ` [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Bjorn Andersson
  6 siblings, 0 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

Add the MDP5, DSI and DSI PHY blocks for the display found on the
msm8974 SoCs. This is based on work from msm8916.dtsi and Jonathan
Marek.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/qcom-msm8974.dtsi | 132 ++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 45b5c8ef0374..3f613c5b95a1 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -3,6 +3,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/qcom,gcc-msm8974.h>
+#include <dt-bindings/clock/qcom,mmcc-msm8974.h>
 #include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/reset/qcom,gcc-msm8974.h>
 #include <dt-bindings/gpio/gpio.h>
@@ -1085,6 +1086,137 @@
 				};
 			};
 		};
+
+		mdss: mdss@fd900000 {
+			status = "disabled";
+
+			compatible = "qcom,mdss";
+			reg = <0xfd900000 0x100>,
+			      <0xfd924000 0x1000>;
+			reg-names = "mdss_phys",
+			            "vbif_phys";
+
+			power-domains = <&mmcc MDSS_GDSC>;
+
+			clocks = <&mmcc MDSS_AHB_CLK>,
+			         <&mmcc MDSS_AXI_CLK>,
+			         <&mmcc MDSS_VSYNC_CLK>;
+			clock-names = "iface",
+			              "bus",
+			              "vsync";
+
+			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+
+			interrupt-controller;
+			#interrupt-cells = <1>;
+
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			mdp: mdp@fd900000 {
+				status = "disabled";
+
+				compatible = "qcom,mdp5";
+				reg = <0xfd900100 0x22000>;
+				reg-names = "mdp_phys";
+
+				interrupt-parent = <&mdss>;
+				interrupts = <0 0>;
+
+				clocks = <&mmcc MDSS_AHB_CLK>,
+					 <&mmcc MDSS_AXI_CLK>,
+					 <&mmcc MDSS_MDP_CLK>,
+					 <&mmcc MDSS_VSYNC_CLK>;
+				clock-names = "iface",
+				              "bus",
+				              "core",
+				              "vsync";
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+						mdp5_intf1_out: endpoint {
+							remote-endpoint = <&dsi0_in>;
+						};
+					};
+				};
+			};
+
+			dsi0: dsi@fd922800 {
+				status = "disabled";
+
+				compatible = "qcom,mdss-dsi-ctrl";
+				reg = <0xfd922800 0x1f8>;
+				reg-names = "dsi_ctrl";
+
+				interrupt-parent = <&mdss>;
+				interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
+
+				assigned-clocks = <&mmcc BYTE0_CLK_SRC>,
+				                  <&mmcc PCLK0_CLK_SRC>;
+				assigned-clock-parents = <&dsi_phy0 0>,
+				                         <&dsi_phy0 1>;
+
+				clocks = <&mmcc MDSS_MDP_CLK>,
+				         <&mmcc MDSS_AHB_CLK>,
+				         <&mmcc MDSS_AXI_CLK>,
+				         <&mmcc MDSS_BYTE0_CLK>,
+				         <&mmcc MDSS_PCLK0_CLK>,
+				         <&mmcc MDSS_ESC0_CLK>,
+				         <&mmcc MMSS_MISC_AHB_CLK>;
+				clock-names = "mdp_core",
+				              "iface",
+				              "bus",
+				              "byte",
+				              "pixel",
+				              "core",
+				              "core_mmss";
+
+				phys = <&dsi_phy0>;
+				phy-names = "dsi-phy";
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+						dsi0_in: endpoint {
+							remote-endpoint = <&mdp5_intf1_out>;
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						dsi0_out: endpoint {
+						};
+					};
+				};
+			};
+
+			dsi_phy0: dsi-phy@fd922a00 {
+				status = "disabled";
+
+				compatible = "qcom,dsi-phy-28nm-hpm";
+				reg = <0xfd922a00 0xd4>,
+				      <0xfd922b00 0x280>,
+				      <0xfd922d80 0x30>;
+				reg-names = "dsi_pll",
+				            "dsi_phy",
+				            "dsi_phy_regulator";
+
+				#clock-cells = <1>;
+				#phy-cells = <0>;
+				qcom,dsi-phy-index = <0>;
+
+				clocks = <&mmcc MDSS_AHB_CLK>;
+				clock-names = "iface";
+			};
+		};
 	};
 
 	smd {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 6/6] ARM: dts: qcom: msm8974-hammerhead: add support for display
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
                   ` (4 preceding siblings ...)
  2019-05-31  9:46 ` [PATCH v3 5/6] ARM: dts: msm8974: add display support Brian Masney
@ 2019-05-31  9:46 ` Brian Masney
  2019-06-16 18:42 ` [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Bjorn Andersson
  6 siblings, 0 replies; 9+ messages in thread
From: Brian Masney @ 2019-05-31  9:46 UTC (permalink / raw)
  To: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

Add initial support for the display found on the LG Nexus 5 (hammerhead)
phone. This is based on work from Jonathan Marek.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
index 51889d66b55a..4776f01f492c 100644
--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
+++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
@@ -332,6 +332,16 @@
 				function = "gpio";
 			};
 		};
+
+		panel_pin: panel {
+			te {
+				pins = "gpio12";
+				function = "mdp_vsync";
+
+				drive-strength = <2>;
+				bias-disable;
+			};
+		};
 	};
 
 	vibrator@fd8c3450 {
@@ -531,6 +541,54 @@
 			};
 		};
 	};
+
+	mdss@fd900000 {
+		status = "ok";
+
+		mdp@fd900000 {
+			status = "ok";
+		};
+
+		dsi@fd922800 {
+			status = "ok";
+
+			vdda-supply = <&pm8941_l2>;
+			vdd-supply = <&pm8941_lvs3>;
+			vddio-supply = <&pm8941_l12>;
+
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			ports {
+				port@1 {
+					endpoint {
+						remote-endpoint = <&panel_in>;
+						data-lanes = <0 1 2 3>;
+					};
+				};
+			};
+
+			panel: panel@0 {
+				reg = <0>;
+				compatible = "lg,acx467akm-7";
+
+				pinctrl-names = "default";
+				pinctrl-0 = <&panel_pin>;
+
+				port {
+					panel_in: endpoint {
+						remote-endpoint = <&dsi0_out>;
+					};
+				};
+			};
+		};
+
+		dsi-phy@fd922a00 {
+			status = "ok";
+
+			vddio-supply = <&pm8941_l12>;
+		};
+	};
 };
 
 &spmi_bus {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5
  2019-05-31  9:46 ` [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5 Brian Masney
@ 2019-06-03 14:54   ` Jeffrey Hugo
  0 siblings, 0 replies; 9+ messages in thread
From: Jeffrey Hugo @ 2019-06-03 14:54 UTC (permalink / raw)
  To: Brian Masney
  Cc: Rob Clark, Sean Paul, open list:DRM PANEL DRIVERS, MSM,
	freedreno, Dave Airlie, Daniel Vetter, lkml, Linus Walleij,
	Jonathan Marek, Rob Herring

On Fri, May 31, 2019 at 3:46 AM Brian Masney <masneyb@onstation.org> wrote:
>
> The mdp5 drm/kms driver currently does not work on command-mode DSI
> panels due to 'vblank wait timed out' errors. This causes a latency
> of seconds, or tens of seconds in some cases, before content is shown
> on the panel. This hardware does not have the something that we can use
> as a frame counter available when running in command mode, so we need to
> fall back to using timestamps by setting the max_vblank_count to zero.
> This can be done on a per-CRTC basis, so the convert mdp5 to use
> drm_crtc_set_max_vblank_count().
>
> This change was tested on a LG Nexus 5 (hammerhead) phone.
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> Suggested-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>

Reviewed-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>

> ---
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 +++++++++++++++-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c  |  2 +-
>  2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> index c3751c95b452..6fde1097844f 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> @@ -450,6 +450,18 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
>         mdp5_crtc->enabled = false;
>  }
>
> +static void mdp5_crtc_vblank_on(struct drm_crtc *crtc)
> +{
> +       struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
> +       struct mdp5_interface *intf = mdp5_cstate->pipeline.intf;
> +       u32 count;
> +
> +       count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff;
> +       drm_crtc_set_max_vblank_count(crtc, count);
> +
> +       drm_crtc_vblank_on(crtc);
> +}
> +
>  static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
>                                     struct drm_crtc_state *old_state)
>  {
> @@ -486,7 +498,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
>         }
>
>         /* Restore vblank irq handling after power is enabled */
> -       drm_crtc_vblank_on(crtc);
> +       mdp5_crtc_vblank_on(crtc);
>
>         mdp5_crtc_mode_set_nofb(crtc);
>
> @@ -1039,6 +1051,8 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc)
>                 mdp5_crtc_destroy_state(crtc, crtc->state);
>
>         __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
> +
> +       drm_crtc_vblank_reset(crtc);
>  }
>
>  static const struct drm_crtc_funcs mdp5_crtc_funcs = {
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index 97179bec8902..fcb0b0455abe 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -750,7 +750,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
>         dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
>         dev->driver->get_scanout_position = mdp5_get_scanoutpos;
>         dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
> -       dev->max_vblank_count = 0xffffffff;
> +       dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
>         dev->vblank_disable_immediate = true;
>
>         return kms;
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support
  2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
                   ` (5 preceding siblings ...)
  2019-05-31  9:46 ` [PATCH v3 6/6] ARM: dts: qcom: msm8974-hammerhead: add support for display Brian Masney
@ 2019-06-16 18:42 ` Bjorn Andersson
  6 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2019-06-16 18:42 UTC (permalink / raw)
  To: Brian Masney
  Cc: robdclark, sean, dri-devel, linux-arm-msm, freedreno, airlied,
	daniel, linux-kernel, linus.walleij, jonathan, robh,
	jeffrey.l.hugo

On Fri 31 May 02:46 PDT 2019, Brian Masney wrote:

> This patch series adds working display support to the LG Nexus 5
> (hammerhead) phone.
> 
> Changes since v2:
> - Dropped two drm/msm bug fix patches that have been merged separately.
> - New patch: 'add support for per-CRTC max_vblank_count on mdp5'.
>   Special thanks to Jeffrey Hugo for helping to track down this issue.
> - Add panel_pin to msm8974-hammerhead device tree. Dropped Linus
>   Walleij's reviewed-by on this patch due to this change.
> 
> Changes since v1:
> - Shortened problem description above. I'll reply to this email and send
>   a full dmesg with the boot log with debugging turned on.
> - Dropped patch 'fix null pointer dereference in
>   msm_atomic_prepare_fb()'
> - New patch: Remove resv fields from msm_gem_object struct that was
>   incorrectly being referenced by the prepare_fb callbacks.
> - Add drm_plane_enable_fb_damage_clips() to plane init for mdp4, mdp5,
>   and dpu1.
> - Add Linus Walleij's reviewed-by to patches 3-6
> 
> My status page at https://masneyb.github.io/nexus-5-upstream/
> describes what is working so far with the upstream kernel on the Nexus
> 5.
> 

Assuming that patches 1 and 2 won't affect the dts and applied patches 3
through 6 for v5.3.

Regards,
Bjorn

> Brian Masney (6):
>   drm/msm: add dirty framebuffer helper
>   drm/msm: add support for per-CRTC max_vblank_count on mdp5
>   ARM: qcom_defconfig: add display-related options
>   ARM: dts: qcom: msm8974-hammerhead: add support for backlight
>   ARM: dts: msm8974: add display support
>   ARM: dts: qcom: msm8974-hammerhead: add support for display
> 
>  .../qcom-msm8974-lge-nexus5-hammerhead.dts    |  92 ++++++++++++
>  arch/arm/boot/dts/qcom-msm8974.dtsi           | 132 ++++++++++++++++++
>  arch/arm/configs/qcom_defconfig               |   5 +
>  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c     |   3 +
>  drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c    |   3 +
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c     |  16 ++-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c      |   2 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c    |   3 +
>  drivers/gpu/drm/msm/msm_fb.c                  |   2 +
>  9 files changed, 256 insertions(+), 2 deletions(-)
> 
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  9:46 [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Brian Masney
2019-05-31  9:46 ` [PATCH v3 1/6] drm/msm: add dirty framebuffer helper Brian Masney
2019-05-31  9:46 ` [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5 Brian Masney
2019-06-03 14:54   ` Jeffrey Hugo
2019-05-31  9:46 ` [PATCH v3 3/6] ARM: qcom_defconfig: add display-related options Brian Masney
2019-05-31  9:46 ` [PATCH v3 4/6] ARM: dts: qcom: msm8974-hammerhead: add support for backlight Brian Masney
2019-05-31  9:46 ` [PATCH v3 5/6] ARM: dts: msm8974: add display support Brian Masney
2019-05-31  9:46 ` [PATCH v3 6/6] ARM: dts: qcom: msm8974-hammerhead: add support for display Brian Masney
2019-06-16 18:42 ` [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support Bjorn Andersson

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org linux-arm-msm@archiver.kernel.org
	public-inbox-index linux-arm-msm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox