From patchwork Fri Nov 18 12:16:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalyan Thota X-Patchwork-Id: 22292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp160996wrr; Fri, 18 Nov 2022 04:18:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5KtptcH5juYPQKKwPEU00T7iUGqUrsEJCchBqI6/7D+jOVj4/BeIclT1WfzTj/UhA9kv2A X-Received: by 2002:a17:906:8314:b0:7ae:1063:55d3 with SMTP id j20-20020a170906831400b007ae106355d3mr5340062ejx.578.1668773893036; Fri, 18 Nov 2022 04:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668773893; cv=none; d=google.com; s=arc-20160816; b=0BF5K5kZ61V8XyCPtMVKIfZWQW3amwQ5edPV/AKYJ6Oehyzt4MxO7bqHrrAy+1cfAz keogBRv5VoieTD9TzkYDtQ6qV2k5ur+5574BTr3WU7aEQwqaFLsQv2VgLD9JGECStUcB GIJ/fcBIs3wJ7zvS1HKuDLe/wdM+JKIcGToy8ZubPkRipvkT5mJKxs4KtZQpr0mvhCWz nMuKzKi3diWtX6wHT0qE4qoR/haHoBWWnklindx/by6ZZ64Ayle8ww3FwOp3Qwf/RWXI /VkBVRxIYxhhOYHmkyTQLu2GB3xRcWiDbrpaReDbPgXHfBlw3jt6UhZVPG0rFtYW8mOR hW2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=uRp/u16xQYmKjhV+fe6yBaMSO+Uv2ElPDHphNubQ9dU=; b=KBC6T6R2HPX/hE5v5jEgm00y6s+pRwHWtcgzqyc5vvRg+yoJmsUGp3Jez8O4B2Wt33 NdKTpeCc3837YqR9wZre5ovLh8K7yH+YGWyjH76264zmPAIARiqtgLRecG+F6BiaoHHM zwB3mjYsUf+Su2wAXFOlhgxdDT+f3N62AVunsvAwaK1lWef2H2Vl6v2GpaEgvUZ/FaVp AVVOWS1rPryGJLBiSlDKVcBFd1zMS+KSUbJsTV0xur8krhVcYjNvubxKxBqTfkBTCZKB 8UE4m9fBcVkI/Ch09FEvtfniIQh3lm4Ws9ipjzeJEbPcYns76Gw0bzbq+1EfYXDq17pA fcYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="aNWd79/y"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh13-20020a170906da8d00b007adf38290f1si2987297ejb.642.2022.11.18.04.17.43; Fri, 18 Nov 2022 04:18:13 -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="aNWd79/y"; 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 S235387AbiKRMRP (ORCPT + 99 others); Fri, 18 Nov 2022 07:17:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240700AbiKRMRA (ORCPT ); Fri, 18 Nov 2022 07:17:00 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED23785ED8; Fri, 18 Nov 2022 04:16:59 -0800 (PST) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AIBlUJ6010324; Fri, 18 Nov 2022 12:16:56 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; s=qcppdkim1; bh=uRp/u16xQYmKjhV+fe6yBaMSO+Uv2ElPDHphNubQ9dU=; b=aNWd79/yJGl64fTYKNiTPiZCps7XLIyA80NpYjmfbgBMABP0+nnqI+szkpw3zeSijOsw ZpGwMcMWfiLdclhluPMIm76OPhVUw38YINtIKDxOO1lK6pu3QXJXHcdOCWTr7KnW/esP qkyGl4/Dm8UlSrgrfHmFQ80dlWH9SlYZGZ+tEdw3i/9a1sRWIy9RZL2uUaVnw5pBJosf xcNIHrjl1NiGFkzUhXjHKzi54tTkoyFuJgUvogGO2GogoAuAnZmbWMMP7oVLDswbWBdy eUMgvLncFruKPODZQ9lRlVA83TZrz5+J/VMZgZf2piR5uW85QZmjkCHyBIbT4V9ZL9hb Cw== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kx0s5hkte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Nov 2022 12:16:55 +0000 Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 2AICGoxX013697; Fri, 18 Nov 2022 12:16:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3kt4jkkc6q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 18 Nov 2022 12:16:52 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AICGphD013703; Fri, 18 Nov 2022 12:16:51 GMT Received: from kalyant-linux.qualcomm.com (kalyant-linux.qualcomm.com [10.204.66.210]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 2AICGpQM013698; Fri, 18 Nov 2022 12:16:51 +0000 Received: by kalyant-linux.qualcomm.com (Postfix, from userid 94428) id 76F4C2EA0; Fri, 18 Nov 2022 04:16:50 -0800 (PST) From: Kalyan Thota To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org Cc: Kalyan Thota , linux-kernel@vger.kernel.org, robdclark@chromium.org, dianders@chromium.org, swboyd@chromium.org, quic_vpolimer@quicinc.com, dmitry.baryshkov@linaro.org, quic_abhinavk@quicinc.com Subject: [PATCH v3 2/3] drm/msm/disp/dpu1: add helper to know if display is builtin Date: Fri, 18 Nov 2022 04:16:46 -0800 Message-Id: <1668773807-19598-3-git-send-email-quic_kalyant@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1668773807-19598-1-git-send-email-quic_kalyant@quicinc.com> References: <1668773807-19598-1-git-send-email-quic_kalyant@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: TLZvwzQ9bRuMumk0d1E-Zahh6G7PwSOa X-Proofpoint-ORIG-GUID: TLZvwzQ9bRuMumk0d1E-Zahh6G7PwSOa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-18_02,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=980 suspectscore=0 impostorscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211180073 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749836253687688633?= X-GMAIL-MSGID: =?utf-8?q?1749836253687688633?= Since DRM encoder type for few encoders can be similar (like eDP and DP) find out if the interface supports HPD from encoder bridge to differentiate between builtin and pluggable displays. Changes in v1: - add connector type in the disp_info (Dmitry) - add helper functions to know encoder type - update commit text reflecting the change Changes in v2: - avoid hardcode of connector type for DSI as it may not be true (Dmitry) - get the HPD information from encoder bridge Changes in v3: - use bridge type instead of bridge ops in determining connector (Dmitry) Signed-off-by: Kalyan Thota --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +++++++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 6 ++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 9c6817b..574f2b0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "msm_drv.h" #include "dpu_kms.h" @@ -217,6 +218,32 @@ static u32 dither_matrix[DITHER_MATRIX_SZ] = { 15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10 }; +bool dpu_encoder_is_builtin(struct drm_encoder *encoder) +{ + struct drm_bridge *bridge; + int ops = 0; + + if (!encoder) + return false; + + /* Get last bridge in the chain to determine connector type */ + drm_for_each_bridge_in_chain(encoder, bridge) + if (!drm_bridge_get_next_bridge(bridge)) + ops = bridge->type; + + switch (ops) { + case DRM_MODE_CONNECTOR_Unknown: + case DRM_MODE_CONNECTOR_LVDS: + case DRM_MODE_CONNECTOR_eDP: + case DRM_MODE_CONNECTOR_DSI: + case DRM_MODE_CONNECTOR_DPI: + case DRM_MODE_CONNECTOR_WRITEBACK: + case DRM_MODE_CONNECTOR_VIRTUAL: + return true; + default: + return false; + } +} bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index 9e7236e..7f3d823 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -224,4 +224,10 @@ void dpu_encoder_cleanup_wb_job(struct drm_encoder *drm_enc, */ bool dpu_encoder_is_valid_for_commit(struct drm_encoder *drm_enc); +/** + * dpu_encoder_is_builtin - find if the encoder is of type builtin + * @drm_enc: Pointer to previously created drm encoder structure + */ +bool dpu_encoder_is_builtin(struct drm_encoder *drm_enc); + #endif /* __DPU_ENCODER_H__ */