From patchwork Mon Sep 25 15:40:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 144646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1577935vqu; Mon, 25 Sep 2023 17:21:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp6yWpb4UwiAmbTRmBQECDn4T9pfiD+DQfFINFr1uU2CoxYitvmPZwuGwVn2xXA4u/rusp X-Received: by 2002:a05:6a20:12ca:b0:149:700e:f50a with SMTP id v10-20020a056a2012ca00b00149700ef50amr1732900pzg.29.1695687686391; Mon, 25 Sep 2023 17:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695687686; cv=none; d=google.com; s=arc-20160816; b=cmZgcl2W6jeoURGF/B4BGUWqKCEe8g+Dc5wHLVyCANthdYmfxfn1kkmg+v2qCf0BAi 1EpgACGOsHz6Ro47he0l4oFb20NLVeOMaEOAu9iQuUjbvwS0K3K8t7h7ajW4ZH4Eg6w/ FZDixGzoumwiI0pKwtX5kyH6/CNU/Gi/PKoZCXFHKi6lhZ/qTg2h5pIKwx3RkX/vqqWW an8mEpdHYkDLy/TGxTdKgZS+UO50/jfuJYttaQ9PkrvSahkSGUannCYeaqZICopla/8m 0V1gc9PIwKI1DiEJsyrcEr6E+bLhxt+oDD67qd1bklidTD4rLg0Qo8N1H2CA6F+j3kAi kxFg== 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 Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 142-20020a630294000000b00578b6e32b5dsi11091253pgc.405.2023.09.25.17.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 17:21:26 -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 4D58880A3661; Mon, 25 Sep 2023 08:44:42 -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 S233093AbjIYPmQ (ORCPT + 29 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 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:44:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778057411237384229 X-GMAIL-MSGID: 1778057411237384229 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) {