Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1067515pxm; Wed, 23 Feb 2022 17:15:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJybvP38B6ke8hEy9q5iliAGPsK0VaCAgt8YlC6QzbLAW/kc43M2areXJkp5N3VbbO17i3kV X-Received: by 2002:a05:6a00:2296:b0:4e1:3029:ee2 with SMTP id f22-20020a056a00229600b004e130290ee2mr223256pfe.22.1645665339799; Wed, 23 Feb 2022 17:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645665339; cv=none; d=google.com; s=arc-20160816; b=tHZJ1+HFqZ+BmnNC1O2uAS3xvxSfAP2GzdQrceIfLd9NA6dDyLQ3zoX39Yt7QzocuY /douannp/89fF4lTONkcbKMHFUIlihxAywMWdeEr2zsbp2g3Il2P4oLFMsP2dI+day9W oprhkIq5GRyCyG8K8tRz8dkDJM3/htmcxk/HEp6KsxjstmdUKQlv0Jkk+n2+EGTTvqa0 5U9rDXb5SSK1YG4113Bey3WOZK/zoMYRUhA5A2wR4u1w4hxcxfRfmqFOrb59HjwJ9Trh DR4c53UA6UIG3yTpmd+x3QNgNMR4jViudQP9KEFEpMRFyIVxcjuGNOy7HUjCPGR0GULb j9Yg== 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=IJ6APkYuD7LAXUyZhnABHRg1ty0ji8Ql0wpJY6HaLYc=; b=jtWsyzJen9RAIL3/QJL3tcRKL70AEGgkTcEyYtatKHZnoqwUziy+0UvR3DzZjlRVlk QRUhZJ9PYYTYVVSxdLf5YvdVymFs33pGTBOYGRMI+atmGdUt1Dj7dxyrNkkGqGlbzY2Y dq7uYTYOy22laRjZtjdaCu0k0MzWdPByryA6MY9Ae+SLCffyZcNvKzMoCbZTC9nbLlk9 113XI1RXx2K/M2yuagJbeX8Rr7u/fHi0s8mPeX+ZccAMLfe3oKOKv+uwnyCO3OWQB7Kn 5RVYVKhayu1QFreeqYLBgijkJ1Oozu+0htvTP8leIMlPAAMdYJn6k6Rt2vi5ImxbyIlN Nqqg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o6si1121050pgv.157.2022.02.23.17.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 17:15:39 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 15AB416BCF9; Wed, 23 Feb 2022 17:01:37 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241127AbiBWPOy (ORCPT + 99 others); Wed, 23 Feb 2022 10:14:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbiBWPOx (ORCPT ); Wed, 23 Feb 2022 10:14:53 -0500 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50AE8B82DE; Wed, 23 Feb 2022 07:14:23 -0800 (PST) HMM_SOURCE_IP: 10.64.8.31:44458.435332613 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.31]) by 189.cn (HERMES) with SMTP id 30AE11001F7; Wed, 23 Feb 2022 23:14:17 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-b7fbf7d79-bwdqx with ESMTP id 90e95b07aa22426594cd3a88c70e7830 for maxime@cerno.tech; Wed, 23 Feb 2022 23:14:21 CST X-Transaction-ID: 90e95b07aa22426594cd3a88c70e7830 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: <0d4a75c4-78bb-4aed-0fa8-88e9cc165896@189.cn> Date: Wed, 23 Feb 2022 23:14:12 +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 v10 3/4] drm/lsdc: add drm driver for loongson display controller Content-Language: en-US To: Maxime Ripard Cc: Thomas Zimmermann , Roland Scheidegger , Zack Rusin , Christian Gmeiner , David Airlie , Daniel Vetter , Rob Herring , Thomas Bogendoerfer , Dan Carpenter , Krzysztof Kozlowski , Andrey Zhizhikin , Sam Ravnborg , "David S . Miller" , Jiaxun Yang , Lucas Stach , Maarten Lankhorst , Ilia Mirkin , Qing Zhang , suijingfeng , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Randy Dunlap , kernel test robot References: <20220220145554.117854-1-15330273260@189.cn> <20220220145554.117854-4-15330273260@189.cn> <20220222082747.66otrkc4zwvhem7w@houat> <54ea69d7-2fac-74dc-2ef6-843a666cff85@189.cn> <20220223143912.m727fie3vtdkvklo@houat> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: <20220223143912.m727fie3vtdkvklo@houat> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,SPOOFED_FREEMAIL_NO_RDNS, 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/23 22:39, Maxime Ripard wrote: > On Tue, Feb 22, 2022 at 10:46:35PM +0800, Sui Jingfeng wrote: >> On 2022/2/22 16:27, Maxime Ripard wrote: >>>> + if (!of_device_is_available(output)) { >>>> + of_node_put(output); >>>> + drm_info(ddev, "connector%d is not available\n", index); >>>> + return NULL; >>>> + } >>>> + >>>> + disp_tims_np = of_get_child_by_name(output, "display-timings"); >>>> + if (disp_tims_np) { >>>> + lsdc_get_display_timings_from_dtb(output, &lconn->disp_tim); >>>> + lconn->has_disp_tim = true; >>>> + of_node_put(disp_tims_np); >>>> + drm_info(ddev, "Found display timings provided by connector%d\n", index); >>>> + } >>>> + >>>> + connector_type = lsdc_get_connector_type(ddev, output, index); >>>> + >>>> + if (output) { >>>> + of_node_put(output); >>>> + output = NULL; >>>> + } >>>> + >>>> +DT_SKIPED: >>>> + >>>> + /* Only create the i2c channel if display timing is not provided */ >>>> + if (!lconn->has_disp_tim) { >>>> + const struct lsdc_chip_desc * const desc = ldev->desc; >>>> + >>>> + if (desc->have_builtin_i2c) >>>> + lconn->ddc = lsdc_create_i2c_chan(ddev, index); >>>> + else >>>> + lconn->ddc = lsdc_get_i2c_adapter(ddev, index); >>> This looks weird: the connector bindings have a property to store the >>> i2c controller connected to the DDC lines, so you should use that >>> instead. >>> >> This is not  weird,  ast, mgag200, hibmc do the same thing. > And none of them have DT support. > > Maxime You are wrong, ast driver have dt support. See ast_detect_config_mode() in drm/ast/ast_main.c static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) {     struct device_node *np = dev->dev->of_node;     struct ast_private *ast = to_ast_private(dev);     struct pci_dev *pdev = to_pci_dev(dev->dev);     uint32_t data, jregd0, jregd1;     /* Defaults */     ast->config_mode = ast_use_defaults;     *scu_rev = 0xffffffff;     /* Check if we have device-tree properties */     if (np && !of_property_read_u32(np, "aspeed,scu-revision-id",                     scu_rev)) {         /* We do, disable P2A access */         ast->config_mode = ast_use_dt;         drm_info(dev, "Using device-tree for configuration\n");         return;     }  .... }