From patchwork Sun Jun 30 20:36:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11024615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C7A714C0 for ; Sun, 30 Jun 2019 20:36:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CA602847F for ; Sun, 30 Jun 2019 20:36:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60C282851B; Sun, 30 Jun 2019 20:36:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13CF42847F for ; Sun, 30 Jun 2019 20:36:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EE9189DD3; Sun, 30 Jun 2019 20:36:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by gabe.freedesktop.org (Postfix) with ESMTPS id CACDF89DBC; Sun, 30 Jun 2019 20:36:40 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id s15so12474817qtk.9; Sun, 30 Jun 2019 13:36:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nR/YCvWjef2okuUJBoulBLc7CJvLwyzicV4xinW8aAU=; b=dngwz3I1OLDuC/fngoLvFSE8WKG6E4CSkd/chF5QOE52EsW8EO7w98nXJUvZIXN8CN H1Yk8CUbc+AYmi2Iwf4m69X3yQaBBn1+St2f8YlWlCgMCITEFk+gQJi+Qhg5Loh6vAo4 Dd4/jg14+ZcjU82Q5ZJPaOyJMxoRzJcEY5gRagKteUawl4z5DMj81ww7DYkyeo8Dyarv ROelgKxiUNk5+cYCsO9e2LRYhrBCKpGPKiV7L1uaTHfFB916sxw7m+FxJvSBE3hnpmaT Rd6ECmTbu4V5if2sIF8loFCLV5j6vhg5oSICjdd+OTi8zymI3mhI8mNW+eVTF3Ar70xm b6Sw== X-Gm-Message-State: APjAAAWm5T0WYAY9H3oUji159o2RXn08R45BMLuJtP6wrYQjOdSWRCz4 Y1uEBIG+scleS/kTLBaoSGRCmVqZQnZ0dA== X-Google-Smtp-Source: APXvYqwJWB4WKYHWiOhXkTyDDWP8+VjolCHUld/jlsHEBPSEA7SLRDj+rfthVKZlVShn0LY+FxfB8A== X-Received: by 2002:ac8:2439:: with SMTP id c54mr17304252qtc.160.1561926999718; Sun, 30 Jun 2019 13:36:39 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id k40sm4616907qta.50.2019.06.30.13.36.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 13:36:39 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 1/4] dt-bindings: chosen: document panel-id binding Date: Sun, 30 Jun 2019 13:36:05 -0700 Message-Id: <20190630203614.5290-2-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630203614.5290-1-robdclark@gmail.com> References: <20190630203614.5290-1-robdclark@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nR/YCvWjef2okuUJBoulBLc7CJvLwyzicV4xinW8aAU=; b=o3VkptGTVq61lvXebAtF1Vs8W4dTkHIWwPtXHRYASTjCMmewaFs9plkDD2/J4+6eUT 99w13xOT8AtKeZWBDcDHNrY2Cnlsc7Bi2NyImXZzEz8YAW4abxef7RuwUstD898tYxjB 2oLC2WfceHZM0cQeMRf3eZfuWS6/TJWXh2hmN0qzhZTWNUd7T0kNUlv0rTZkACVZx7KM OMiSRI3Y/YF3biXYIvlyIBZ7dL5eZzxqt+04Kz4fT6y0n1vByrwjsAw7vIXqkXH+xEe+ rJebE03H9+t5CleK1iADDMFw3OzfpUWS9V9DoONGAm/m32TRWJiK75aKmM243ptyoBHH sg1w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , aarch64-laptops@lists.linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Mark Rutland , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark The panel-id property in chosen can be used to communicate which panel, of multiple possibilities, is installed. Signed-off-by: Rob Clark --- Documentation/devicetree/bindings/chosen.txt | 69 ++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/Documentation/devicetree/bindings/chosen.txt b/Documentation/devicetree/bindings/chosen.txt index 45e79172a646..d502e6489b8b 100644 --- a/Documentation/devicetree/bindings/chosen.txt +++ b/Documentation/devicetree/bindings/chosen.txt @@ -68,6 +68,75 @@ on PowerPC "stdout" if "stdout-path" is not found. However, the "linux,stdout-path" and "stdout" properties are deprecated. New platforms should only use the "stdout-path" property. +panel-id +-------- + +For devices that have multiple possible display panels (multi-sourcing the +display panels is common on laptops, phones, tablets), this allows the +bootloader to communicate which panel is installed, e.g. + +/ { + chosen { + panel-id = <0xc4>; + }; + + ivo_panel { + compatible = "ivo,m133nwf4-r0"; + power-supply = <&vlcm_3v3>; + no-hpd; + + ports { + port { + ivo_panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out_ivo>; + }; + }; + }; + }; + + boe_panel { + compatible = "boe,nv133fhm-n61"; + power-supply = <&vlcm_3v3>; + no-hpd; + + ports { + port { + boe_panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out_boe>; + }; + }; + }; + }; + + display_or_bridge_device { + + ports { + #address-cells = <1>; + #size-cells = <0>; + + ... + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + endpoint@c4 { + reg = <0xc4>; + remote-endpoint = <&boe_panel_in_edp>; + }; + + endpoint@c5 { + reg = <0xc5>; + remote-endpoint = <&ivo_panel_in_edp>; + }; + }; + }; + } +}; + +Note that panel-id values can be sparse (ie. not just integers 0..n). + linux,booted-from-kexec ----------------------- From patchwork Sun Jun 30 20:36:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11024617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D744913BD for ; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5A1E2851B for ; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B78612852B; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56EB72847F for ; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86D0389DD8; Sun, 30 Jun 2019 20:36:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3674C89DC1; Sun, 30 Jun 2019 20:36:52 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id a27so9471614qkk.5; Sun, 30 Jun 2019 13:36:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=StYKnXypXDaNaX52nN9jVP9VolfDF5eTNSV4sKsYdNo=; b=gCmGTZ6Lak1wa/SaAdUKceBE8yRwhuUt03Keh/RSrORZqFvfPNYFkhJHoSMks5DGse 8i4LROaFlIYpRmkkvaaNdNiwxb3lGgMErqz4ICo5wRIdcgRYWFuKfpafa2S/AJPaK+MO 9D03IsDRL2/VqLcW1zBWGPWb/rn/WpXbePrPc9wPW3A1unqyQcRq4egEaccIZ2Dn3dJp v5+kzS2tyE97QlHNhYeqA+KJ8QiHarXELzmsg0Rvkh7Xkegfu5NwECmTxnxn0leogP3R JBTWTmseAF0SLM0Xcfzqb950IfFYzvodEBWcrlja8EzahfYFUMO+KLjSmjGnTOBWAsU0 +pLw== X-Gm-Message-State: APjAAAWaKUNIURPKKypz2bWTa08dvlWEevKWm566Dv8/sLS/GxtoUYhe Gimj+E5ewSERmOHnRPhjRdQ/0fY9eYB5QA== X-Google-Smtp-Source: APXvYqxXYbfD7yFwsEz+jE2N/G7xl1mla7Ol0HLh8IFTwUjqsgfF8qe2/PhUmuHvmACYXofc01f/Cg== X-Received: by 2002:a37:bf07:: with SMTP id p7mr15452759qkf.315.1561927011188; Sun, 30 Jun 2019 13:36:51 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id c192sm4014942qkg.33.2019.06.30.13.36.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 13:36:50 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/4] efi/libstub: detect panel-id Date: Sun, 30 Jun 2019 13:36:06 -0700 Message-Id: <20190630203614.5290-3-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630203614.5290-1-robdclark@gmail.com> References: <20190630203614.5290-1-robdclark@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=StYKnXypXDaNaX52nN9jVP9VolfDF5eTNSV4sKsYdNo=; b=M5YzlCM7sZ7t6Ve1AiiXyULjkmLIbFjo9sO9b9FRNY409L/mHrGKx1FzO5c4lhLgBZ TdNvoZ//n6uDY4yHMu8qpw8HEmgJ+k9tvZbCSYcXR1hRvKeWlGjaxxVmmsTaw/Ah5Jta QW7RuKYv53B+pt6XWvAqtVJrjIcgOQIh6D5k0HhSbMJvjHpKnb7XFy0+y5Vn8ORjdKHS l8cIPPGb4xKCVl1XXeGvLjawptesNngCnBK3nD5nZ0xmfNsaW4lNx4KqqOTFS1RF4sno kaal7JJ7sFroRfvY2pny5HmStncnKE7DmZg3WPWQUwoPCGKi3rJWs/LlrcBXFfBQ4d33 57IA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , aarch64-laptops@lists.linaro.org, Julien Thierry , linux-efi@vger.kernel.org, Ard Biesheuvel , Will Deacon , Steve Capper , Alexander Graf , Leif Lindholm , linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, Ingo Molnar Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark On snapdragon aarch64 laptops, a 'UEFIDisplayInfo' variable is provided to communicate some information about the display. Crutially it has the panel-id, so the appropriate panel driver can be selected. Read this out and stash in /chosen/panel-id so that display driver can use it to pick the appropriate panel. Signed-off-by: Rob Clark --- drivers/firmware/efi/libstub/arm-stub.c | 49 +++++++++++++++++++++++++ drivers/firmware/efi/libstub/efistub.h | 2 + drivers/firmware/efi/libstub/fdt.c | 9 +++++ 3 files changed, 60 insertions(+) diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 04e6ecd72cd9..999813252e0d 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -69,6 +69,53 @@ static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg) return si; } +/* + * We (at least currently) don't care about most of the fields, just + * panel_id: + */ +struct mdp_disp_info { + u32 version_info; + u32 pad0[9]; + u32 panel_id; + u32 pad1[17]; +}; + +#define MDP_DISP_INFO_VERSION_MAGIC 0xaa + +static void get_panel_id(efi_system_table_t *sys_table_arg, + unsigned long fdt_addr) +{ + efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; + efi_status_t status; + struct mdp_disp_info *disp_info; + unsigned long size = 0; + + status = efi_call_runtime(get_variable, L"UEFIDisplayInfo", + &gop_proto, NULL, &size, NULL); + if (status == EFI_NOT_FOUND) + return; + + status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, + (void **)&disp_info); + if (status != EFI_SUCCESS) + return; + + status = efi_call_runtime(get_variable, L"UEFIDisplayInfo", + &gop_proto, NULL, &size, disp_info); + if (status != EFI_SUCCESS) + goto cleanup; + + if ((disp_info->version_info >> 16) != MDP_DISP_INFO_VERSION_MAGIC) + goto cleanup; + + efi_printk(sys_table_arg, "found a panel-id!\n"); + + set_chosen_panel_id(fdt_addr, disp_info->panel_id); + +cleanup: + efi_call_early(free_pool, disp_info); +} + void install_memreserve_table(efi_system_table_t *sys_table_arg) { struct linux_efi_memreserve *rsv; @@ -229,6 +276,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, if (!fdt_addr) pr_efi(sys_table, "Generating empty DTB\n"); + get_panel_id(sys_table, fdt_addr); + status = handle_cmdline_files(sys_table, image, cmdline_ptr, "initrd=", efi_get_max_initrd_addr(dram_base, *image_addr), diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 1b1dfcaa6fb9..8832cb9a7a40 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -39,6 +39,8 @@ void efi_char16_printk(efi_system_table_t *, efi_char16_t *); unsigned long get_dram_base(efi_system_table_t *sys_table_arg); +void set_chosen_panel_id(unsigned long fdt_addr, unsigned panel_id); + efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, void *handle, unsigned long *new_fdt_addr, diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 5440ba17a1c5..cb6ea160a40a 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -200,6 +200,15 @@ static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map) return EFI_SUCCESS; } +void set_chosen_panel_id(unsigned long fdt_addr, unsigned panel_id) +{ + void *fdt = (void *)fdt_addr; + int node = fdt_subnode_offset(fdt, 0, "chosen"); + u32 fdt_val32 = cpu_to_fdt32(panel_id); + + fdt_setprop_var(fdt, node, "panel-id", fdt_val32); +} + #ifndef EFI_FDT_ALIGN # define EFI_FDT_ALIGN EFI_PAGE_SIZE #endif From patchwork Sun Jun 30 20:36:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11024621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD2B414C0 for ; Sun, 30 Jun 2019 20:36:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD9232847F for ; Sun, 30 Jun 2019 20:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D2D2851B; Sun, 30 Jun 2019 20:36:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7845A2847F for ; Sun, 30 Jun 2019 20:36:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9CDC289CB8; Sun, 30 Jun 2019 20:36:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by gabe.freedesktop.org (Postfix) with ESMTPS id 852C089DDF; Sun, 30 Jun 2019 20:36:56 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id m14so9450799qka.10; Sun, 30 Jun 2019 13:36:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=49NmudHDFaiz637maLt0od1jxi4vc0fBNFWPB/OQ7Ew=; b=NRy/cPMEY/Ic+sD1CWIA/uOgvGVIGPbe+0kGB0f5xRgmrOBcJvlPq/ZFyiA1fUk+YJ 5FHSMfXpibPR6gIKL2MKCycW+5z3xd2ZK8WPr1v0N3uA/ozmgQJwrmpoLiycCa1FlWwI dCfgR8JqbIVsGmFObg8dZGkRTUmKOJJV94kCYZ3VaEGHHi7C2hm7qkH/rzsNZlU3TEUo id2pUH4ZOn9CRBth+Z6+gCleZI8uar6VYhWxO91+4XIZth7uA3qC/DMsrHmNQOowNw+8 UEmUFvy/c8ZxebRzxu/O5vaC9J6rhK0qKm4c+P9S93pONaSuUKzvXgv5sd/hMkDxjwbO IC9A== X-Gm-Message-State: APjAAAU9lthB0Db3GZOjhrLOWV8LGGhM4PbsMvx2wnUMTDAULSeps80X +gFCO3jBeq9fdYEnBVFKvZl745nX8RVkTw== X-Google-Smtp-Source: APXvYqw9dPdRPjUOBiaJgOP42sCQA941WsYe4Bx2/e7qKIMcRkO0Fhw3GXsoNcznih/UEJD2KmtWsA== X-Received: by 2002:a37:9a97:: with SMTP id c145mr18112662qke.309.1561927015455; Sun, 30 Jun 2019 13:36:55 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id v30sm4457747qtk.45.2019.06.30.13.36.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 13:36:54 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/4] drm: add helper to lookup panel-id Date: Sun, 30 Jun 2019 13:36:07 -0700 Message-Id: <20190630203614.5290-4-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630203614.5290-1-robdclark@gmail.com> References: <20190630203614.5290-1-robdclark@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=49NmudHDFaiz637maLt0od1jxi4vc0fBNFWPB/OQ7Ew=; b=DBTuLa2SFCIRlncjgp0a8sjJMrmiVoevGiyq+PyOd3P/l5i0yHONM0OpSlSPJQxe0j 7W2lLA6Jtko/v+HWPa5jPZz/hgrSWzo9Npum9/dB6oPMFA7EasBtv8GFtuNx5mx3Q5K9 yNS0NwKxar7I5iQ/3fYTwzi1un0rCFFcDdWgmz1y61hZD4K1wajMwyRnQoPTepJ4vg5r t0Xk5yYpLn/9+BgC+O/N6chIuEGHCEfKTJMDGl7F7gMMUeVDaUkAS985kTO3JwIwbl1c hCkd5sPpwrIYtzhobXpu28W9vMkxVoChJUA/Rf6RNJHr4+SqFPjJmDgdUa25jHGDkxPx TkEQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , aarch64-laptops@lists.linaro.org, Maxime Ripard , Sean Paul , linux-kernel@vger.kernel.org, David Airlie , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark Finds the panel-id from chosen, so drivers can use this to pick the correct endpoint when looking up panel. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_of.c | 21 +++++++++++++++++++++ include/drm/drm_of.h | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 43d89dd59c6b..3ba65750048b 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -279,3 +279,24 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, return ret; } EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); + +/** + * drm_of_find_panel_id - return id of panel from chosen + * + * Returns the panel id, or zero if none specified + */ +int drm_of_find_panel_id(void) +{ + struct device_node *np = NULL; + u32 panel_id; + + np = of_find_node_by_path("/chosen"); + if (!np) + return 0; + + if (of_property_read_u32(np, "panel-id", &panel_id)) + return 0; + + return panel_id; +} +EXPORT_SYMBOL_GPL(drm_of_find_panel_id); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index ead34ab5ca4e..6cd2d59cb1db 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -35,6 +35,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); +int drm_of_find_panel_id(void); + #else static inline uint32_t drm_of_crtc_port_mask(struct drm_device *dev, struct device_node *port) @@ -77,6 +79,11 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, { return -EINVAL; } + +static inline int drm_of_find_panel_id(void) +{ + return 0; +} #endif /* From patchwork Sun Jun 30 20:36:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11024629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1624A14C0 for ; Sun, 30 Jun 2019 20:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079502847F for ; Sun, 30 Jun 2019 20:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFD032851B; Sun, 30 Jun 2019 20:37:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE6C92847F for ; Sun, 30 Jun 2019 20:37:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 014FC89DEC; Sun, 30 Jun 2019 20:37:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by gabe.freedesktop.org (Postfix) with ESMTPS id EE0CF89DBC; Sun, 30 Jun 2019 20:37:00 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id p15so12533986qtl.3; Sun, 30 Jun 2019 13:37:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8APoQ9tZU7X1UIGwGdNOM/HXlIAPWX8EBWLqslvtxlM=; b=BrIFbVcH/1+HpK3UnkspERKSqLX4mDTRanNYQmQ2mHXkljR1TeD4bf8NXli8Z+HdzD m6GXCqNvw0hFhwr+YBL/Vg7cHyd8CR6pctbLG4TbwfdEOYb8fkJiA6Dxt/zmQDVPusuF iszXFdGhtoiRDWlY5Fd+qSZ0kA5jFaAvZpB+NHbcxrzE+2nAO28ybesRs5dSiVnLIYPh sv7s850pWkmjysWoZBgbN6lRr9HLxplmk/ksD5Z7gcz0nmEqXkJsCUfQ4+y6ChiVX0LW YmXkNK009ekIM2iodAw024TGNZc6y1v4qp9ApLC10l2TdqcC1dwEzi38QnAMwEXObQNl q4bQ== X-Gm-Message-State: APjAAAUvpgmCmyAwCnfykoGbQZEX33cYGQG1pMtk/vDT4bhkGmyzInmF dWdSzsGdDfm7thq0dS2TiLUhTk3jg6NLrQ== X-Google-Smtp-Source: APXvYqwxwquSsHnIcky5zw5j12bwbckaOicNC38h2rTq/yBmIuBNSXDXUcizer8wonP7Iwt/XdyKaQ== X-Received: by 2002:ac8:25b1:: with SMTP id e46mr17548583qte.36.1561927019833; Sun, 30 Jun 2019 13:36:59 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id u71sm4204966qka.21.2019.06.30.13.36.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 13:36:59 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 4/4] drm/bridge: ti-sn65dsi86: use helper to lookup panel-id Date: Sun, 30 Jun 2019 13:36:08 -0700 Message-Id: <20190630203614.5290-5-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630203614.5290-1-robdclark@gmail.com> References: <20190630203614.5290-1-robdclark@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8APoQ9tZU7X1UIGwGdNOM/HXlIAPWX8EBWLqslvtxlM=; b=d3z4n1Elaz6sMd0HfkAc3L/Jg3jRjJ3q5MVg9+j6BpET2WfEXXMsF8q8eZOGVEz4Cv xhQ8lgdI0SF9RuqqESt3FMcumyI8AcOVyCTG7OVXeZYfqvRoyeiaj5bIzxw6tuH+030F jQqUdDEaeAZi6g8sHMxNKT+F4dx840TIZMBcDr+ui4iCrOvc1Nlz2H8Z7yUEeO8psXp5 u5wfiZ30TZvqzkqko8jUpIaK8cgrgdx+SlycR2b+td26EN8mY/ZT+vACywSbRSH+27ZU 9bSdtPa+JtZc8nXkJWmSBZX3XCqMcJ1QXeRIV4KZtmE1WduVtA1ph1QFllGNx9yTBQmy 5RKg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , aarch64-laptops@lists.linaro.org, David Airlie , linux-kernel@vger.kernel.org, Laurent Pinchart , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark Use the drm_of_find_panel_id() helper to decide which endpoint to use when looking up panel. This way we can support devices that have multiple possible panels, such as the aarch64 laptops. Signed-off-by: Rob Clark --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 2719d9c0864b..56c66a43f1a6 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -790,7 +790,7 @@ static int ti_sn_bridge_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct ti_sn_bridge *pdata; - int ret; + int ret, panel_id; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { DRM_ERROR("device doesn't support I2C\n"); @@ -811,7 +811,8 @@ static int ti_sn_bridge_probe(struct i2c_client *client, pdata->dev = &client->dev; - ret = drm_of_find_panel_or_bridge(pdata->dev->of_node, 1, 0, + panel_id = drm_of_find_panel_id(); + ret = drm_of_find_panel_or_bridge(pdata->dev->of_node, 1, panel_id, &pdata->panel, NULL); if (ret) { DRM_ERROR("could not find any panel node\n");