Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5557062pxb; Mon, 14 Feb 2022 01:50:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN4hAWoRtwFS1ubasmfIHagIdhqJfdI5mcX8lFP8x22+152hVXzcNgEB29G9cQy7IsiEa2 X-Received: by 2002:a63:10:: with SMTP id 16mr11102843pga.87.1644832244475; Mon, 14 Feb 2022 01:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644832244; cv=none; d=google.com; s=arc-20160816; b=xEc3hBCKUmBYy+yHz5VO6e94fLJqkM6JGG2vKqFKp6+0cV5/bMA4Sdc+2r5O7M31NX FD10YVT06G/m3+8RA6W8GZnYBUuD2aCcRf/SIjNvsV/s37DGVSePoN4dJSJnerG9xI8f G6CyHxdRc/tlJuKC8fbVfePoqb/Qh6okmMAjsKox1EmiuOIxXYq63R6PiENM9mM7o4qt AEkmECP2E63DX/z/wn/uIJMZ9gO9a0GmC1DBKVZjRFNR9YyHdSFtRFAgby9BiiOUfoaL a3NgP6nPykuA61kroDKaGqcw4VF4XJdlUeONUbcanoInnCv67JFDTrrexQN+iVS5jVHM ANGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:hmm_source_type:hmm_attache_num :hmm_source_ip; bh=D6oSHz4+5GPFPRRBhwTORxuzIZMTRTLxlmGRV6igEb8=; b=bVu9B8m9UOLYhQ3+3dPTZAZ+JZfxT2erEC2naVoUiZsQDFvmb9ADGovN4kJOuFqGcq QbwhohePooK71iWmOCZpVBSxtDA/P3ahNvEwUxOEs3vKfgYUSplhapryyy65JG9uWGRE g39zJt3n3qlMGZaRCXMJS41DSn/kc9B0UQn1+LgJcgcvw/FTm+hpo9f6uzhaTiHjm/Be jJSpkIiiCH5c39WfmZHlI6bJMQP/y9A9PmsO4Zi/wT3axqdcRLxuFmQsLrHdAxEv2Cud sy8WtgKuSSJG8+9rk+1/2CmCzlaOafKU7rhmY6yMZ+U+kloc0GLdiJs+N1/cyTs8ewTK ig6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19si11356301pjs.114.2022.02.14.01.50.30; Mon, 14 Feb 2022 01:50:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229451AbiBLSLv (ORCPT + 99 others); Sat, 12 Feb 2022 13:11:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiBLSLt (ORCPT ); Sat, 12 Feb 2022 13:11:49 -0500 Received: from 189.cn (ptr.189.cn [183.61.185.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA2504B405; Sat, 12 Feb 2022 10:11:41 -0800 (PST) HMM_SOURCE_IP: 10.64.8.41:60616.1189609616 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id 611C3100139; Sun, 13 Feb 2022 02:11:33 +0800 (CST) Received: from ([172.27.8.53]) by gateway-151646-dep-b7fbf7d79-9vctg with ESMTP id 30291ab50f664b3aaf0ab2bf57b87b99 for maxime@cerno.tech; Sun, 13 Feb 2022 02:11:40 CST X-Transaction-ID: 30291ab50f664b3aaf0ab2bf57b87b99 X-Real-From: 15330273260@189.cn X-Receive-IP: 172.27.8.53 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: <8b7bcb57-4450-ed67-bd5f-d8e8f2e74510@189.cn> Date: Sun, 13 Feb 2022 02:11:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v6 1/3] drm/lsdc: add drm driver for loongson display controller Content-Language: en-US To: Maxime Ripard Cc: Dan Carpenter , Lucas Stach , Maarten Lankhorst , Roland Scheidegger , Zack Rusin , Christian Gmeiner , David Airlie , Daniel Vetter , Rob Herring , Thomas Bogendoerfer , Krzysztof Kozlowski , Andrey Zhizhikin , Sam Ravnborg , suijingfeng , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Randy Dunlap References: <20220203082546.3099-1-15330273260@189.cn> <20220203082546.3099-2-15330273260@189.cn> <20220203085851.yqstkfgt4dz7rcnw@houat> <11ac5696-29e3-fefa-31c0-b7b86c88bbdc@189.cn> <20220209084908.kub4bs64rzhvpvon@houat> <84bfb2fc-595c-3bae-e8a0-c19ccbcfcfd8@189.cn> <20220209161624.42ijbnhanaaari46@houat> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: <20220209161624.42ijbnhanaaari46@houat> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/2/10 00:16, Maxime Ripard wrote: > On Wed, Feb 09, 2022 at 10:38:41PM +0800, Sui Jingfeng wrote: >> On 2022/2/9 16:49, Maxime Ripard wrote: >>> On Fri, Feb 04, 2022 at 12:04:19AM +0800, Sui Jingfeng wrote: >>>>>> +/* Get the simple EDID data from the device tree >>>>>> + * the length must be EDID_LENGTH, since it is simple. >>>>>> + * >>>>>> + * @np: device node contain edid data >>>>>> + * @edid_data: where the edid data to store to >>>>>> + */ >>>>>> +static bool lsdc_get_edid_from_dtb(struct device_node *np, >>>>>> + unsigned char *edid_data) >>>>>> +{ >>>>>> + int length; >>>>>> + const void *prop; >>>>>> + >>>>>> + if (np == NULL) >>>>>> + return false; >>>>>> + >>>>>> + prop = of_get_property(np, "edid", &length); >>>>>> + if (prop && (length == EDID_LENGTH)) { >>>>>> + memcpy(edid_data, prop, EDID_LENGTH); >>>>>> + return true; >>>>>> + } >>>>>> + >>>>>> + return false; >>>>>> +} >>>>> You don't have a device tree binding for that driver, this is something >>>>> that is required. And it's not clear to me why you'd want EDID in the >>>>> DTB? >>>> 1) It is left to the end user of this driver. >>>> >>>> The downstream motherboard maker may use a dpi(XRGB888) or LVDS panel >>>> which don't have DDC support either, doing this way allow them put a >>>> EDID property into the dc device node in the DTS. Then the entire system works. >>>> Note those panel usually support only one display mode. >>> I guess it depends on what we mean exactly by the user, but the DTB >>> usually isn't under the (end) user control. And the drm.edid_firmware is >>> here already to address exactly this issue. >>> >>> On the other end, if the board has a static panel without any DDC lines, >>> then just put the timings in the device tree, there's no need for an >>> EDID blob. >> Loongson have a long history of using PMON firmware, The PMON firmware >> support flush the dtb into the the firmware before grub loading the kernel. >> You press 'c' key, then the PMON will give you a shell. it is much like a >> UEFI shell. Suppose foo.dtb is what you want to pass to the vmlinuz. >> Then type the follow single command can flush the dtb into the PMON firmware. >> >> |load_dtb /dev/fs/fat@usb0/foo.dtb| >> >> For our PMON firmware, it**is** totally under developer/pc board maker's control. >> You can flush whatever dtb every time you bootup until you satisfied. >> It(the pmon firmware) is designed to let downstream motherboard maker and/or >> customers to play easily. >> >> Support of reading EDID from the dtb is really a feature which downstream >> motherboard maker or customer wanted. They sometimes using eDP also whose >> resolution is not 1024x768. This is out of control for a graphic driver >> developer like me. > And, to reinstate, we already have a mechanism to set an EDID, and if it > wasn't an option, the DT is not the place to store an EDID blob. I know, put edid blob in the dts maybe abuse, but i am not push dts with edid blob either. It is left to other people, and the ./arch/powerpc/boot/dts/ac14xx.dts already have edid blob. >> And drm.edid_firmware have only a few limited resolution which is weak. > You're wrong. There's no limitation, it's just as limited as your > solution. You put the same thing, you get the same thing out of it. The > only difference is where the data are coming from. It is extremely difficult to use, it have difficulty to specify which firmware edid is for which connector. because we have a 1024x600 panel and a 1920x1080 monitor. It require you to know the connector's name at first, it is not as intuitive as my method. I am exhausted by it. >> I will consider to adding drm.edid_firmware support, thanks. > It just works if you use drm_get_edid. > >>>> 2) That is for the display controller in ls2k1000 SoC. >>>> >>>> Currently, the upstream kernel still don't have GPIO, PWM and I2C driver support >>>> for LS2K1000 SoC. >>>> >>>> How dose you read EDID from the monitor without a I2C driver? >>>> >>>> without reading EDID the device tree support, the screen just black, >>>> the lsdc driver just stall. With reading EDID from device tree support >>>> we do not need a i2c driver to light up the monitor. >>>> >>>> This make lsdc drm driver work on various ls2k1000 development board >>>> before I2C driver and GPIO driver and PWM backlight driver is upstream. >>>> >>>> I have many local private dts with the bindings, those local change just can not >>>> upstream at this time, below is an example. >>>> >>>> The device tree is a platform description language. It's there to let >>>> the OS know what the hardware is, but the state of hardware support in >>>> the said OS isn't a parameter we have to take into account for a new >>>> binding. >>>> >>>> If you don't have any DDC support at the moment, use the firmware >>>> mechanism above, or add fixed modes using drm_add_modes_noedid in the >>>> driver, and leave the DT out of it. Once you'll gain support for the >>>> EDID readout in the driver, then it'll just work and you won't need to >>>> change the DT again. >>>> >> The resolution will be 1024x768, it will also add a lot modes which may >> not supported by the specific panel. Take 1024x600 as an example, >> Both drm_add_modes_noedid() and firmware mechanism above will fail. >> >> Because the user supply EDID only and manufacturer of some strange panel >> supply EDID only. > It's fairly easy to address: if the panel has some EDID, make the driver > able to read it; if it doesn't, describe the mode in the DT. > > And if you want to be nice to your users, the firmware can even patch > the DT at boot time to add the necessary bits based on whatever info it > has, it doesn't have to be static. > > Maxime