Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp774321rwb; Wed, 16 Nov 2022 07:30:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6G0Xj88rMGyBbf2hkWQZvUdjHfVDlKVMcEIb98+coOmXbqtXH0/Q5hvNyH6FbjnqUEuDqv X-Received: by 2002:a17:902:a5c6:b0:179:e1f6:d24d with SMTP id t6-20020a170902a5c600b00179e1f6d24dmr9381397plq.91.1668612656990; Wed, 16 Nov 2022 07:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668612656; cv=none; d=google.com; s=arc-20160816; b=o9ua9WZJgtGFC2RfuMuuNyyrs93S7pzON934jtZQwRy13+37bp+kWsmgFJ8CpSALTf P3Vm2OgEdvqwn30mjMOqLNGN1G/sWJ/R9+KQA+ACUPkg11rFgF3lvHNutHje7RQ0cf18 MCHV/aixFKTtqzE2v6k/Vr4hEFOf0i0paVZ4TfaCMrwz26aTE/Icxdjc0XPnT4JayDQv rWeo89mUGBNj0Katfun9SIaURyOceFH5S2oXkmG32Q+dCRwEG/kgQIuQ3KcpNogYKI4p DPvNCyY3LHLZNnI0/n9GjXxSzC9ExFK+R4gwlH+lH0/x3dwvgz22AqRWTbY5udd5SL2W ccSg== 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:dkim-signature; bh=pIhDvtdkQeKfm95d4eKSzt0UrUR7I+3ffypY3ZTOQ4g=; b=xfQMTP3yaF2Y+XrzfU4rEGm77ssJKZqu11FAzDKLQ+Z/GA1MmKa83zcbr9NNkFMrm6 MTf0rBE4u8Gjjf1Mxo6N7UlrjDLroNkWZSg/56qxgXlbsdd52K9YkLDOwxt6qfkPaWmN n3n5likOq7fUwy2KK6JunlN8VPg6DmcEihTvm8XwE09p5hWnkSV9Y2d0IpVs5V3fsDes ARQEkqyaIwXb9UjO51Eq1FqwkUyrwMW1c4z+UhzmtMEFBs04MXvxQXR4vr0ZocLW9uJ8 vbaTJVBDsftKqg5CT9HuXupB5WNr7QoBSMUcaQ4wDaj7LqcMNsvCdhw5b1FNVwkPPQ0C p1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LJoG9sep; 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 s12-20020aa78bcc000000b00562f2ff1579si13966319pfd.60.2022.11.16.07.30.44; Wed, 16 Nov 2022 07:30:56 -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=LJoG9sep; 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 S231777AbiKPPLd (ORCPT + 91 others); Wed, 16 Nov 2022 10:11:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiKPPLb (ORCPT ); Wed, 16 Nov 2022 10:11:31 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2CA43AE9; Wed, 16 Nov 2022 07:11:30 -0800 (PST) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AGEneeX005649; Wed, 16 Nov 2022 15:11:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=pIhDvtdkQeKfm95d4eKSzt0UrUR7I+3ffypY3ZTOQ4g=; b=LJoG9sepYOAXCfCEtp0040/XH84kCeyHBSNmoKTwqPGF286zqsxVM4ocOzF/T61JrmOj Dd9la9T9lcM7o7h3iOmV4aBDGf4/n4sg0S33xAcc7MoIdNXgj3i7Tm6KVgorOJULDKfJ XQfGQ4BSKPRZytag/LPew2t7WdiIZIXaSoI2NwALCA5UGaXumaBNHKIHFrtxUtWRoHBi 6mVdKF3IlCZ75geiLefSo2ovkfCGJAnkvhixGJE4wxQU9frlNFGigYEvGZfQfS9OzyJz FjMgN+BjpTNUICOC6OaQti1s/7riArDbcPaMnxKM4ho4f9BPYYXk2LbiyhfLpxL+nKqh vw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kvyh2gb4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 15:11:26 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2AGFBOhL019728 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 15:11:24 GMT Received: from [10.216.25.63] (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.29; Wed, 16 Nov 2022 07:11:20 -0800 Message-ID: <6b1907db-3fdb-8fe0-e5e3-21ea17021925@quicinc.com> Date: Wed, 16 Nov 2022 07:11:16 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v2 2/3] drm/msm/disp/dpu1: add helper to know if display is pluggable Content-Language: en-US To: Dmitry Baryshkov , Kalyan Thota , , , , CC: , , , , References: <1668609040-2549-1-git-send-email-quic_kalyant@quicinc.com> <1668609040-2549-3-git-send-email-quic_kalyant@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-GUID: D7LkRPspLYV_7_l_M4Das6kBg83zrcoa X-Proofpoint-ORIG-GUID: D7LkRPspLYV_7_l_M4Das6kBg83zrcoa 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-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 bulkscore=0 clxscore=1011 mlxscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160106 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 On 11/16/2022 7:08 AM, Dmitry Baryshkov wrote: > On 16/11/2022 17:30, Kalyan Thota wrote: >> 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 >> >> Signed-off-by: Kalyan Thota >> --- >>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 16 ++++++++++++++++ >>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++++++ >>   2 files changed, 22 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..be93269 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,21 @@ 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_pluggable(struct drm_encoder *encoder) >> +{ >> +    struct drm_bridge *bridge; >> +    int ops = 0; >> + >> +    if (!encoder) >> +        return false; >> + >> +    /* Get last bridge in the chain to determine pluggable state */ >> +    drm_for_each_bridge_in_chain(encoder, bridge) >> +        if (!drm_bridge_get_next_bridge(bridge)) >> +            ops = bridge->ops; >> + >> +    return ops & DRM_BRIDGE_OP_HPD; > > No. This is not what you should be checking (hint: polled connectors > also can be pluggable). > > Please check the type of the actual connector connected to this encoder. > Even if we check the connector type as DSI or eDP that does not necessarily mean its built-in. We can even use DSI or eDP as a pluggable display. Thats why we thought of this check. >> +} >>   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..691ab57 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_pluggable - find if the encoder is of type pluggable >> + * @drm_enc:    Pointer to previously created drm encoder structure >> + */ >> +bool dpu_encoder_is_pluggable(struct drm_encoder *drm_enc); >> + >>   #endif /* __DPU_ENCODER_H__ */ >