From patchwork Mon Sep 25 15:40:48 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: 144683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1618527vqu; Mon, 25 Sep 2023 19:10:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxmHkX29IF39w5IMqmnk7b4swU++OfQRdkqFApHIEGHcWiVF5nt+7dRCVX2h4wia4Rg4L8 X-Received: by 2002:a9d:77c4:0:b0:6b7:6e07:4951 with SMTP id w4-20020a9d77c4000000b006b76e074951mr8591435otl.25.1695694232919; Mon, 25 Sep 2023 19:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695694232; cv=none; d=google.com; s=arc-20160816; b=hgYHSRwnWXlNjlcPjmNFcMKz8XKYux70ZE9x3kRilaC6qvrwIxdxBIm/yWs0bf922R jRzUsxUOSko3jUXpuIA7FJfI9LQ888+Y/vMi5OhmGPsMBkiZ0CBpuclKEyPS3vIrfgsL zFNHkE3Ja1R18krooQKkdE1cuLm853oa5A7eK4ApMbTPDqP0mz348+LP0aArt+RE6f33 EOvEx2F4zZ0lO59/jLBCxVWwkwZrPWQXuZa0cuztGsQ/+HZ6WwqefbScgoLISSQXlUiJ YWAplJzhTajjwZQBumqXmH1onp2yLxrY8wMRLKQUhkbIxz34bP8e9Usp5h+5civGQKcU Pn0A== 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=ZNmLk2/hMJ8q4cG9CX8+EYjM5qVrNntkoJGG0Zi7eVo=; fh=11LKKpIlt6rtONTt+h6X+e6wp8mj+pGxb3/fOJjZKK8=; b=XiPuUBWPr9/fLSPL3LjpNyPtv8uG5W2R6U0bGQmRiMIMZvV4MUfdS34wLKXxZbUQE/ W6Pg+v4Me1JbKU+j1/kpV+iIp1/SbEfxEECDr8K6cOGjvQyzPRvqd3V5e8bWWiIHCLIy XznSZITUkzrtCvWW5VMGPjPj3FQsAWBYZK/CmpmzMf2TTK/Y4dejersiq/spltPBLYK4 IuZTdoIQUrOhuscQj6DmuL/dLEM503LZJ3w5/XcXbNb+9K1yYIoahyx92T2t1tDIYOwJ 8sZJKlA3FFKj4Fmx+GiaP/JeprwYEHxjGUFe0OVM7lHbz3UaX0gMeb1hi3EWZt+FNUew FzdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EOxV/9Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d11-20020a056a0024cb00b0068fadbc3169si11991376pfv.254.2023.09.25.19.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 19:10:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EOxV/9Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 9E83380622A7; Mon, 25 Sep 2023 08:41:38 -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 S232963AbjIYPlc (ORCPT + 29 others); Mon, 25 Sep 2023 11:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231698AbjIYPlU (ORCPT ); Mon, 25 Sep 2023 11:41:20 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693E9115 for ; Mon, 25 Sep 2023 08:41:12 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4053db20d03so54436325e9.2 for ; Mon, 25 Sep 2023 08:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656471; x=1696261271; 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=ZNmLk2/hMJ8q4cG9CX8+EYjM5qVrNntkoJGG0Zi7eVo=; b=EOxV/9Z/wnx1svPvJS+1bL/BXHY4YcboRKsUgtMl9Jg/A1pM6NIjT/b1lVdyM8EN0K Et1iMhsY1izR5C7eIxvJQiqLr/iAv4Y4CpNeh4Sou6ugsNP8veN6myap06RQe8bPQHqI UFpjtzWGHkYIOmb9s61pzF0Mn629sP2Col4qkl5cjfAwi04nKgjyc88Nten6y/M7WFpH lePlKFBSC2RhDYe9cXWm638NY3/KU9W0LkLnWZPft/4kHrEXvKHcWKOjLRLuaM4Fwg5P mqndCdlZDeu4U0MnrfmRIsFXAPZIC8BGMvNIgIUAuFRTenIrGB3PQy0QBRSCzCfH7a5u EZjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656471; x=1696261271; 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=ZNmLk2/hMJ8q4cG9CX8+EYjM5qVrNntkoJGG0Zi7eVo=; b=WDnj0YxksP6pE0o5RyJ2mZwRYGTNxoZSs7ZZLy5Qztg6aM5lED+pf0o2GyPCjTLmsY r/z+6W1CYhmDM/JOrVp6nok9PM1nr3eDCeCtXhqgu0I2zPAepOkrKahlYbM+Cra/AMPQ d8igkwaPV4KmxwdWc+6Xb9dO3Gx3p8kR0Aygrul9tyE8QCBplUsx3SHAbclEdSMdbX3Y 4NH1ElIk+HSxM+CN3NZeAKi10k88j8yscKghlboBhrzhBztywvl4VvbRVQKwNbxzuYgn PIZhmYgQGXFucQ4k0P1CiCRi+vn5bBwdGAE3C4hdH2fvB719cXHbc8/c6pAyGVq9kTF1 oSMg== X-Gm-Message-State: AOJu0YxDJG+OxlAS16npT70yXaSw997SfqZxKITcbYCDPGGTENd/pLe0 UsxdPwoaMksO45LQx1cqM4dc7Q== X-Received: by 2002:a05:600c:2613:b0:405:499a:7fc1 with SMTP id h19-20020a05600c261300b00405499a7fc1mr6145896wma.40.1695656470963; Mon, 25 Sep 2023 08:41:10 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:41:10 -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 06/17] media: qcom: camss: Pass line_num from compat resources Date: Mon, 25 Sep 2023 16:40:48 +0100 Message-ID: <20230925154059.837152-7-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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]); Mon, 25 Sep 2023 08:41:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778064275714165981 X-GMAIL-MSGID: 1778064275714165981 line_num indicates the number of RDI - raw data interface channels which are associated with a given IFE/VFE - image/video front end. On several SoCs the RDI number is not static for each VFE - for example on sm8250 VFE Lite has four RDIs where regular VFE has three. Assigning line_num statically in the subdev_init() phase initialises each VFE to the lower number, meaning in practical terms that we are lobbing off one RDI on some VFEs. Interrupt handling uses static for (i = RDI0; i < RDI2; i++) {} in some of our VFE blocks but this can't work for situations where we have a mixture of VFE @ 3 RDI and VFE-lite @ 4 RDI blocks. First step to remediate is to pass line_num from a compat string controlled data-structure and do so on a per-VFE basis. Later patches will assign the correct number of RDI blocks per VFE. Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- .../media/platform/qcom/camss/camss-vfe-170.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-1.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-7.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-8.c | 2 -- .../media/platform/qcom/camss/camss-vfe-480.c | 1 - drivers/media/platform/qcom/camss/camss-vfe.c | 5 +++ drivers/media/platform/qcom/camss/camss.c | 36 ++++++++++++------- drivers/media/platform/qcom/camss/camss.h | 1 + 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c index 82d2392022dd1..2ba7160b3bd1e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -753,8 +753,6 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) { vfe->isr_ops = vfe_isr_ops_170; vfe->video_ops = vfe_video_ops_170; - - vfe->line_num = VFE_LINE_NUM_GEN2; } const struct vfe_hw_ops vfe_ops_170 = { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c index bc309f326f519..2911e4126e7ad 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c @@ -992,8 +992,6 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) vfe->isr_ops = vfe_isr_ops_gen1; vfe->ops_gen1 = &vfe_ops_gen1_4_1; vfe->video_ops = vfe_video_ops_gen1; - - vfe->line_num = VFE_LINE_NUM_GEN1; } const struct vfe_hw_ops vfe_ops_4_1 = { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c index 8acd76c9746ba..b65ed0fef595e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c @@ -1188,8 +1188,6 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) vfe->isr_ops = vfe_isr_ops_gen1; vfe->ops_gen1 = &vfe_ops_gen1_4_7; vfe->video_ops = vfe_video_ops_gen1; - - vfe->line_num = VFE_LINE_NUM_GEN1; } const struct vfe_hw_ops vfe_ops_4_7 = { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c index 3a0167ecf873a..7b3805177f037 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c @@ -1173,8 +1173,6 @@ static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) vfe->isr_ops = vfe_isr_ops_gen1; vfe->ops_gen1 = &vfe_ops_gen1_4_8; vfe->video_ops = vfe_video_ops_gen1; - - vfe->line_num = VFE_LINE_NUM_GEN1; } const struct vfe_hw_ops vfe_ops_4_8 = { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c index 074fa4e38163e..43a2964121f22 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -569,7 +569,6 @@ static const struct camss_video_ops vfe_video_ops_480 = { static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) { vfe->video_ops = vfe_video_ops_480; - vfe->line_num = MAX_VFE_OUTPUT_LINES; } const struct vfe_hw_ops vfe_ops_480 = { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 94ee7c7039eb3..f381c82f1f877 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1305,6 +1305,11 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, default: return -EINVAL; } + + if (!res->line_num) + return -EINVAL; + + vfe->line_num = res->line_num; vfe->ops->subdev_init(dev, vfe); /* Memory */ diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index d1152a7db9cd2..54886a2a449b0 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -123,7 +123,8 @@ static const struct camss_subdev_resources vfe_res_8x16[] = { { 0 }, { 0 } }, .reg = { "vfe0" }, - .interrupt = { "vfe0" } + .interrupt = { "vfe0" }, + .line_num = VFE_LINE_NUM_GEN1, } }; @@ -263,7 +264,8 @@ static const struct camss_subdev_resources vfe_res_8x96[] = { { 0 }, { 0 } }, .reg = { "vfe0" }, - .interrupt = { "vfe0" } + .interrupt = { "vfe0" }, + .line_num = VFE_LINE_NUM_GEN1, }, /* VFE1 */ @@ -281,7 +283,8 @@ static const struct camss_subdev_resources vfe_res_8x96[] = { { 0 }, { 0 } }, .reg = { "vfe1" }, - .interrupt = { "vfe1" } + .interrupt = { "vfe1" }, + .line_num = VFE_LINE_NUM_GEN1, } }; @@ -442,7 +445,8 @@ static const struct camss_subdev_resources vfe_res_660[] = { { 0 }, { 0 } }, .reg = { "vfe0" }, - .interrupt = { "vfe0" } + .interrupt = { "vfe0" }, + .line_num = VFE_LINE_NUM_GEN1, }, /* VFE1 */ @@ -463,7 +467,8 @@ static const struct camss_subdev_resources vfe_res_660[] = { { 0 }, { 0 } }, .reg = { "vfe1" }, - .interrupt = { "vfe1" } + .interrupt = { "vfe1" }, + .line_num = VFE_LINE_NUM_GEN1, } }; @@ -621,7 +626,8 @@ static const struct camss_subdev_resources vfe_res_845[] = { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg = { "vfe0" }, - .interrupt = { "vfe0" } + .interrupt = { "vfe0" }, + .line_num = VFE_LINE_NUM_GEN2, }, /* VFE1 */ @@ -641,7 +647,8 @@ static const struct camss_subdev_resources vfe_res_845[] = { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg = { "vfe1" }, - .interrupt = { "vfe1" } + .interrupt = { "vfe1" }, + .line_num = VFE_LINE_NUM_GEN2, }, /* VFE-lite */ @@ -660,7 +667,8 @@ static const struct camss_subdev_resources vfe_res_845[] = { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg = { "vfe_lite" }, - .interrupt = { "vfe_lite" } + .interrupt = { "vfe_lite" }, + .line_num = VFE_LINE_NUM_GEN2, } }; @@ -787,7 +795,8 @@ static const struct camss_subdev_resources vfe_res_8250[] = { { 0 }, { 0 } }, .reg = { "vfe0" }, - .interrupt = { "vfe0" } + .interrupt = { "vfe0" }, + .line_num = 4, }, /* VFE1 */ { @@ -805,7 +814,8 @@ static const struct camss_subdev_resources vfe_res_8250[] = { { 0 }, { 0 } }, .reg = { "vfe1" }, - .interrupt = { "vfe1" } + .interrupt = { "vfe1" }, + .line_num = 4, }, /* VFE2 (lite) */ { @@ -822,7 +832,8 @@ static const struct camss_subdev_resources vfe_res_8250[] = { { 400000000, 480000000 }, { 0 } }, .reg = { "vfe_lite0" }, - .interrupt = { "vfe_lite0" } + .interrupt = { "vfe_lite0" }, + .line_num = 4, }, /* VFE3 (lite) */ { @@ -839,7 +850,8 @@ static const struct camss_subdev_resources vfe_res_8250[] = { { 400000000, 480000000 }, { 0 } }, .reg = { "vfe_lite1" }, - .interrupt = { "vfe_lite1" } + .interrupt = { "vfe_lite1" }, + .line_num = 4, }, }; diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index 3b6562b515d46..fc02aa84a5dd7 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -48,6 +48,7 @@ struct camss_subdev_resources { u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; + u8 line_num; }; struct icc_bw_tbl { From patchwork Mon Sep 25 15:40:53 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: 144675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1607027vqu; Mon, 25 Sep 2023 18:38:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmMUuZrBWEuZ/rluchauos6/WxFs/ZfBPU+49J4SV0hkwJdhyAN1VlQZeK3F+ESUFhE3Cv X-Received: by 2002:a17:903:32d1:b0:1bf:193a:70b6 with SMTP id i17-20020a17090332d100b001bf193a70b6mr2340826plr.5.1695692311671; Mon, 25 Sep 2023 18:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695692311; cv=none; d=google.com; s=arc-20160816; b=I23P3+9JlDGF435A8rMtGWey646+Hqr3wm5f0QzTE8A7E7QukgwcGSd9eC5eLVZHNn HDsgka7wILJ0RsHH0sPCRFNpaU/zPZPPc1mJdmqcT20QBYi13O8GLj/UHUz2WUG+Rtf2 aWuI5sXxVu+nF8awWKZMdg1O2pRRowEX4ruA61sYt5v+OuW42ZMdNPLoQ6gRFjzIH3W4 SAZMM9y0IFres3TfrWqGEFTWWR9U/8brOVrogSh0OpVerC9G5mRKPoATW22J/RKQwZTO NAR0RKylsy//y3dwWBllKZg2qvH6mr7HT27ccNY2P9XzUIUcTdbUyo3r1VkFY8Q0yoip V6oQ== 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; fh=11LKKpIlt6rtONTt+h6X+e6wp8mj+pGxb3/fOJjZKK8=; b=ND0Sj+/Ao5RcdA5y8YnQX4m5AEGOdZdwR/i60QeYD9ICoju0lL51pWKDDnhgnW0ppV bOD8qy/Iw+tuK/Ws+vr1189091PlgrAgm6LFoY1IcI/WCRtQ9ns6HqLtb604A5Xj/yjf aq9XhZFzOB6AjC/Pi5Pn1JmtWKo11rC9IlYA7G0goIQy83ZkRMvD9YbVABKWz5SS5QdG +jlSAIPkx2tRVu5FRqWyBP/jTl2FDGIKAl54a7cp/hSy9da7BWz5UuSgPfs6l9IKT8iO O1lC8rTtYNk9sJxDnjM/Ld8QWZ7ldQMktnUaV5UNW1x79M/tkag1eyEjQMUK4e0p4N0X OddA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jvgf32aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a5-20020a170902710500b001c4514c872fsi10539965pll.485.2023.09.25.18.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 18:38:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jvgf32aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id B2E9B80FD3A8; Mon, 25 Sep 2023 08:42:06 -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 S233151AbjIYPl4 (ORCPT + 29 others); Mon, 25 Sep 2023 11:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbjIYPl3 (ORCPT ); Mon, 25 Sep 2023 11:41:29 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6CB1B5 for ; Mon, 25 Sep 2023 08:41:18 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-405417465aaso55420215e9.1 for ; Mon, 25 Sep 2023 08:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656477; x=1696261277; 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; b=Jvgf32aOulSysep/r2PHBiTBZdzYWRtf4K6wg4FZgROpmxdftdMCKf94lamDtcClzp 2Ir/1RJ+EGwrzudCUpJ31V2eI9zwkhYH8htAOU/fluIvRAUJ8ZjzEKdLl1zmyCG0o6RS Tpuk0OofYBaKTJXBNYIe1C2VcDTP7iUDR8UqHIAsxMnovc6Zpak82sd5jPu8EWS0/6e0 q52W9eVrT/uxRJURvueaDUuLt3m9I/0NzBhBv1tp0zirBvNMZtFrXj6TVFujwb7i8SDa m2dAwXf9DgAXOwpAfGAHu7FTJowSPQKVneG/bDGwpVkAjRf/YXbKFfO7LxNW4YNGpndF LTkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656477; x=1696261277; 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; b=UCFTHk2KmTefMIJCe7EvNO0NJA31by8XebHirnQiEfzk+IKmFlWuOQDakusb60zAe3 kaWTSIigyyW+NKZvddSQt1e4IUWeTZ9lpce+tR2aG/xe0To0L22PWeocMs40b8p4ff8k OFH70dMBjh3sgGQulFqvUlubs2Ntr7reql+zerhQ5G7NGc2pdzvnys7h+CELz22hLZKb WWOqKEC9y1zM77WQuaxsgwfWfABQon6TpEXmRdgi+7ln1OuxQVo+qfAbej6B9S6Passg Ke4iFOEQFThdBVkbNWRgOWmfV4GEJiOoRHcb8/nc/PgAwM2H0a5ndfrKSHCs8SKO5eh3 3nfg== X-Gm-Message-State: AOJu0Yw5NpdKmukAzFnHNuqPvZoSVpXh/Wl8dBeJ5j4WBf2mt6fbRXua UwRv5sF7qj2Ql7XiqVtVjZuvig== X-Received: by 2002:a7b:ca56:0:b0:3fb:df34:176e with SMTP id m22-20020a7bca56000000b003fbdf34176emr5970660wml.31.1695656477042; Mon, 25 Sep 2023 08:41:17 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:41:16 -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 11/17] media: qcom: camss: Allow clocks vfeN vfe_liteN or vfe_lite Date: Mon, 25 Sep 2023 16:40:53 +0100 Message-ID: <20230925154059.837152-12-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=-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 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:42:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778062261724134818 X-GMAIL-MSGID: 1778062261724134818 The number of Video Front End - VFE or Image Front End - IFE supported with new SoCs can vary both for the full and lite cases. For example sdm845 has one vfe_lite and two vfe interfaces with the vfe clock called simply "vfe_lite" with no integer postfix. sc8280xp has four vfe and four vfe lite blocks. At the moment we declare vfe_lite0 and vfe_lite1 for sm8250 but never set those clocks because we don't match the strings. We need to support the following clock name formats - vfeN - vfe_liteN - vfe_lite with N being any reasonably sized integer. There are two sites in this code which need to do the same thing, constructing and matching strings with the pattern above, so encapsulate the logic in one function. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index db8f68819ded9..4db0d0a1c6a51 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -431,6 +431,20 @@ void vfe_isr_reset_ack(struct vfe_device *vfe) complete(&vfe->reset_complete); } +static int vfe_match_clock_names(struct vfe_device *vfe, + struct camss_clock *clock) +{ + char vfe_name[7]; /* vfeXXX\0 */ + char vfe_lite_name[12]; /* vfe_liteXXX\0 */ + + snprintf(vfe_name, sizeof(vfe_name), "vfe%d", vfe->id); + snprintf(vfe_lite_name, sizeof(vfe_lite_name), "vfe_lite%d", vfe->id); + + return (!strcmp(clock->name, vfe_name) || + !strcmp(clock->name, vfe_lite_name) || + !strcmp(clock->name, "vfe_lite")); +} + /* * vfe_set_clock_rates - Calculate and set clock rates on VFE module * @vfe: VFE device @@ -454,9 +468,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe) for (i = 0; i < vfe->nclocks; i++) { struct camss_clock *clock = &vfe->clock[i]; - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate = 0; long rate; @@ -537,9 +549,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) for (i = 0; i < vfe->nclocks; i++) { struct camss_clock *clock = &vfe->clock[i]; - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate = 0; unsigned long rate; From patchwork Mon Sep 25 15:47:06 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: 144639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1568216vqu; Mon, 25 Sep 2023 17:01:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2a3gR3QxoMGhLwJl+vQWDUu8QwVVUmbOqub2RRSOVuoXeuuEs3gO173R8cdYpm2pVQrJ0 X-Received: by 2002:a17:902:c40a:b0:1c1:dbd6:9bf6 with SMTP id k10-20020a170902c40a00b001c1dbd69bf6mr9396398plk.41.1695686484391; Mon, 25 Sep 2023 17:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695686484; cv=none; d=google.com; s=arc-20160816; b=cfJXiIzzKa1ZoWMOH5xRXOkENcjkCMH8Vys8ei/QHrdprj6r08I64IINoEiJCgHClS GA+umWxVd/8MCry1tWyBLawdqPJDyD7EPdJoErw4BdTPoXM/fYpRHWfxcFtR4XWmfDng 2DERI5Z3z3LNgdKcoAHiqKHo0N1tY25ZgctsGO5f4g3BMBozej1ljgP9Jeui9LW4UL/f He0IPoT2onQlM4oT9p8cR+NNnAFhnDhLjmVWyOcayXZfW5Q2IDdVvvZnero6XhuoWOG5 VEg85/CCsDzT5hUaskDmbmhf4nDdsNm3eh7RC6A3rlmycW4ctkOcgidH4ytzyPkzQWeK ZRyA== 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=8DxLhsFGQa0BTkz7p4gD6/w8EaSRpwpvd+XFr08IQZw=; fh=YrDxnoZE2zu1w4A5O/pMyb6W2NB5EAkKDOR3m7KPwy0=; b=rvTcMdvWhqHxV99h/4HjuUChrY6WqsTffs0WJkGl88xxHcW73R/zOs5J57uJqSpEIp uTK60rEvKCGsXcRVh0vkLcK2RlkAagsqVSxiCedTiuJP/5z+Cq9LPCjPCz7Xn/8i/Twk QNxRejRQq/mYqx9DhQX9KTffuoOcgiEfzB7mpUayTla8TWEgnbCSuhtgfw6qcqio2WCI nVHp8eHivFxin4lmUrIKVV3V4at6qLkYyEIgF4jzEKYd72RACu3+SVttocYXa8NCnMXF vie9Pej0DUQ0C0XOXP6FGO+vp9K6jieyPaA2v+FLSRk4Ruwi+cSwhN5Fn+FS8a/xo9T1 j/Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LZlnh0xU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id n8-20020a170902d2c800b001bda1941a8esi11687383plc.582.2023.09.25.17.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 17:01:24 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LZlnh0xU; 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=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 howler.vger.email (Postfix) with ESMTP id F13F382B928C; Mon, 25 Sep 2023 08:48:48 -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 S233339AbjIYPsV (ORCPT + 29 others); Mon, 25 Sep 2023 11:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233116AbjIYPri (ORCPT ); Mon, 25 Sep 2023 11:47:38 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FB2F12A for ; Mon, 25 Sep 2023 08:47:30 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3215f19a13aso6600153f8f.3 for ; Mon, 25 Sep 2023 08:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656848; x=1696261648; 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=8DxLhsFGQa0BTkz7p4gD6/w8EaSRpwpvd+XFr08IQZw=; b=LZlnh0xUnVJ5e6ELnJk4teq+a0xyXb9CtxIjXENsIDXStmEHIVNNWK2sP+9iGIbkP8 VXeWqQdAO7TISU4WvEG8vHRjmYtN8u9dqVvGwVTnG1qouaZuBKMguT+QP0UfAR9958Bg 20ysUECGyEV0di8JW/2EG/wXcdGbftZ+AjHlphhnuIsn3RoUEZNZ48XNrXUPebHgHDrc 8Zy3jxg8mkMD9r/44tZVZO4wrFheb6I7F8xEOcYxARLp3EiDwk0eYMabVlR8P5XH1O5d 2zz7YjGpTD/IS5yCVWAbnNNRE40cwPr5JsP2oyVcmApBMsUf3YCrl1nvJnR9pw0cz1os objA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656848; x=1696261648; 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=8DxLhsFGQa0BTkz7p4gD6/w8EaSRpwpvd+XFr08IQZw=; b=Xszweacip0+1oCIgh6TiUm0wx+OYF3eJneZ/M5tmBagSHiIkToCz4fSY/9d4r8unWU QW12XCIfvZqZ0z7t164jcWG8Eally4W0HwsoGjk8ch07c9O6Y5j7BzuuAE29sMaUvfZf fKolMylv0AoY3hNjEtSBw7MU3AqQBjqC7CZ/27b6r1McwPHhy/gKCL9fuy7I1fIAV++Q vGu5qjofaGeonhhz3159pPlqad5Z36nGWCABMHu6jjWBjwyA0oMCdN2ZeJTCCAkpoxE7 Kmi0/wtTSg9Pp8JVNKow6QdqNUjbpcNIcXXsIucxFync8qTAEI29SJdZTauGQ7/lxcwk AaHA== X-Gm-Message-State: AOJu0YzXT/tltqIFevoR+k4IHPJhPmZ/L4CkK96jzhZbGhg4QuI8Kho0 UqQNeXZAFIc1wvtNcZ87ftvmug== X-Received: by 2002:a5d:6a0c:0:b0:314:ca7:f30b with SMTP id m12-20020a5d6a0c000000b003140ca7f30bmr6183611wru.54.1695656848598; Mon, 25 Sep 2023 08:47:28 -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 d4-20020adffd84000000b0031f34a395e7sm12077536wrr.45.2023.09.25.08.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:28 -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: [RESEND PATCH v6 16/17] media: qcom: camss: Propagate vfe_reset error up the callstack Date: Mon, 25 Sep 2023 16:47:06 +0100 Message-ID: <20230925154707.837542-17-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230925154707.837542-1-bryan.odonoghue@linaro.org> References: <20230925154707.837542-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 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=unavailable 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]); Mon, 25 Sep 2023 08:48:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778056150732189092 X-GMAIL-MSGID: 1778056150732189092 A previous patch I had removed the returns from vfe_disable() since we didn't trap any meaningful errors. Konrad pointed out vfe_reset() could return an error, which is true. Trap the vfe_reset() error code and throw it up the callstack. Suggested-by: Konrad Dybcio Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index b3d5af7f09690..4839e2cedfe58 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -435,8 +435,11 @@ static int vfe_disable_output(struct vfe_line *line) int vfe_disable(struct vfe_line *line) { struct vfe_device *vfe = to_vfe(line); + int ret; - vfe_disable_output(line); + ret = vfe_disable_output(line); + if (ret) + goto error; vfe_put_output(line); @@ -446,7 +449,8 @@ int vfe_disable(struct vfe_line *line) mutex_unlock(&vfe->stream_lock); - return 0; +error: + return ret; } /** 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) {