Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1395802rdh; Mon, 25 Sep 2023 11:22:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdKOLaLIUa5ijteQdY32RiEDscvKhT9bSI9sljM04ejjkS6NTQWNbnJSVTh0NyFfofJcRx X-Received: by 2002:a17:90b:352:b0:274:8951:b5ed with SMTP id fh18-20020a17090b035200b002748951b5edmr512730pjb.20.1695666162796; Mon, 25 Sep 2023 11:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695666162; cv=none; d=google.com; s=arc-20160816; b=bektOSAyUCDg2Ij0wNEZ5JI39QD1ZkP6moT9fBItseLo+vzP3xy6QEPcEMWtXdYYiJ CJ96e7k8/rkIlxx8qBsHXFr1g7pqutN5LJfhMspo0LPLJp+4H1Ura7I+4pYzbr9PwB0Z DLx9hEqzjsOybJdQ3TMp+7u8Q8/vLSCdaLg1B8Y1mGnPpy4siBAHMC+k4H6V3BqkotJF lc6qveUSXW82BXCO+SpLMFX/0LQ92kQcR0o8NLKqjxONNB0KS2pHgw3QKSihYcTiksHE hKXIXsaXcg7UQEaNErvq+MSaQncLL7ScPQIJzjS8mGQhRPFVKymt7/7z+pPdWV5hsvST m+CQ== 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=yKTR9FGAJbp1Nit0RKPxQtBceNed5p1nXP0aMRVoGew=; fh=11LKKpIlt6rtONTt+h6X+e6wp8mj+pGxb3/fOJjZKK8=; b=BZdplNio6kpgFm5OFMBmxL0IZ39sIPS/T7xaKINs0Zl6T2n/Qv7U9dRPekjJ8Yef2l 4B/nXkDDiS0D8oxAT1u4FjwC4Lc9zo6Q6PWfleRwaBH9kxNxaYg/+gvAGzqa2Hpif/5/ jN0OdpBhd9ex7wa6IzwxnCGuqn80mDyF6etlDZnJ3ZlQs22DITtpDEjKpJPz2JRkjjAx xt3IYT5uaFiddAz/R7OgFAfSuKy3BevN7G6XtaizVwKcXE9SS4r/S7bNvMbyno2oTlIh QBQWBfIvT31pbTtyTGRZzkBKszOhsTb08sWis1gmregjvdwrvzrfXGSiqzAAfZ116JGe 1jbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QrsVFyjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ei8-20020a17090ae54800b002764fc15dd3si10546292pjb.37.2023.09.25.11.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 11:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QrsVFyjB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id C874080A90ED; Mon, 25 Sep 2023 08:43:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233088AbjIYPmQ (ORCPT + 99 others); Mon, 25 Sep 2023 11:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233106AbjIYPlx (ORCPT ); Mon, 25 Sep 2023 11:41:53 -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 7E374CDE for ; Mon, 25 Sep 2023 08:41:25 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4060b623e64so633725e9.0 for ; Mon, 25 Sep 2023 08:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656483; x=1696261283; 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=yKTR9FGAJbp1Nit0RKPxQtBceNed5p1nXP0aMRVoGew=; b=QrsVFyjBk4md7uG1N5IvQSP5V1erEytLEvYNHpgT3vyzTmh38XzPDdzehb+6E2LZXN w1D39S1mXoceUOlTWjRMW1YpKN8OaiqtYUVMjot9OEbOU1nwjcFd7+5kOoUL2/HCgmis aiD/537GtobJ2vJ3m30T4zbWWQFnkSeKmT6Wj2t/1mY3fLQcct55lk9FsMt1q3nxS0LM 3fcNHpk9kV6wAxvUXVWtEDwwN1xB2lNNltONrNZD3CaQtEnnIBu9gh35zUxwVRzU9nGY Ou5lubkYZ3CrkWqZ7JJmqmGl3iA0c5gxFi7C1tN68DySt2ltSPFI78OBQQQkNTAkH2Fk meaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656483; x=1696261283; 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=yKTR9FGAJbp1Nit0RKPxQtBceNed5p1nXP0aMRVoGew=; b=UJcPpQ5pva24crQrcHsu2+Xa16goGl+2v+5HV/G86emOH1tUDnplTnQsiSWPv5AJ1I H40fiYmNgyZ2N8MqVQnitXRrFOBrG/pk9e0WjSahSj+m0zf1qHWCCp00iBFj3OBSrxMT wJuA+gGwOTUKqQIL49/zv/RJe5V6TdRq7Lmw00EN6Ytt1A8Qs3nxxs4iQhDvnVO/8vO2 knBQ1/7lOEWhlYJSmgIpD+iIUFsaJS368ZKpfASUWPERh32Sv3hMPFzlC1BFAQmNN34p 86CfmKdV7CZt94bOoKBxSB9PLbTvIOIHuQwBPnTzvnzZpzi8fKoJbSM+NZcrYaICt5Oz 0Ayw== X-Gm-Message-State: AOJu0YzFkJ22z/tCV228FgLLyEUwhxJ0i+l9sW9l/zppx5CjUVGaA+wP wnXlBz0ddA7v45uz2m1G/5H7kA== X-Received: by 2002:a05:600c:11d2:b0:405:409e:1fcb with SMTP id b18-20020a05600c11d200b00405409e1fcbmr43234wmi.5.1695656483646; Mon, 25 Sep 2023 08:41:23 -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 m15-20020a7bca4f000000b003fe4548188bsm15206155wml.48.2023.09.25.08.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:41:23 -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, robert.foss@linaro.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 17/17] media: qcom: camss: Comment CSID dt_id field Date: Mon, 25 Sep 2023 16:40:59 +0100 Message-ID: <20230925154059.837152-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230925154059.837152-1-bryan.odonoghue@linaro.org> References: <20230925154059.837152-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:43:09 -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 --- 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 + * DT : 21:16 + * + * CID : VC 3:0 << 2 | DT_ID 1:0 + */ u8 dt_id = vc; if (tg->enabled) { -- 2.42.0