Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1153961pxa; Sat, 1 Aug 2020 20:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuU5DxF4HA6FqTzEYY+gYi8wfzXRJ6lPvpDdqoJHHAkG3OtSUdiaTg1tZ83PZlAiKkNnr7 X-Received: by 2002:a05:6402:10cc:: with SMTP id p12mr7033491edu.117.1596337956421; Sat, 01 Aug 2020 20:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596337956; cv=none; d=google.com; s=arc-20160816; b=YZ9lWVf6gcZg9QS9nvwHBn1ITTK8mgdC8cU18/2O4bWRrEKLVoRd5m75wkR5E9WKmA 4Vf3rFiVlbSAAhSTCqG1IehkypyXYhPd1CjQwK0jcDJsgcfG+RXA82/apz3TM5f0nHal IqHHzzAb9uqTpaqpOaYR8V6FtmCwq3XCUIzEWYANR5LfsTJHW3KFc0HDfxM08dXlTnNW kfsxDqJ34/yZtn2WkWuCmzvM1UCZ/kxXDJLbGiIHP/dDKqzw0KO0IEvup2g3DckI1Dvz CbEJjjdENHBwpjAdP1wJOOwf6EAYWzLjJ4otVreezz37Cc+zGGcRdSK6YG+DX9Nik/ZW NfsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=D6AtGQouSaqNf4Vvq8rYuoKNvXjyFn4xt1eQuufj4sE=; b=kHFTcnQBq/UeIP4rNzp6dURthM0zyYlOOc7ehHERG+U3ZHtUdjIckRBbjdNE+Iby/b BBlHuL23cOBuXxpQV8nJ1FS6IBkLuQBdKvH4wU+iZ1SR7XoKM04oO/qzo7qQga1rkjQZ d4mmipB7ZhduS2KS0gV3yUWRrvn9i3iG5JttWXYy3I6aBQhd3xNXIlvaFhab/BpXL20Y v8KR8bgCsIyA/fEkYFlI96RAJ0jfQ+pE+6A5tXBEqR+7pqb+pYf1PhA25MtHHkuMR4kE w9QD/ypzX7oKV+FirnH1Ot1ms5bjJBwoGIIxTRRdEq3c2QcfsY04S/+QBvOLjd0+pMle FQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SmpfRrTq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr2si7944393ejb.439.2020.08.01.20.12.14; Sat, 01 Aug 2020 20:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SmpfRrTq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727058AbgHBDCs (ORCPT + 99 others); Sat, 1 Aug 2020 23:02:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:42820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725883AbgHBDCs (ORCPT ); Sat, 1 Aug 2020 23:02:48 -0400 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 765EC2080C for ; Sun, 2 Aug 2020 03:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596337367; bh=69kZjUSWNDziqCdzHTUc/4mOGEuEQGCa68+3zSX0jzA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SmpfRrTqdw7ywZ7jaI8zkGknqoIz3Z+lsCw+09LoYxUbxA8u697/wKTfJYsUscfI7 ZvfWIuoCJ/7PMpR9eZBmFy3ouzl0V2QHhQOTMrLMW8plbtkUUBn+EFuR1KXV6kFPQ4 Jyd/LDpSM9vxF2InbTRM/zoja6e78/kMuIxIzdBo= Received: by mail-ed1-f53.google.com with SMTP id c15so15253241edj.3 for ; Sat, 01 Aug 2020 20:02:47 -0700 (PDT) X-Gm-Message-State: AOAM531L+EeqxudL76nRdOwbJ/UABRNKUas9C6dIxs57QaT2JLD/G84U cS7Lybx8kQ4MXJBknUZoZchQr3Uh5C2gybLlDg== X-Received: by 2002:a50:9e6f:: with SMTP id z102mr10521268ede.300.1596337365962; Sat, 01 Aug 2020 20:02:45 -0700 (PDT) MIME-Version: 1.0 References: <20200728111800.77641-1-frank-w@public-files.de> <20200728111800.77641-4-frank-w@public-files.de> In-Reply-To: <20200728111800.77641-4-frank-w@public-files.de> From: Chun-Kuang Hu Date: Sun, 2 Aug 2020 11:02:33 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/5] drm: Add get_possible_crtc API for dpi, dsi To: Frank Wunderlich Cc: "moderated list:ARM/Mediatek SoC support" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , DRI Development , Linux ARM , linux-kernel , Stu Hsieh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Frank: Frank Wunderlich =E6=96=BC 2020=E5=B9=B47=E6=9C= =8828=E6=97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8B=E5=8D=887:18=E5=AF=AB=E9=81=93= =EF=BC=9A > Describe why need this patch. I think the reason is: For current mediatek dsi encoder, its possible crtc is fixed in crtc 0, and mediatek dpi encoder's possible crtc is fixed in crtc 1. In some SoC the possible crtc is not fixed in this case, so search pipeline information to find out the correct possible crtc. > From: Stu Hsieh > > Test: build pass and run ok > > Signed-off-by: Stu Hsieh Need your signed-off-by tag. > --- > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 42 +++++++++++++++++++++ > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 + > 2 files changed, 44 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/dr= m/mediatek/mtk_drm_ddp_comp.c > index 57c88de9a329..a5f2ff6bea93 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c > @@ -13,6 +13,8 @@ > #include > #include > #include > +#include > + > #include "mtk_drm_drv.h" > #include "mtk_drm_plane.h" > #include "mtk_drm_ddp_comp.h" > @@ -412,6 +414,22 @@ static const struct mtk_ddp_comp_match mtk_ddp_match= es[DDP_COMPONENT_ID_MAX] =3D { > [DDP_COMPONENT_WDMA1] =3D { MTK_DISP_WDMA, 1, NULL }, > }; > > +static bool mtk_drm_find_comp_in_ddp(struct mtk_ddp_comp ddp_comp, > + const enum mtk_ddp_comp_id *path= , > + unsigned int path_len) > +{ > + unsigned int i; > + > + if (path =3D=3D NULL) > + return false; This checking is redundant, so remove it. > + > + for (i =3D 0U; i < path_len; i++) > + if (ddp_comp.id =3D=3D path[i]) > + return true; > + > + return false; > +} > + > int mtk_ddp_comp_get_id(struct device_node *node, > enum mtk_ddp_comp_type comp_type) > { > @@ -427,6 +445,30 @@ int mtk_ddp_comp_get_id(struct device_node *node, > return -EINVAL; > } > > +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, > + struct mtk_ddp_comp ddp_c= omp) > +{ > + struct mtk_drm_private *private =3D drm->dev_private; > + unsigned int ret; > + > + if (mtk_drm_find_comp_in_ddp(ddp_comp, private->data->main_path, > + private->data->main_len) =3D=3D true) { ' =3D=3D true' is redundant, so remove it. > + ret =3D BIT(0); > + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, > + private->data->ext_path, > + private->data->ext_len) =3D=3D true) { Ditto. > + ret =3D BIT(1); > + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, > + private->data->third_path, > + private->data->third_len) =3D=3D true) { Ditto. > + ret =3D BIT(2); > + } else { > + DRM_INFO("Failed to find comp in ddp table\n"); > + ret =3D 0; > + } > + return ret; > +} > + > int mtk_ddp_comp_init(struct device *dev, struct device_node *node, > struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id com= p_id, > const struct mtk_ddp_comp_funcs *funcs) > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/dr= m/mediatek/mtk_drm_ddp_comp.h > index debe36395fe7..1d9e00b69462 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h > @@ -202,6 +202,8 @@ static inline void mtk_ddp_ctm_set(struct mtk_ddp_com= p *comp, > > int mtk_ddp_comp_get_id(struct device_node *node, > enum mtk_ddp_comp_type comp_type); > +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, > + struct mtk_ddp_comp ddp_c= omp); > int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node, > struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id com= p_id, > const struct mtk_ddp_comp_funcs *funcs); > -- > 2.25.1 >