Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1735820rwb; Thu, 8 Dec 2022 14:45:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FUKCvZMHXqpQ9dbiUu9EFmBCEA9feOzm68I8pCFcZ0RAa34E7vXYaseaqD2UMH8o9Jm/+ X-Received: by 2002:a05:6402:205c:b0:46d:c48c:50eb with SMTP id bc28-20020a056402205c00b0046dc48c50ebmr2380601edb.13.1670539503898; Thu, 08 Dec 2022 14:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670539503; cv=none; d=google.com; s=arc-20160816; b=yr9pQ7gUXiH56/JfhMPWw470ebkQT8vPP95t1ZtPUmB7/Zcv0BzgfZ6X5U7NgwmMvS fgh2R75hlGqTRcweA7ILQQAW/BGxEa1J61jvCXu6l6YzwE35bEv2OKCmSSB+/afjlXrY mLQhPPRzKmdSTC/VUH7iYKsQ0CKBTyz7JSSbtQXv/JHm4VNkjrKmbSUirkYgD5KqqDVx 6Rm0j5IGeTOxHWfXR/PLUb9SXDq5SZAQfFpvndbKRAUGFUzHQv2LLO7dpZrr1rjlyGDw ZdxN708yvOM7pw5hHP8tbaXrweD9S3F/ctRsg3Z0FNSiaMPID2wqQ8SQgYsARMwTkSeh JkCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sIJ5dMnjXmO0FIhRywE1nT/SfTTrlAg6Vmi+r4kCh6E=; b=DZ3mB1F+ZO2dqYQO53t4HygJ1IKkIQR0nhIxVEXri9hDnzR5FY5KP+ANb2oVeZhIiQ C5cW6ApPhLX4ObJcD9GE5UZ9O7GTyB90Nsex7wfyUr0Itf8Y9K01fBCYLDuo6AiJ9apG 6dWkUNPSGmGMNEC2oUbuHR0YQIqnhpaw99M36XF2vRadS+LgUB92HQHpVAOJQuux36QV qvAppZcE4TRu1EIXHkMnA7gtU4g07VKiv8AkjA/N4e1s32WjCoBA9zUV5T7CICmJZYNv gIqbBlTXyASxF6UAV+alTU+1RaAWm4zeQyH/9dx1TRfFtgmn3MKkV93PlsK7ZQ+sjTx/ iJHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Fdnuaw2Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz15-20020a0564021d4f00b0046af62544a0si9313139edb.401.2022.12.08.14.44.32; Thu, 08 Dec 2022 14:45:03 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Fdnuaw2Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbiLHWh7 (ORCPT + 75 others); Thu, 8 Dec 2022 17:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbiLHWhx (ORCPT ); Thu, 8 Dec 2022 17:37:53 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244392F030; Thu, 8 Dec 2022 14:37:48 -0800 (PST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B8MU2K9026288; Thu, 8 Dec 2022 22:37:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=sIJ5dMnjXmO0FIhRywE1nT/SfTTrlAg6Vmi+r4kCh6E=; b=Fdnuaw2QJk5NLQfgL2EW9+o8XEzYalsDMOWX+DsCVtsGc+3qbCNzJcBrhYPbTqEVBVj2 IBP4289A6BWQjRvic5DVAxJprjhtxNalrmakpJjdwyCLn9aNwJD0F93VcwJlF7W0KKvF bDt/rzk9+GMcmdSMD+VNcBzgezk2Znffhddefbfm7TexprMNppzCTHqAAzkp3L4Ec4p7 kwefwN86vecqDdy1Wbn+vYjUHiTCSlwGxeCVwAJB7ZwHdIOCRpeXlx+wtQm2nvbMR5br 2ycVg2MDkBFm7cBS1Gm71zIRe23ny0exiHDSzDNqW87brS++j+FjzVUGc93n6/KpU9r+ NA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mbffs9kdv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Dec 2022 22:37:37 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B8MbakC014164 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Dec 2022 22:37:36 GMT Received: from khsieh-linux1.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 8 Dec 2022 14:37:36 -0800 From: Kuogee Hsieh To: , , , , , , , , , , , , , , , CC: Kuogee Hsieh , , , , , Subject: [PATCH v11 4/5] drm/msm/dp: parser link-frequencies as property of dp_out endpoint Date: Thu, 8 Dec 2022 14:36:54 -0800 Message-ID: <1670539015-11808-5-git-send-email-quic_khsieh@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1670539015-11808-1-git-send-email-quic_khsieh@quicinc.com> References: <1670539015-11808-1-git-send-email-quic_khsieh@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: iyYsNdsfkbeS816WEhCXmVQO2YSorfbN X-Proofpoint-GUID: iyYsNdsfkbeS816WEhCXmVQO2YSorfbN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-08_12,2022-12-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212080186 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 Add capability to parser and retrieve max DP link supported rate from link-frequencies property of dp_out endpoint. Changes in v6: -- second patch after split parser patch into two patches Changes in v7: -- without checking cnt against DP_MAX_NUM_DP_LANES to retrieve link rate Changes in v9: -- separate parser link-frequencies out of data-lanes Changes in v10: -- add dp_parser_link_frequencies() Changes in v11: -- return 0 if(!endpoint) Signed-off-by: Kuogee Hsieh --- drivers/gpu/drm/msm/dp/dp_parser.c | 27 +++++++++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_parser.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index b5f7e70..9a7dcd4 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -91,6 +91,29 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) return 0; } +static u32 dp_parser_link_frequencies(struct device_node *of_node) +{ + struct device_node *endpoint; + u64 frequency = 0; + int cnt = 0; + + endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */ + if (!endpoint) + return 0; + + cnt = of_property_count_u64_elems(endpoint, "link-frequencies"); + + if (cnt > 0) + of_property_read_u64_index(endpoint, "link-frequencies", + cnt - 1, &frequency); + of_node_put(endpoint); + + frequency /= 10; /* from symbol rate to link rate */ + frequency /= 1000; /* kbytes */ + + return frequency; +} + static int dp_parser_misc(struct dp_parser *parser) { struct device_node *of_node = parser->pdev->dev.of_node; @@ -113,6 +136,10 @@ static int dp_parser_misc(struct dp_parser *parser) parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ } + parser->max_dp_link_rate = dp_parser_link_frequencies(of_node); + if (!parser->max_dp_link_rate) + parser->max_dp_link_rate = DP_LINK_RATE_HBR2; /* 540000 khz */ + return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 866c1a8..6b10c3e 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -15,6 +15,7 @@ #define DP_LABEL "MDSS DP DISPLAY" #define DP_MAX_PIXEL_CLK_KHZ 675000 #define DP_MAX_NUM_DP_LANES 4 +#define DP_LINK_RATE_HBR2 540000 /* khz */ enum dp_pm_type { DP_CORE_PM, @@ -119,6 +120,7 @@ struct dp_parser { struct dp_io io; struct dp_display_data disp_data; u32 max_dp_lanes; + u32 max_dp_link_rate; struct drm_bridge *next_bridge; int (*parse)(struct dp_parser *parser); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project