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: 11024619 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 01436174A for ; Sun, 30 Jun 2019 20:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E46AF2847F for ; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D792628518; 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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76FFF28518 for ; Sun, 30 Jun 2019 20:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbfF3Ugl (ORCPT ); Sun, 30 Jun 2019 16:36:41 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:33772 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfF3Ugk (ORCPT ); Sun, 30 Jun 2019 16:36:40 -0400 Received: by mail-qt1-f195.google.com with SMTP id h24so9492328qto.0; Sun, 30 Jun 2019 13:36:40 -0700 (PDT) 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-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=f9GrOik005KtBVtr602MpVT6hM8xbuBfvrac1KMwQKn+iRH6llh6f2h2vWNbHqF4GL D6eY478oEH3FZibldG982nAAlKhP40dxQ6ZTI0v8TQ5Wo63VchFe7XfKcr12deIR6tGh 1aUeokqckcAJXkYXEdu5Hj/ae+KgUQ/EewgQ7zS4MfrokFnOSwZP6WatWzX/lPdQS7oc qFrjL6t5OLOTlAdBB62WXs7SwL2+wNRKlawVXipG//p0zaMkqwGd9Lkjxvbr2m5HvNbk usR6rBk7HIxpeETn6WeaI67vf9B1AQ5+p5gwR7yZPLdakTQxBe9DyIzlbRULP1f3Vk0X GiAA== X-Gm-Message-State: APjAAAXROdVPugyCiDWOu6DjGPvARq70TNYEwEtrlE10rOwpV8CJIbfl ZHzexuw9+3PgCPmHRvq0deQ= 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 Cc: freedreno@lists.freedesktop.org, aarch64-laptops@lists.linaro.org, Rob Clark , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: 11024623 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 1A06514C0 for ; Sun, 30 Jun 2019 20:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A0DC2847F for ; Sun, 30 Jun 2019 20:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F274228535; Sun, 30 Jun 2019 20:37:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77E4E2847F for ; Sun, 30 Jun 2019 20:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726984AbfF3Ugx (ORCPT ); Sun, 30 Jun 2019 16:36:53 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33474 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfF3Ugw (ORCPT ); Sun, 30 Jun 2019 16:36:52 -0400 Received: by mail-qk1-f195.google.com with SMTP id r6so9508147qkc.0; Sun, 30 Jun 2019 13:36:51 -0700 (PDT) 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-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=e1NC488A3tVtj1P+/JV2DlPCBvLU18EWXuUzO049MDdwqjv6YrIkkHK+ae4ogcJnc+ AZaWeJUGYAr5fO3Ky16n8Z/Xm6OfumiMfn4bzfjASqpOvhgJm0BsQkBKunnuOygA0RFX xgNGMMSuiBgY4JX4F1HEQBmEOH36JWIoezgV1DYBD86/+ZUI6FxFcMbzPfUZSi0TBAqG 2vd5XACT0SdkAdOLJboh59acQ3vF1SOs+5dTJsYPYaHQWK9V9U+ShQzXaJ3oPkvnVtjj LsJTKIxULNolOMgZe69x39SLXcGrfNFYcJ+6oM3yX/p9zX05A8bB5PR3LavefBk/tHw5 rGNg== X-Gm-Message-State: APjAAAV8LPYPpd/HbhfPEiy7pci6ovYgMYtaOCIQXQq4W3mkAXoKD0UE 7W9DHSSRPR+87iiCMSvWEgU= 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 Cc: freedreno@lists.freedesktop.org, aarch64-laptops@lists.linaro.org, Rob Clark , Ard Biesheuvel , Ingo Molnar , Will Deacon , Leif Lindholm , Alexander Graf , Steve Capper , Lukas Wunner , Julien Thierry , linux-efi@vger.kernel.org, linux-kernel@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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: 11024625 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 3785713BD for ; Sun, 30 Jun 2019 20:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2884F28518 for ; Sun, 30 Jun 2019 20:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CA732852B; Sun, 30 Jun 2019 20:37:02 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A27C528518 for ; Sun, 30 Jun 2019 20:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbfF3Ug4 (ORCPT ); Sun, 30 Jun 2019 16:36:56 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35977 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfF3Ug4 (ORCPT ); Sun, 30 Jun 2019 16:36:56 -0400 Received: by mail-qk1-f193.google.com with SMTP id g18so9488926qkl.3; Sun, 30 Jun 2019 13:36:55 -0700 (PDT) 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-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=CGlZSAjKr6A47l5S3oSm/DJld1DEZybZSIE0/Y9UjkMwW02M/V/s0CsZmw0LOICxey MVd2wKd5PIvJgc3qi/YJRvJvTG1mp+0dPvOhjaVvf+ZG8HxStCuNEOt1oB4z5+pk9Aum ql4DWE80cPGBsw+DO/6d11/DjmLb1iDWj0tXG/H+v10KKudZrG7vqnB9BCOOsLkas6rj y0KU1/9daJ5iEjUkK7c6arT6hg9+uymAUejYk+zGaXGBUXrAROOEzk69h6/6LSD34M65 c+D+8G0c2Ag5lmKWmFVURRro5n7CNgdBSoC2+cg6/th9NIMeOlh3hjJ7+oCTDaT7MkKc EjtQ== X-Gm-Message-State: APjAAAXm8ETawkNSFCbX8M1e9ixQzBn1aF9xJ43Mbyei7jvrh/MCgBE+ RHNeW0c54s26m2ZdBFFb5nBvOxfWmaPUWw== 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 Cc: freedreno@lists.freedesktop.org, aarch64-laptops@lists.linaro.org, Rob Clark , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , linux-kernel@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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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: 11024627 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 2802D14C0 for ; Sun, 30 Jun 2019 20:37:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19EBC2847F for ; Sun, 30 Jun 2019 20:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E1AF2851B; 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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9C162847F for ; Sun, 30 Jun 2019 20:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbfF3UhB (ORCPT ); Sun, 30 Jun 2019 16:37:01 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42325 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfF3UhA (ORCPT ); Sun, 30 Jun 2019 16:37:00 -0400 Received: by mail-qt1-f193.google.com with SMTP id s15so12475225qtk.9; Sun, 30 Jun 2019 13:37:00 -0700 (PDT) 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-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=qTAQKxTIVXGyzQjrwWt/hG/JOGp4cuKOUQeiNBdN6PvPap0gOmHABADvcOGPZuupsd P87h/gIjlIYsKsT/musQXMC8Kepjw3eXVZJ41SAXBeEcxJ1DwddYlmr9BlmWJFN1O1mS AaXtl1v7qJrFv8HTgqaGp+UWm8S93zC/QWdGabEBJipVO5ta6NfNyuMbsDJ8hB0as7Ie vHh7oj1uFki/vWykF7F1e2g6+bP4XWKrvhxKjGB9gB2I83iafjOQBM1fPFNglKyUQml0 cTuGCgODjMV70XIFm+cWrBRpBVwWvdSW9CnMkmoXPdBE9uLNdC4cNNB2jQcdramFse5T 3TlA== X-Gm-Message-State: APjAAAVMtrlrEJSS+gvoxR0Yr9XrGwlC24LM0yVdMWIa31EKbjtZi4+q 2Dt5rO9WGYxuR+owkOGWspg= 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 Cc: freedreno@lists.freedesktop.org, aarch64-laptops@lists.linaro.org, Rob Clark , Andrzej Hajda , Laurent Pinchart , David Airlie , Daniel Vetter , linux-kernel@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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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");