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: 716210 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 2BB94EE49AA for ; Tue, 22 Aug 2023 16:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237570AbjHVQQc (ORCPT ); Tue, 22 Aug 2023 12:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233571AbjHVQQb (ORCPT ); Tue, 22 Aug 2023 12:16:31 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944DCCE6 for ; Tue, 22 Aug 2023 09:16:29 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fee8af9cb9so27775205e9.1 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=R2++Zl0qlM8uael57cm8UBGd9vzzjOuiLv1uF0RSM5yPwYFjMPW2Zi6hWTZ6syeSXL 6R8MPfx6eUsbs5eEKJcc2V3m/crc8r/2i8Jq90B2fKnKN2W6NekkoUnBKWNW8deebzdY AdGujvM0N6d+VD6Zjd+7N4ZLEBXHRRo4Rvy5C2FJnQ0hNGpnLrDdFwrFG3yM1Gojrhvc R/6P78W29iR1/RggjuORw1MavcgpmvKFWQsOqug91v99VEmqZUWf4calAiKB4rCH4dVp mohUuYHTfPcz/zxeXWsKiMQZL79LG8pGdzRHCKc/JQIvPS5R6jyEtwHgZ0676b7jMszA NOvQ== X-Gm-Message-State: AOJu0Yy3AQ4MOndtmLODMj1g8dbFLX9MgX4w64kLNxLri8LtQtgwKwLH h/KfKrxyQpSflQ7ME3M3Ln9mDQ== 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-arm-msm@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: 715812 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 3D73DEE4996 for ; Tue, 22 Aug 2023 16:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237581AbjHVQQh (ORCPT ); Tue, 22 Aug 2023 12:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237561AbjHVQQd (ORCPT ); Tue, 22 Aug 2023 12:16:33 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECCCCCDF for ; Tue, 22 Aug 2023 09:16:30 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fe4cdb72b9so44628915e9.0 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=KLXGUwGHlwMOLlHAX8h7jyIZl6K+1vpRMdWBML+dnvRV+5uCdf4+wUjco1XQHV5E7z PSZs4fSdF7J2/nO0h+C/DstREaN3ZhwFCWC6eZiGDJP/blFG4Z3JJRBd8v1gAMwBZ/fQ cZ3xSOxh+ppWHu51rWWo7OMYC/ztx+Ht2rOuYRPwWS306Iw3BH4selbmYiD20F4NpOQd YFWH4oOodEYuhDKqSyCzqo6iU9/8OtmowOJlgjZ12v7yH0yP6Vflcf6RNqTxt/cE5R1Y iW3/03TIxOCX169Njs9rjyvpbe641gdIP3coSXc0E/hqBVi++dvXA05w1MO7FirBuubm fdVg== X-Gm-Message-State: AOJu0YxtnhCij4hVUsmYDQdUhs1T5XG1JVLsRhiYMaBy8Cov95pEyRhN DfP9lLLF/xWS7QhLPiPvrWUGEQ== 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-arm-msm@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: 715810 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 70A3BEE49A3 for ; Tue, 22 Aug 2023 16:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237579AbjHVQQm (ORCPT ); Tue, 22 Aug 2023 12:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237580AbjHVQQh (ORCPT ); Tue, 22 Aug 2023 12:16:37 -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 78F3CCE8 for ; Tue, 22 Aug 2023 09:16:32 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fed963273cso23278425e9.1 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=G54WPduMBwjg1oTZlGf+hfDyZWkLOCOEScdk03xWYByqEfI0fubyndAOxozEWeC4gS mH7s+Z++rCBZu/nuuV5E1nQZvH50glq0JKCB6Wdb0w5YiRj9bhJgnW0wXefVw/FoV+Db vwGtMyzzIX/jFjb9dTbYrslNWVFjmcSNIMXeOMt5jhin2bpPrq/1n5rag4eXp6RC7JfO JQ42+jcXDJLpR+gd8r3yLZtNPezi4WZUCLdWNnOebTf2+zLTe/L8SgfbztBGCynbj6G7 ZBpkUCufh6PssSbollDh7PnERFulX5s/D5IGghLTMpdBfEcPPOEpsEzEnVN/3enBDCG7 PiEg== X-Gm-Message-State: AOJu0YyVABHbMo6fvpdkprsCmOFTOLSKGQzIYK2O2VCAwCYUOXeoeUWx +NPkn+RvtxOpG47JV/7gyUjwbw== 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-arm-msm@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: 716209 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 E0D1FEE49AE for ; Tue, 22 Aug 2023 16:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237563AbjHVQQi (ORCPT ); Tue, 22 Aug 2023 12:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237587AbjHVQQh (ORCPT ); Tue, 22 Aug 2023 12:16:37 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69DAFCEF for ; Tue, 22 Aug 2023 09:16:34 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-317f1c480eeso4205631f8f.2 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=Cm16iCGqiH09QmFZjxZSVFXxz2tBMB3o9pkddwz4J7cC7QO4OLhcBHnVOQ/gD1B2xI lZhKh5lmT2Ka4tzyf6/fyCXNI73S7ionYKUr4qKtfeMHYjmgGwiQx0f4gg+Sf9hLA4BR D4J+c6zzbTLTTyPntoPBhiqTncVSPe8NmvWZYFqWt2DdmqbvgsugHqrLWgRd6NiLJW6s wrorDCT45rZrypynJPNJ89w0uqPqm7m9XqmoqHmbUnwRi9DlWo0BqXdYtXvEBuHNbn0t ytuzpZ4S+yFk4Z3WJZk6Zi9UGdFbng5vxRSmaB6ITDhbMa28kUUAnuA8+QlPnLDUakVr kP9A== X-Gm-Message-State: AOJu0YzLd2cXasMfKPVU55JDp+aCAu+LflBD82Z2HGUf3xqIGfnsWc7g qROvLqf2CyWFFBTfkyrTnczh5A== 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-arm-msm@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: 715811 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 42556EE49AF for ; Tue, 22 Aug 2023 16:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237601AbjHVQQj (ORCPT ); Tue, 22 Aug 2023 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237568AbjHVQQi (ORCPT ); Tue, 22 Aug 2023 12:16:38 -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 9CF16E42 for ; Tue, 22 Aug 2023 09:16:36 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fee5ddc334so19846395e9.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=iAvzPfAweuCL0LqhMxfSjhp9AXSD3+a/fIH3BgGbe/RJ+e7fTXOOMij/stkid1Q4FW rGzPqH1UaGKyrRGDcK0ey1L1fkE1TviMteXUtVT4riJ0JizoV2Hpgrol5Y1Sd84VFTxg oPYOQX5nlzU3QKV6NGnUxAwIAVHHUch5eqCp97FAVjiFypeCf23ZLwIZCzAafgyGn/4H kkgG0O+AjbOh2uAzvzdsZO/L8/R5bMDt+mEzDznUuY6nLqkkUTxI0DE3/VEHgVDl0i/v v5Y8aBnMKVgrfADTmwcMkMkz/NOp6Z173m8Iv9pmER82f8v4jSv7tTKAP6GEH49M5vbC bpPg== X-Gm-Message-State: AOJu0Yx6NPlLIuMKkkVTJfzuvt3n+kh7x36zkU2N07t5ufIrKOE5LxfD xJwKwtsYWfSN+0ZbSG6uPAhcVQ== 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-arm-msm@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: 716208 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 37372C3DA66 for ; Tue, 22 Aug 2023 16:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237580AbjHVQQn (ORCPT ); Tue, 22 Aug 2023 12:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237615AbjHVQQl (ORCPT ); Tue, 22 Aug 2023 12:16:41 -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 18BD6CF0 for ; Tue, 22 Aug 2023 09:16:38 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fef56f7222so15398735e9.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=DUJeCNADkHR2DNIZ2NKDOnidu1KHtvHqriHnozcnFMPvcdcnKnHSKjaEmrirabCAek bmdOrlYeqmYflKIBZf3/Kkz4QR8v0U0wOUdj0k1ZcJqOTGptFkKkUs6xo82+gja/ApLN gxAGTt2SrkyW2qwOPUqbbJmlNSxPjGGeGngOLEzVKcjj5A3nw1vPESVT7e5iIvLidXXM 22KDHvlC0okgxNvcQ7PXkAjlslk080SUwU0aoUAcwUzanKnR713cpH/gVHX+k+jZcz2U oTjNYUKFGiatb1Q5iuQJh1FbdiMcnhNY9pe/HwIJ7756nG8ULKXLmptb5xVzC4DVaKLH 8E7g== X-Gm-Message-State: AOJu0YzjWDkMSY56pgUszU8mjrg4OdEf2gmYnYsyczEkCvZtTIZwFTBb dX4kqd2AQi0jWIZ44q4qfFwfMf89Zwxwb1ksHrM= 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-arm-msm@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: 716207 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 62B19EE49AA for ; Tue, 22 Aug 2023 16:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237659AbjHVQQv (ORCPT ); Tue, 22 Aug 2023 12:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237634AbjHVQQu (ORCPT ); Tue, 22 Aug 2023 12:16:50 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC30BCFC for ; Tue, 22 Aug 2023 09:16:39 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fee06efd6bso20770675e9.0 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=HLrT6lf6I4rHrjK+8XDWk3dXSEH7Ajzd9pO48jTEiAeMhLiI8jF72pCzEwGdeafKWh G3sxmfKC6FyCJS2oYlNEjFOOwyR8y+/AuMg7Z8p1HKug9eX+7XZmI5HZn/sepDCFUeHa QWZC+KB//FeFbm2qgApl8En4nlm42cC0Hoemb+zSIq/0ajhasmpwvR7tfu7T8K67kp5y u1xfYjft80v5jBTDUxg+9CeC5YmY+s2G3byupSYHAN+IUs68oeZBwdyplaA1YdNz58rW k/caUTZyyLi536036gbt3G6b6n6MLj82IpOzJgoStLzIuIn5NFEdxud/ORaWsqAZFEb/ utcg== X-Gm-Message-State: AOJu0YyZYChQu5gB0fOIG+WwcPIuq6CWKxywso/UCkprQNoiaR4XdYLU DrMdmvxhihW7CttcasgUDhJUxA== 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-arm-msm@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: 715809 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 D6CD8EE49AF for ; Tue, 22 Aug 2023 16:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237641AbjHVQQw (ORCPT ); Tue, 22 Aug 2023 12:16:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237561AbjHVQQu (ORCPT ); Tue, 22 Aug 2023 12:16:50 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 260B3E52 for ; Tue, 22 Aug 2023 09:16:41 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fed6c2a5cfso40338245e9.3 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=H99Ck6jktH7nSXX1bQ70l89UZhwdqnXh+1Z+wZ9qCZEEebP+cLYxZRuKJyk0gqWkpK cbhz2d+etqDERC4lSjd2ZFOu6mf8YQTLrQd0nA4zI5uueDnFUv34b5GsNm5UK8bnITEQ C6PlhZMmYFJdgSPKQ2MZ3twuZcRgeOBeEt7rroVuKbbUYDGK4D6MUx/5rZc11/L2cdUk BEnXVHLxe6BCsqtcYUK7H39fpELDiOi6ZZDtcwDftC+tUsTHdN7JimGpPOBrJQBNryjs Bwr2zE5+63FeZnI2wulwoSJHF+TZ/2jEEEjIie761El2bbRh4UpmB1Mp6sbehhsaJVNl BfBg== X-Gm-Message-State: AOJu0YyDjAxAsY2bfW+UR42vlf6JhvSPjRVRY7N0Dzw4IdUfbJg9N+ok FALyMRmcOiJXRchMewDoUgC35maafVYS/hDnUqU= 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-arm-msm@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: 716206 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 60A8CEE4993 for ; Tue, 22 Aug 2023 16:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237620AbjHVQQy (ORCPT ); Tue, 22 Aug 2023 12:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237653AbjHVQQv (ORCPT ); Tue, 22 Aug 2023 12:16:51 -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 80D0CE5A for ; Tue, 22 Aug 2023 09:16:42 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fef34c33d6so18275345e9.3 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=IGG0Y8PT4qyqsRvaR0H5l8pIbUUilOy6Ws9Gkmt807w1SMAeI2EdAS+KAEuplVswjU vw3mWVQ8eIKAQXAS7CmDW6ria+Fo4eqFXbb68DXGcpiCYiOraZrOuhVwWKdrGfdVzOXU cQdUeztLdjb766a3Yk5G5cGghGt+ameOQe5H+qgLvLfbEnQ737Ly7uUBqrgq4vroXsiC ojT2lwII3+oJShnLBC9HUQbj/ylFQYSMmH8SSfSOwY4L5H6o6VfIT0mGBCcU8lUA/2ZV kDqUgenWJ6SlUMId2gMqXEugiIPwF+fKMW6CtVzDoQjnOKNL6Z9RUz1fUmw1MQgMj1zS 6sKA== X-Gm-Message-State: AOJu0YwdADIgbzgyyzC553JdXR5dpllr/i2mxvJne9EWppHIK5QnnvUv v2JVdB7d4uKvFvbgOb9hmfsiFw== 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-arm-msm@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));