Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1171683rdh; Mon, 25 Sep 2023 05:32:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1gdn6YGEUdKaUgti9ktYlHhWi6l+U5PEzCQTp/KAanPDkyYex8TvG+IGRxkgBLkeLixEW X-Received: by 2002:a05:6871:454:b0:1db:f454:7d66 with SMTP id e20-20020a056871045400b001dbf4547d66mr8615223oag.30.1695645145021; Mon, 25 Sep 2023 05:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695645144; cv=none; d=google.com; s=arc-20160816; b=grDDsKT9SeiEFlpvVdnIp2hy7PXRtnl++4ttBCm+eGp5km9Ur7B3MkDZ3zuAkEv1PA oyylMDXm62F7WOnXZVu1dvHDJMYi2iv5kKDx8S3q6K13a3fGklXXxurM9lGr9fe6AOmV 26FNHJCDdg7j5QV6yjzChYeMYedlVaNaIuqAXiWuVjFLVCykhrD0In1LPBJXtpmhFtkl y5VPLuSg6YV+yGYPdSJQamXZXLwT/2gJ22s3wiqCYDpgKpovAeRFE4Ql7obzm59H8U4A eJkmMmESPdznlupaqZl2bmjGEzRrrLqvt73Wx2LFRWQ4CTNPQnYqB5XfZx0RkTkeQpH3 TFhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PSJbxCivBERsxJ1gn2F9Y4QItmR5KfwVZ1fNzThtEZc=; fh=7iSfjgUe4mGIisMljdIinyDgaCG3ExsJ9vK4HE7Npv4=; b=NiIgHQ4nlpb6y0d0W/UVUtE1bchYRuOdbEF0AJkLxYPpoIQ6WUh67n509wLN5Ix7Z9 3JtglavwIb3oOw+9E9hQUgGHIHTDraMmCWpt5yynWHzorqpX2H2tqifEEdi8qnYwtk5e kfjruSm4oBhLDKFQ4FTqMPlc10teRp1n44LeDpQgjda2E3JmZE1R7eA2QQsQzwLBoYyN CDL5su7Y6xX+z7aWfYj2vhsqEo7o0c2nRQdLOZHzl6NBWU3jImV34j/et/54X7hRPsRj trHV0oZpUtJUmTYJDx+JvbGvQwAg6q0gK0siZbNFms49im+G6lg+gd82c9dEd2Zv5h9j D04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HpIdGXb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id u14-20020a63f64e000000b005653283b8a4si10428453pgj.785.2023.09.25.05.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HpIdGXb5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0139D807CF73; Mon, 25 Sep 2023 01:16:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232947AbjIYIPj (ORCPT + 99 others); Mon, 25 Sep 2023 04:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbjIYIPR (ORCPT ); Mon, 25 Sep 2023 04:15:17 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ACECE6B; Mon, 25 Sep 2023 01:14:43 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 78D0013C5; Mon, 25 Sep 2023 10:13:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695629581; bh=UayU5lkKf30RwZHdj36MVC/jnuYHI1+ittUZYokTGlU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HpIdGXb5Nz4TdNxofbbT8FN6Jtz+yOCoi/j+Js7k7YjqS3LXuzZxG5hUrSj/QpjNr YQyDuokVLHdMpBXcPrY9SMjvrqxoNOoS0hqdfkotQv1NwhUbwL2hmY8IvJ3T1Jb55P J5vcoOPtDQuFO5D5Nz4koSR1yaIG7PZSxOJioyOg= Date: Mon, 25 Sep 2023 11:14:52 +0300 From: Laurent Pinchart To: Hans Verkuil Cc: Bryan O'Donoghue , 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, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 17/17] media: qcom: camss: Comment CSID dt_id field Message-ID: <20230925081452.GA8583@pendragon.ideasonboard.com> References: <20230911131411.196033-1-bryan.odonoghue@linaro.org> <20230911131411.196033-18-bryan.odonoghue@linaro.org> <1e815d41-719a-4ca1-98e3-872f882ed03e@xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1e815d41-719a-4ca1-98e3-872f882ed03e@xs4all.nl> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 01:16:25 -0700 (PDT) On Mon, Sep 25, 2023 at 09:11:52AM +0200, Hans Verkuil wrote: > On 11/09/2023 15:14, 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 | 5 +++++ > > 1 file changed, 5 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..cee50fc87e9de 100644 > > --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c > > +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c > > @@ -352,6 +352,11 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) > > phy_sel = csid->phy.csiphy_id; > > > > if (enable) { > > + /* > > + * A value caled 'CID' gets generated internal to CAMSS logic > > caled -> called > > > + * which is a concatenation of [vc:6 | dt_id:2] hence we reuse > > vc:6? Do you mean bit 6 or do you mean the least significant 6 bits? > > Regardless, since the vc variable <= 3 (since MSM_CSID_MAX_SRC_STREAMS is 4), > either interpretation makes little sense. More recent versions of CSI-2 support up to 6 bits of VC (or possibly even more in versions I may not know about). It would probably make sense to write vc[5:0] | dt_id[1:0] or something similar. > And what does "DT" stand for? Data Type. > > + * the least significant two bits of the VC to 'stuff' the CID value. > > + */ > > u8 dt_id = vc; > > If dt_id should be the least significant two bits of vc, shouldn't > this say: "= vc & 3;"? Or, alternatively, have a comment that vc <= 3? > > > > > if (tg->enabled) { -- Regards, Laurent Pinchart