Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2502841rdh; Wed, 27 Sep 2023 04:53:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHILL9gjo/35Zf/G3m+8+tj/NuAAKI/DOgjwy66+xrHZgyjgi9SbngNJDKP0nVyjCGwHVz6 X-Received: by 2002:a67:f1cd:0:b0:452:78ea:4aec with SMTP id v13-20020a67f1cd000000b0045278ea4aecmr1392747vsm.7.1695815630267; Wed, 27 Sep 2023 04:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695815630; cv=none; d=google.com; s=arc-20160816; b=KgdrucB+oXqCl+CYmnevrvBtWiyVDNhKL8fWABW3MW8MI8vpYquQDY1hcX4gBvta5M oIx95P7uEVGaBgMp4wDUQD3A5ciRoIYY2BLUJqQ1cYf/xh0Z/zJeY4vlRIart7bKJMOt 9+3qqbqFpvfTqFxvsKYP8UqxJV591wO22YrRsR8lourP58guh46WMzHXpKYvClRD96FQ EbBOfBxwEvaqBKcQtqLOZDfiLhv6k3kPZwDOl4faE4BFxvcdYYINAUGGHtDdGcFBkmBg XfM5CFse3pATymdBd4DUffejZIG7wKIBjei+O4LEL5oYXM/afEkvKUJd+YanTxXPPC0f p9Ng== 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:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=reKC2lncflXlivP867wyiQVWw8/lbnC8YsCB44YSpLA=; fh=5FYwfyUY4KkLxFnJ8fFbNR6XUSZXr7+ygCf6rk38b/M=; b=zv7HdQzcao6JGOmt4+xfielDqdPRVkkLdDr0QQmouZmr6Ciz6xYoTfgsaRu8LQnriY OAjQ1kFi3Keje8PkvY7WqNtxVFGhmx10yvgMQ7541z6Q1uJG154rSiiTCfzMU3AoYXxi ZiMCHCGK3KWeXYSdj0L+Qt8rqQOt42C+2ugTgqoGl4rmj7sZi79Dq8rJCEGEpw/d6Fp7 M4mgC0/s0KQYp1K/tb1gW1tsg4c2urwvT8vqRzSSFg+bgwChgoDS8uYz6VSm4OoyjzqA cczD501xlinIWgTLetdSOWhGuZJpkB1+eA5mGtlxVUwp2ppHl9Mlx/j9/RtDCAKyZqPh bM5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bu18-20020a632952000000b005819be28987si9009719pgb.346.2023.09.27.04.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 04:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1CDD98023913; Wed, 27 Sep 2023 04:42:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbjI0Lme (ORCPT + 99 others); Wed, 27 Sep 2023 07:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbjI0Lma (ORCPT ); Wed, 27 Sep 2023 07:42:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07929F3; Wed, 27 Sep 2023 04:42:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68382C433CA; Wed, 27 Sep 2023 11:42:26 +0000 (UTC) Message-ID: Date: Wed, 27 Sep 2023 13:42:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH v6 17/17] media: qcom: camss: Comment CSID dt_id field Content-Language: en-US, nl To: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, rfoss@kernel.org, todor.too@gmail.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-kernel@vger.kernel.org References: <20230925154707.837542-1-bryan.odonoghue@linaro.org> <20230925154707.837542-18-bryan.odonoghue@linaro.org> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B4UOle6ZHg02+I8tZicjzj5+yffv1lB5A1btG+AmoZrgf0X2O1B96fqgHx8w9PIpVERN YsmkfxvhfP3MO3oHh8UY1OLKdlKamMneCLk2up1Zlli347KMjHAVjBAiy8qOguKF9k7HOjif JCLYTkggrRiEiE1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85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: <20230925154707.837542-18-bryan.odonoghue@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 04:42:40 -0700 (PDT) On 25/09/2023 17:47, Bryan O'Donoghue wrote: > Digging into the documentation we find that the DT_ID bitfield is used to > map the six bit DT to a two bit ID code. This value is concatenated to the > VC bitfield to create a CID value. DT_ID is the two least significant bits > of CID and VC the most significant bits. > > Originally we set dt_id = vc * 4 in and then subsequently set dt_id = vc. > > commit 3c4ed72a16bc ("media: camss: sm8250: Virtual channels for CSID") > silently fixed the multiplication by four which would give a better > value for the generated CID without mentioning what was being done or why. > > Next up I haplessly changed the value back to "dt_id = vc * 4" since there > didn't appear to be any logic behind it. > > Hans asked what the change was for and I honestly couldn't remember the > provenance of it, so I dug in. > > Link: https://lore.kernel.org/linux-arm-msm/edd4bf9b-0e1b-883c-1a4d-50f4102c3924@xs4all.nl/ > > Add a comment so the next hapless programmer doesn't make this same > mistake. > > Signed-off-by: Bryan O'Donoghue > --- > drivers/media/platform/qcom/camss/camss-csid-gen2.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c > index 6ba2b10326444..791f27b18c394 100644 > --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c > +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c > @@ -352,6 +352,18 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) > phy_sel = csid->phy.csiphy_id; > > if (enable) { > + /* > + * DT_ID is a two bit bitfield that is concatenated with > + * the four least significant bits of the six bit VC > + * bitfield to generate an internal CID value. > + * > + * CSID_RDI_CFG0(vc) > + * DT_ID : 28:27 > + * VC : 26:22 This is 5 bits, not 6 bits as the comment above says. Which is right? > + * DT : 21:16 > + * > + * CID : VC 3:0 << 2 | DT_ID 1:0 > + */ > u8 dt_id = vc; So if dt_id is 2 bits, and vc can be more than 2 bits in the future, shouldn't this read "vc & 3"? Regards, Hans > > if (tg->enabled) {