From patchwork Tue Aug 22 16:16:12 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: 717135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 697AFEE49AE for ; Tue, 22 Aug 2023 16:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235021AbjHVQQc (ORCPT ); Tue, 22 Aug 2023 12:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237561AbjHVQQb (ORCPT ); Tue, 22 Aug 2023 12:16:31 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94643CE7 for ; Tue, 22 Aug 2023 09:16:29 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fef56f7248so15214375e9.3 for ; Tue, 22 Aug 2023 09:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720988; x=1693325788; 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=uRW3uVyacKVMz0n3X0Q3Lp2slVRo4x30QDLpyV/AFPs=; b=Pk2F0c9Rrazytsk16HB+LRnddYNJXPCP3yl2gz8VJKPrcoV6Hokw4kg7LsP0acL3jv NkRk7hi0k2D3BJ4wwtuhOMOgtVVt7T5vbMvQl7ioykCr8jahINu06Q11xUsFSsMQh0LL n18hC646m3ynfxuRFoIBK9US8nxX+G3GBTJ8H3sJLK6aWL1ez5vQEvQOqJ7uwChOS49p 8tsTrKr1j0Ho3XZr6tEbpJATJtTuMMymD4UI2Dlw5oDyY3kzSYT6ZW1y+SZWgK8nRwT5 JPMSp7rhv7tiQU/F+3+UIqE/YHYvxhWPSiT5Upgu58oWHUgSsLeqxVSgUI19oBJ4vfnc UUrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720988; x=1693325788; 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=uRW3uVyacKVMz0n3X0Q3Lp2slVRo4x30QDLpyV/AFPs=; b=ThLCR5PR/sBiIBlSU0YO5vAMjvB7ZfMiYWWgCFU5TpTtsEa6+eIbhM5AW0OFd8B/6X hN6qT4+ytyh46K25Ypm/iPeWaXO3f2UHOdoW6UHVR3sERg9uuZCD8IgqYkEvzkbCAsvW cgaPknysFMddU1hjmBItHvqyRYIzJEGqLtLyEFFePRlDqFUNJvfA8biAjZgv7DE8VVwo MA3C4uaiGTevRkStypHKJaDG/AraMmvFSF/DtHCHIe0OYHrDIVmAiayphK+0nAwk0iso 7RpWPEOl/lVyK3U7CpZdshERacW4V6iwMOMX8gNkb9EN/RstTt6jBmvFP5F71xtb83bz Xjiw== X-Gm-Message-State: AOJu0YxcgT8mN2lpJKJ3ZW3qQFXMopriUOIFJy/m351zVyiQFapWmKWv ZKqm8UcCdGPgRheOJQ3sbCGMJg== X-Google-Smtp-Source: AGHT+IGE2IthDSXynumdojcQS2kqJagZpGEDWNoRrEyfwvVk1jQZisP5AJpzMBj2Lv+cnfjySip1Uw== X-Received: by 2002:a1c:7907:0:b0:3fe:1bef:4034 with SMTP id l7-20020a1c7907000000b003fe1bef4034mr8471234wme.37.1692720988108; Tue, 22 Aug 2023 09:16: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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:27 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 1/9] media: qcom: camss: Fix pm_domain_on sequence in probe Date: Tue, 22 Aug 2023 17:16:12 +0100 Message-ID: <20230822161620.1915110-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We need to make sure camss_configure_pd() happens before camss_register_entities() as the vfe_get() path relies on the pointer provided by camss_configure_pd(). Fix the ordering sequence in probe to ensure the pointers vfe_get() demands are present by the time camss_register_entities() runs. In order to facilitate backporting to stable kernels I've moved the configure_pd() call pretty early on the probe() function so that irrespective of the existence of the old error handling jump labels this patch should still apply to -next circa Aug 2023 to v5.13 inclusive. Fixes: 2f6f8af67203 ("media: camss: Refactor VFE power domain toggling") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index f11dc59135a5a..75991d849b571 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1619,6 +1619,12 @@ static int camss_probe(struct platform_device *pdev) if (ret < 0) goto err_cleanup; + ret = camss_configure_pd(camss); + if (ret < 0) { + dev_err(dev, "Failed to configure power domains: %d\n", ret); + goto err_cleanup; + } + ret = camss_init_subdevices(camss); if (ret < 0) goto err_cleanup; @@ -1678,12 +1684,6 @@ static int camss_probe(struct platform_device *pdev) } } - ret = camss_configure_pd(camss); - if (ret < 0) { - dev_err(dev, "Failed to configure power domains: %d\n", ret); - return ret; - } - pm_runtime_enable(dev); return 0; From patchwork Tue Aug 22 16:16:13 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: 715958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70020EE49AC for ; Tue, 22 Aug 2023 16:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237598AbjHVQQi (ORCPT ); Tue, 22 Aug 2023 12:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237568AbjHVQQd (ORCPT ); Tue, 22 Aug 2023 12:16:33 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA57A193 for ; Tue, 22 Aug 2023 09:16:30 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fef56f7222so15397565e9.2 for ; Tue, 22 Aug 2023 09:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720989; x=1693325789; 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=KplshhytImmpQyw5mB6IesvqS1E/jQySdpPPKRVH1y8=; b=PQZsT1oBoXy3CkrK7CfU4Mog1gDg+IkvheXQagG2Jgc0gA/jvFT0JT0mAQgcEOr4Y4 WBpKNlxFmvy88fv6zzZ2clPSBiulmKpD9Vzzq2NpUJCbhX1kBOKl3APb4Jo1eISIF2eg 1Sca/RLY0MfbyBdvJ1A+uD2x0Vi7wCAziGIbvv/v+kPdL6/zDSLDEosxexu4Hc3ujB2b p26xOPqqFwAorPCd7zKl8Y2kahh5NJ714ZVC5eDBGCAHgXOzOIG9/pB5jLRT0Y0bPMXX ij/VhsCPmOnj6Uaby+6tS5KomhidiRAidCCabA1dgqbvu/Ivi5Yt77NtrzBy5P1E+xNN Qn1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720989; x=1693325789; 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=KplshhytImmpQyw5mB6IesvqS1E/jQySdpPPKRVH1y8=; b=kvaNhubg8be75pgqP8YqljHC58P32VGfZhR9tA9uBa2HelGu8vq+Eql6TjVIM/T1bV RmkGXBNIo127BT9EVVbmSQGicWGXL1wBVzBi3414R5ABYSj7l/gZrhssFNJMQNdgHPSo v4WE6Z5bwZ8AoFwXBxVmt1LhmcjNHO9C5okq4gOnPeVQvSk76mocZrnJjNGq8pMJWnKf qX+M/blv6ysrz+9O79AnZX/v8zAakBbYEYR3xeDhpKyme3zJ74/Rr/eNE/TJwCJ1GXef hL989kxd5NBfimwZnpwHrcqDqFutrsQb1kNL47jX5vSuFjhuaCEcxYKet+/q5QO6RQnL Q0IA== X-Gm-Message-State: AOJu0Ywel2NZ9WrLZD4w28EhfHpAi4U4HZsl/XHuswWCYx1zYPo+CtPm uocOIyScWBgve8SsY8q9xNw84Q== X-Google-Smtp-Source: AGHT+IGy/dR0pSpgveaYmAS5O6XY6G3LxWbjGJHbUD3qLgNjJZmURcA4AwHrXXDSKYoFdBKGxBj2Vw== X-Received: by 2002:a05:600c:22d4:b0:3f9:9a93:217f with SMTP id 20-20020a05600c22d400b003f99a93217fmr7667015wmg.3.1692720989382; Tue, 22 Aug 2023 09:16:29 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:28 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/9] media: qcom: camss: Fix V4L2 async notifier error path Date: Tue, 22 Aug 2023 17:16:13 +0100 Message-ID: <20230822161620.1915110-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Previously the jump label err_cleanup was used higher in the probe() function to release the async notifier however the async notifier registration was moved later in the code rendering the previous four jumps redundant. Rename the label from err_cleanup to err_v4l2_device_register to capture what the jump does. Fixes: 51397a4ec75d ("media: qcom: Initialise V4L2 async notifier later") Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 75991d849b571..f4948bdf3f8f9 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1617,21 +1617,21 @@ static int camss_probe(struct platform_device *pdev) ret = camss_icc_get(camss); if (ret < 0) - goto err_cleanup; + return ret; ret = camss_configure_pd(camss); if (ret < 0) { dev_err(dev, "Failed to configure power domains: %d\n", ret); - goto err_cleanup; + return ret; } ret = camss_init_subdevices(camss); if (ret < 0) - goto err_cleanup; + return ret; ret = dma_set_mask_and_coherent(dev, 0xffffffff); if (ret) - goto err_cleanup; + return ret; camss->media_dev.dev = camss->dev; strscpy(camss->media_dev.model, "Qualcomm Camera Subsystem", @@ -1643,7 +1643,7 @@ static int camss_probe(struct platform_device *pdev) ret = v4l2_device_register(camss->dev, &camss->v4l2_dev); if (ret < 0) { dev_err(dev, "Failed to register V4L2 device: %d\n", ret); - goto err_cleanup; + return ret; } v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev); @@ -1651,12 +1651,12 @@ static int camss_probe(struct platform_device *pdev) num_subdevs = camss_of_parse_ports(camss); if (num_subdevs < 0) { ret = num_subdevs; - goto err_cleanup; + goto err_v4l2_device_register; } ret = camss_register_entities(camss); if (ret < 0) - goto err_cleanup; + goto err_v4l2_device_register; if (num_subdevs) { camss->notifier.ops = &camss_subdev_notifier_ops; @@ -1690,7 +1690,7 @@ static int camss_probe(struct platform_device *pdev) err_register_subdevs: camss_unregister_entities(camss); -err_cleanup: +err_v4l2_device_register: v4l2_device_unregister(&camss->v4l2_dev); v4l2_async_nf_cleanup(&camss->notifier); From patchwork Tue Aug 22 16:16:14 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: 717134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8784EE49AA for ; Tue, 22 Aug 2023 16:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237602AbjHVQQj (ORCPT ); Tue, 22 Aug 2023 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237583AbjHVQQh (ORCPT ); Tue, 22 Aug 2023 12:16:37 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FD15CE9 for ; Tue, 22 Aug 2023 09:16:32 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fee06efd6bso20769905e9.0 for ; Tue, 22 Aug 2023 09:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720991; x=1693325791; 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=OFC5befy1B0F6DaTi/N+wys/sVJv12I6nLzZb1Lm1oY=; b=kBrE5BvGdgAXZA4ki8Ck/2fHTy4BdwWFkTZH4EJmS52gtcB71rf1BpLeqQhrhm+Lgs MUdENTBdYI2N1JJLTfJw31Vm8NYVQKM1td2uZrzcFgxk4IiKzCMiqXz7g7QyXEQhWesb eoMAWVrCILB2mOiL/4XJB1M9HugZBgTJRaC0I/mnl9Vy8rCLJpmClfG/4nVugGhiSjcX DEUor8CazsQzRJgzKzo8ETb4uWO3EtYblGHDWZsBmpJNM7eoxDbJgJUJt5sOZxqgJ/Zm 6rohmlVkcuGmxLpuiMV7wd6aeKBksx/FcnONOSQa2OAYMgn8C1Uot7U81s7msRIMu8dm j4WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720991; x=1693325791; 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=OFC5befy1B0F6DaTi/N+wys/sVJv12I6nLzZb1Lm1oY=; b=GzMKJkteyn7UCAhufJZK+1N5lcNm/KQY9wFDwOgr3VvB5nNpOLScu801j9w92PXf9N a+yS0upXr1rQs1dc7OsfSVMdptmGyqNrLsvfMFe86ghFai45Q73PAWobCJq1dzA52ORx ngPsaKAyGrfOHczHW7LnaxjcPiz4O0kTlvYDl6SMyW/jwXPeJXlYdTkrSYNODfM8mQDV r1Mfq5juWzIbihL6nPfVYWyjt0NPBpPQkt5IUtJ5TF9cD09HHx+slcSSM6ScqedVGE9Q Y1luSmw3wUg3XlqDCUyrcBuSQIpbpnV/ZLb4Ek2mhPW/+s781n/gfLXkw+nsKDDFuYLX pJJg== X-Gm-Message-State: AOJu0YxMO+Ryms/4pZHPeseuJzRysSBoqrYg/3uogVgiYLUugJ4Yzv3s 49fxWFQj6r40zA4N6Qd1r7dUsg== X-Google-Smtp-Source: AGHT+IHG8vfYue8Ae0sHkQlTu/vdoex/1sJumiZdciYe+mijN/OpuhbMa+dGnR8U/guEfQWgQIHUgA== X-Received: by 2002:a05:600c:4c12:b0:3fe:1c57:3be with SMTP id d18-20020a05600c4c1200b003fe1c5703bemr7640593wmp.8.1692720991101; Tue, 22 Aug 2023 09:16:31 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:30 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 3/9] media: qcom: camss: Fix vfe_get() error jump Date: Tue, 22 Aug 2023 17:16:14 +0100 Message-ID: <20230822161620.1915110-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Right now it is possible to do a vfe_get() with the internal reference count at 1. If vfe_check_clock_rates() returns non-zero then we will leave the reference count as-is and run: - pm_runtime_put_sync() - vfe->ops->pm_domain_off() skip: - camss_disable_clocks() Subsequent vfe_put() calls will when the ref-count is non-zero unconditionally run: - pm_runtime_put_sync() - vfe->ops->pm_domain_off() - camss_disable_clocks() vfe_get() should not attempt to roll-back on error when the ref-count is non-zero as the upper layers will still do their own vfe_put() operations. vfe_put() will drop the reference count and do the necessary power domain release, the cleanup jumps in vfe_get() should only be run when the ref-count is zero. [ 50.095796] CPU: 7 PID: 3075 Comm: cam Not tainted 6.3.2+ #80 [ 50.095798] Hardware name: LENOVO 21BXCTO1WW/21BXCTO1WW, BIOS N3HET82W (1.54 ) 05/26/2023 [ 50.095799] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 50.095802] pc : refcount_warn_saturate+0xf4/0x148 [ 50.095804] lr : refcount_warn_saturate+0xf4/0x148 [ 50.095805] sp : ffff80000c7cb8b0 [ 50.095806] x29: ffff80000c7cb8b0 x28: ffff16ecc0e3fc10 x27: 0000000000000000 [ 50.095810] x26: 0000000000000000 x25: 0000000000020802 x24: 0000000000000000 [ 50.095813] x23: ffff16ecc7360640 x22: 00000000ffffffff x21: 0000000000000005 [ 50.095815] x20: ffff16ed175f4400 x19: ffffb4d9852942a8 x18: ffffffffffffffff [ 50.095818] x17: ffffb4d9852d4a48 x16: ffffb4d983da5db8 x15: ffff80000c7cb320 [ 50.095821] x14: 0000000000000001 x13: 2e656572662d7265 x12: 7466612d65737520 [ 50.095823] x11: 00000000ffffefff x10: ffffb4d9850cebf0 x9 : ffffb4d9835cf954 [ 50.095826] x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000057fa8 [ 50.095829] x5 : ffff16f813fe3d08 x4 : 0000000000000000 x3 : ffff621e8f4d2000 [ 50.095832] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff16ed32119040 [ 50.095835] Call trace: [ 50.095836] refcount_warn_saturate+0xf4/0x148 [ 50.095838] device_link_put_kref+0x84/0xc8 [ 50.095843] device_link_del+0x38/0x58 [ 50.095846] vfe_pm_domain_off+0x3c/0x50 [qcom_camss] [ 50.095860] vfe_put+0x114/0x140 [qcom_camss] [ 50.095869] csid_set_power+0x2c8/0x408 [qcom_camss] [ 50.095878] pipeline_pm_power_one+0x164/0x170 [videodev] [ 50.095896] pipeline_pm_power+0xc4/0x110 [videodev] [ 50.095909] v4l2_pipeline_pm_use+0x5c/0xa0 [videodev] [ 50.095923] v4l2_pipeline_pm_get+0x1c/0x30 [videodev] [ 50.095937] video_open+0x7c/0x100 [qcom_camss] [ 50.095945] v4l2_open+0x84/0x130 [videodev] [ 50.095960] chrdev_open+0xc8/0x250 [ 50.095964] do_dentry_open+0x1bc/0x498 [ 50.095966] vfs_open+0x34/0x40 [ 50.095968] path_openat+0xb44/0xf20 [ 50.095971] do_filp_open+0xa4/0x160 [ 50.095974] do_sys_openat2+0xc8/0x188 [ 50.095975] __arm64_sys_openat+0x6c/0xb8 [ 50.095977] invoke_syscall+0x50/0x128 [ 50.095982] el0_svc_common.constprop.0+0x4c/0x100 [ 50.095985] do_el0_svc+0x40/0xa8 [ 50.095988] el0_svc+0x2c/0x88 [ 50.095991] el0t_64_sync_handler+0xf4/0x120 [ 50.095994] el0t_64_sync+0x190/0x198 [ 50.095996] ---[ end trace 0000000000000000 ]--- Fixes: 779096916dae ("media: camss: vfe: Fix runtime PM imbalance on error") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index dabfd613b2f94..938f373bcd1fd 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -611,7 +611,7 @@ int vfe_get(struct vfe_device *vfe) } else { ret = vfe_check_clock_rates(vfe); if (ret < 0) - goto error_pm_runtime_get; + goto error_pm_domain; } vfe->power_count++; From patchwork Tue Aug 22 16:16:15 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: 715957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21B83EE49B0 for ; Tue, 22 Aug 2023 16:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237575AbjHVQQj (ORCPT ); Tue, 22 Aug 2023 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237586AbjHVQQh (ORCPT ); Tue, 22 Aug 2023 12:16:37 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6584ECEE for ; Tue, 22 Aug 2023 09:16:34 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-31781e15a0cso4205840f8f.3 for ; Tue, 22 Aug 2023 09:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720993; x=1693325793; 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=X48QdO7ZGmP4DgIzy4AepzJ0PTfhLqJqNGkl4UYymyI=; b=gYyBA5s0dymZ6dhLnxYaGLZWFiorzQMmIfddojMH5qoC9CBVbRdCcDmIiww0HORiik wZK+2IzBc2mCkj8606O2kct0ENdqY8kbBAZeOHUxKzmyqY55xy9pwI59fXCxtzwH8pMd ivsQuoIbf+b+pgcPwUvvNe0QaKfyz3PBokE2hn2PjpvIHNAaDnorwdnccqX6AJZputdF 8Ae0a0L0/fAoK4THeFHyTK3HQcUcZClKAt9G0SwntUy+mkKlbwAL67gzWk0eXJTJ0kEw KhKAO98A605I+p4J8jlPQObuwwPjs/etlq3Sy2QuCAkdS0mNWQNXexfB51ulTK88SX5r tkUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720993; x=1693325793; 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=X48QdO7ZGmP4DgIzy4AepzJ0PTfhLqJqNGkl4UYymyI=; b=dhvZ6Xv8YiH/FfDCDE9pUdZfyIBcvTyOlQWuV5kMp2iet6x0As/Fzb/L+E+G9M89u+ eItHQPCoPjrjMNDu+UR2X3z752KGld0v+savrB6FIaz7WOByEfU1XAXmCP5+P41gcp+F YzFE5MwPFvaEB/KxlKaAoSncYN7aCGlSqKELNoUh7TnpTnY1Ch2UZtiPqvi0eEGGsRzA gFo6uJwj427GIu9vO6rYhGBsOWfoxNaS3FTR2/c0+LGbE4Jr0tXG6ati8TLvw6p3wTl3 fI+Azz/ZoRkuQXA8Zh4fCPR+4tKeIvtqeEY1rUAhVqxwHSN+D3nWeZsWTwtKzG9iE7Z0 Uzjg== X-Gm-Message-State: AOJu0YxBq62stedQ3qgPGTQ1lAVtNMaL79XVIEvx/yGeIUSdb4NjVZnY +6AdgqVKbVDKlfdoVvZ2zVrJyQ== X-Google-Smtp-Source: AGHT+IGIMDF8lppDQgxjPIAKW1ri+H7YPka52vp9cQO/xOhvri9kKzihS3t11gTZtEk1pR3zIU0FZg== X-Received: by 2002:a5d:6a07:0:b0:314:415:cbf5 with SMTP id m7-20020a5d6a07000000b003140415cbf5mr7817538wru.51.1692720992993; Tue, 22 Aug 2023 09:16:32 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:31 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 4/9] media: qcom: camss: Fix VFE-17x vfe_disable_output() Date: Tue, 22 Aug 2023 17:16:15 +0100 Message-ID: <20230822161620.1915110-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are two problems with the current vfe_disable_output() routine. Firstly we rightly use a spinlock to protect output->gen2.active_num everywhere except for in the IDLE timeout path of vfe_disable_output(). Even if that is not racy "in practice" somehow it is by happenstance not by design. Secondly we do not get consistent behaviour from this routine. On sc8280xp 50% of the time I get "VFE idle timeout - resetting". In this case the subsequent capture will succeed. The other 50% of the time, we don't hit the idle timeout, never do the VFE reset and subsequent captures stall indefinitely. Rewrite the vfe_disable_output() routine to - Quiesce write masters with vfe_wm_stop() - Set active_num = 0 remembering to hold the spinlock when we do so followed by - Reset the VFE Testing on sc8280xp and sdm845 shows this to be a valid fix. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-vfe-170.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c index 02494c89da91c..ae9137633c301 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -500,28 +500,15 @@ static int vfe_disable_output(struct vfe_line *line) struct vfe_output *output = &line->output; unsigned long flags; unsigned int i; - bool done; - int timeout = 0; - - do { - spin_lock_irqsave(&vfe->output_lock, flags); - done = !output->gen2.active_num; - spin_unlock_irqrestore(&vfe->output_lock, flags); - usleep_range(10000, 20000); - - if (timeout++ == 100) { - dev_err(vfe->camss->dev, "VFE idle timeout - resetting\n"); - vfe_reset(vfe); - output->gen2.active_num = 0; - return 0; - } - } while (!done); spin_lock_irqsave(&vfe->output_lock, flags); for (i = 0; i < output->wm_num; i++) vfe_wm_stop(vfe, output->wm_idx[i]); + output->gen2.active_num = 0; spin_unlock_irqrestore(&vfe->output_lock, flags); + vfe_reset(vfe); + return 0; } From patchwork Tue Aug 22 16:16:16 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: 717133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D379EEE4996 for ; Tue, 22 Aug 2023 16:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237588AbjHVQQm (ORCPT ); Tue, 22 Aug 2023 12:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237579AbjHVQQi (ORCPT ); Tue, 22 Aug 2023 12:16:38 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC1AE40 for ; Tue, 22 Aug 2023 09:16:36 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fed963273cso23278815e9.1 for ; Tue, 22 Aug 2023 09:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720995; x=1693325795; 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=iJ2VKKNJcWBxsnE8fA4GSZFE3NOH8fxJi08OtAhPrEw=; b=tIDClvU//nBPMTdJlHk2CT/TMWkfyIhLDPLu4+5XBURuc6RdJ/SkzIMx3jZpdSK14l FptSX8duiC0WMwYg0mNlnmvYTEAM49cafgMwNq9teJr5rNHYBTriqsRtjlOieLZq+NU5 MIhjZjg+oanc59XzBCaL0xbYKg+T9IJY0Vy1lBA4zIF6d190bqsy/N3KGr+CUlkOJ9dk GuGRA7khNsV/kgLjw8Ba3FcP9Jq/zk+VME+L33vDKcMza7WyDas2Ha8igxAHBwt04XmY oPOMzArb0uZok9P8jp9O7ehgdT5Z7/UoQqDe7YvcjJXhYRRqpp/wA5B4lGvbI44krfcp sbyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720995; x=1693325795; 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=iJ2VKKNJcWBxsnE8fA4GSZFE3NOH8fxJi08OtAhPrEw=; b=geUcMzl2qioqCLIO/S9lu/uTQClyVm2TCkzfcPwIbx4KVSKX40O+R5U//tNjCDFrBW CS/uwGHMs2qmlRlHowmoOfIMIJed27baux6uxI/onkMaM+Gc4VHiwH9fTx8L3n+AxXeC FTRHunRsScL+CfsTQoxvV56e8NBiBul/UM14qt7W33aZCg4plMYo5LFqfLHFiIK3S9/s DdhRATLLZSm263jezJBwCtxOu5KW6TyyGtxegDwY9Mfbl2zxvPa4wblx9SicYi9YD07A GuObqzF8LJAlLSWyvIUuxnPpB1HHt7LndSOZFsgDXm45Nd4c8+frP8YrCGim4ZkbVttI 85oA== X-Gm-Message-State: AOJu0YxSq9fAa5/XlhEA/OS9qbKVMxaRo9ItI2744I0mfBf9y/zvaafl TWh37QIAqmJAFIa7fxcp1B4Dxw== X-Google-Smtp-Source: AGHT+IF0P/tGXfuORLiqfSIShYCcmVarjae6QmfjI8GMSwjt1V0vb+MYVmQcn/8l1H099oZIh40PiA== X-Received: by 2002:a1c:6a16:0:b0:3fe:1c10:8d04 with SMTP id f22-20020a1c6a16000000b003fe1c108d04mr7447740wmc.19.1692720995134; Tue, 22 Aug 2023 09:16:35 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:34 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 5/9] media: qcom: camss: Fix VFE-480 vfe_disable_output() Date: Tue, 22 Aug 2023 17:16:16 +0100 Message-ID: <20230822161620.1915110-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org vfe-480 is copied from vfe-17x and has the same racy idle timeout bug as in 17x. Fix the vfe_disable_output() logic to no longer be racy and to conform to the 17x way of quiescing and then resetting the VFE. Fixes: 4edc8eae715c ("media: camss: Add initial support for VFE hardware version Titan 480") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-vfe-480.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c index f70aad2e8c237..a64d660abc538 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -334,28 +334,15 @@ static int vfe_disable_output(struct vfe_line *line) struct vfe_output *output = &line->output; unsigned long flags; unsigned int i; - bool done; - int timeout = 0; - - do { - spin_lock_irqsave(&vfe->output_lock, flags); - done = !output->gen2.active_num; - spin_unlock_irqrestore(&vfe->output_lock, flags); - usleep_range(10000, 20000); - - if (timeout++ == 100) { - dev_err(vfe->camss->dev, "VFE idle timeout - resetting\n"); - vfe_reset(vfe); - output->gen2.active_num = 0; - return 0; - } - } while (!done); spin_lock_irqsave(&vfe->output_lock, flags); for (i = 0; i < output->wm_num; i++) vfe_wm_stop(vfe, output->wm_idx[i]); + output->gen2.active_num = 0; spin_unlock_irqrestore(&vfe->output_lock, flags); + vfe_reset(vfe); + return 0; } From patchwork Tue Aug 22 16:16:17 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: 715956 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D4BEE49B0 for ; Tue, 22 Aug 2023 16:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237623AbjHVQQn (ORCPT ); Tue, 22 Aug 2023 12:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237614AbjHVQQl (ORCPT ); Tue, 22 Aug 2023 12:16:41 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 189CECEF for ; Tue, 22 Aug 2023 09:16:38 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fef56f7222so15398745e9.2 for ; Tue, 22 Aug 2023 09:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720996; x=1693325796; 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=4W80DDZNGe/khXLl1P1oJD7Ws9Jxxl4GH65wXpEW+I0=; b=U+I3c2omMZRorK598XE13zuIDehZ8w9I22s/zu04h0wsbhre50YlhPO9rSG201wEnd iw2Fi0WFthYfRo+6jZdWAJ5MOboaw4xIwSY+ETSC2M6ei2FarU8yplYx59eoi8N5tMyc xhEemMA122O/CKqHAJrkunE4cOHoLut8I7JkRk7BlxD2ejhJJYAR2CkCvXWpPd/z6IwD O4yZwAhRGMOBkDaeOz080yQ2D1CSOIDBa3shH+ypNQjHA0YzQj4RjS1u9PkHg20Erqpm bxsfI36OYHXOCwcAO/yIS1cDzscbBUO0M1d+aIiVvV2bwN+S65SHez/1R1q/vQpDxtUQ A3Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720996; x=1693325796; 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=4W80DDZNGe/khXLl1P1oJD7Ws9Jxxl4GH65wXpEW+I0=; b=DGvP1sNZXTo/sL32l6IFNdkAK/vXElSteAL2dp54hLYscQBXY1vcleHmqwCFiRiT0r uaIwdtUgozTHfA1J+2n6euu4PGBBKpjyIIekjqmFzwjUX8h/CreN8UB8XMGjRYCzlsvl kNQmQd2oUtQrVgYiMwQJATdp4CmGkYQdS+O/mlDsF51jw3Qw65zl2J2QeYT8Dyvquzpb q9Wl/IQvYX/TAXpgN2rKCd9xbaZGLLMcvZJ/A0uv9COGJSFg/VcrSqO72FEqOayO88L5 aQc90P7vpPdUfkJMfR9Ka+9KsA9Qkjt+d9lWF/4/jw4Uh4FzUIXkwNdumy+OqINKg/gr J+gg== X-Gm-Message-State: AOJu0YwzpACZYLnBLknBH2aEo+De7buAIUvsO5w1h3Qf3LA26vEp5iZZ MVsNG1scBBP6jL1VRT/J8emDGw== X-Google-Smtp-Source: AGHT+IEbmEdUgVc8gPoUPKvvsXPkSIASSjWR0w0R/tzbC9KKX1EtZerjUipZVmqFoATxxQ09bMenEA== X-Received: by 2002:a7b:c3d0:0:b0:3f9:c0f2:e1a4 with SMTP id t16-20020a7bc3d0000000b003f9c0f2e1a4mr7429737wmj.34.1692720996718; Tue, 22 Aug 2023 09:16:36 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:35 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 6/9] media: qcom: camss: Fix missing vfe_lite clocks check Date: Tue, 22 Aug 2023 17:16:17 +0100 Message-ID: <20230822161620.1915110-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org check_clock doesn't account for vfe_lite which means that vfe_lite will never get validated by this routine. Add the clock name to the expected set to remediate. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 938f373bcd1fd..b021f81cef123 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -535,7 +535,8 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) struct camss_clock *clock = &vfe->clock[i]; if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1")) { + !strcmp(clock->name, "vfe1") || + !strcmp(clock->name, "vfe_lite")) { u64 min_rate = 0; unsigned long rate; From patchwork Tue Aug 22 16:16:18 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: 717132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5311FEE4993 for ; Tue, 22 Aug 2023 16:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237655AbjHVQQv (ORCPT ); Tue, 22 Aug 2023 12:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233345AbjHVQQu (ORCPT ); Tue, 22 Aug 2023 12:16:50 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53A0E42 for ; Tue, 22 Aug 2023 09:16:39 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fed963273cso23279125e9.1 for ; Tue, 22 Aug 2023 09:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720998; x=1693325798; 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=3OyWEn0a7ANAIyfQKneFB5+mcuDJYIdBx8m3ndVKkig=; b=zvnyprHX+iigGVq3/eNCiRAwhuXOvuF8IV8loHm5dQpoXsYYQ8HQu20OvVYnggeDCh PvSGd6IPHqRIP1iGAqUki/jHAlHdsEqJQjZjQfha7cvRaq4h8TPFMVMm4azEVxpDSD61 Zf11OH8niLWOP8hNx/lwdVljeX+I0Vx6RF5W7ZkO4FmNKuwbVrkm/ssROhmJF1txBR7a 0LmhemfY1gx6yxcYTwY+jQHLk+fJN1D99AS1EdhsrL1LEQb4NaGlax3wdOg8MfSfN8Fs 8YvQnOQbCdNazhGz+CC1PlvdGhnXfkyUYwXAzpz+Jx6/eNpKN52sBveGZ9XkuyXXl8AE 5czA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720998; x=1693325798; 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=3OyWEn0a7ANAIyfQKneFB5+mcuDJYIdBx8m3ndVKkig=; b=JXKbbV7Ldb7U4jjhWT+9Qisg2zQzQFGH8Jp3xuhivTpw1FeiHYfTjC72/8F4bkzIpX ExFYeBvTBFgg5mHN9Bpx+eXc0id/Nt0msyhyJ+EA8/Zzgwe4BWgINh61UAXb7J8Oyvuc lDHlpM5mXG0NYptDPbwMjN32eouEx4ag1vV8X3iapKPq8kXveTRyreHlKNx8MnEa9dJL ehzE7FDouX5Hj+B6GxrvS7970WJDOThfkcIdUsU//SoDA78Rn7ojx4YjgoQxZfpbc0ro X0gR/PBvEtPTiuwzbFoopDwGPe8vBKwKBnRrYjSdox8/5T5QpsuaJtq0G9I+f2ntJHUZ ndRQ== X-Gm-Message-State: AOJu0Yy/o201yGXv32W2iB/iWqsh0vTVWhE/+E0e2HK8ksR/ifWoWVcF MNNNZaiCeB2QYqyJZpFwmtPFsA== X-Google-Smtp-Source: AGHT+IFcul/BNcu7Pbe7zk/hcv5jWmRt4f/BlNdEHr7V80X9cc5nuQXKfoq5DTX9+16SDQJsaWjwmA== X-Received: by 2002:a7b:cd06:0:b0:3fe:df0:c10f with SMTP id f6-20020a7bcd06000000b003fe0df0c10fmr7659667wmj.17.1692720998168; Tue, 22 Aug 2023 09:16:38 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:37 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 7/9] media: qcom: camss: Fix invalid clock enable bit disjunction Date: Tue, 22 Aug 2023 17:16:18 +0100 Message-ID: <20230822161620.1915110-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org define CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE BIT(7) disjunction for gen2 ? BIT(7) : is a nop we are setting the same bit either way. Fixes: 4abb21309fda ("media: camss: csiphy: Move to hardcode CSI Clock Lane number") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio --- drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 04baa80494c66..4dba61b8d3f2a 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -476,7 +476,7 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, settle_cnt = csiphy_settle_cnt_calc(link_freq, csiphy->timer_clk_rate); - val = is_gen2 ? BIT(7) : CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE; + val = CSIPHY_3PH_CMN_CSI_COMMON_CTRL5_CLK_ENABLE; for (i = 0; i < c->num_data; i++) val |= BIT(c->data[i].pos * 2); From patchwork Tue Aug 22 16:16:19 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: 715955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93C78EE49AE for ; Tue, 22 Aug 2023 16:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237639AbjHVQQw (ORCPT ); Tue, 22 Aug 2023 12:16:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237641AbjHVQQu (ORCPT ); Tue, 22 Aug 2023 12:16:50 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24BFBE50 for ; Tue, 22 Aug 2023 09:16:41 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fef5809999so14956155e9.2 for ; Tue, 22 Aug 2023 09:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692720999; x=1693325799; 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=WOQ9tyjj8WPoyJd2gELXd60f8pMhiSuAdrU1RFxkiK0=; b=uieELBsM44VA5KzhlxYoBcWt6DDdWGr+42NYgtHF9bbZkkDJwKCcPbxQG8HhanlHyT yGCmNAuDKgHFWbho9PVKqCllL0b9HnSEdxqyU28X2VJzwA3RqLeN1ig+D3yxES9wLllT vKLH4NelEoZre0H6iyBCyWyVeKjOnONSCOJY9IZejBRbc1K+cO1YLuUKkPWVO1CjHcZL B13X8hTmGy4zOhZssjRcQZFXqqFP56H2OAfPSmgB5Jb2+BZ5egTPfGXVG+fK3OPnOFkP +q8qhECNTalcl+WJFrFjVJL2idy/ho1d48dunrDEhblP/OWg9uIpAIPOKR/lmQZsWR4U go0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692720999; x=1693325799; 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=WOQ9tyjj8WPoyJd2gELXd60f8pMhiSuAdrU1RFxkiK0=; b=AnlCZHJ9HP8boetbtoNiCfa7/bBGPbPR7x0GGs9i7BsTOLzP6lXEAu9kOaQB6AikGx oM8QuuDZyZOsUeB7sYAfObWsE8lgFz2IlAJdsKSVyjntfSztQTY9ifbfwc44OD8U20Ze ObVtZqvBSIwk3SZjljgX9X5bkMgcLu9KvuyCQluOxPYkSh0K5ZGVc0eZQAM4YIKtAJXA hQv2gutHoxvULmI8AESOYGwoX1xJPZAIOmjEKJm/BvIY0yVrwN8pmbInvzIY8Kkkfpqk SEtWZkqk1hwu2Yz1Dd4MMR4rUTHeuDz7D7XqhVX+2nTdUlAoZvmE8cIhAQeg0SXxeZO2 CPgA== X-Gm-Message-State: AOJu0YwXl/TVNjwXxgjlm/fFXDtb/z9OCFjNTtdL0ZxSJQo7+dPRWsh+ IyB+CTGhyJZoAxT/82whkKmhWA== X-Google-Smtp-Source: AGHT+IGrm1B/yM+0GCY/WXRV6kQBI7gVRUFmO3dEvnGxiSxZEBuxPB1h++sXNcD8RehiH8011cLdrA== X-Received: by 2002:a05:600c:2218:b0:3fb:40ff:1cba with SMTP id z24-20020a05600c221800b003fb40ff1cbamr8090816wml.6.1692720999636; Tue, 22 Aug 2023 09:16:39 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:38 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 8/9] media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3 Date: Tue, 22 Aug 2023 17:16:19 +0100 Message-ID: <20230822161620.1915110-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org VC_MODE = 0 implies a two bit VC address. VC_MODE = 1 is required for VCs with a larger address than two bits. Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Cc: stable@vger.kernel.org Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-gen2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c index 45c7986d4a8d0..140c584bfb8b1 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -449,6 +449,8 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG0); val = 1 << CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN; + if (vc > 3) + val |= 1 << CSI2_RX_CFG1_VC_MODE; val |= 1 << CSI2_RX_CFG1_MISR_EN; writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); From patchwork Tue Aug 22 16:16:20 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: 717131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90AFEEE49B1 for ; Tue, 22 Aug 2023 16:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237642AbjHVQQy (ORCPT ); Tue, 22 Aug 2023 12:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237649AbjHVQQv (ORCPT ); Tue, 22 Aug 2023 12:16:51 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB6FE58 for ; Tue, 22 Aug 2023 09:16:42 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fef4b063a7so16568995e9.2 for ; Tue, 22 Aug 2023 09:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692721001; x=1693325801; 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=gDNt/WREBTg/eyzelwYJ6xLsaGw8ZLYgXhKH1kRyKTw=; b=SrcUieWkvx4l11Y7NSsd5YrVm6DBreJ7pY3QSlqNeqq1pBS3CnWtdxgAA5rG3GVy6w 1c2EEa07wYWSwzzmVsYdNDHS592yV1EBcDVGQKwFls2FFGNWwhXKco/0xamHEhPCEo8I eP0R0Hs5/hEewG0SgDWpzlAjXVdcBKFNGZ2yXmUKRQ35fnxqbUtno95Y67MNSQuiQE4M n/ieAhGvYOvKHsYOMg+q0pC461TZZVA9SezriiUFnB3lRveRq26GlACwjEeYLOlbnGbU JNoou9R6XOm/HoFsJxOC6PGImr4JzsQpy//fUjh1nokt+FSV2ELV7GIjCL01JRxHh+pc 9lSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692721001; x=1693325801; 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=gDNt/WREBTg/eyzelwYJ6xLsaGw8ZLYgXhKH1kRyKTw=; b=b/Ts+nf9XJXqIom624JOt1/S3Bis9JqGnoe2Fh2avIGn8R0wnpwYl+Qk1XdNL6Vsr3 bdsCFMtbfNiOveq/Xsn+nHMgnB9IaSxkTNOzvO8w+95mY2kbZqBDI6l6nKee3G5A5lvU T7DEvFUC7SoCzeNtPfwFgCLHjexweh4YURHln3XFY+Ye+uEmN0ipw5lembkEw2vCOXqg 6s70xRJP3xwrGxfyRC2RW9Wx7EiaCpUBXxDspN1yUxjjrJs8GTXO4oW6vt1h1BJRK8xE YdAs/tGxNvMUuLTKzVTiy09skUO7UVoKmyBiNqSYCczi4SSyMz2S0mLhFDiWnYKiPwbM iHcg== X-Gm-Message-State: AOJu0YydHZ1FJt9l7mAwMP3ZVXgPYejqNXatRDJgoAbtQ+jNHTkzqcUc VhZp/mg7Qir/ncfayU4N7oIqag== X-Google-Smtp-Source: AGHT+IG5OXewEEPzUWd33gPULZFS3altnF3WPO8ofTpd2kse+EYBtvZayWBn7l0QN5DvbWb1xolZvQ== X-Received: by 2002:a7b:c4c3:0:b0:3fe:173e:4a53 with SMTP id g3-20020a7bc4c3000000b003fe173e4a53mr7685395wmk.0.1692721001093; Tue, 22 Aug 2023 09:16:41 -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 t23-20020a7bc3d7000000b003fe1fe56202sm16516130wmj.33.2023.08.22.09.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 09:16:40 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v1 9/9] media: qcom: camss: Fix csid-gen2 for test pattern generator Date: Tue, 22 Aug 2023 17:16:20 +0100 Message-ID: <20230822161620.1915110-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> References: <20230822161620.1915110-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Andrey Konovalov In the current driver csid Test Pattern Generator (TPG) doesn't work. This change: - fixes writing frame width and height values into CSID_TPG_DT_n_CFG_0 - fixes the shift by one between test_pattern control value and the actual pattern. So that TPG starts working, but with the below limitations: - only test_pattern=9 works as it should - test_pattern=8 and test_pattern=7 produce black frame (all zeroes) - the rest of test_pattern's don't work (yavta doesn't get the data) - regardless of the CFA pattern set by 'media-ctl -V' the actual pixel order is always the same (RGGB for any RAW8 or RAW10P format in 4608x2592 resolution). Tested with: RAW10P format, VC0: media-ctl -V '"msm_csid0":0[fmt:SRGGB10/4608x2592 field:none]' media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/4608x2592 field:none]' media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]' v4l2-ctl -d /dev/v4l-subdev6 -c test_pattern=9 yavta -B capture-mplane --capture=3 -n 3 -f SRGGB10P -s 4608x2592 /dev/video0 RAW10P format, VC1: media-ctl -V '"msm_csid0":2[fmt:SRGGB10/4608x2592 field:none]' media-ctl -V '"msm_vfe0_rdi1":0[fmt:SRGGB10/4608x2592 field:none]' media-ctl -l '"msm_csid0":2->"msm_vfe0_rdi1":0[1]' v4l2-ctl -d /dev/v4l-subdev6 -c test_pattern=9 yavta -B capture-mplane --capture=3 -n 3 -f SRGGB10P -s 4608x2592 /dev/video1 RAW8 format, VC0: media-ctl --reset media-ctl -V '"msm_csid0":0[fmt:SRGGB8/4608x2592 field:none]' media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB8/4608x2592 field:none]' media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]' yavta -B capture-mplane --capture=3 -n 3 -f SRGGB8 -s 4608x2592 /dev/video0 Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Cc: stable@vger.kernel.org Signed-off-by: Andrey Konovalov Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-gen2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c index 140c584bfb8b1..6ba2b10326444 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -355,9 +355,6 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) u8 dt_id = vc; if (tg->enabled) { - /* Config Test Generator */ - vc = 0xa; - /* configure one DT, infinite frames */ val = vc << TPG_VC_CFG0_VC_NUM; val |= INTELEAVING_MODE_ONE_SHOT << TPG_VC_CFG0_LINE_INTERLEAVING_MODE; @@ -370,14 +367,14 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) writel_relaxed(0x12345678, csid->base + CSID_TPG_LFSR_SEED); - val = input_format->height & 0x1fff << TPG_DT_n_CFG_0_FRAME_HEIGHT; - val |= input_format->width & 0x1fff << TPG_DT_n_CFG_0_FRAME_WIDTH; + val = (input_format->height & 0x1fff) << TPG_DT_n_CFG_0_FRAME_HEIGHT; + val |= (input_format->width & 0x1fff) << TPG_DT_n_CFG_0_FRAME_WIDTH; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_0(0)); val = format->data_type << TPG_DT_n_CFG_1_DATA_TYPE; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_1(0)); - val = tg->mode << TPG_DT_n_CFG_2_PAYLOAD_MODE; + val = (tg->mode - 1) << TPG_DT_n_CFG_2_PAYLOAD_MODE; val |= 0xBE << TPG_DT_n_CFG_2_USER_SPECIFIED_PAYLOAD; val |= format->decode_format << TPG_DT_n_CFG_2_ENCODE_FORMAT; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_2(0));