ARM: qcom: working Nexus 5 display support
Subsystems (6)
v3 cover ARM: qcom: working Nexus 5 display support
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(-)
Signature · 1 line
2.20.1
PATCH v3 1/6 drm/msm: add dirty framebuffer helper
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.
--- 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(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +3 -0
@@ -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);
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +3 -0
@@ -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:
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +3 -0
@@ -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:
drivers/gpu/drm/msm/msm_fb.c +2 -0
@@ -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
Signature · 6 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v3 2/6 drm/msm: add support for per-CRTC max_vblank_count on mdp5
In reply to Brian MasneyThe 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.
--- 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(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +15 -1
@@ -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 = {
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +1 -1
@@ -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;
Signature · 6 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5
Quoted 10 lines · Brian Masney
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_countto zero. This can be done on a per-CRTC basis, so the convert mdp5 to usedrm_crtc_set_max_vblank_count().
Quoted 4 lines
This change was tested on a LG Nexus 5 (hammerhead) phone.
Signed-off-by Brian Masney <[email protected]>Suggested-by Jeffrey Hugo <[email protected]>
Quoted 62 lines
--- 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(-)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +15
-1@@ -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 = {drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +1
-2@@ -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
PATCH v3 3/6 ARM: qcom_defconfig: add display-related options
In reply to Brian MasneyAdd 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.
--- arch/arm/configs/qcom_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/configs/qcom_defconfig +5 -0
@@ -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
Signature · 1 line
2.20.1
PATCH v3 4/6 ARM: dts: qcom: msm8974-hammerhead: add support for backlight
In reply to Brian MasneyAdd necessary device tree nodes for the main LCD backlight.
--- .../qcom-msm8974-lge-nexus5-hammerhead.dts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +34 -0
@@ -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";
Signature · 6 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v3 5/6 ARM: dts: msm8974: add display support
In reply to Brian MasneyAdd 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.
--- arch/arm/boot/dts/qcom-msm8974.dtsi | 132 ++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +132 -0
@@ -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 {
Signature · 6 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v3 6/6 ARM: dts: qcom: msm8974-hammerhead: add support for display
In reply to Brian MasneyAdd initial support for the display found on the LG Nexus 5 (hammerhead) phone. This is based on work from Jonathan Marek.
--- .../qcom-msm8974-lge-nexus5-hammerhead.dts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +58 -0
@@ -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 {
Signature · 6 lines
2.20.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Quoted 21 lines · Brian Masney
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-CRTCmax_vblank_counton mdp5'. Special thanks to Jeffrey Hugo for helping to track down this issue.
- Addpanel_pinto 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 inmsm_atomic_prepare_fb()'
- New patch: Remove resv fields frommsm_gem_objectstruct that was incorrectly being referenced by theprepare_fbcallbacks.
- Adddrm_plane_enable_fb_damage_clips()to plane init for mdp4, mdp5, and dpu1.
- Add Linus Walleij's reviewed-by to patches 3-6
Quoted 4 lines
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
Quoted 22 lines
Brian Masney (6):
drm/msm: add dirty framebuffer helper
drm/msm: add support for per-CRTCmax_vblank_counton 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(-)Signature · 1 line
2.20.1