From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6CB1C001B2 for ; Fri, 16 Dec 2022 19:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbiLPTqk (ORCPT ); Fri, 16 Dec 2022 14:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231994AbiLPTqj (ORCPT ); Fri, 16 Dec 2022 14:46:39 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFABF11839 for ; Fri, 16 Dec 2022 11:46:37 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id b3so5034161lfv.2 for ; Fri, 16 Dec 2022 11:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4tu904MKHl4wlHKTZTyOl2mc2CnxBACoWjclSh2uBUU=; b=mlxkDAyQtKgDDQHCxiGBylV5M8jE6Y2EUKneYivBKiBAkYxKtUdSFMV6q4inN0WS4k wvRNf46MJ4V2YzvgMq/MEW8u9jAZpG06DlFa+aLLfHxR1hNT4uqpqsbl4yopwqyVUM00 omfFYKf2iVG6NyPpk1J1g8NJfcTgxfvb4M5q7fgMNVgCxcfBk7NO6f1jpaWOIqmJzB27 n76xsjSQVt3/2j3fAy49c0GymMaJFvBCzmmQdHrU9iHfTap16V6Q+CatNEffN7cWB6qM 7EikkHTMsmlLei9B0FoWlb2bf8BW5SXWYHGwoklmgOuq6Ua0c6pkXZ0gjS2kJgNDaYaB XMTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4tu904MKHl4wlHKTZTyOl2mc2CnxBACoWjclSh2uBUU=; b=qEqRaw8tj6PJxsyZ3Mc76bXFC05qbdfh0kWNFrSXKzc+p6q2tmvg2HvvAGF3kbDn2u Xvb7UHMhMI7w8bdJ5xp/HbQODcE1EZ83Yp4vCqzUgzOD1XI/bZKAfvYq9fCgQISLpcQB KLwXLPEM+IrPNfac5kxatmUm/j0h+1rh4W66bNcfXC5RCkd2i1I8FYxDvHla8X0Z8yNB 2OZJrz72MdbIfn/BT4JzeKSew9szo02CN8vSQRcVog/mBaQq3Qb+afoMFvQI18Q8L1EZ cUrq12kOHYEEGwXI97QFiIxTA4js7thOUo4n3p+fxEXNghv8JRBdYNeGyeeJ+8DHMDXY dUIA== X-Gm-Message-State: ANoB5pkGVfsw0Ar3fc6vAG798R3cUTBgKIYGoznqkN9i3pxGky7yRgU7 EVigMzYBNBEo03rU99T3WtX/oA== X-Google-Smtp-Source: AA0mqf5lUG97cEpxdK/0zmN3VLq6wwUkQGiOk1cz8eYzEKl6ZpaDwTMCX83ITUPLsAq/RJ9UEGt/8Q== X-Received: by 2002:a05:6512:39c2:b0:4b4:e4a1:2fc6 with SMTP id k2-20020a05651239c200b004b4e4a12fc6mr10880035lfu.68.1671219996137; Fri, 16 Dec 2022 11:46:36 -0800 (PST) Received: from ?IPV6:2001:14ba:a085:4d00::8a5? (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id c20-20020ac25f74000000b004b6e157d326sm294500lfc.168.2022.12.16.11.46.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 11:46:35 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2022 21:46:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v14 3/5] drm/msm/dp: parse data-lanes as property of dp_out endpoint Content-Language: en-GB To: Kuogee Hsieh , dri-devel@lists.freedesktop.org, robdclark@gmail.com, sean@poorly.run, swboyd@chromium.org, dianders@chromium.org, vkoul@kernel.org, daniel@ffwll.ch, agross@kernel.org, andersson@kernel.org, konrad.dybcio@somainline.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org, airlied@gmail.com Cc: quic_abhinavk@quicinc.com, quic_sbillaka@quicinc.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1671217893-17496-1-git-send-email-quic_khsieh@quicinc.com> <1671217893-17496-4-git-send-email-quic_khsieh@quicinc.com> From: Dmitry Baryshkov In-Reply-To: <1671217893-17496-4-git-send-email-quic_khsieh@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 16/12/2022 21:11, Kuogee Hsieh wrote: > Add capability to parser data-lanes as property of dp_out endpoint. > Also retain the original capability to parser data-lanes as property > of mdss_dp node to handle legacy case. > > Changes in v6: > -- first patch after split parser patch into two > > Changes in v7: > -- check "data-lanes" from endpoint first > > Changes in v14: > -- replace "parser" with "parse" at commit subject > -- add matching brackets at dp_parser_misc() > > Signed-off-by: Kuogee Hsieh > Reviewed-by: Dmitry Baryshkov > --- > drivers/gpu/drm/msm/dp/dp_parser.c | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c > index dd73221..d42987a 100644 > --- a/drivers/gpu/drm/msm/dp/dp_parser.c > +++ b/drivers/gpu/drm/msm/dp/dp_parser.c > @@ -94,16 +94,25 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) > static int dp_parser_misc(struct dp_parser *parser) > { > struct device_node *of_node = parser->pdev->dev.of_node; > - int len; > - > - len = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); > - if (len < 0) { > - DRM_WARN("Invalid property \"data-lanes\", default max DP lanes = %d\n", > - DP_MAX_NUM_DP_LANES); > - len = DP_MAX_NUM_DP_LANES; > + int cnt; > + > + /* > + * data-lanes is the property of dp_out endpoint > + */ > + cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES); > + if (cnt > 0) { > + parser->max_dp_lanes = cnt; > + } else { > + /* > + * legacy code, data-lanes is the property of mdss_dp node > + */ > + cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES); > + if (cnt > 0) > + parser->max_dp_lanes = cnt; > + else > + parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */ This bugged me for some time. I think the following piece of code is easier to understand and handle: cnt = drm_of_get_data_lanes_count_ep(...); /* legacy, data-lanes property of the mdss_dp node */ if (cnt < 0) cnt = drm_of_get_data_lanes_count(.....); if (cnt > 0) parser->max_dp_lanes = cnt; else parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; > } > > - parser->max_dp_lanes = len; > return 0; > } > -- With best wishes Dmitry