Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3374722rdh; Thu, 28 Sep 2023 09:45:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFX8J9kxLP5pKMPBcPeOLRYRHQ7HLwkwV+i157lNurRYCLyh1OKug+zF/GZ1K7AF5JfOvh2 X-Received: by 2002:a17:90a:7525:b0:26b:219f:3399 with SMTP id q34-20020a17090a752500b0026b219f3399mr1544563pjk.35.1695919536729; Thu, 28 Sep 2023 09:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695919536; cv=none; d=google.com; s=arc-20160816; b=LOBEA2FeSlzhWEsC+0MJXGj39bj3tUfhm6bS7oRXI00tXnbhySDPoOeblZP2RtktVj ZGLMsqMoWk8haMzubYG4uCzxZjM7s+RtBRNiT5SLuqhOX7SrJJgdLjhCoBNVtkEDhlx2 b3umL1UzxCSIL/t2YzixblbkTbyolienQd3Mp2bWxBM8l3JobHEPrWuVc88WGp4ljMvY tH2NYNL8OQiRyWtwSf4OizbOZpok0LS4mHy2mWQF+cF3hgzZF+euopxYyOa73MYgBunf V76xyE/Y6GVZa5p2Wj4TjJdhK5lVWpLbBuGlF9j3lR/K675q4vE+mtxOTTXbD3iUpbGA SQwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6jBieT6zUjTCyWMNhIJcWnE9xtuerzKjzThbkTJLWlo=; fh=YrDxnoZE2zu1w4A5O/pMyb6W2NB5EAkKDOR3m7KPwy0=; b=UU6WJz74NUe36GXhavYM9HV3mxuQJGpExmd1OFHMXWF83fcw9Dnzc5sU0AaUimu3Au 34+Mxn7gTGKvqg6MWzMBghODJkm3kzM0RmEAjdEX8uzTRF/dxBZG5a6Mm+qzBcxED/iD I6IJtFa2rg6RKTie7a4pKujSDQ+23f5lHlJouvf0ZqcVSRYI+W0X34PrJSq3Zlw6FWYK mcEg4sWXtQ7RR6QtBbX9bWfw/aK1wHiH/bxaiqGcJU0HGtbl+S28E6Ke2VW3kMUV6GxB CIzbAhdwC3ip5v8wCPP+4Xk52ayDaXdEzxIWICp7Q+x+PY/NGUSQyUnEVbfF7bf6poCY cHvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HkobCTq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id mi2-20020a17090b4b4200b00276b87c8b8esi8934617pjb.59.2023.09.28.09.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 09:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HkobCTq6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D2CA880657C2; Wed, 27 Sep 2023 17:58:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbjI1A6t (ORCPT + 99 others); Wed, 27 Sep 2023 20:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbjI1A6s (ORCPT ); Wed, 27 Sep 2023 20:58:48 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B46BF for ; Wed, 27 Sep 2023 17:58:46 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-405524e6769so64665715e9.1 for ; Wed, 27 Sep 2023 17:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695862725; x=1696467525; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6jBieT6zUjTCyWMNhIJcWnE9xtuerzKjzThbkTJLWlo=; b=HkobCTq6/HD91PNS1jjnXl0+aO0CPzLkFUWJxDQQtUZ/P/3PaGyEFOGeinRY4x9IW1 n3PVSschWd5+r1CmtOtwAkrNiMRoiTa2ddbnsKy/zqS4dgc4kHzqSXYW9SMoVQP946V6 UpIXm6omO1jfdGVNBzavCaotsc743YSap1DGYRXB9u9cf0DJBA06KECIBliEBzkVbOwP GpKFu7Hs1dgOIqXVbO1m4wL7bqzArlWu6g6T4ozO4JMSiX5zt3HV3zsHRM31DDBO6Fe5 zzsTzwhkgWodlQYnGtvj9PmFUjNgo0njzVtzPRhCuc78ibpuXqxXHY4gWjNZizlBZTgu UASg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695862725; x=1696467525; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6jBieT6zUjTCyWMNhIJcWnE9xtuerzKjzThbkTJLWlo=; b=KQ3/g9gXkBgargTomfVVVWi2DOk1BxzekCDRxq+trdf6MznuDLkSlVyP+x53qnN5Wq N+bPxW7RDdDVFq2GA/BB/Ucv/5UHg9r3iV5p2Bj+VBJ0PwaC1IWCLNnUmB/qYIhfjRfT 4M31qptLezIv3aRjJczAWDeS7M1MAarsvHY9QLgggTH9VWVqjzOtsntIL5IB8M3Wv8m0 8uVQW/Eg4aRZTwac5NrqBEP16gtECUc42V7OwGIIt/wNak5RB5DbdglEHnphIW597Ldg NRiIulXbwVkhsdje3Q8IZWIV/i/pLXFKvRy3ft1k+EWUHiH5ePN1FHh54FemlxuZMr+Y KDDw== X-Gm-Message-State: AOJu0YwoTMTcCj9mzMM/tbk9eT60Dv+rRKf+U/UTd6cpaSsI0+6sECmL 0LSlC26p5Lsvi8MKhMpKL/2K6A== X-Received: by 2002:a05:600c:6012:b0:406:51a0:17ea with SMTP id az18-20020a05600c601200b0040651a017eamr54217wmb.10.1695862725175; Wed, 27 Sep 2023 17:58:45 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id v21-20020a7bcb55000000b00404719b05b5sm18789086wmj.27.2023.09.27.17.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 17:58:44 -0700 (PDT) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, hverkuil@xs4all.nl, 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, Bryan O'Donoghue Subject: [PATCH v6.1] media: qcom: camss: Comment CSID dt_id field Date: Thu, 28 Sep 2023 01:58:25 +0100 Message-ID: <20230928005825.1626251-1-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <314cee42-c235-4d2a-b4a6-4da92d2c1548@xs4all.nl> References: <314cee42-c235-4d2a-b4a6-4da92d2c1548@xs4all.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 17:58:53 -0700 (PDT) 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 --- .../media/platform/qcom/camss/camss-csid-gen2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c index 6ba2b10326444..05ff5fa8095a8 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -352,7 +352,19 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) phy_sel = csid->phy.csiphy_id; if (enable) { - u8 dt_id = vc; + /* + * DT_ID is a two bit bitfield that is concatenated with + * the four least significant bits of the five bit VC + * bitfield to generate an internal CID value. + * + * CSID_RDI_CFG0(vc) + * DT_ID : 28:27 + * VC : 26:22 + * DT : 21:16 + * + * CID : VC 3:0 << 2 | DT_ID 1:0 + */ + u8 dt_id = vc & 0x03; if (tg->enabled) { /* configure one DT, infinite frames */ -- 2.42.0