Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5680482iog; Thu, 23 Jun 2022 03:16:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vkx7tKZRXbe65mf09PnKs3uVweLgzKmZk5Qwc3Ahx8ilgDrZ6Gv9vUK7KVQN5OuxTTN9HZ X-Received: by 2002:a17:90a:8d02:b0:1ec:a006:ea13 with SMTP id c2-20020a17090a8d0200b001eca006ea13mr3248498pjo.229.1655979374195; Thu, 23 Jun 2022 03:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655979374; cv=none; d=google.com; s=arc-20160816; b=txh3Cv1k1bQ+EABGFkaEF+z8lVNt6GRPA4eIRgA6wFi2jy+mtSOn0obJuMPtRVBAhv viKUuSNOjaVCNAbomQxabvu9jIbqwvggOaVMlr+psjqUYkaCiSNNfLjW6NhEV0B1HSX3 51Fp/8iHiAhXg7wQLBBO0TN83+OmMDGbxWvX8AsFjDlrYVhUjEekZX0fJl7qDBHTn4wL ox5rIngKLUoGSdE/3QZslpXf7EhFBnmHA+VbYC68UWT/SJ/BkBZlv8bhANZxqObU7N4i Npy80F5FtALHn5jk1tFFLgOtmgCeYGpySxwHxPbVp129sNUqms5BFiHYqJUi0EajZVRn E7zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=UPcwSf/6QO4HpZ12PIq0E8dxfa+SOYiABgHmOP2/u74=; b=K4nKw/6LRAPq8kGh5n/HUvOi/rmbkbu/eemDAYuG0UlIBBmf+6U/Poo8cSYiVYEWs1 xE/HwrqbI6glh5ExslAihtTIF/mX78X3z0Ou2WsGj74nM2j69lD4ZREnHB5XKXKnmiCw wZe0GcIqoZhlbV61guyGiln1JwWykUsp6l9/WEg/ehVjbRuhMHY7gHC7oCGD4yOE6Cyj Wp/suaVjYC6HKeUdNa+rWcCFMv5Z3GqWTkOqCUGBjJG0yT+dldrI5IeRM50SzLZBPqyW Jbomojq7lIuS+DOibx9aWlhamL6J6jNjhHkGd19yRBFo4DdjyDveYlCOEEy3z8AYHlTK gjFA== 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 ob1-20020a17090b390100b001ed05bf19basi2278826pjb.67.2022.06.23.03.16.02; Thu, 23 Jun 2022 03:16:14 -0700 (PDT) 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 S230515AbiFWJf2 (ORCPT + 99 others); Thu, 23 Jun 2022 05:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiFWJfZ (ORCPT ); Thu, 23 Jun 2022 05:35:25 -0400 X-Greylist: delayed 186 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 23 Jun 2022 02:35:23 PDT Received: from ironport.ite.com.tw (60-251-196-230.hinet-ip.hinet.net [60.251.196.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12EA149264 for ; Thu, 23 Jun 2022 02:35:22 -0700 (PDT) Received: from unknown (HELO mse.ite.com.tw) ([192.168.35.30]) by ironport.ite.com.tw with ESMTP; 23 Jun 2022 17:32:12 +0800 Received: from CSBMAIL1.internal.ite.com.tw (CSBMAIL1.internal.ite.com.tw [192.168.65.58]) by mse.ite.com.tw with ESMTP id 25N9W7mn009951; Thu, 23 Jun 2022 17:32:07 +0800 (GMT-8) (envelope-from allen.chen@ite.com.tw) Received: from VirtualBox.internal.ite.com.tw (192.168.70.46) by CSBMAIL1.internal.ite.com.tw (192.168.65.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.14; Thu, 23 Jun 2022 17:32:07 +0800 From: allen CC: Allen Chen , Pin-yen Lin , Jau-Chih Tseng , Hermes Wu , Kenneth Hung , Allen-kh Cheng , Pin-yen Lin , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Matthias Brugger , "open list:DRM DRIVERS" , open list , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Subject: [PATCH] drm/bridge: add it6505 driver read config from dt property Date: Thu, 23 Jun 2022 17:31:54 +0800 Message-ID: <20220623093154.52701-1-allen.chen@ite.com.tw> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.70.46] X-ClientProxiedBy: CSBMAIL1.internal.ite.com.tw (192.168.65.58) To CSBMAIL1.internal.ite.com.tw (192.168.65.58) X-TM-SNTS-SMTP: 532277101033EC0C5799347BF5418EF1C05372C83BD9777B75A722A680D091252002:8 X-MAIL: mse.ite.com.tw 25N9W7mn009951 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RDNS_DYNAMIC, SPF_HELO_NONE,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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: allen chen add read max-lane and max-pixel-clock from dt property Signed-off-by: Allen-kh Cheng Signed-off-by: Pin-yen Lin --- drivers/gpu/drm/bridge/ite-it6505.c | 35 ++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 4b673c4792d77..c9121d4635a52 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -436,6 +436,8 @@ struct it6505 { bool powered; bool hpd_state; u32 afe_setting; + u32 max_dpi_pixel_clock; + u32 max_lane_count; enum hdcp_state hdcp_status; struct delayed_work hdcp_work; struct work_struct hdcp_wait_ksv_list; @@ -1466,7 +1468,8 @@ static void it6505_parse_link_capabilities(struct it6505 *it6505) it6505->lane_count = link->num_lanes; DRM_DEV_DEBUG_DRIVER(dev, "Sink support %d lanes training", it6505->lane_count); - it6505->lane_count = min_t(int, it6505->lane_count, MAX_LANE_COUNT); + it6505->lane_count = min_t(int, it6505->lane_count, + it6505->max_lane_count); it6505->branch_device = drm_dp_is_branch(it6505->dpcd); DRM_DEV_DEBUG_DRIVER(dev, "Sink %sbranch device", @@ -2895,7 +2898,7 @@ it6505_bridge_mode_valid(struct drm_bridge *bridge, if (mode->flags & DRM_MODE_FLAG_INTERLACE) return MODE_NO_INTERLACE; - if (mode->clock > DPI_PIXEL_CLK_MAX) + if (mode->clock > it6505->max_dpi_pixel_clock) return MODE_CLOCK_HIGH; it6505->video_info.clock = mode->clock; @@ -3057,6 +3060,8 @@ static void it6505_parse_dt(struct it6505 *it6505) { struct device *dev = &it6505->client->dev; u32 *afe_setting = &it6505->afe_setting; + u32 *max_lane_count = &it6505->max_lane_count; + u32 *max_dpi_pixel_clock = &it6505->max_dpi_pixel_clock; it6505->lane_swap_disabled = device_property_read_bool(dev, "no-laneswap"); @@ -3072,7 +3077,31 @@ static void it6505_parse_dt(struct it6505 *it6505) } else { *afe_setting = 0; } - DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %d", *afe_setting); + + if (device_property_read_u32(dev, "max-lane-count", + max_lane_count) == 0) { + if (*max_lane_count > 4 || *max_lane_count == 3) { + dev_err(dev, "max lane count error, use default"); + *max_lane_count = MAX_LANE_COUNT; + } + } else { + *max_lane_count = MAX_LANE_COUNT; + } + + if (device_property_read_u32(dev, "max-dpi-pixel-clock", + max_dpi_pixel_clock) == 0) { + if (*max_dpi_pixel_clock > 297000) { + dev_err(dev, "max pixel clock error, use default"); + *max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX; + } + } else { + *max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX; + } + + DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %u, max_lane_count: %u", + it6505->afe_setting, it6505->max_lane_count); + DRM_DEV_DEBUG_DRIVER(dev, "using max_dpi_pixel_clock: %u kHz", + it6505->max_dpi_pixel_clock); } static ssize_t receive_timing_debugfs_show(struct file *file, char __user *buf, -- 2.25.1