From patchwork Wed Mar 27 18:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783850 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6162214EC7D for ; Wed, 27 Mar 2024 18:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562931; cv=none; b=HODkHxM6MDmLsDOX/6YuUwvRcrab+C0KngoBpGKUkLYEcpi/4SIrsFZXPo9rXfg0oqFNpuETPNAGdnf7NGrrmIDVbtn/dsfz8hv+GsZdZcqCZkh2OOq/H7Xyu0ikWDP3a02gg38fGGArjIpXN2liirPSwx2iGVU5AnMVb41DlEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562931; c=relaxed/simple; bh=RxQTdUpjK7n9jlqHzRTCj2QYKYXt/gcESZV0SsfqRQs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AZjYxdLy4cgxqxoPRuNJeRkd4MPYJgsElxFqUayvhgusBu/aeFbc7523luEM8K4YCKoIiE6/hGM2rimI3l5pIZd2/3jx5Bt7A2upHRvR3/v+uPWOTGTUnZTxu/FJAjF7kilb57BXYVuR0aZ/+ncjXuwL6JFiSAUmCoZqJ7gITxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cRVzc6bp; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cRVzc6bp" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2d28051376eso811851fa.0 for ; Wed, 27 Mar 2024 11:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562927; x=1712167727; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ufceKu2sjQInstNmRM4A4hKgkn0LCmoRG9xSwRpexAY=; b=cRVzc6bpjLTMhXAZy2T3jW4iSnrmGuct027Svrb1TPyGbkEjWXlbhIkFTGfSfF6UVb SAat3+pj1XxpO+M7D15GrgVrbynq5DrQTw+v74MX3/kshGyT3p96dw8W7ccTRMtxbVHm VbAYa0fpyMUO18L4vaO/dDQ3V1k7C/earcxtned+rMs0P92QlfKVJnIWU/LCA0WKiusZ q4DD3/tFzkvaz+DbGrwuH+n9cDaVm2ujX8V9u4xdwmLjCVvJb24P+q33XVFnrN4hvTW0 eQpF90OeR31lDYKZzdIVm6EDEX8t+EUvcPEQh3iOhJrXlMmqHSSZJ7glRT+2KtvgIvSp 6Qig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562927; x=1712167727; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ufceKu2sjQInstNmRM4A4hKgkn0LCmoRG9xSwRpexAY=; b=kFMtpvb2i15L79uWpq5ZE0Rr1Cc/nuz5V/Dv2JmNi1G/ewITQjSxp0DzFhEm65/ZaD jhebJN/wHApifZzLDelA6KBwgtz4PhIe/9X+r3yW48z3ysX8afj5ioPvkB0jC5EY1A2v ZPNZu2paBkNl0FJue3J1YnwFwsRG588l2CE/DsKriHpWPvSuxL1cS54Ewl1D2DhA00Sf 78lib8+BHdToOpcJF6ogRqVYgKXgqn3o3zgYyudglruwGEqBXzFjpfgFlVf6zR0ptO5O wfJRvdHSZiMCcn9zMTpJmG6iGkgqrMnwOdYe5g6ygzTZQLMTwOy/ZiVnU3HnqzZH7Q1H 1IIQ== X-Forwarded-Encrypted: i=1; AJvYcCWOF0pqZlgKIVet7A3Fu+RJRD6lceUWiHUYFIue9OsiwLwEgxL11mzAsWj6Wa/gzXY3E/N4tDvmDXLN75S+7CGQuG99ZAq/FSPuZh4= X-Gm-Message-State: AOJu0Yz8YlsaER3VyE1qQmd5IHQbxI3dVm67WQw/BJtKPPx7+adsKbGG WIzDK3OCQM0AmF35q1nrxXVRQd9bTsjPeKs3iRXOWnQk0Ykw26lPQM01nhjcBqM= X-Google-Smtp-Source: AGHT+IGtwkr+8FXBH5HawUs/22QbET/WVAMrziaPP/BiLHPGLePuqcrILJR9bIJkIOKHVJ4YhncSEg== X-Received: by 2002:a2e:850f:0:b0:2d6:87d7:601 with SMTP id j15-20020a2e850f000000b002d687d70601mr685526lji.9.1711562927492; Wed, 27 Mar 2024 11:08:47 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:47 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:39 +0100 Subject: [PATCH v3 01/19] media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-1-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=1871; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=RxQTdUpjK7n9jlqHzRTCj2QYKYXt/gcESZV0SsfqRQs=; b=9QFcKbbpKNO5D0mYgcLuINzynNtodRw9SlT5GHRxCBjR91l65bNRlMOS4j/aThpH5CqLOiwJ9 woEwXi6/F+8BxMC+95huEpVqeO0a4KECM7U87NHTSAuik16lBuWZcgS X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Commit c22b1a29497c ("media: venus: core,pm: Vote for min clk freq during venus boot") intended to up the rate of the Venus core clock from the XO minimum to something more reasonable, based on the per- SoC frequency table. Unfortunately, it ended up calling set_rate with that same argument on all clocks in res->clks. Fix that using the OPP API. Fixes: c22b1a29497c ("media: venus: core,pm: Vote for min clk freq during venus boot") Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 502822059498..8bd0ce4ce69d 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -41,24 +41,23 @@ static int core_clks_get(struct venus_core *core) static int core_clks_enable(struct venus_core *core) { const struct venus_resources *res = core->res; - const struct freq_tbl *freq_tbl = core->res->freq_tbl; - unsigned int freq_tbl_size = core->res->freq_tbl_size; - unsigned long freq; + struct dev_pm_opp *opp; + unsigned long freq = 0; unsigned int i; int ret; - if (!freq_tbl) - return -EINVAL; + if (core->has_opp_table) { + opp = dev_pm_opp_find_freq_ceil(core->dev, &freq); + if (IS_ERR(opp)) + return PTR_ERR(opp); + dev_pm_opp_put(opp); - freq = freq_tbl[freq_tbl_size - 1].freq; + ret = dev_pm_opp_set_rate(core->dev, freq); + if (ret) + return ret; + } for (i = 0; i < res->clks_num; i++) { - if (IS_V6(core)) { - ret = clk_set_rate(core->clks[i], freq); - if (ret) - goto err; - } - ret = clk_prepare_enable(core->clks[i]); if (ret) goto err; From patchwork Wed Mar 27 18:08:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783440 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F66914F9C3 for ; Wed, 27 Mar 2024 18:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562934; cv=none; b=ChMr+KhrTq0uyrLREOgM4oyuJdljr2dEvgBE2XSiui1IDWbWaEOG8DdDBhzY9VpjLkiuovko0wus1dKGBCOueqLPUSidg1wpfQclSjdX6fuZBvE7fo3lpFS29VLuCly+chsFIN2yAX7v7v12UTmJIxE0enMBvvCzrT73teDGqhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562934; c=relaxed/simple; bh=2J4GFcJEb/ok1nMNM2COXn5TmyzEayEQndQUNkB4dqo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h7t86ftsq0VTfLN6rD8KCogBv+Z82+joH+Ly107GHSePsTfEAWvKRtzC4tjfRS4pPbVy+j1hzy/qXzIs+5SSrInvXRIgKOQsiBPZPNXFcL1eGrLQ9QznTt0ENoUbF3Z3gIDdnISsFoBTXsOkqLbbz3euiVkwH3wMHxaicYZMiwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ID10q6LU; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ID10q6LU" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3417a3151c4so21021f8f.3 for ; Wed, 27 Mar 2024 11:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562929; x=1712167729; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yKtma1geY0OQRnHtThKspHVPEwvhLZRJr0GFmraQ2AM=; b=ID10q6LU1ckyZB31C81axJhTEpxxDrxTzEY1LFFSo794UBXhXggRBWA9KhevGFSu7r FQxYgWJfo4VM3ou4aGovieHYZUwv7kdzJxQU42yOIUOqI6gKBL8m6AxnvpnsyPO14V+L ogRAv3DQTvb+yLO3BgwcgaZ+HV5ZEo1F6WerghIImikunto2NTKSkSu7ENNVyKzdyovY W1dO9pianpovlizjjTK2iVKKFw6wPxuuxlYveHWGMuLgJme+O6F3LCr4HJVmYp3rpWzc 3jXSrvXE3hUFle0HXec9PkTZw4F+AOVGs+xbBWtvs0+YM2JzXFK6tU+1dSHxW3rECpNT v5Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562929; x=1712167729; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yKtma1geY0OQRnHtThKspHVPEwvhLZRJr0GFmraQ2AM=; b=YnHpoVF+6m2umTMQS5BVFik3gwfnzRBHnMu0eEr68L/anw1pG3Qw62l0evnYNoUtyY 1R8oUV7zlktQpwZ4+q3quaIn8NT8Ce3KmuztdzlQ050fcv9tB18nfbRFFIbdTFHB2rdl YjsdvvANnxwTE2dMJUzAGv3Qaztf6J73wQTCwryCpVm6ae9XagqHj0YcRYHFe2tpwXsW AS6HH2fB4EFfU5JQduArazLqnwYXZ7ahAGxd8kbioX6HP/fFqi+x9UBgIwx5mR6nvd1/ v3whWlbTVWx4MOAhcNBoDXZ5JkFylYbsFKmHyd2zPFs13h9m/U/uFAelDO3iO/gRt9Ve hl0w== X-Forwarded-Encrypted: i=1; AJvYcCUntnQtN6pVsNP2v7era67+RNdmDDnIgLUT/Qxnaov2DsgeimwCvbctQA6z8OTYUDXL2nobPgFtffdBSeLfi0gKEN86fGzncMw+K6w= X-Gm-Message-State: AOJu0Yy/TLHiGxfaChvvx3FTVzd5PIOZSyaDFLSAEyj0EV7QHC452WvZ auTyv6o2pGZEf056dcFtSgLskzTOgvUb0dHln35i/wL8lG0GBHqk5btL08+0+UU= X-Google-Smtp-Source: AGHT+IHsB3GLxgP5XIxcW+UPWTDprzqykwmuw33rABaQFAjPbcDfqcHvD3oXaa7/QCIBqaYiG6I5CA== X-Received: by 2002:a5d:6a92:0:b0:341:bd4e:68f5 with SMTP id s18-20020a5d6a92000000b00341bd4e68f5mr713223wru.5.1711562929578; Wed, 27 Mar 2024 11:08:49 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:49 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:40 +0100 Subject: [PATCH v3 02/19] media: venus: pm_helpers: Rename core_clks_get to venus_clks_get Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-2-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=1211; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=2J4GFcJEb/ok1nMNM2COXn5TmyzEayEQndQUNkB4dqo=; b=rWV62J+CudHYBsig6BzDDpFCVZyvMzuo7cNi9KQPbqPsoeQ1YAY48CyGpCanimW3iJhftI1OC uZeNr0vPJoDBcjrFoVPEbLo4EKqjQaQoXYnESFn6PBHgNv8cGSOOaD8 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= "core" is used in multiple contexts when talking about Venus, rename the function to save on confusion. Signed-off-by: Konrad Dybcio Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/pm_helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 8bd0ce4ce69d..ac7c83404c6e 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -23,7 +23,7 @@ static bool legacy_binding; -static int core_clks_get(struct venus_core *core) +static int venus_clks_get(struct venus_core *core) { const struct venus_resources *res = core->res; struct device *dev = core->dev; @@ -294,7 +294,7 @@ static int core_get_v1(struct venus_core *core) { int ret; - ret = core_clks_get(core); + ret = venus_clks_get(core); if (ret) return ret; @@ -961,7 +961,7 @@ static int core_get_v4(struct venus_core *core) const struct venus_resources *res = core->res; int ret; - ret = core_clks_get(core); + ret = venus_clks_get(core); if (ret) return ret; From patchwork Wed Mar 27 18:08:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783849 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8B8150993 for ; Wed, 27 Mar 2024 18:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562934; cv=none; b=VAoLuyaPpneml9+zvNFOKBBR+KnMXfLG4/nUCaY/qShiRr7cy7O6r0Qg86bOorjKIbutygghs4VlRJefVp2frwuORYMS0844zLqouM4HlZhOWFelClaN53w287wi/IQv6X8FtX9+EfIGWfZl3FtqnH+PfSVZZfnvRQGib3cOv+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562934; c=relaxed/simple; bh=0FsCQVaaR6mlZkTyREXWtukXCjlINsoRv31QgmDTlf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=As/NLHqS3MYilfmunGkq+quo049AZuCYerswzEt+xZu1ux4nAX4dRSyJyHt+iMX3cTVxgqDaRWtz9m2epBhIJi6NfpSkZwKg9zXsRBjghRkxQIZ1MiZ2NtiHLbkqgVeoyFceB+fZYgBPpMnMUgJp2mlJDVe7VKWIRI4iH7j2DSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QRHSIiZz; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QRHSIiZz" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a4a387ff7acso13077166b.2 for ; Wed, 27 Mar 2024 11:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562931; x=1712167731; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Cpiy05x6+KmwppdZDoeFtIMDjcMCWVRc+LYx5JwTOaY=; b=QRHSIiZzE9NdURx5SjtD2dmOvBjQioEuGVTBX7DeV8JvcMS36dFt6WbNlw8iS38QVA sBsEayhr0WjumwsEPah0fzq5/uL6qMa/XAz4Cdg8hD6zWi2vAIeENlrXstjaQCxikax7 O9iIjhBYVFxbwUWaXHwXirXCkqzUPAttS+E71MbVlX62GuKqG9bu95tnPb0Vnz0Fsjyz kNlFTBKUgM6ir0ssAepSYW0F5Rfh7oD8bKLZPihrqhvOyROTyd2dj9P6Q/VbXdx0z9VE 430Le/SH3rK1BGZfs1f0Pg7iojQbTeVwBLftdpqZJ+Q1e0ElFXbkjcKTrnQZLriCzsLr REnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562931; x=1712167731; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cpiy05x6+KmwppdZDoeFtIMDjcMCWVRc+LYx5JwTOaY=; b=CrD/lnbR9ZDWIQ8+Nn+j0eEUF0zbcfFUBHI7qfy8T1w1q2vOUQNeavVKqsXXq2XDRn y9h/yy5bsgWU8GmQw6wmuYS2GO3NN63Io9Y9ym+Y96PUQ2x+8VBhC05fKUJfV2qhmxZV dKTAPE17zT8YqFN0wvFDEkX4VlKjJJ4lln339moMssKov8eJgzt7xi+1wlcnRcBU3Ei0 lngDybFl41U2TbuAJiRAWR28esmIpsb6IFhMSetpSY1d5IbxF9PmzlAl0PlUjwd3m+0t IPPo5Xn7NBMZSbxN/MVks9VchG5DHmCALO/4ufiXHX8PA7mrJkJNiR4nkN1E6MzRHOlr Exeg== X-Forwarded-Encrypted: i=1; AJvYcCVlAgVCHM2/T7D+NV8KH/4kvuCRXniSywgGw43BsIkhiLLiAWWvXbZTGZO3xleBFd15K5ww4agNXjMw1+oQ9tBJM8AKhWDJDWEIg+o= X-Gm-Message-State: AOJu0YymTOVFr3oEb+qnIU0JtpdxnNcIdbsbl1a5U1ywR+3S05277PeL hgthGq32OiGenIsmDfVpoiz0nT0tifC1O5h/Q9W/SKg41qLDuZ1xoC782W5xX70= X-Google-Smtp-Source: AGHT+IHydqg0ryKTowRqgPPxpikjTmMXrNDLePw6z1aW3FjnX1XIQsJWSdcaJJk1RsmEiO76VwqCHw== X-Received: by 2002:a17:906:e209:b0:a47:29ef:f3ca with SMTP id gf9-20020a170906e20900b00a4729eff3camr165767ejb.31.1711562931607; Wed, 27 Mar 2024 11:08:51 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:51 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:41 +0100 Subject: [PATCH v3 03/19] media: venus: pm_helpers: Add kerneldoc to venus_clks_get() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-3-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=2193; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=0FsCQVaaR6mlZkTyREXWtukXCjlINsoRv31QgmDTlf4=; b=XnknYN2sPi2dJ+IqyT2Vfoq8/8onJ2qiUbiRyC6uKY00P0GSoy+wFqTEbOhtzn8LOy+0HBZBn bddAPSiXr86AVYTi8xNlIi7MUuDCciF+i/4xzPBAPKg+681HKPrZD3/ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= To make it easier to understand the various clock requirements within this driver, add kerneldoc to venus_clk_get() explaining the fluff. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ac7c83404c6e..cf91f50a33aa 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -23,6 +23,34 @@ static bool legacy_binding; +/** + * venus_clks_get() - Get Venus clocks that are not bound to a vcodec + * @core: A pointer to the venus core resource + * + * The Venus block (depending on the generation) can be split into a couple + * of clock domains: one for main logic and one for each video core (0-2 instances). + * + * MSM8916 (and possibly other HFIv1 users) only feature the "main logic" + * domain, so this function is the only kind if clk_get necessary there. + * + * MSM8996 (and other HFIv3 users) feature two video cores, with core0 being + * statically defined a decoder and core1 an encoder, with both having + * their own clock domains. + * + * SDM845 features two video cores, each one of which may or may not be + * subdivided into two encoder/decoder threads. + * + * Other SoCs either feature a single video core (with its own clock domain) + * or one video core and one CVP (Computer Vision Processor) core. In both cases + * we treat it the same way (CVP only happens to live near-by Venus on the SoC). + * + * Due to unfortunate developments in the past, we need to support legacy + * bindings (MSM8996, SDM660, SDM845) that require specifying the clocks and + * power-domains associated with a video core domain in a bogus sub-node, + * which means that additional fluff is necessary.. + * + * Return: 0 on success, negative errno on failure. + */ static int venus_clks_get(struct venus_core *core) { const struct venus_resources *res = core->res; From patchwork Wed Mar 27 18:08:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783439 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C4B1509BC for ; Wed, 27 Mar 2024 18:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562936; cv=none; b=Q0iIR1aLxBkh6dPIMduN+X7IqXIBc5T4yLGGCfRpyfZDtTj61sDMh//b5PZASEgryj3/qi+71jfPrOkrFUVxX90C/vZS0ZR+dLkAwAXaqbo9f8zumjE02uOEwCNc33YvJ57Atk12jq6mK2T7g0/Qskc/Fwja/cX09ml+NAKLvvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562936; c=relaxed/simple; bh=wJFz5d8slJE57e5GmLZn5BRO8EuIyUY4HPhwJVN9rgI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jWrzVseKxRMDEVh//irXGTdY/J8JXN92ju/jHcx661NHFag5FeqeOhS9aJiB3TlICCK5O0rbgdc+xXuY3/YBGdcyiXm10HEvvBZWtw2khfuZ96w6U8pzE9jwPAaK++V4lp8sXIwYmfn0RxZHz8gTYxKSqburZz+aRLEfkEczjzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=TMm5uSOH; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TMm5uSOH" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so166154a12.0 for ; Wed, 27 Mar 2024 11:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562933; x=1712167733; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=MwBVkmIN/f23ohmAUPrx11lmfpC7Jl/+ZfCBD2GN4gY=; b=TMm5uSOHPUezfr4Extnw4pnEauJg2zO4K4Kar2RmOmoGkJRy+97HmFwZHRwJylUAzb 3ODxOUa5Ze4JjNH9YYuNDzCtesAwoggdeUgp/SR1ovHvPHzAVJOFjjQXRDnJgNA6ykIJ E+Jj5JJIrqgzylLXx9riLUwkJUhm5KvO7t9at29An0FBCwS0qxPtVUdaKnazrWdEo9Y7 gd/oV8e6aSntBOEOm8wyTnToOR/ubrCYOZVzoRYHfxq7lT/6jv0zGREiI9fekapKGbv2 aY7Nig1e+oFSKy0XTk62fMBHxGEb6JVzW1b7jwWp9zViNBuiCupVUO1aUS1WEBK7/nE3 V+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562933; x=1712167733; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MwBVkmIN/f23ohmAUPrx11lmfpC7Jl/+ZfCBD2GN4gY=; b=A8STM5/G8sAB8nca/m0QmOQjMa8aoQst79JSP2+1UI9nCIcJRd8FDg+bqy3iPvxdaN Cv409Tfrs6TskJB66h19YLwjzSTfpLVvwuzwXeQ9HTtuvr26wC5+T/RVZfTEH6xkMREp nscXMv/7j2O9ha0bfvRZKH2Rf2gMmecGvreON2f7ElxV/fwtqdNXFSVGtcMSzYOYGRf3 TSBzkW7wSnpT0ARkevFExAOTz0BeRElgYnRaJaHfZLaWDvaFElGOMyJq5yNZhl8UfGBW rylByfYCAKZfpbLypHMYqGybZaT4+OO0OaM9HvLHz5jLFi/N4yxYJw6yA9m0PTsR49Ue oE3g== X-Forwarded-Encrypted: i=1; AJvYcCUQ7FoFciq3GpqxiV10IMzRECwsed7UMSJUZv7d8iTzwjeM3xupu5t4G8k1En4Vl7VmF2Y9WXjlNH3U8sjYkGaYTYM2TpJyJ5Lx+vw= X-Gm-Message-State: AOJu0Yx5ZYlDTeTetPZkygZKSMos2Ej4lfQxyLSO8JKllcEPd+boZFPW ZOkgujp4FMm/G6LpwGkdI8iPKMBfaiyV/Bsr5FgGAEqWaCqpKVf+BhAupNdWnP4VDEY93RK+L8C t X-Google-Smtp-Source: AGHT+IFczK4OLDrjikdsTIV/OH2pjjMwuuZc/I3AgccnWZnTU7aC8UhvaOwiVA4JU1kLpTXRuTYorg== X-Received: by 2002:a17:906:b50:b0:a4d:f5e6:2e2b with SMTP id v16-20020a1709060b5000b00a4df5e62e2bmr180563ejg.30.1711562933332; Wed, 27 Mar 2024 11:08:53 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:52 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:42 +0100 Subject: [PATCH v3 04/19] media: venus: core: Set OPP clkname in a common code path Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-4-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=2649; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=wJFz5d8slJE57e5GmLZn5BRO8EuIyUY4HPhwJVN9rgI=; b=Bf0NiXBrHoyEc1WvPD6HAWIxeCn4Fg0XKu3Y2qVcVxRUSCDSltlwUnL+ip3BgQppXfxv5tzbU WahzULqG2VFDZCeiiIy33gihXvW/COD9XjaOjejxcxynWqbz1us2wTU X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Calling devm_pm_opp_set_clkname() is repeated for all HFI versions in pm_ops->core_power. Move it to the common codepath. This also lets us get rid of core_get_v1. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 5 +++++ drivers/media/platform/qcom/venus/pm_helpers.c | 23 ++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index ce206b709754..5ab3c414ec0f 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -319,6 +320,10 @@ static int venus_probe(struct platform_device *pdev) if (!core->pm_ops) return -ENODEV; + ret = devm_pm_opp_set_clkname(dev, "core"); + if (ret) + return ret; + if (core->pm_ops->core_get) { ret = core->pm_ops->core_get(core); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index cf91f50a33aa..ef4b0f0da36f 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -318,21 +318,6 @@ static int load_scale_v1(struct venus_inst *inst) return ret; } -static int core_get_v1(struct venus_core *core) -{ - int ret; - - ret = venus_clks_get(core); - if (ret) - return ret; - - ret = devm_pm_opp_set_clkname(core->dev, "core"); - if (ret) - return ret; - - return 0; -} - static void core_put_v1(struct venus_core *core) { } @@ -350,7 +335,7 @@ static int core_power_v1(struct venus_core *core, int on) } static const struct venus_pm_ops pm_ops_v1 = { - .core_get = core_get_v1, + .core_get = venus_clks_get, .core_put = core_put_v1, .core_power = core_power_v1, .load_scale = load_scale_v1, @@ -423,7 +408,7 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .core_get = core_get_v1, + .core_get = venus_clks_get, .core_put = core_put_v1, .core_power = core_power_v1, .vdec_get = vdec_get_v3, @@ -1013,10 +998,6 @@ static int core_get_v4(struct venus_core *core) if (legacy_binding) return 0; - ret = devm_pm_opp_set_clkname(dev, "core"); - if (ret) - return ret; - ret = vcodec_domains_get(core); if (ret) return ret; From patchwork Wed Mar 27 18:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783848 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5FBC14EC52 for ; Wed, 27 Mar 2024 18:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562938; cv=none; b=KTdJjwAn/vH8+GOVFhcMT7Yuw2++w6/OeVsoHpbCDDe4zyN4YTq0Dj2oGdcJgya82p3e2UzQS9sy0de4IUTnL8TSGAswaLYnBIJiFL67myYXZFLV7xywc80j4vGXSmx2sWKQ/1ED4ue+RCVMzxDF8nAMJb+8GJElxPGq3E17/Lk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562938; c=relaxed/simple; bh=eVSp2SaXb6ZPEBSHNnDQtpmgf1YsvfYEdjUHzWm3f+A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cl7gHkeJkWDGr9RqRTgArTv5u5HU46dSz+UhoUq0XoVQbwtbgtkK9oU7AkStE3PHFffiQE1m9hzYv90ddsN1PlPGsdk18/v2LFoTTtVLQGExxw1Zs3cRot0sW39DeCv+GaX8N7SUvmB1/hPD5VvPQ/Qm2lkWZ97XdtkmsQF3K3I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WGUDT0JB; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WGUDT0JB" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-515a81928a1so39924e87.3 for ; Wed, 27 Mar 2024 11:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562935; x=1712167735; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6wX0IpKx3jbsUc8KFF/llXZK/XjrxPJxaaSBhC3+nnU=; b=WGUDT0JBZguhcYWEsQyZPljvyoxw/2qMauHU4bnDXUcTFrvNco7zu+wufMKK2cDA2R N7ho/LKd9/XGGZBGp7iD/546lLAS184XlLREWUdNdLKnNVYMqSy3xcHh/NHVbKDM/zpE pRO/MJPpW76ThDlx9xDJv9/z2f/Ylwbvq4+4eQ+awRT1lt5AWW54NCu9lkGn8rftZJ0O k2BXYP/Nnz8GNKlqd87BM7NlUyHKdzT3WKECuLmzE+vCe6f4WeAs3YqABTeLKrhS7/Nc Kc4HqVQZwGV2L5/tsBsHyWuhfdHXU2BU5MVvIv4678ENkwLZSs4v66i/EDcgLU3jK5YZ rcqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562935; x=1712167735; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6wX0IpKx3jbsUc8KFF/llXZK/XjrxPJxaaSBhC3+nnU=; b=rb4peb/V3MWrifvbn6gx/JvFLroaRnYUfTZiJQdTHnTSJHVibFZjDKZKw+tNtQT78T yktk6Em2/DdYjFFFlAQzFGNCg8RGg2qlo5ZAq2p7FglyszcVuyieTKDFxK5EiyKRp2Mi egDpg5e7ZW9crVV1PyqSdiXy3IqvitASKbQ5VK4RS/PiIV89wEpojKsBqePjFjjF1Qli v27JDVbLh6CcQX6C9la3aATtA7BtY1rnMnKmaNtWn2HlxaZA4oTyRKmfvphah80qHu/Z i2L3fgBLX6duFaAPeCh7mqTAubil3dOs1O1hp4OeKwPf5GhMVBNST9KDIovqLqqIwTZ3 aynA== X-Forwarded-Encrypted: i=1; AJvYcCWvJaXnV5Dv45lNbncv2SHpLdZ/pmA/ZuAwicowqzPNKVIiITFbvgaBzqd3WANblp38q8zte/HMwVSJMrlPm+kcnzv4/c/YfAcZzG8= X-Gm-Message-State: AOJu0YyqocjvmKgPcleaHIAsL6RYnFM71fEaMbQMpYnT9yOrztR9zyGY lcQzFD9rRA7pS3Cxqf8obGPQ8pDk9qx/ncwGQvwn0OQuFQ+OmSmh//QQWcQpICk= X-Google-Smtp-Source: AGHT+IHyeSfG7ShilV7TcOWI1bw67bLr5thuITdc64PT5gCyRpNSobuwZPQWecT7wRuzwik+KCUFqw== X-Received: by 2002:ac2:4d83:0:b0:514:2f24:b0b6 with SMTP id g3-20020ac24d83000000b005142f24b0b6mr154865lfe.67.1711562935224; Wed, 27 Mar 2024 11:08:55 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:54 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:43 +0100 Subject: [PATCH v3 05/19] media: venus: pm_helpers: Kill dead code Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-5-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=1555; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=eVSp2SaXb6ZPEBSHNnDQtpmgf1YsvfYEdjUHzWm3f+A=; b=BHWNIoTztfwsrr7RTZRtaZ/YQ1pFKmqgIum9BEIl4vsZSVPGO2xFlQP/pT4zwOeWHR1Vb+Z3r /McnKLl0KVYA7TIGWZo8axiTp/1+e1w90voRNu1NsVTvMWZezJg1Ik0 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= A situation like: if (!foo) goto bar; for (i = 0; i < foo; i++) ...1... bar: ...2... is totally identical to: for (i = 0; i < 0; i++) // === if (0) ...1... ...2... Get rid of such boilerplate. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ef4b0f0da36f..730c4b593cec 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -878,14 +878,10 @@ static int vcodec_domains_get(struct venus_core *core) .pd_flags = PD_FLAG_NO_DEV_LINK, }; - if (!res->vcodec_pmdomains_num) - goto skip_pmdomains; - ret = dev_pm_domain_attach_list(dev, &vcodec_data, &core->pmdomains); if (ret < 0) return ret; -skip_pmdomains: if (!core->res->opp_pmdomain) return 0; @@ -928,9 +924,6 @@ static int core_resets_reset(struct venus_core *core) unsigned int i; int ret; - if (!res->resets_num) - return 0; - for (i = 0; i < res->resets_num; i++) { ret = reset_control_assert(core->resets[i]); if (ret) @@ -953,9 +946,6 @@ static int core_resets_get(struct venus_core *core) unsigned int i; int ret; - if (!res->resets_num) - return 0; - for (i = 0; i < res->resets_num; i++) { core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]); From patchwork Wed Mar 27 18:08:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783438 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E439B152175 for ; Wed, 27 Mar 2024 18:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562940; cv=none; b=NYMqu5B9uAFHGQfvOrgKBOVjqMpwBO3nATCt+Tefcjjx+rTW9D1YdK/e2j/HCHfD+/MfeRxnWJzVkjZt8TALEksPKi+a7LOLyndEgSrewhx4HZR+MsHPcNZmgf8b32xk23ux1p++TkbCoAZ23IZirfL59qS6oM4jEq/ekDvqoL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562940; c=relaxed/simple; bh=6kdN4bIMMHrZ4SMvrh49Lrd228bzKlbevJXjeVijEjQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iaBL7W6OeZfHRnNN8S82FEeWcEk1UxjDUyA7bOe3xIsd1UswbSE2tW6UvfPgd+B+Dw5CG6gepzAws5EU5kUGPO8/xsw8H1g1Bs8jSeE3ErXR270VdmCxEpIH3OqXIuch2ifaaY8IMgnAgOOYQpuEJz7+uigg7NjyVpMnBPTcGQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=GBwGLLRV; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GBwGLLRV" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a4a3a5e47baso11881066b.2 for ; Wed, 27 Mar 2024 11:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562937; x=1712167737; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=v0yrZ/yWAaXgHD2Ul0KN3dDIRFMbDzRG8DuMRaqz9/s=; b=GBwGLLRVa8m6haSMEvTbNMUkL+jjFKL1nLdGPKrjVMdQ7IuHF0X1XFCJE3zPGpM3Ot FEmV6og7SF1IGUFD9WjJbppOdbsFc5L2K/JQ8ITxfMCM9uU5tjsw+8rXhHK0QhriNghA ypb1jJLHO7J7PQ8ODXfm/+jAwce+o1obZNKZuVpTy4FY466I9Si+F8M29c9YCvLCvd3k 6ET/cSTJPnatZECwzj7vkKh61qRDyu3T1is+jCBCpFU0ravcTN+SmChpfaOrW5iJJbGE XCAPxhKGYaU4zrzBj+fF/xvoKuj+bHy2urubtkztofEJjSkH1VRu+H1VPqxSy0vdrJDZ s5BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562937; x=1712167737; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v0yrZ/yWAaXgHD2Ul0KN3dDIRFMbDzRG8DuMRaqz9/s=; b=ehNoGcfHlIJMRo5gkeHHNNwpnyhay7ydMgv2NwQacszU8kmtVA/vE6RnHI2mXgzYh2 /Je0bOUaa6AbBGEg0XeR5bUSAL+yyyV5eNC7/QeJddmCXw4VemyDFccBbKuV3MyPSbYn z19ASBc7sD8tqKUcD4g6jQGcYpS8oc3p6V527U5DNY0khRTUWye2R7eOXgEPJg/uPjCw tgYItfeTYSslGAoRXclhjFbEaY7WVobh5MKE6a5aUr9+l3xvfSuMNQiyDyf02OnPkpi0 lBl1YUk/2C1yZl5r0s4aAAa0zRRJAfjn6ZH0N/mUcC92QxzH0O+LRfx9kqtfdUQ1E7sI bJ9Q== X-Forwarded-Encrypted: i=1; AJvYcCWtkyCBEoMht68wEd27gclMMUjeYEc1qnVE5ANUIKHE94O5E4/bh+izcimFSL9UZdG60NiLqE/8yJXWT9UwbvnZCAs+v+lal7A+rPA= X-Gm-Message-State: AOJu0YxjdUHnhOQ05iPiHR9xYiP2VKnK0cehoXBO6uCvcsHbwqs6uTCo qdDDPrTNr/eih3l3IrDwBoBedGoL4RL8SojweaC46X2nuTQyw0CW7HPKWdtrgC4= X-Google-Smtp-Source: AGHT+IHbdhdIQeAt45jjUho5CTqQerepzE1y3k0TDCgxOb3MaGlCeDURF9i5RvhUzg0sPfbNUeLljA== X-Received: by 2002:a17:906:4559:b0:a46:4d16:439b with SMTP id s25-20020a170906455900b00a464d16439bmr131713ejq.43.1711562937226; Wed, 27 Mar 2024 11:08:57 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:56 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:44 +0100 Subject: [PATCH v3 06/19] media: venus: pm_helpers: Move reset acquisition to common code Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-6-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562923; l=2551; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=6kdN4bIMMHrZ4SMvrh49Lrd228bzKlbevJXjeVijEjQ=; b=CtQR+eHJic5RXCB/ys245BqBen08N508V3dMF9qZepH61Eg6IBXLL/1ibfyDLWYOWndHzKBoG Q8bhVnsEexeAaw6s+eU2HvdmvE2TAufRlJPbHuXmMHg7HUvIUP8obA1 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= There is no reason to keep reset_get code local to HFIv4/v6. Move it to the common part. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 9 ++++++++- drivers/media/platform/qcom/venus/pm_helpers.c | 23 ----------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5ab3c414ec0f..0652065cb113 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -286,7 +287,7 @@ static int venus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct venus_core *core; - int ret; + int i, ret; core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); if (!core) @@ -324,6 +325,12 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; + for (i = 0; i < core->res->resets_num; i++) { + core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]); + if (IS_ERR(core->resets[i])) + return PTR_ERR(core->resets[i]); + } + if (core->pm_ops->core_get) { ret = core->pm_ops->core_get(core); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 730c4b593cec..5b2a40a2f524 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -939,25 +939,6 @@ static int core_resets_reset(struct venus_core *core) return ret; } -static int core_resets_get(struct venus_core *core) -{ - struct device *dev = core->dev; - const struct venus_resources *res = core->res; - unsigned int i; - int ret; - - for (i = 0; i < res->resets_num; i++) { - core->resets[i] = - devm_reset_control_get_exclusive(dev, res->resets[i]); - if (IS_ERR(core->resets[i])) { - ret = PTR_ERR(core->resets[i]); - return ret; - } - } - - return 0; -} - static int core_get_v4(struct venus_core *core) { struct device *dev = core->dev; @@ -981,10 +962,6 @@ static int core_get_v4(struct venus_core *core) if (ret) return ret; - ret = core_resets_get(core); - if (ret) - return ret; - if (legacy_binding) return 0; From patchwork Wed Mar 27 18:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783847 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52BB8152190 for ; Wed, 27 Mar 2024 18:09:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562942; cv=none; b=FiBZocMBeU6IvOrIv6RCCsMy3E4RlJ/xgkQY6jy8epdbQA0r9snWomG3LF95bA7JhfEM76Z8CoeM90mahfsJtcB958y+I7EzpIj8C7/WX2RZ++eX6Wnw26jjKdUgVvmGS05K/F4KKAzkRrohqHK5K7mJi1GYpTX++wvKr3DfYLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562942; c=relaxed/simple; bh=Budt9AUFLpH1GYKX8rMtQXugAPGu6mfLKAoQkafZiaw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bo2oUipNu35yM7PamYj8dmnUxJGd5hM3WBpEZVscNwrzf3eXEILq1ThTKI5vc7NjvsuH8svVBkBQC4gdKZKDf620hF3VU9elcAf4H0KEZs5wbySSaPuVGidTQ2t36CRgrGaOtD2vOuWtWy8ficp2oepOAWR1nqd2gOJQOGRtM9w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rVkeu2le; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rVkeu2le" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so166261a12.0 for ; Wed, 27 Mar 2024 11:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562939; x=1712167739; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DJhEqHIZwwgc6uNF+pC9y2W8axppjx29k8m/ZrhWPRw=; b=rVkeu2leYFiFNc223n2BK8AnwXn89B0p83x++is6nd/z5ABbRv0QQ3kFpCyMIn+0VV AfdlF4m158oEHkI3km+ZQZ14zUMjznWLhoEvtCvBfJcDKrYpxEFTfYRiuqu3rS3e/Guj Vh+ZFR69rAKHB+2cv4fAhDn+fNjmyVUnoDI0mOBA5Np2VgZWh63gWPe6PZkrNZ7BxH+c 3yAZCkfdW6Us/6BSDsChdIFn3RG6CcOmasBu0Rf3nSLwx8pfjHEF/m0iSJ+02loa9dYe F902hzYSdo+CZnmb1DtiECzdrccGmDKmyx5Je//h2lawtN+OcPju/5XNr7vctM0gbwtD AOMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562939; x=1712167739; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJhEqHIZwwgc6uNF+pC9y2W8axppjx29k8m/ZrhWPRw=; b=evPT3sajdScQ1qNrczkzU2Asrugz1m2kNnEi3+avxayq7P938mJ6Chb9hUHibN1ymN C5BdUoxOnwU+4zAaiURs3WtZCgvDKLmeyKMKMHt1Tz6mlRKrAEWen7hBBJqYSxItSFhC 06Lb02YYaEZf/tz8+SLzKQ1jUvQbveazHF/8SzJTj0wPRp1prUhJIXzi8ZhXAClY6qUO 1cRpxWKeELwrVwD3oGLK9xwV+0NVn/YdXLF+a6KyMSlgc45rnjtyrSPIM4ugvxDUq5Z5 A4ptHzJnkEg4+Stp5I0ViMAvGgiFUyrs/ntjacYoXzpcurt1kPXMIrmbPdLVpN93tCky vRjg== X-Forwarded-Encrypted: i=1; AJvYcCU5b/Bhj6TuKxK/7WwOLSSm+xIz4OefC5SSonjE1aKz2gcvRUzj3DJjPRqGyFRf15lOmCWirAEc3Ic6O+B3PReS5GN4FnRdCN8Q0Bo= X-Gm-Message-State: AOJu0YxvaJqtLBlT/S3CrwzmjgmniRRgU+Dvc+RrbSOB5yCnucKm4W7y mPRvZZ3d2A9Ezd0jRruWItX9sWe+sGu73nRi35wl3U9XoaYdCTY4cE/S46IHuDU= X-Google-Smtp-Source: AGHT+IFg2fdSBGhwpvoAe6uBODcR1dEVreZcP7kGjP05S5Jc97wqqqIh+NeIcQVvZbGt2UxiVIYhIw== X-Received: by 2002:a17:906:6885:b0:a49:9631:1df with SMTP id n5-20020a170906688500b00a49963101dfmr181069ejr.77.1711562938850; Wed, 27 Mar 2024 11:08:58 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:08:58 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:45 +0100 Subject: [PATCH v3 07/19] media: venus: core: Deduplicate OPP genpd names Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-7-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=2511; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=Budt9AUFLpH1GYKX8rMtQXugAPGu6mfLKAoQkafZiaw=; b=UFLj+uwJyuVqVs+fTzGZMKqQs29u1/aYfsU8w9zlzRy7BQoarxCrDpnWsR/h9kMFz1PnlZ0vb LmL27/8psDhAPde7VvB0UqKVgIBIVLEOr5TuMBxbZpTkHDoGmojRqfi X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Instead of redefining the same literals over and over again, define them once and point the reference to that definition. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 0652065cb113..5e7cb54e6088 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -538,6 +538,9 @@ static const struct dev_pm_ops venus_pm_ops = { SET_RUNTIME_PM_OPS(venus_runtime_suspend, venus_runtime_resume, NULL) }; +static const char *pd_names_cx[] = { "cx", NULL }; +static const char *pd_names_mx[] = { "mx", NULL }; + static const struct freq_tbl msm8916_freq_table[] = { { 352800, 228570000 }, /* 1920x1088 @ 30 + 1280x720 @ 30 */ { 244800, 160000000 }, /* 1920x1088 @ 30 */ @@ -721,7 +724,7 @@ static const struct venus_resources sdm845_res_v2 = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, @@ -770,7 +773,7 @@ static const struct venus_resources sc7180_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 1, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -827,7 +830,7 @@ static const struct venus_resources sm8250_res = { .vcodec_clks_num = 1, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "mx", NULL }, + .opp_pmdomain = pd_names_mx, .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, @@ -886,7 +889,7 @@ static const struct venus_resources sc7280_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, From patchwork Wed Mar 27 18:08:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783437 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38BAF152522 for ; Wed, 27 Mar 2024 18:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562944; cv=none; b=sjYU0vJJRrsIycG3LxIQHU/H3RO0P42Zv+LdVL7rNkvYPHw7N9XhPOuKs49bwXmQOLGYii/uY21SbqmiQEk+5IBFZf7ZMEsshuY+zmmp3IZ99WvBAyfYtqTvsV9rDwQme421ouc0ogmQY/vTejLRLn7Xkt0fpceU7GydAHZBLvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562944; c=relaxed/simple; bh=9GQzIJs6byPQfUBP/1zw0u8rZrLZ3CXA+a/XNH00r2M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mcFTNwXl4rctpNRYPP0uFVTi6RqqNdBhchSVQbRvuk6VUP38Ng8KK5At1QQEgJQhtspQvps60vLfgYNjysH0Qyec5nK3cB70WWrcYSIaqjDdVzk4mw482UEp0Xo7sD/UumxSufrsxGaduwB6qkcxEiQDbSkzMp8bpSz3tvESomY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=W+BBciU/; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="W+BBciU/" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-56c36f8f932so2176190a12.0 for ; Wed, 27 Mar 2024 11:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562940; x=1712167740; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+RKGFKd/nh2wuvJYyEzPyLuatA0djI0PTARmRoGHA9E=; b=W+BBciU/ulYc9YXgbtc5+pURAjbXRRFaXRrWb7ux5os5AkjlW6Aim4YvEGtRuKzDU9 uy3IMhiAzEv7LMXMAFHddDZ0fk6tS3TVk+p++TqSFPymboj1Y8q3O3/rwCThI4zCuUK4 p815Q0wHYjunXgg+9lQirn4XpE5j1LcRjg26mewAA7hqD/X7rLl5VXxkpr1tthP3QBQp LONR2B4rxYR4EWEA0gFhX8U28wV0/nHbAAF4HBjGoeeMUTvoogw3Ia4/Uq/sS4Qc7xJF diXOPFhUuy2iuIG0xpmFVM48lXGb8FBD+RkWXYfVwY7e4Udv1fUwepS5+4G9tPN2rWib LPWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562940; x=1712167740; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+RKGFKd/nh2wuvJYyEzPyLuatA0djI0PTARmRoGHA9E=; b=FVP+y7//FhJeqBnmyiBJMH2pt4oswwHM84c7VAeAPpC3ofpUgiIOk71tafYoXESVHV P6e82c05sa5GBy6zARrAT9kixKeYdWsRNFZcdufSEcmeW4LdJzftxrFZJx2aSOVOVVuX pkTURTpuEVK16Z0UhvA5fYhmCSe5PUVGnBjVY70STOE1p/gfKt2vWfkXudzT6xsNTn4/ PT2SLG4FJFVu4GiLzRJwRlro+L7f56tK0KsWV6anzE92NX3qdFgKZIeJ2UTsM9vxiwbf pNIZW39U7FxzQX2AfVGcckdUptf9ypLBgoIzcZKH7TvlTd+9t0fT7ssmFNKoxMWfiu+6 uF8A== X-Forwarded-Encrypted: i=1; AJvYcCVvoYXDIumXCtQhvNgrpgVjON7EPZMgObW3KH901QFwKWbFI1K0aq6+Ld/IOwJbVI0NvDxRxRPAxJ71uXdvUvq8h63Nm6MfTcAKCXA= X-Gm-Message-State: AOJu0Yzml3KqRh9Ko8Qj/gaIXSmC3Ix04vEYUT8A6vWvgAQME0Xjp5GI 9sLnYMKmYSR3Is+BIUujY8lLHj3wD37fN1utngEmkXSJ3uknYC/F2U1pgCrUBhc= X-Google-Smtp-Source: AGHT+IF8em4aTF+mqWJPqPmN0a0sKq0NkhDYuNS1awWjIcgY3l/wCITySnO09ip0NjjG7gMF79n9pw== X-Received: by 2002:a17:907:7dab:b0:a46:87bc:6f95 with SMTP id oz43-20020a1709077dab00b00a4687bc6f95mr41973ejc.20.1711562940775; Wed, 27 Mar 2024 11:09:00 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:00 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:46 +0100 Subject: [PATCH v3 08/19] media: venus: core: Get rid of vcodec_num Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-8-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3452; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=9GQzIJs6byPQfUBP/1zw0u8rZrLZ3CXA+a/XNH00r2M=; b=2wczzaBnZhVoe2Wd/KIeFXeXGdfSdJYsCfKZM4wWQADLgdzHlap80f/liwqeNFPnLggf6EWeG 2Cg51BSWGKfAm1heyYTNL5FvruHn+hijThaXHCtmLys3DHA0erj00XY X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= That field was only introduced to differentiate between the legacy and non-legacy SDM845 binding. Get rid of it. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 5 ----- drivers/media/platform/qcom/venus/core.h | 1 - drivers/media/platform/qcom/venus/pm_helpers.c | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5e7cb54e6088..26a0c264685a 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -651,7 +651,6 @@ static const struct venus_resources sdm660_res = { .vcodec0_clks = { "vcodec0_core" }, .vcodec1_clks = { "vcodec0_core" }, .vcodec_clks_num = 1, - .vcodec_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, .vmem_id = VIDC_RESOURCE_NONE, @@ -725,7 +724,6 @@ static const struct venus_resources sdm845_res_v2 = { .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, .opp_pmdomain = pd_names_cx, - .vcodec_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -774,7 +772,6 @@ static const struct venus_resources sc7180_res = { .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, - .vcodec_num = 1, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .vmem_id = VIDC_RESOURCE_NONE, @@ -831,7 +828,6 @@ static const struct venus_resources sm8250_res = { .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_mx, - .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, @@ -890,7 +886,6 @@ static const struct venus_resources sc7280_res = { .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, - .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 6a77de374454..376de1161114 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -74,7 +74,6 @@ struct venus_resources { const char **vcodec_pmdomains; unsigned int vcodec_pmdomains_num; const char **opp_pmdomain; - unsigned int vcodec_num; const char * const resets[VIDC_RESETS_NUM_MAX]; unsigned int resets_num; enum hfi_version hfi_version; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 5b2a40a2f524..ba63e6427eb9 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -622,7 +622,7 @@ min_loaded_core(struct venus_inst *inst, u32 *min_coreid, u32 *min_load, bool lo VIDC_CORE_ID_1 : VIDC_CORE_ID_2; *min_load = min(core1_load, core2_load); - if (cores_max < VIDC_CORE_ID_2 || core->res->vcodec_num < 2) { + if (cores_max < VIDC_CORE_ID_2 || legacy_binding) { *min_coreid = VIDC_CORE_ID_1; *min_load = core1_load; } From patchwork Wed Mar 27 18:08:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783846 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53B75152DF8 for ; Wed, 27 Mar 2024 18:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562946; cv=none; b=BoAxtS7rOZpWrjb+E/TCHPpo6vSw8f+Uy/zm1P+loTTCpZpiHUNGWxXJVPyVg7Jn4dTv7shB7ZmzH59mRJ/B3RoVcKy79iAEYNLLBGQi6UaXEGBrOLf9xze7iz4+NDZdReoGam0VpCupNFTSLRLn3jqNMzg3U9M3Cglt635z5rA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562946; c=relaxed/simple; bh=5deDbCqxm3pbuUkC1x82NgelAh/GpAhJZVmIpVo3Vdg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RBlqyOkycFYtj2lXudaX2MQNYNC2nJ3bx7kgV+ePjE3wBb9EwzgghYG3jdo/D6ccEwfkWv+2BiCKiDFTDyK8Onku9HUJnhLKdLKYaJGKsOaRER5DtPfPQzL94jwk9e+AXPRM5xhw/P0w7TIVa9FcWQmYzGgDQS4rz1zvauYew/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xnixwsXz; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xnixwsXz" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-515c3eeea5dso41773e87.1 for ; Wed, 27 Mar 2024 11:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562942; x=1712167742; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EnJKSpG5I+N8+ub2PloVLx2aQVcpd0l8jh5r+k1tbE4=; b=xnixwsXzoJfAU4ii4eMu8NtPoYN4KSM8+//M6LI8ZbUjPXBwFsMmFWlNfutg4LOy69 8M1SzHq7fQ+2tm1Ykij+X4uyCFS7MOBqviv0bJ0D9c5fa//qaCiixrmlEvvnjzAid6G9 G71M4DxaaOf3RKvFGQ/qUOzMwsceEq9DyixvdW3yAgbxAzDZdMf0MoMVcrMT1wZkVD+i AGkA/HYafS6+nWatA8sOvqOq+9OgvkBN6rJPCrs+w6jCXlhLTsJqV9qG3BoUjClED8UX i8p576T2RM83G1Gzef12nVJKYqCQ6Y5Oz3bUwrTOw59mjPsC1Dt5U219oKcvaRFxLKvS beaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562942; x=1712167742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EnJKSpG5I+N8+ub2PloVLx2aQVcpd0l8jh5r+k1tbE4=; b=dyIr9upaWd33K3QKB3rqOBMxU+rufoYQTJMADn9bTzxGl8nbVV57o3jpu8uOm9pGzV Eh1yI0Pzj3hUMOIHUEFBwpOkNR1xK2aPAE1a2WF2v1jPVK5NtbTeaPZxtOqqi7s+LEz1 1yAEj6St5n8Il9UB4LvL9vS7hbxHF2YWladd8WGDSA21xsgc/b3B+NKmTyTzgz1HRrPN 3A+wi37vTLX0JqLoO7LjRXnNjVTCgIkUrvc2/yt650SLj5z/PglzW3WZLiecDgh5dBrs 6y6Aq+vphwFavXLnL1BUBwPb7kOlAwzBLlLmPfSSkz7BzAdZc6LSWK3ezmKUFRuE2u6H 5CQw== X-Forwarded-Encrypted: i=1; AJvYcCXJiWko+mmf1Wka88jYy93G+Xefbiko2UZmvDra4eORNPn/5b1IVKsS93lsYEX2ZNOEUnbp4bFuo/93FTahej2t/bg5FKT0jjWXtVc= X-Gm-Message-State: AOJu0Yxr2bhE4WK5Gset5f1YPTI3550lFIAZnrWX0R33B4cmNeZyAT1o GcA1ZHxFnfFGU4Oj+2ipJvvwSnMXt/YXciVk378bHYNLygLvtQ9bE8y5SF+jFa0= X-Google-Smtp-Source: AGHT+IEikHfkjz5iGGucvA3wmg5PW2Xtt6oYFCRrntX8DgpyEkGmFFW7CqAWkrprwpJQ8XJaxlN4AQ== X-Received: by 2002:a19:8c03:0:b0:513:5a38:f545 with SMTP id o3-20020a198c03000000b005135a38f545mr158520lfd.62.1711562942530; Wed, 27 Mar 2024 11:09:02 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:02 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:47 +0100 Subject: [PATCH v3 09/19] media: venus: core: Drop cache properties in resource struct Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-9-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=5260; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=5deDbCqxm3pbuUkC1x82NgelAh/GpAhJZVmIpVo3Vdg=; b=2QQWrNVPG0+yfJkDg+6wdHGor1QZelE9/HXpUfrZpYPx4xbIijDcNZWcJPEWkMWFmisIZbSet 5IHXVx3Ylh6CM8KeiJhgq7IRDI2Zl72njPH30tnBktE79PqxtsWe6n5 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Currently VMEM/OCMEM/LLCC is disabled on all platforms. Make it unconditional to save on space. These caches will not be enabled until the Venus driver can reference them as chunks of SRAM (they're modelled as separate devices) to avoid hardcoding magic addresses and rougely accessing the hardware, bypassing the normal accessors. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 24 ------------------------ drivers/media/platform/qcom/venus/core.h | 3 --- drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++------ 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 26a0c264685a..51ac9eff244c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -562,9 +562,6 @@ static const struct venus_resources msm8916_res = { .clks_num = 3, .max_load = 352800, /* 720p@30 + 1080p@30 */ .hfi_version = HFI_VERSION_1XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xddc00000 - 1, .fwname = "qcom/venus-1.8/venus.mbn", }; @@ -595,9 +592,6 @@ static const struct venus_resources msm8996_res = { .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xddc00000 - 1, .fwname = "qcom/venus-4.2/venus.mbn", }; @@ -653,9 +647,6 @@ static const struct venus_resources sdm660_res = { .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .cp_start = 0, .cp_size = 0x79000000, .cp_nonpixel_start = 0x1000000, @@ -702,9 +693,6 @@ static const struct venus_resources sdm845_res = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .fwname = "qcom/venus-5.2/venus.mbn", }; @@ -727,9 +715,6 @@ static const struct venus_resources sdm845_res_v2 = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .cp_start = 0, .cp_size = 0x70800000, @@ -774,9 +759,6 @@ static const struct venus_resources sc7180_res = { .opp_pmdomain = pd_names_cx, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .cp_start = 0, .cp_size = 0x70800000, @@ -832,9 +814,6 @@ static const struct venus_resources sm8250_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, .num_vpp_pipes = 4, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .fwname = "qcom/vpu-1.0/venus.mbn", }; @@ -889,9 +868,6 @@ static const struct venus_resources sc7280_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .cp_start = 0, .cp_size = 0x25800000, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 376de1161114..e083ebb3ab4b 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -80,9 +80,6 @@ struct venus_resources { enum vpu_version vpu_version; u8 num_vpp_pipes; u32 max_load; - unsigned int vmem_id; - u32 vmem_size; - u32 vmem_addr; u32 cp_start; u32 cp_size; u32 cp_nonpixel_start; diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index f9437b6412b9..42ff96f71235 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1067,17 +1067,14 @@ static void venus_process_msg_sys_error(struct venus_hfi_device *hdev, static irqreturn_t venus_isr_thread(struct venus_core *core) { struct venus_hfi_device *hdev = to_hfi_priv(core); - const struct venus_resources *res; void *pkt; u32 msg_ret; if (!hdev) return IRQ_NONE; - res = hdev->core->res; pkt = hdev->pkt_buf; - while (!venus_iface_msgq_read(hdev, pkt)) { msg_ret = hfi_process_msg_packet(core, pkt); switch (msg_ret) { @@ -1085,9 +1082,10 @@ static irqreturn_t venus_isr_thread(struct venus_core *core) venus_process_msg_sys_error(hdev, pkt); break; case HFI_MSG_SYS_INIT: - venus_hfi_core_set_resource(core, res->vmem_id, - res->vmem_size, - res->vmem_addr, + /* Disable OCMEM/VMEM unconditionally until support is added */ + venus_hfi_core_set_resource(core, VIDC_RESOURCE_NONE, + 0, + 0, hdev); break; case HFI_MSG_SYS_RELEASE_RESOURCE: From patchwork Wed Mar 27 18:08:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783436 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 110F9152E13 for ; Wed, 27 Mar 2024 18:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562947; cv=none; b=R2c6V3kH+9RPE6fQLz7vsdaGEyguS2xpHFyNmOKIhsKgarCVdmJQObr697TR7rPIsvBgV6BT7Po7P67onqRj9g3QEQjGE5Ndv4OQAE8GB5WKNSZhIkOewVoD0Y+7hwhfzE7LuDRRogHMduL1TdQ/QzyeScev1AcIKG865g/Yi7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562947; c=relaxed/simple; bh=zpVxIGK/DC5DJdxj6d45A6gz7HiJf9g2H9+GSTEHLyk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MaKYaIqJzVRWjfROwgA+A7Tye0M4xqYX3ScgBj2m7g1Waco71E0XMZKo4u1/swYnwHO64UcGc+qVUXVw6j3chJ5rNE1tSr671tEszeH/wNq9wQO+MdZ3MxbSp9VntiwJCV3qgCYYmzvmLF8nNbu3uplMIqhJnPdLK1rZtdgIM8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mRB6ZhI2; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mRB6ZhI2" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a4a387ff7acso13099366b.2 for ; Wed, 27 Mar 2024 11:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562944; x=1712167744; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4k+D1R/CO2vefULfDvrbe1JRYsRPZZCZwyqn3SKwsgk=; b=mRB6ZhI2ps6TBIJPrZob/ry/DkkJvkxPg+bYtYJdMyK0RrI4zNxgcbZu1YO3Oqv194 LAiZnlRS86Arq57t1TuPu2nbIDa7G+1+mZNiZn35K32dMI2Nl4k5cxQpwNTzzRNEvMtk o8X4ew5Tl06wBOyJRR1zTS/fHNqK9UkyLNtP89nA9ncH3gwRs8aWaXXqK+Lr9JK7pKNn YNfv4VHE8lkHQhm1tfwmMRdJVa6/qAzH8BzDcTvRu9Qatm6zJXQ9StNyuC+ZGf9zolAL 89pY6ybwm1BepOIFqdB4608DB36w3nT+gEGZJU96hJUF7LHE0qd3PvUQuj7CK/GADdVu 6KiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562944; x=1712167744; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4k+D1R/CO2vefULfDvrbe1JRYsRPZZCZwyqn3SKwsgk=; b=WudhZIzKlLAn91Op4sla5PIueQ4kZ03SH/9h7mDvPMtAg1duhqzJFBKoet+22np8Vy G8bx/F1qtYUTakfaI2kV7br+RDcHsJXdLgoGUTcTEXVt64ri1ukCEvuivX4a46ulzOIn Vz50Nk8VGoa9KdgW1oVN8VvtBwv74XE/mLE+Hrc4/6FfbtQoqpiNgqJTtKgcJXME7lw9 C3Yci5/ZJxXoLCyAf2NMTdW5IiEIEMFQhqSPTHenWB0OmpUrS8SXW2r6a5RrUjjL/mEc IOpCo7S2XTxntK0qILsFzi+vqckVoI0SN9ZUhu9efqDf5r9Eu/4dnwrYnyIw7fEV966f JQbA== X-Forwarded-Encrypted: i=1; AJvYcCVfPL0OMSnbZ89d0Yxw53SLXiQ0w82K8ekLDjuVV6z8/btsaFAglAqLBoNnzUNf+mjg/Dl7I7lCYL0N+XHDeCppi7Vq64ndFuyhIbQ= X-Gm-Message-State: AOJu0YyBARiFx78rKg4zwHfJ7kreHjgaR+xPzXdPRnmLJZqfhyaSvIlS oq/yKQIdN7yTfJKRrPOJxoDXdQypIhJOlfbbdTlDMzToYsTZAyGB5dnr7oi6C+g= X-Google-Smtp-Source: AGHT+IGgh8TVK7OaOIm3bODIsmJap1Sy6Kp85kSNzHznpes15v25Nir9SvBKmsFNHfjIzUjXZW0S4Q== X-Received: by 2002:a17:907:1b17:b0:a46:636d:ef23 with SMTP id mp23-20020a1709071b1700b00a46636def23mr213739ejc.54.1711562944568; Wed, 27 Mar 2024 11:09:04 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:04 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:48 +0100 Subject: [PATCH v3 10/19] media: venus: core: Use GENMASK for dma_mask Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-10-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=2766; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=zpVxIGK/DC5DJdxj6d45A6gz7HiJf9g2H9+GSTEHLyk=; b=KE3ZI01LlS6edqeVW0yMZSlgZxpiWF33PPA9Z+BTOODUIXObGqTSBmR5rIY4voS0rD8lIUri0 2ZS65Ft7gT0CIbc9VvabxmKT5SGO/H+FZdyzgvPvE/quAClfrrunznY X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= The raw literals mean very little. Substitute it with more telling bitops macros. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 51ac9eff244c..5d41ecddcef6 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -562,7 +562,7 @@ static const struct venus_resources msm8916_res = { .clks_num = 3, .max_load = 352800, /* 720p@30 + 1080p@30 */ .hfi_version = HFI_VERSION_1XX, - .dma_mask = 0xddc00000 - 1, + .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, .fwname = "qcom/venus-1.8/venus.mbn", }; @@ -592,7 +592,7 @@ static const struct venus_resources msm8996_res = { .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, - .dma_mask = 0xddc00000 - 1, + .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, .fwname = "qcom/venus-4.2/venus.mbn", }; @@ -693,7 +693,7 @@ static const struct venus_resources sdm845_res = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .fwname = "qcom/venus-5.2/venus.mbn", }; @@ -715,7 +715,7 @@ static const struct venus_resources sdm845_res_v2 = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, @@ -759,7 +759,7 @@ static const struct venus_resources sc7180_res = { .opp_pmdomain = pd_names_cx, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, @@ -814,7 +814,7 @@ static const struct venus_resources sm8250_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, .num_vpp_pipes = 4, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .fwname = "qcom/vpu-1.0/venus.mbn", }; @@ -868,7 +868,7 @@ static const struct venus_resources sc7280_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .cp_start = 0, .cp_size = 0x25800000, .cp_nonpixel_start = 0x1000000, From patchwork Wed Mar 27 18:08:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783845 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F053153517 for ; Wed, 27 Mar 2024 18:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562951; cv=none; b=dffh9TuGgJS0x9LnA+ksujdyqphtdeEsxhBd2UASgKn7gBatGC5286x5z/7mF0yZIkR2cEqbfUyX98FVbfN1rZ+DFgY27Q+4cO0/ZULuhbPdOas7b3x0GDTip/RssuCDqPG4E9VkBs4s6e8zPS8HcWFlSIxRQ20HgR0ksVTYASI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562951; c=relaxed/simple; bh=EiXe27maCyYzrjrt5IwhfaloukG1N+cTVNcHKqRf8YA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NCWdEpyyEN487O9gbDLnu4eS9EP4UPiYruY4fgZDYf0l8MJrZWorJjhqlzyGpfkRWT8Axpw0CCCeDfuiCknsjNP/kReJFLV3IRuEjAPttCdi+K+Yg22YqSHJ+uumiEGY4lubjlGtVBYWmVHPRLJWdskPq9/Rs2tNNIZd2IjGJE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=IQSeRvo1; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IQSeRvo1" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-56845954ffeso164619a12.2 for ; Wed, 27 Mar 2024 11:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562947; x=1712167747; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xatJGVguCNf/WUAldulDt3r9Z4hc+wH++h2/GcCJG1M=; b=IQSeRvo1eBSzKzFYex3MseyWGcJs0O/1WZsFZyL95zbEBaelM1v7/BhkI1BOewY9My 5U0OC+IOmTkc2nynCVhHoQk8KTEuKFn76za+CTTwjmLr4w2Sg/clbpEAYYQ7/uQ3qTbO iTZD7WfSkX1g+/KmC+TWNQ211YoL2+Q3bJASjmsouO/9mOvg7LmPuqwFRVEGnxY5+jJS xr9HFIkCqL5ZIMNp46sqx+B7ubl93IRang0QzVH0MwAGKt4YIyb3FbxIDHJpbfMYdzRs Spl3hdhSR3z8m0By9wB982cJwf0gZ+8cGj1ZOTUviBkez1uZR0Z4JGI8hPuwL1T1wtVo Foug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562947; x=1712167747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xatJGVguCNf/WUAldulDt3r9Z4hc+wH++h2/GcCJG1M=; b=sDLpMXVPVmlJW9F0pwMEmKUORRCYOm5WKiPt/EazfAbYfDaMUS8wbZPVQlokizU6+S GRekmXEz6MOngSr0UQ+d6qS1B1vugl0t+ThnumbbcGvNH/otiXr5cHpHBW0u/eZNaJi2 wvEBnJA3J7eFmznBBi5Gf43W3i+n7H3Nz+EeNsc3d9wgs4ZSwFtj+muREpCoPcuE2WTf O662vbMmY/C4kSfm+86OkGOm145nSplQgMhQXRmvZ7BXcYEtm4KmNq5VRWUeGhF5hRru 2ZhEJc1K7cO9+Th6FU9IK0n0sP/xgdqTOh6aeYXKK+TS3Bx3OrWhsl78cWhng4h1E7PB 5Ppg== X-Forwarded-Encrypted: i=1; AJvYcCW7CEMXEMU915r9UvKVyuHnw3C/3cCh8/oOKj0zTETja0ulMqTwcUtht50kv+ob4cDMhgCIP+pdjICpi5nnF7KJ4yvw0EtM2HV8cao= X-Gm-Message-State: AOJu0YxVSUNxn3fOKAiGF+yCZmOp1AfNfee7oC47y4U9uLiUz+bzA/8k vXScEPw1BfnQlEcWNA460Xf7D0rzWmboGvGjSKvNK2lmGN/3wR9bduOrLuVP4IA= X-Google-Smtp-Source: AGHT+IFAyclNN4I78UIFoCD8VhQN0l5lMHm2AOnllf/HSvhKhjLhbnYt1UmK73zhkGkPB9pWxrnOOg== X-Received: by 2002:a17:906:b03:b0:a47:5182:3b83 with SMTP id u3-20020a1709060b0300b00a4751823b83mr130341ejg.61.1711562946738; Wed, 27 Mar 2024 11:09:06 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:06 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:49 +0100 Subject: [PATCH v3 11/19] media: venus: core: Remove cp_start Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-11-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3292; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=EiXe27maCyYzrjrt5IwhfaloukG1N+cTVNcHKqRf8YA=; b=mlD7n7YL3SQ+J38D0yoA6/DN8bT8LEhucyYAIAhEcUu1SKn0/Dh66xVzbhel9RerNwXf7vQox rtRJypTfSF5CfgVhLlrzMetiYkAsZvAESASyHRuo7M1YcGTavpdwPSQ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= It's hardcoded to be zero. Always. Ever since msm-3.10. Or maybe even before. Remove it! Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 4 ---- drivers/media/platform/qcom/venus/core.h | 1 - drivers/media/platform/qcom/venus/firmware.c | 3 +-- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5d41ecddcef6..b10d083b8b17 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -647,7 +647,6 @@ static const struct venus_resources sdm660_res = { .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, - .cp_start = 0, .cp_size = 0x79000000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x28000000, @@ -716,7 +715,6 @@ static const struct venus_resources sdm845_res_v2 = { .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .dma_mask = GENMASK(31, 29) - 1, - .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x24800000, @@ -760,7 +758,6 @@ static const struct venus_resources sc7180_res = { .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .dma_mask = GENMASK(31, 29) - 1, - .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x24800000, @@ -869,7 +866,6 @@ static const struct venus_resources sc7280_res = { .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, .dma_mask = GENMASK(31, 29) - 1, - .cp_start = 0, .cp_size = 0x25800000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x24800000, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index e083ebb3ab4b..19908f028441 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -80,7 +80,6 @@ struct venus_resources { enum vpu_version vpu_version; u8 num_vpp_pipes; u32 max_load; - u32 cp_start; u32 cp_size; u32 cp_nonpixel_start; u32 cp_nonpixel_size; diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index fe7da2b30482..16e578780be7 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -245,7 +245,6 @@ int venus_boot(struct venus_core *core) if (core->use_tz && res->cp_size) { /* * Clues for porting using downstream data: - * cp_start = 0 * cp_size = venus_ns/virtual-addr-pool[0] - yes, address and not size! * This works, as the non-secure context bank is placed * contiguously right after the Content Protection region. @@ -253,7 +252,7 @@ int venus_boot(struct venus_core *core) * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0] * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1] */ - ret = qcom_scm_mem_protect_video_var(res->cp_start, + ret = qcom_scm_mem_protect_video_var(0, res->cp_size, res->cp_nonpixel_start, res->cp_nonpixel_size); From patchwork Wed Mar 27 18:08:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783435 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64AE01534ED for ; Wed, 27 Mar 2024 18:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562952; cv=none; b=YW6xhZVPeXOB7oBmDwLzBc5HRkmiMsHxrpFPjwBlGeAkmOAC0BnNDblL2gayVrALWfbeZ79T9qi+xBOrUEK6020wE9xaPRCwO4di4icE4Us4XuqsgGEraRYHm/wy2HpSIFxvYJr2h0RFLcTPTUX+I91u/DkfC07EuzqLBFgW/Ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562952; c=relaxed/simple; bh=uKZ6667EoCGildVfNWTzXSkSlQhMEph3V2H0e5o40v0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DsyMsPLC7TIomcksS6THoGfMOQaIAnCZ5+jF2AoFcfeMUsJA1WijcE2PH6CEa9NXVqUn47y7bubjJ9MLzHwolPW3I0J8s7rXJD1gZ4pT/ixuQlgAWG9R7CwK4AvEQ8ksA3soD8HNkNeq91geFyGdoIbcNpO1KHPri7sxDEizcdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ou90ZX2i; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ou90ZX2i" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d6fd3cfaceso350241fa.3 for ; Wed, 27 Mar 2024 11:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562949; x=1712167749; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VC6r/0UijU2j1avcMZoL5LKkgLhP+P1n2LhOJ6yQmQA=; b=ou90ZX2i8tNXP1FC48kTbXp2YGSwBtlDJyH/8CrmwGJCIyF0aWEzWomLIx2jYzTSwN XnOTFzIVkBvFLvMv9oxdT4Jyx5NNuscIeGKuLglOrbqKy5EuRXAUp5IRb3HnRUtDxDEE 1nB9Hi6wfxhJBqHmxbiOzxY5mK0aZ0pgbDYWszDOJz9cFT52eY1/7MZUAWaQ2zYikX5f lpAJv6FCgIDngSEal74MvMqeHdnExuQvoB9GEIQu2JyYE9HKFYlECpxIIn9pxbqo51Lj tpdQibtkuddFm4Z2b75DrszP3QDr4jgwtknNabkBaJMr/5LntswwpYgBkTpz2VeDYupf 23uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562949; x=1712167749; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VC6r/0UijU2j1avcMZoL5LKkgLhP+P1n2LhOJ6yQmQA=; b=OqXz+uEYsdyktJVyOmkBIQWmhTqug8/tFehlParli0ifedxo3auLJQPxJgXOO1/4s3 gPJIKT2XUqrBYaV2ZmATen4YiHEm+a8AraOuFhYXJjU7FjATcPs4SpFHhbkJql+7YJPu b+SpK31PXyfVycelJCf3BReoGdflIeVq/vsjAVl5HJHUimAJ7tWnZveS4fxauXtl1GlP YLyAoYSjGmSSI+7piDcUimRT1eDmCUnd33le2n/MgsLk5GABp6D15L0duSesSTvQcTPS II7PaFlKI3NoXTo7/nrl8M2QCzb41BJnUYf56poC3MHuADk8sjgOTr5G308vNutN+drh 4KGA== X-Forwarded-Encrypted: i=1; AJvYcCWa2bOK+dfQke83FrCVQtAKeh85zDQjvrVZsMmqzgy6SS2P0m/vapDvfasw02oaTThE0w6WBLyd6JMzrHjfUID9CNmCB5Czbcz1DL4= X-Gm-Message-State: AOJu0YxlcPzI3EcrQHClvH4u9WHdyI+1I6mLiYpF1FFEHbcv1eTsBHnP ylOZu9+J5/d+50J/cmuy2nzZ2GK8+67zN1oqjxDh7GXK4T2aUEvZFrGBelng7DI= X-Google-Smtp-Source: AGHT+IGGDeKs0PfcAcsWxWdT7br0kQgaVIMadaedgSZVIV7feZRWPe4mxQXnQjWiaxBXnI7xvrRCLQ== X-Received: by 2002:a2e:9b17:0:b0:2d4:68ef:c714 with SMTP id u23-20020a2e9b17000000b002d468efc714mr675073lji.38.1711562948778; Wed, 27 Mar 2024 11:09:08 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:08 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:50 +0100 Subject: [PATCH v3 12/19] media: venus: pm_helpers: Commonize core_power Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-12-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=4717; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=uKZ6667EoCGildVfNWTzXSkSlQhMEph3V2H0e5o40v0=; b=ma4U0Iy0ZpQrWDyV1rJ2TKb1cU4VutbOcDmYdPTYqNxbaZsw7l3obqbemJmWoVPkwAVstytOc bZQ3lQMY/O/BWmENfUdqgNMk6ogLfYNfyHLt5g4fSTjFI2r/9xgXZDx X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= core_power_v4 called with num_resets = 0 and core->pmdomains[0] == NULL does exactly the same thing as core_power_v1. Unify them! Signed-off-by: Konrad Dybcio Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/core.c | 21 +++++++-------------- drivers/media/platform/qcom/venus/pm_helpers.c | 17 +---------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index b10d083b8b17..6bbb8153797c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -477,18 +477,15 @@ static void venus_core_shutdown(struct platform_device *pdev) static __maybe_unused int venus_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - const struct venus_pm_ops *pm_ops = core->pm_ops; int ret; ret = hfi_core_suspend(core); if (ret) return ret; - if (pm_ops->core_power) { - ret = pm_ops->core_power(core, POWER_OFF); - if (ret) - return ret; - } + ret = venus_core_power(core, POWER_OFF); + if (ret) + return ret; ret = icc_set_bw(core->cpucfg_path, 0, 0); if (ret) @@ -503,8 +500,7 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: - if (pm_ops->core_power) - pm_ops->core_power(core, POWER_ON); + venus_core_power(core, POWER_ON); return ret; } @@ -512,7 +508,6 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) static __maybe_unused int venus_runtime_resume(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - const struct venus_pm_ops *pm_ops = core->pm_ops; int ret; ret = icc_set_bw(core->video_path, kbps_to_icc(20000), 0); @@ -523,11 +518,9 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) if (ret) return ret; - if (pm_ops->core_power) { - ret = pm_ops->core_power(core, POWER_ON); - if (ret) - return ret; - } + ret = venus_core_power(core, POWER_ON); + if (ret) + return ret; return hfi_core_resume(core, false); } diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ba63e6427eb9..3410039bb641 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -322,22 +322,9 @@ static void core_put_v1(struct venus_core *core) { } -static int core_power_v1(struct venus_core *core, int on) -{ - int ret = 0; - - if (on == POWER_ON) - ret = core_clks_enable(core); - else - core_clks_disable(core); - - return ret; -} - static const struct venus_pm_ops pm_ops_v1 = { .core_get = venus_clks_get, .core_put = core_put_v1, - .core_power = core_power_v1, .load_scale = load_scale_v1, }; @@ -410,7 +397,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .core_get = venus_clks_get, .core_put = core_put_v1, - .core_power = core_power_v1, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -990,7 +976,7 @@ static void core_put_v4(struct venus_core *core) vcodec_domains_put(core); } -static int core_power_v4(struct venus_core *core, int on) +int venus_core_power(struct venus_core *core, int on) { struct device *dev = core->dev; struct device *pmctrl = core->pmdomains ? @@ -1138,7 +1124,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .core_get = core_get_v4, .core_put = core_put_v4, - .core_power = core_power_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index a492c50c5543..77db940a265c 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -12,7 +12,6 @@ struct venus_core; struct venus_pm_ops { int (*core_get)(struct venus_core *core); void (*core_put)(struct venus_core *core); - int (*core_power)(struct venus_core *core, int on); int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); @@ -28,6 +27,7 @@ struct venus_pm_ops { }; const struct venus_pm_ops *venus_pm_get(enum hfi_version version); +int venus_core_power(struct venus_core *core, int on); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Wed Mar 27 18:08:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783844 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B99015359E for ; Wed, 27 Mar 2024 18:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562954; cv=none; b=JGPxeIIrCzTVYMxPa5aHb1R6By9q7m8EO4GiCE+RMZ7xz/+DgkCvh87/Ry/aX/OqnUa+VMc93zjnGHbjmTr6wk/rh1gMs6tacWcLiHzFsQ2KeCHPcHIH/dIoONDa5DnqELOaAC1chqB8QZRomXZJzjU7S1BchjjBQVhfnYdWDmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562954; c=relaxed/simple; bh=gZuMEGLa8tjLrTt/r1nP1U/PhdOkjOKI49XZqbUqCao=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DtQJlTkaIPQzzVI9+1MnfoEqy3a/9ft4HKVneE6cYCcCYV/FQyrVR3QZGDWYdZ6ozQwhhuOv/d0FVZvIIgTYLEGuty7CKCc77UAW+HhaV7JnQ8yHSnZiNUMcanSGLCaN6iSmfxwQx35Q2jU8dBVyVLTF9xQ0iPlacky8tltQ5sw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FxyqU26U; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FxyqU26U" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a4734ae95b3so15934466b.0 for ; Wed, 27 Mar 2024 11:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562951; x=1712167751; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Uyg9cCjIBe5vwMzPvAWfPgo3MthJhgF+WNFlCLkOSMo=; b=FxyqU26UKWd3xQlHRoJ/+ceIQ/NiRzRJIJSw1iVSTHDPbiUlMpCBm/nLRAOARuGMQI 8ByuuFXR+bH7YTzCpO/SfvogDVuH3GH42oQnB9XRJSegqo2+bxlKeAbT++O/ksHArmAw artRpV6l8iF1UhZKkcbKPYfSbTdK/bSTZshCOlBQ7jGV6vfHr1he8lu7p+5YtXzLE5x0 H+nhL+AuV86F95NE9gW/w+QdvEVr4GBoYA06vazm8cQv1ZZUT4qgWdnRMpWXl26XLdxw Hsfmb0HV2G3Ng22nxb9xgwkzXRvyLLjOZy8Ql+T+NUr/P4NaNt9rXT6bFFVmvHpamWS0 /11A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562951; x=1712167751; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uyg9cCjIBe5vwMzPvAWfPgo3MthJhgF+WNFlCLkOSMo=; b=IO27Q1FH8KPfvzDVKVKJ15PO3JacnRHDK66bVuWrnskqQN4lsNecUejMwud3+9PGtu 80xb/5ekpVv/ODd1x9H32GPBVLZiHCo3STLl1n3EMR8QUWYMRGwOIc9EbtO4bnudfyCY NV9hrv+i9ElA7wR3g1+UHOHUyFzufF/rLDacdkj2sqOy8MojsjP3NoAXAyvvHikbgScT t5dAG06xoFaT+vBvUsbCC3i91kyNb5qyr5n9gjnF095A82geRi5oCHbbITW6KM2//kcN 9mi+QEIA45UI7aXs4/mViqcl+NowE/fzkcz/Tu9UrWnsQeyQK+JM8gOPaExp5CGUaIw8 60GA== X-Forwarded-Encrypted: i=1; AJvYcCW6an+4JRO0F+DzvQynSRLfuGwB7WJho6nEOvF1aHJJXSdOb8oHbqc985PXisUCnHES6BJUzMZn9YulOzxl3PNGF0NVbYUk3PHNs6k= X-Gm-Message-State: AOJu0YzZ7sf2HH7gS8Fus8oJzvhzSusCI3Ph8DZnQUkmcKNWSG496kZU FOTeg8Cq0k80K5SdsCVceTWfjwdaEtH1YaQa0OLx0TwdXDx15wx+DBOzCl0kOBo= X-Google-Smtp-Source: AGHT+IFFlIFU/vyvYtRyfqCFRAFhIAHw5w84pme9DfSHL/4LWxh9PcAiJAtfBOMzzjCE3e7lRIWkCA== X-Received: by 2002:a17:906:46ce:b0:a47:4ba1:5955 with SMTP id k14-20020a17090646ce00b00a474ba15955mr173976ejs.20.1711562950900; Wed, 27 Mar 2024 11:09:10 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:10 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:51 +0100 Subject: [PATCH v3 13/19] media: venus: pm_helpers: Remove pm_ops->core_put Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-13-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3935; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=gZuMEGLa8tjLrTt/r1nP1U/PhdOkjOKI49XZqbUqCao=; b=YHVHS8hGzUNo7n0S3Ixu+Uh38s0NJda67wJFlykESRxI3MSOjUZUd29kFi0SaMjqPnoZ5y+IP SXX0vjXe0QVBWMesKUaNQ9QQRfqzB32tvnVRiAqPISLpizk4JXRe60J X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Without an OPP table and with vcodec_pmdomains_num (so, v1, v3 and sdm845_legacy targets), core_put_v4 is a NOP, jut like core_put_v1. Unify them! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 8 +++----- drivers/media/platform/qcom/venus/pm_helpers.c | 17 +---------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 6bbb8153797c..5b18b1f41267 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -426,15 +426,14 @@ static int venus_probe(struct platform_device *pdev) err_core_deinit: hfi_core_deinit(core, false); err_core_put: - if (core->pm_ops->core_put) - core->pm_ops->core_put(core); + vcodec_domains_put(core); + return ret; } static void venus_remove(struct platform_device *pdev) { struct venus_core *core = platform_get_drvdata(pdev); - const struct venus_pm_ops *pm_ops = core->pm_ops; struct device *dev = core->dev; int ret; @@ -452,8 +451,7 @@ static void venus_remove(struct platform_device *pdev) pm_runtime_put_sync(dev); pm_runtime_disable(dev); - if (pm_ops->core_put) - pm_ops->core_put(core); + vcodec_domains_put(core); v4l2_device_unregister(&core->v4l2_dev); diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 3410039bb641..d717e150b34f 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -318,13 +318,8 @@ static int load_scale_v1(struct venus_inst *inst) return ret; } -static void core_put_v1(struct venus_core *core) -{ -} - static const struct venus_pm_ops pm_ops_v1 = { .core_get = venus_clks_get, - .core_put = core_put_v1, .load_scale = load_scale_v1, }; @@ -396,7 +391,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .core_get = venus_clks_get, - .core_put = core_put_v1, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -893,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core) return ret; } -static void vcodec_domains_put(struct venus_core *core) +void vcodec_domains_put(struct venus_core *core) { dev_pm_domain_detach_list(core->pmdomains); @@ -968,14 +962,6 @@ static int core_get_v4(struct venus_core *core) return 0; } -static void core_put_v4(struct venus_core *core) -{ - if (legacy_binding) - return; - - vcodec_domains_put(core); -} - int venus_core_power(struct venus_core *core, int on) { struct device *dev = core->dev; @@ -1123,7 +1109,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .core_get = core_get_v4, - .core_put = core_put_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 77db940a265c..3014b39aa6e3 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -11,7 +11,6 @@ struct venus_core; struct venus_pm_ops { int (*core_get)(struct venus_core *core); - void (*core_put)(struct venus_core *core); int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); @@ -28,6 +27,7 @@ struct venus_pm_ops { const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); +void vcodec_domains_put(struct venus_core *core); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Wed Mar 27 18:08:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783434 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D788153823 for ; Wed, 27 Mar 2024 18:09:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562956; cv=none; b=WQ0MTUcra5NazVTLPN8kOjGkrkuBN7CX+lNAduhoR0NExvrgJSHHxsl/bP9HrrX7rq5o6kaHGiGB4km3Wui0ID1X3MTo4jKvwlpwV/45nmoGje/5SU4aY8I/oVW/jDluCsZczqL9Q5J4OcCUTJoR9iBLrSmzXDKus0kFQ0JaCEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562956; c=relaxed/simple; bh=N/+DdFoVCHF23AQ+OjDZ00SaK75sELYmsLPOH0p2aT4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtfmK2BeAdTtkby3+8x0rDJaBNasnb53HPctvtYmcF5r/SsT6GBaD76bBgoCzFoUg0e2o+wAf9UzmNBwzsC5biwiqL0bb1vjDSpWAPRSyH5H6TxA9OXeCMu6fdLOoeVL0IvMuF9c2v2nQjJ2EJYUVepfOl2ZgaW1vVFnpneeVpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nLpe09sy; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nLpe09sy" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-56bdf81706aso154304a12.2 for ; Wed, 27 Mar 2024 11:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562953; x=1712167753; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=X/CQd/17iJ2kwXZI1u99C8d+fll4NuRn/euAOmsXPlU=; b=nLpe09syAhOCWd9tQd+MwornteZb8fNr5WtkOEhJGMVdkuksIVwiE0gddSqAuOe+1B gVL4sQE3VZj/f9sNWnSZcz6rmCvZ+6vF0Zgt//X+0KT/oxbro5QATKyq0DDgbi7I/67X ICc71XRNgOG9avnZ8+Aw+xWLbSNAL0QW0SiMqCN4UlXucWDnkZXqN3G4KHtzF5lEUveJ ZIIxIzD3uCNBYA6zjCPdQK0wt42Km/LXj0EZbymsC6Jw59Mb/vVcMGlQAYaofAjzJAy3 m0lhGonDUAv7jG54pe6PgwYADePQ8Ojeov2GGT9uTI0BCAgCkAsv7YBcGFBk/AAilmrJ ln/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562953; x=1712167753; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X/CQd/17iJ2kwXZI1u99C8d+fll4NuRn/euAOmsXPlU=; b=t0Ytqzejem4tD14nkWJQ+RjJ3EYSd4bbT/PU39vWVahnKHlGT8giQL0awJmKHJM/mC 4Qmi7lbpzH0iCM1xUhCVYUrLTj9GuisiLdgKKOX01m40HWR57rxTSGedUW+lei/yWJDD eZJnRPBpRGyxA7FUJbsO8vVFGpQ936rmdU6yB4jPu/Yk+gsy+qXGSvugx6WPNlgWxZmN txhtGX5U8BNlOMYZg2TKbBvc6UjJ+xwzM7ij46mkujWTpx623bCPMn9jU72bNybKOevs sRQda+YbyRia+oIq4CqL17nyHjVi6qrTwSITymjIgSGzm0w1AodXhNMmGLpkQrST4s5U TMPA== X-Forwarded-Encrypted: i=1; AJvYcCUxmQ52DtF7J9cO/AOgFIzcE+zha5agXfXgFCKBelvRNzXnXL/CbmDP0NHL3JIfEv/dciEgx6EwupLmo7WK2XLPCvqCyU1tRKfYQ/Y= X-Gm-Message-State: AOJu0YydzuS2wKIIT6TiQyUGSDASqvy9XAwr2tX2IhGKc0Pce/NuIYFE iYnzmGeFnTx60G5W5xrTpOT/ZUnmXzRDs/KrJt7rY34HyG61zn2APGQxQNVl05Q= X-Google-Smtp-Source: AGHT+IFlkgzqIP+Q1UG8pVb70TSNRnC5zHkS+ExOzcbgp11+GWgEylpMe38xvrUC1mvRu+IwuYKU1Q== X-Received: by 2002:a17:906:3c51:b0:a46:e595:f357 with SMTP id i17-20020a1709063c5100b00a46e595f357mr189730ejg.9.1711562953062; Wed, 27 Mar 2024 11:09:13 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:12 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:52 +0100 Subject: [PATCH v3 14/19] media: venus: core: Define a pointer to core->res Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-14-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=1808; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=N/+DdFoVCHF23AQ+OjDZ00SaK75sELYmsLPOH0p2aT4=; b=1gxBTxoz/cxrMX0RUDFm+MPnu8jLxtNwBQRjFbmiKwfrMWSZ2mUQ6GbUHNJot8qeaX5xQ5sw6 0G9hX+ocBcYALouuYtXDuLwShrMO/8+6DguNAgv1Iz8Lb2t+ZwkTf/2 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= To make the code more concise, define a new variable 'res' pointing to the abundantly referenced core->res. Signed-off-by: Konrad Dybcio Reviewed-by: Bryan O'Donoghue Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5b18b1f41267..e61aa863b7f7 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -285,6 +285,7 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id) static int venus_probe(struct platform_device *pdev) { + const struct venus_resources *res; struct device *dev = &pdev->dev; struct venus_core *core; int i, ret; @@ -315,9 +316,11 @@ static int venus_probe(struct platform_device *pdev) if (!core->res) return -ENODEV; + res = core->res; + mutex_init(&core->pm_lock); - core->pm_ops = venus_pm_get(core->res->hfi_version); + core->pm_ops = venus_pm_get(res->hfi_version); if (!core->pm_ops) return -ENODEV; @@ -325,8 +328,8 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; - for (i = 0; i < core->res->resets_num; i++) { - core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]); + for (i = 0; i < res->resets_num; i++) { + core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]); if (IS_ERR(core->resets[i])) return PTR_ERR(core->resets[i]); } @@ -337,7 +340,7 @@ static int venus_probe(struct platform_device *pdev) return ret; } - ret = dma_set_mask_and_coherent(dev, core->res->dma_mask); + ret = dma_set_mask_and_coherent(dev, res->dma_mask); if (ret) goto err_core_put; From patchwork Wed Mar 27 18:08:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783843 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BC21153BD7 for ; Wed, 27 Mar 2024 18:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562960; cv=none; b=aCqyYl5gxgodJbPed0Ztsbm9MNCbR//JJHhNGUA1RwHKkKEcYiOlsh+qd37OaUeityWBCnh/Ne8sioDIN4bY8ovbO+9v31C2WiQpj9pN2V7pXQAf0z9JF0eSpUckDvclgty5r9LKjpgssqdd2QyUBZ5um9yU48QfFuxhqW+Psnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562960; c=relaxed/simple; bh=afMiBrFoHhRzer2cqmqFzs4ZW0H+P1izDB/I0qvx+go=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GdNRQzqtFDfjCaCoxW1sUPhjWKNIep0Jto/QJDp0v8c57LxvvcMH+6K2obQP8LR6kdcAoDyzo3wXw/1ZiMKO1Tmwd/R6ADKgmn0DHpYX+IvCmN2VZBwi30QVhjKvlefSkC+46YVGAbYT//ZX7PJf9HuQnxECKN7UzL2/1K0B94g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SW8ayQp9; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SW8ayQp9" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-513e89d0816so38813e87.0 for ; Wed, 27 Mar 2024 11:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562955; x=1712167755; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+IVHgSW/xaGi23QYFJtUQH6kBo9HwGpw1RMo77ssnFg=; b=SW8ayQp9tmrVYA29AH8aaduQqMwdWgGWMsouNailI6YeDRnnC8cPzjWpp/6dBtJfXX fWXZE0ihNoqkhGq49d5quiuNskHX9gWsgw6i+b6SpHOVONPpsezuzi82TE/9ZdtPMBVQ IBOoBF7GsjVFVcpQLArk4VgZXTkFt2LJ0aeoV20MjmqGvUlQaZygv3aIsPlpFkvOtnsu k2w9TRDKFQk+81NU7+7NHZ1mmA8lcSzxNurjl652ZKmb0zlg5SdmaBI8T3ho9iSh+KPW juKKNKhGlOhXvm+WICvnkTNHk20IvlHfs8ska2l/EbRDNPSvvBFaqBAQn5SQ6zhYRtAW iClw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562955; x=1712167755; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+IVHgSW/xaGi23QYFJtUQH6kBo9HwGpw1RMo77ssnFg=; b=QFO0hdmqnelQfGhjQLxxgcCakZDW++L5/7pNnQjRk+s+Cg/VFYk9LmYbv60f6tJ5g6 hyFcs17jTDgPveadxjqcYSJbnThDLsfpV+l5EvCg9Ap9AoQc3GEa/uX7VLwHvbEMIlAB FBOnQ8RkRKiQhOCxxraaCGiBLUOrBfC2WrpUwkaKi9zgMN1GMPDgmztPrjsUyB8uu6su BO9dU6QX8SXxT4aMXGSSVLVakB45sh5CNbH4NxH+2gwgK7yeEFMCjBx8wTxxvK8JOXqn +Z1HB6RhK22NS9hm7dsTrkf07cHo9FpBvJGsPduCzICrvpg2S4yx5NTkYw845kmGln9s B5EA== X-Forwarded-Encrypted: i=1; AJvYcCXWsddyxDDp0Wq4wsFTkP3gRGuL/54Wbiz0KAemvxkcZ0sP7lGFp7Tv+hJHmpZXmMtyWnV7r1XKhbqbS0ms2DWYmNLcZM07i+wCQbc= X-Gm-Message-State: AOJu0Yz2V/Ry5Hwi3B5ZKqBv5OkFr6N2oFo+GANK0qvoNv/N55MIo2xF jmLOP7rV8ngPk1//Zef4r1TcUwmLBZ76uEsZLTAnZWNxsAn0EeHbOGdqY0NBZsM= X-Google-Smtp-Source: AGHT+IGWhgiKUOdcrvmm8dwp1JWqillWx9nhvam2rmFbhmWYMBwh4DC45tz760zHnjGHGPWkIoZAgA== X-Received: by 2002:ac2:5b0c:0:b0:513:c593:a634 with SMTP id v12-20020ac25b0c000000b00513c593a634mr171919lfn.6.1711562955383; Wed, 27 Mar 2024 11:09:15 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:14 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:53 +0100 Subject: [PATCH v3 15/19] media: venus: pm_helpers: Simplify vcodec clock handling Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-15-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=13981; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=afMiBrFoHhRzer2cqmqFzs4ZW0H+P1izDB/I0qvx+go=; b=DL6uk51sRVqRvs/kCIzEnj6XcH/3HNCesxKFi0Bld1sSHdQ+HCYGYwjdglU2ECFgHYNmxbdtP 5/flOoziTmsCEsi6PKUTHZesB/TupkfohJuFrO04dq+ogk6Qf/VBk8z X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Currently the infrastructure is set up for vast expandability, but it's far too complex for what is just 0-2 clocks. Categorize the clocks and simplify their getting. One notable change is that vcodec clocks are switched to use devm_clk_get_optional, which will let us commonize the code further while leaving the burden of figuring out which SoCs need codec-specific clocks and which don't to the bindings checker. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 18 ---- drivers/media/platform/qcom/venus/core.h | 13 ++- drivers/media/platform/qcom/venus/pm_helpers.c | 129 +++++++++++++------------ 3 files changed, 71 insertions(+), 89 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index e61aa863b7f7..1f4a86b1bd73 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -581,9 +581,6 @@ static const struct venus_resources msm8996_res = { .reg_tbl_size = ARRAY_SIZE(msm8996_reg_preset), .clks = {"core", "iface", "bus", "mbus" }, .clks_num = 4, - .vcodec0_clks = { "core" }, - .vcodec1_clks = { "core" }, - .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, @@ -636,9 +633,6 @@ static const struct venus_resources sdm660_res = { .bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec), .clks = {"core", "iface", "bus", "bus_throttle" }, .clks_num = 4, - .vcodec0_clks = { "vcodec0_core" }, - .vcodec1_clks = { "vcodec0_core" }, - .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, .cp_size = 0x79000000, @@ -680,9 +674,6 @@ static const struct venus_resources sdm845_res = { .bw_tbl_dec_size = ARRAY_SIZE(sdm845_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "core", "bus" }, - .vcodec1_clks = { "core", "bus" }, - .vcodec_clks_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -699,9 +690,6 @@ static const struct venus_resources sdm845_res_v2 = { .bw_tbl_dec_size = ARRAY_SIZE(sdm845_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "vcodec0_core", "vcodec0_bus" }, - .vcodec1_clks = { "vcodec1_core", "vcodec1_bus" }, - .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, .opp_pmdomain = pd_names_cx, @@ -744,8 +732,6 @@ static const struct venus_resources sc7180_res = { .bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "vcodec0_core", "vcodec0_bus" }, - .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, @@ -796,8 +782,6 @@ static const struct venus_resources sm8250_res = { .clks_num = 2, .resets = { "bus", "core" }, .resets_num = 2, - .vcodec0_clks = { "vcodec0_core" }, - .vcodec_clks_num = 1, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_mx, @@ -851,8 +835,6 @@ static const struct venus_resources sc7280_res = { .ubwc_conf = &sc7280_ubwc_config, .clks = {"core", "bus", "iface"}, .clks_num = 3, - .vcodec0_clks = {"vcodec_core", "vcodec_bus"}, - .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 19908f028441..b4c41dc0f8c7 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -24,9 +24,10 @@ #define VDBGFW "VenusFW : " #define VIDC_CLKS_NUM_MAX 4 -#define VIDC_VCODEC_CLKS_NUM_MAX 2 #define VIDC_RESETS_NUM_MAX 2 +#define MAX_NUM_VCODECS 2 + extern int venus_fw_debug; struct freq_tbl { @@ -68,8 +69,6 @@ struct venus_resources { const struct hfi_ubwc_config *ubwc_conf; const char * const clks[VIDC_CLKS_NUM_MAX]; unsigned int clks_num; - const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; unsigned int vcodec_clks_num; const char **vcodec_pmdomains; unsigned int vcodec_pmdomains_num; @@ -123,8 +122,8 @@ struct venus_format { * @aon_base: AON base address * @irq: Venus irq * @clks: an array of struct clk pointers - * @vcodec0_clks: an array of vcodec0 struct clk pointers - * @vcodec1_clks: an array of vcodec1 struct clk pointers + * @vcodec_core_clks: an array of codec core clk pointers + * @vcodec_bus_clks: an array of codec bus clk pointers * @video_path: an interconnect handle to video to/from memory path * @cpucfg_path: an interconnect handle to cpu configuration path * @has_opp_table: does OPP table exist @@ -176,8 +175,8 @@ struct venus_core { void __iomem *aon_base; int irq; struct clk *clks[VIDC_CLKS_NUM_MAX]; - struct clk *vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; + struct clk *vcodec_core_clks[MAX_NUM_VCODECS]; + struct clk *vcodec_bus_clks[MAX_NUM_VCODECS]; struct icc_path *video_path; struct icc_path *cpucfg_path; bool has_opp_table; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index d717e150b34f..583153bbb74e 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -110,67 +110,74 @@ static void core_clks_disable(struct venus_core *core) static int core_clks_set_rate(struct venus_core *core, unsigned long freq) { - int ret; + int i, ret; ret = dev_pm_opp_set_rate(core->dev, freq); if (ret) return ret; - ret = clk_set_rate(core->vcodec0_clks[0], freq); - if (ret) - return ret; - - ret = clk_set_rate(core->vcodec1_clks[0], freq); - if (ret) - return ret; + for (i = 0; i < MAX_NUM_VCODECS; i++) { + ret = clk_set_rate(core->vcodec_core_clks[i], freq); + if (ret) + return ret; + } return 0; } -static int vcodec_clks_get(struct venus_core *core, struct device *dev, - struct clk **clks, const char * const *id) +static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i; + char buf[13] = { 0 }; /* vcodecX_core\0 */ - for (i = 0; i < res->vcodec_clks_num; i++) { - if (!id[i]) - continue; - clks[i] = devm_clk_get(dev, id[i]); - if (IS_ERR(clks[i])) - return PTR_ERR(clks[i]); + /* Best we can do is 2 cores */ + if (id > MAX_NUM_VCODECS - 1) { + dev_err(dev, "Got impossible vcodec id %u\n", id); + return -EINVAL; + }; + + snprintf(buf, sizeof(buf), "vcodec%u_core", id); + + /* First try the non-legacy name */ + core->vcodec_core_clks[id] = devm_clk_get_optional(dev, buf); + if (IS_ERR(core->vcodec_core_clks[id])) { + /* Try again, with the legacy name */ + core->vcodec_core_clks[id] = devm_clk_get_optional(dev, "core"); + if (IS_ERR(core->vcodec_core_clks[id])) + return PTR_ERR(core->vcodec_core_clks[id]); + } + + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "vcodec%u_bus", id); + + core->vcodec_bus_clks[id] = devm_clk_get_optional(dev, buf); + if (IS_ERR(core->vcodec_bus_clks[id])) { + core->vcodec_bus_clks[id] = devm_clk_get_optional(dev, "bus"); + if (IS_ERR(core->vcodec_bus_clks[id])) + return PTR_ERR(core->vcodec_bus_clks[id]); } return 0; } -static int vcodec_clks_enable(struct venus_core *core, struct clk **clks) +static int vcodec_clks_enable(struct venus_core *core, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i; int ret; - for (i = 0; i < res->vcodec_clks_num; i++) { - ret = clk_prepare_enable(clks[i]); - if (ret) - goto err; - } + ret = clk_prepare_enable(core->vcodec_core_clks[id]); + if (ret) + return ret; - return 0; -err: - while (i--) - clk_disable_unprepare(clks[i]); + ret = clk_prepare_enable(core->vcodec_bus_clks[id]); + if (ret) + clk_disable_unprepare(core->vcodec_core_clks[id]); return ret; } -static void vcodec_clks_disable(struct venus_core *core, struct clk **clks) +static void vcodec_clks_disable(struct venus_core *core, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i = res->vcodec_clks_num; - - while (i--) - clk_disable_unprepare(clks[i]); + clk_disable_unprepare(core->vcodec_bus_clks[id]); + clk_disable_unprepare(core->vcodec_core_clks[id]); } static u32 load_per_instance(struct venus_inst *inst) @@ -343,8 +350,7 @@ static int vdec_get_v3(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - return vcodec_clks_get(core, dev, core->vcodec0_clks, - core->res->vcodec0_clks); + return vcodec_clks_get(core, dev, 0); } static int vdec_power_v3(struct device *dev, int on) @@ -355,9 +361,9 @@ static int vdec_power_v3(struct device *dev, int on) vcodec_control_v3(core, VIDC_SESSION_TYPE_DEC, true); if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); else - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); vcodec_control_v3(core, VIDC_SESSION_TYPE_DEC, false); @@ -368,8 +374,7 @@ static int venc_get_v3(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - return vcodec_clks_get(core, dev, core->vcodec1_clks, - core->res->vcodec1_clks); + return vcodec_clks_get(core, dev, 1); } static int venc_power_v3(struct device *dev, int on) @@ -380,9 +385,9 @@ static int venc_power_v3(struct device *dev, int on) vcodec_control_v3(core, VIDC_SESSION_TYPE_ENC, true); if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); else - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); vcodec_control_v3(core, VIDC_SESSION_TYPE_ENC, false); @@ -441,7 +446,7 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false); if (ret) @@ -457,7 +462,7 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false); if (ret) @@ -484,7 +489,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); if (ret) return ret; @@ -502,7 +507,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); if (ret) return ret; @@ -763,20 +768,18 @@ static int vdec_get_v4(struct device *dev) if (!legacy_binding) return 0; - return vcodec_clks_get(core, dev, core->vcodec0_clks, - core->res->vcodec0_clks); + return vcodec_clks_get(core, dev, 0); } static void vdec_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - unsigned int i; if (!legacy_binding) return; - for (i = 0; i < core->res->vcodec_clks_num; i++) - core->vcodec0_clks[i] = NULL; + core->vcodec_core_clks[0] = NULL; + core->vcodec_bus_clks[0] = NULL; } static int vdec_power_v4(struct device *dev, int on) @@ -792,9 +795,9 @@ static int vdec_power_v4(struct device *dev, int on) return ret; if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); else - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); vcodec_control_v4(core, VIDC_CORE_ID_1, false); @@ -808,20 +811,18 @@ static int venc_get_v4(struct device *dev) if (!legacy_binding) return 0; - return vcodec_clks_get(core, dev, core->vcodec1_clks, - core->res->vcodec1_clks); + return vcodec_clks_get(core, dev, 1); } static void venc_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - unsigned int i; if (!legacy_binding) return; - for (i = 0; i < core->res->vcodec_clks_num; i++) - core->vcodec1_clks[i] = NULL; + core->vcodec_core_clks[1] = NULL; + core->vcodec_bus_clks[1] = NULL; } static int venc_power_v4(struct device *dev, int on) @@ -837,9 +838,9 @@ static int venc_power_v4(struct device *dev, int on) return ret; if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); else - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); vcodec_control_v4(core, VIDC_CORE_ID_2, false); @@ -934,11 +935,11 @@ static int core_get_v4(struct venus_core *core) dev_info(dev, "%s legacy binding\n", legacy_binding ? "" : "non"); - ret = vcodec_clks_get(core, dev, core->vcodec0_clks, res->vcodec0_clks); + ret = vcodec_clks_get(core, dev, 0); if (ret) return ret; - ret = vcodec_clks_get(core, dev, core->vcodec1_clks, res->vcodec1_clks); + ret = vcodec_clks_get(core, dev, 1); if (ret) return ret; From patchwork Wed Mar 27 18:08:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783433 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8BFA153BF0 for ; Wed, 27 Mar 2024 18:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562960; cv=none; b=XekFgh5eBX56X5OCLIPr6cF6SArPh8RlbXW6G9twqGzKuPF/7JdjtUqZYjTObLJ9RfMksU/tHhO3qTDWfVtiT+ZthM1Sf6Vm3CjdM5EPqqTiDYii+1dC194qN1TV9buSLZ0gSXPedWKHjK9R+kfvG799Yfg+F0BmeoiKdQSC6Gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562960; c=relaxed/simple; bh=rfeCKF0TDJxow2k4V6ytPA8cst5sc8C0h2kYpOgo/rw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p1q9bs5RVk2mx2KaowGLxL9lR6VFXam40y0yhyguV+yH6lz43tt9KdZ91eTVS48vs1hm+gwJ0NCcCz2SnZlkAZhlBCcKd3m5+8iTbgBR/64os+tLNAwKg6QmYgt/3pd7At/Gj7E4Bw6gCuRaQMxqRWmeAB7deps3lG/0MHAk3A8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ShAPU6yN; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ShAPU6yN" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a470d7f77eeso12797466b.3 for ; Wed, 27 Mar 2024 11:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562957; x=1712167757; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+hgrsUJ/GR8AiL4ulZYMnT6DC/W7yW/8RHSfzLSDdCI=; b=ShAPU6yN8vndh/cLbeJZMqJoFHJCPKrvBd9UM0Wbzx52l2Evh60L+fvmVxn8YM0PmA SzGWV4JrQR5RJSmq8VVucJj4bGwuNGGxB5WHv2CCNiCmpA6lGmRUgjl3b79h9irIfYai 5Xi2mEN2mhBuG3riDZuF3chWl9mV1hJae2KJzjHRlxlo4H49Ni1Pkdtzvn8uDx2T/V0e w/w85vyNOtKcgKm8GlwDOXkm0vfCmiRDtbPi7VIyn0jE/8SLqpiniBZ1zp9ApuCprjZu 5IbFi0y5iLpm2Bvd71wFQ8Lw2+6zn+mtWx5MBaNSosHRf7x2h2hAkv3L9xGHV+quERlF xyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562957; x=1712167757; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+hgrsUJ/GR8AiL4ulZYMnT6DC/W7yW/8RHSfzLSDdCI=; b=bLDMVDpb7oRfg3gzKD8DjKKhtGnPc7qN5dgZAHOst03Ev8344WHZ2V5HA2PmlX29vQ bHc41uyj/gLC1VQOaCfVA8+d6n7D14Kbll0U0D6ILpVAs6TWIZDim+8gMT2cKtBpxGYT 9azVHmAupaXEyKREQhwrW6a7zD/mMmZXMD9DbrY31l0UGNtkENKNb48wt1OS5voesWjk iEzardzyppcKtp4jC08VqEOHN/sI7nJr/jlsF9oeKF7zNN/k35hN1aY2kE4jT4uUYA8i DuUomI8F7uWbuKpOTManKC45VfvjunN0Hs/+XlBs7D6AfW1KP1d5VAym8UA8GbrxRLUq jeIw== X-Forwarded-Encrypted: i=1; AJvYcCXPs81EO52i4Go7H1f4BUf5/0jkfiWroEdX9NRfrr8nBCwTy8kQE5fZ6hj9GL644ty3f5wUebnF24f87GF1vNQQXmFJXxG6IytRi0k= X-Gm-Message-State: AOJu0Ywu77zZz9tUXNoZIwhWXzjTZha2q4lW6nhOfTf+7lrTQlVIIgSl c6pvd0dV1gr+s3ut9ccQCkb2hszxSg38zdDqBIr4wWW/tXF3b53QoipRCqPi6Sw= X-Google-Smtp-Source: AGHT+IFOo4sFmtLzwbLXP0KtVDvk+1I6H0+uefuNN51KXyk92++u2x6hlx1B7phPd+BPI28GFR3vGA== X-Received: by 2002:a17:907:7e94:b0:a4e:f44:f73e with SMTP id qb20-20020a1709077e9400b00a4e0f44f73emr258584ejc.13.1711562957265; Wed, 27 Mar 2024 11:09:17 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:16 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:54 +0100 Subject: [PATCH v3 16/19] media: venus: pm_helpers: Commonize getting clocks and GenPDs Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-16-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3311; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=rfeCKF0TDJxow2k4V6ytPA8cst5sc8C0h2kYpOgo/rw=; b=8KXAuuvGmO4WCVHnBLB5zdXP45qg+FE3jQHPKn1ZAnwRK5Q0Ij6puORMMO76D+9TTLNhNwuYI GEX9ukAJMclCBi0uqCujkCl83LSgnomFNnzTlQ3u89RbNnNUJPkwvEu X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= As has been the story with the past few commits, much of the resource acquisition logic is totally identical between different generations and there's no good reason to invent a new function for each one. Commonize core_get() and rename it to venus_get_resources() to be more meaningful. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 8 +++----- drivers/media/platform/qcom/venus/pm_helpers.c | 5 +---- drivers/media/platform/qcom/venus/pm_helpers.h | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 1f4a86b1bd73..6914fa991efb 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -334,11 +334,9 @@ static int venus_probe(struct platform_device *pdev) return PTR_ERR(core->resets[i]); } - if (core->pm_ops->core_get) { - ret = core->pm_ops->core_get(core); - if (ret) - return ret; - } + ret = venus_get_resources(core); + if (ret) + return ret; ret = dma_set_mask_and_coherent(dev, res->dma_mask); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 583153bbb74e..ba5199d9e5c9 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -326,7 +326,6 @@ static int load_scale_v1(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v1 = { - .core_get = venus_clks_get, .load_scale = load_scale_v1, }; @@ -395,7 +394,6 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .core_get = venus_clks_get, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -920,7 +918,7 @@ static int core_resets_reset(struct venus_core *core) return ret; } -static int core_get_v4(struct venus_core *core) +int venus_get_resources(struct venus_core *core) { struct device *dev = core->dev; const struct venus_resources *res = core->res; @@ -1109,7 +1107,6 @@ static int load_scale_v4(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v4 = { - .core_get = core_get_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 3014b39aa6e3..7a55a55029f3 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -10,8 +10,6 @@ struct venus_core; #define POWER_OFF 0 struct venus_pm_ops { - int (*core_get)(struct venus_core *core); - int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); @@ -28,6 +26,7 @@ struct venus_pm_ops { const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); void vcodec_domains_put(struct venus_core *core); +int venus_get_resources(struct venus_core *core); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Wed Mar 27 18:08:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783842 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAB3B154427 for ; Wed, 27 Mar 2024 18:09:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562962; cv=none; b=btWk5JsRduFtxXepDSeJ82wMutknYjLHyJpAwFc85yQu814rVDVEObsj9TnyhzZJIHRWWuXJp3+3qhdVz68E/rBhGgcLmnTk1c5vB0uypOPGkvkqBLe770DA42g3ekinhMXgyX1p8tzGse0d97/s9HkGxiUTBUKVIePJvZCe6N8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562962; c=relaxed/simple; bh=YPOM16vVGulFeYJxVS/bQNxn7NvNb50oyMZ+8/LRVgc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MSz8v78cnT7UF9MP0PgVoTsGzxIcwGV/5w240LFc4IYOA+T4pyJgXyDymxsQO90q1yWokfOc0yv1iP+JNraf7HVi1XkgfAjEwZ7jUh2oKQ6wHQS4alY1bYBZODx+mxa5ykNwjKVrNgPAs2t3uUjZbaVCB1m9OryzqkMQUFxSRMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R9QWhxvm; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R9QWhxvm" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-56bc5a3aeb9so127571a12.3 for ; Wed, 27 Mar 2024 11:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562959; x=1712167759; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=viaDnL+jorLpEr4D5ysTfAL5WbtSuMoX3VxG9GbPUNs=; b=R9QWhxvmrEjvrSRoOMLxeL1heLMZCmEzE/UgAZp34Ohg5LJeIOsU8F2SboXF+IDAwE JgxBEmsCZucoFeC+TxyXRUmPr5q1t+8pPi6QPSzt5sA7LdDmKOpC1cGhmFtxbj8mwxD/ lAJAwZexbLmBzBAYuHhMargWNgkiqiz0Sh8EsAj79ImO/Lrv7JDVDxT7mM7eSzS2qel6 C5wFN89BH3B3lfKcHyrnHHl4NKidApSVaAMaPbZWWs2kL5OBlZhru/36uuCpn5cvyGR7 RWGIo8RCqOVWY1PW7Rw/KG1FtgNP76almw+UVWNHYlrXCfyuRQEzKofMvl74EaYzvfso YGtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562959; x=1712167759; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=viaDnL+jorLpEr4D5ysTfAL5WbtSuMoX3VxG9GbPUNs=; b=Jmu6KKKGWr9Ot3Aw/etznooZW66Rq1I06CifOP3iMg5pH5Ld4jph654WmxAQx/tBLL gO0tU24X/oEorpwcGa8rNas5VTRbSwByoygltjpLqLdYqBa3IUt1i1o0cgom1YSxqsE9 KpwIw/Kab9/XMD1DZ0RGIX3nblV00su8vWBvu7KiAE5VtNFgg3/4qKcG7ss3d2e9IX8C ZTlKykULTRsqd8DcN5nwsGy3paSl8s3wnj0fJGOacYybWDGDQB7rZuvcoTeE9ej0jb0J Wlgl2IJ5r3P2NAgVtcGPwFcaqW+OWYgdd8xhyPjT9F05Cb/8NSGGHTK2az/m6Vxq+Kr2 BBRw== X-Forwarded-Encrypted: i=1; AJvYcCWcJQBojy0B8FhIdfnJPNuAjYt5sDdHHnkkXuExQC0bNqfnZExSQ9E8CNFz3s/mJMSRcJpPOSmZFyoHDdS5zkbuyK/K8KvkuGXz39c= X-Gm-Message-State: AOJu0YwMvkOJP3amNhZsHmO2TOwUpyofuB6f8wQXZ9Vyp094Q+Smyx3l IlCfdYhGj9h8FSpCPEf2faJWUDkHHrLq+7Aa6Iydbb76bqehdXBXzoaA/jvduYI= X-Google-Smtp-Source: AGHT+IG/PjxCHswV8MvrfbQwwLAqPrtsUShHYsjN0mLDozARzVNLuuojODIfOriJYcf4wowFpY/Euw== X-Received: by 2002:a17:907:7255:b0:a46:be3d:1ed8 with SMTP id ds21-20020a170907725500b00a46be3d1ed8mr184672ejc.54.1711562959250; Wed, 27 Mar 2024 11:09:19 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:18 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:55 +0100 Subject: [PATCH v3 17/19] media: venus: pm_helpers: Commonize vdec_get() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-17-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=4126; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=YPOM16vVGulFeYJxVS/bQNxn7NvNb50oyMZ+8/LRVgc=; b=7lvejkr6meg+gAXR22j3qf8VLzKNbxdPnlDC7PC8VF9sGYKtv7vvBC3PicIpDr9rDssyMPMbf kkhEFrSjp01BFvUOkzY0sY0ZA3yD6fYEVfMqRHpRUb8byEMW7BTbSd7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= This function can be very easily commonized between the supported gens. Do so! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 22 ++-------------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- drivers/media/platform/qcom/venus/vdec.c | 9 +++++++-- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ba5199d9e5c9..3818384bae10 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -125,7 +125,7 @@ static int core_clks_set_rate(struct venus_core *core, unsigned long freq) return 0; } -static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) +int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) { char buf[13] = { 0 }; /* vcodecX_core\0 */ @@ -158,6 +158,7 @@ static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) return 0; } +EXPORT_SYMBOL_GPL(vcodec_clks_get); static int vcodec_clks_enable(struct venus_core *core, u8 id) { @@ -345,13 +346,6 @@ vcodec_control_v3(struct venus_core *core, u32 session_type, bool enable) writel(1, ctrl); } -static int vdec_get_v3(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - return vcodec_clks_get(core, dev, 0); -} - static int vdec_power_v3(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); @@ -394,7 +388,6 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, .venc_power = venc_power_v3, @@ -759,16 +752,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on) return ret; } -static int vdec_get_v4(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - if (!legacy_binding) - return 0; - - return vcodec_clks_get(core, dev, 0); -} - static void vdec_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -1107,7 +1090,6 @@ static int load_scale_v4(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v4 = { - .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, .venc_get = venc_get_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 7a55a55029f3..4afc57dac865 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -10,7 +10,6 @@ struct venus_core; #define POWER_OFF 0 struct venus_pm_ops { - int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); @@ -27,6 +26,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); void vcodec_domains_put(struct venus_core *core); int venus_get_resources(struct venus_core *core); +int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id); static inline int venus_pm_load_scale(struct venus_inst *inst) { diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 29130a9441e7..d127311100cd 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1788,8 +1788,13 @@ static int vdec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); - if (core->pm_ops->vdec_get) { - ret = core->pm_ops->vdec_get(dev); + /* + * If the vcodec core clock is missing by now, it either doesn't exist + * (8916) or deprecated bindings with pre-assigned core functions and + * resources under the decoder node are in use. + */ + if (!core->vcodec_core_clks[0]) { + ret = vcodec_clks_get(core, dev, 0); if (ret) return ret; } From patchwork Wed Mar 27 18:08:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783432 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D081154BE9 for ; Wed, 27 Mar 2024 18:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562965; cv=none; b=Pywys/ILfLpme1pnuv/whgURtJ0qrHEEmDaEXefNtQh7PbE7ZS24jexuy3L1RfAQxqodD6EOuwkoESfuFIgt3Xxrsd2/BMDCbC9Wde7ocTsQLUV844162BY+d0P164Z1jENexHUQpxfG+tnAyq+Aif4sqPhH7IW5SYpLDiSgkDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562965; c=relaxed/simple; bh=HSihMM2FSfP4d/9KhUbWIuto84CGubkUezGJaEyCTN4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AE67nccEKkjT3bnez9CmS7VqHlVJ11I/+OMrIqWbYSjU7AD+zJubcYpyuLK1OY3S5elFzHhQnBDi/DweJlQp83bHB3/ad/9vDUBj03Tw8Teg02Vg8Id7sW/N+OAZK49b7EZaD4UGJTQ1WL2ZLTLfnT/Mgq4EeyVVrH06p+bB+Cc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HjsdU4os; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HjsdU4os" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a4a393b699fso26170166b.0 for ; Wed, 27 Mar 2024 11:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562962; x=1712167762; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=O86sooFnv+K6X9Hejn9ziW9o27GzAO8P1YZRBYqEbNs=; b=HjsdU4osuAap3VTzNY+nD+xkPAo+2LxA6xaC4hGLVsCIWrJg77WbEPqNGm1QTGebYi pJmksnbN3vfAcAba8swpz/0QOXVO+DGZ5/X7C4jWw803T8qg6KSQNgEZSNPlRPDMAqHt 69OmC++MVA8XPA+XAXvvwbsuqdGj535lXWwGKy9DNX0rnR7324uM2eXKsuevXkJeBsHd lF8lN6EfNcJBkzrvE53JMNV3qLW1XbuoxdOnSNwFVJaaayNViPKfvve7FAtok4d44GwG 789+uzM9+eeeNBLeE/TZlon2j7ewHVdt/hEho6NFqSvbiOICuHP5BezczG6EPbDYc+q5 gLHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562962; x=1712167762; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O86sooFnv+K6X9Hejn9ziW9o27GzAO8P1YZRBYqEbNs=; b=mwh6XN7lF2SBZO57G8Fm033X0XLJHpIX/ZDZA4btt3rwDCk6WjM9fmOhDzy2+u4EnK G6zkaLdGwyI9m8nJ161T+ChvYqgL3Qga8UuPMGMmv3/EqQJVqFJRRWkIZHF7GsdWo8q/ op5lkHXGCUo5c6fYyy2zd3GfIoxWDOLEj7Wn8mMZOUEeRMMVp82mXuvzeloqsJY6b1Am /TWrXUs35bBltA11caPa7/1PYQMk5bSzcONXlwkjdSLBwGFWnm8Ov9smurW6Wm3h2lHJ 41ZsTfFyOhnjQzVx/1b6mMbKon/8A7IMbWGnDoFXGy4PgSvrrzTt/nwGr5Fn1Hf0HPjd Ay8g== X-Forwarded-Encrypted: i=1; AJvYcCXC+S3OYHS+2rm5RegYjNk1onBIVG22rFkSLlEdFK8j9/wqcsSIMN4QP1/sgKhWafC/y1+59kiTpe/cQTNMnRfCSGfcZvWVpBsO3cI= X-Gm-Message-State: AOJu0YyAs2JOg18AOTzvnf8kyNqKYtQeJdHiEbKILi9IDGk7+oxmFD/F e4riumBKQOigBQuDaxKFvq235cc9GyqnhVcj9At9aFAwFiLhvTA5SDnjp0ZlYbw= X-Google-Smtp-Source: AGHT+IHHHaAzVexcQv+vgyswmvYjPMLnVGL4av0uBH5jefJwU/EuTt+IjPXJat5enkvHEKlDW0yNuw== X-Received: by 2002:a17:906:b848:b0:a4e:d1b:efb1 with SMTP id ga8-20020a170906b84800b00a4e0d1befb1mr46999ejb.5.1711562962564; Wed, 27 Mar 2024 11:09:22 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:21 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:56 +0100 Subject: [PATCH v3 18/19] media: venus: pm_helpers: Commonize venc_get() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-18-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3254; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=HSihMM2FSfP4d/9KhUbWIuto84CGubkUezGJaEyCTN4=; b=5oClluLz0nikKafGz/9dpBvnpWLtRzWilUVYfbcWu+ygCGByvNuYCxjKzKJfWHiMjUr8VVIIr Jc0D6CuJqlKD1ULIpubAesWCcb8nhV+TbqHDR5xgk7fm+fMw+Difbfx X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= This function can be very easily commonized between the supported gens. Do so! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 19 ------------------- drivers/media/platform/qcom/venus/pm_helpers.h | 1 - drivers/media/platform/qcom/venus/venc.c | 9 +++++++-- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 3818384bae10..5d174b83926b 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -363,13 +363,6 @@ static int vdec_power_v3(struct device *dev, int on) return ret; } -static int venc_get_v3(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - return vcodec_clks_get(core, dev, 1); -} - static int venc_power_v3(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); @@ -389,7 +382,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .vdec_power = vdec_power_v3, - .venc_get = venc_get_v3, .venc_power = venc_power_v3, .load_scale = load_scale_v1, }; @@ -785,16 +777,6 @@ static int vdec_power_v4(struct device *dev, int on) return ret; } -static int venc_get_v4(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - if (!legacy_binding) - return 0; - - return vcodec_clks_get(core, dev, 1); -} - static void venc_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -1092,7 +1074,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, - .venc_get = venc_get_v4, .venc_put = venc_put_v4, .venc_power = venc_power_v4, .coreid_power = coreid_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 4afc57dac865..cbf54e6c6eab 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -13,7 +13,6 @@ struct venus_pm_ops { void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); - int (*venc_get)(struct device *dev); void (*venc_put)(struct device *dev); int (*venc_power)(struct device *dev, int on); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 3ec2fb8d9fab..d17aeba74b49 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1557,8 +1557,13 @@ static int venc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); - if (core->pm_ops->venc_get) { - ret = core->pm_ops->venc_get(dev); + /* + * If the vcodec core clock is missing by now, it either doesn't exist + * (8916) or deprecated bindings with pre-assigned core functions and + * resources under the decoder node are in use. + */ + if (!core->vcodec_core_clks[1]) { + ret = vcodec_clks_get(core, dev, 1); if (ret) return ret; } From patchwork Wed Mar 27 18:08:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 783841 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BAE814F9F0 for ; Wed, 27 Mar 2024 18:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562968; cv=none; b=jyZy5esFN2JfONnutlQqw7me43kW+k4uJg7Qv+Odl0uxEvEvGVzJYNLPDfjJlVY7K66RcRWDohVZhLtxfshM04NQX7z8aP+wkVP6v6nRsVlt02hdBx+icZxGMSi30xGnLG9uXvRAR/EfktYsZXkVNg6/+eyJUz2ENIpXbL98Rfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562968; c=relaxed/simple; bh=3qglLyapUHx3u+l/QabEvMvzkmj10BvUO0XdDxR56GM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WCyMzHLSfvQywbAHGd74cU4QET4lpvhSISC/IOVhqpYyRxEqfvr/Vr7xvzFeZCFEW1o3cEnkUTdZwPu9lBhg2GmqYwFvDjNoN0EY53q8vxwwnHwrmj2S1R7p2uCHb72jPECJTGJbJLLDE/GgyvnFcVBiopy5goMiT4w2+pmhm/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KqQr7cX5; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KqQr7cX5" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-512ed314881so10631e87.2 for ; Wed, 27 Mar 2024 11:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711562965; x=1712167765; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ny0RW5yHEK6S0vsSjArXEVaJzkIsrNf4sgwhXeVchD4=; b=KqQr7cX5GNzc8hL1on3VS21JEi2s0dCnyZw7z6ps7O2HI/ESB7VeChm+aQR6+WGS2l T6/KgYlTNBdcDxxUshh6aQJ85fMYfilfbDDyG3Dc/rR4IpOVdQEKyH+5l0hPFG5K6Zj7 G90wsvE1LwLpOpGNExVX6W4Onyoa2kK3wfbikuJUBpmmfA8ha0UKX85Q2A5hzraF0pcm LsjNwzH7G4wRYorLY6e5LOm382uWn6hgTGonpkS5h06JH3XNJ3pFgR53RrJbI2z89yIU ErBQbGZyCqauLR2IiCnKUcDMA/P8Axb0zDBziYQaujVVy4+OBFA7LrgXYGdn+rceOqBX ZdYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711562965; x=1712167765; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ny0RW5yHEK6S0vsSjArXEVaJzkIsrNf4sgwhXeVchD4=; b=H5COG2Cs4C9+pDu2vuNJJLabfhKPkYSOI7SfKqKiTViToXLhph2/RLTdj+jDitAC8k q7VLGxBYZR7reYrSKPw1YlhEKxho8kYgBtovtGBO2caX5t99dJHRmXCnmm7vYFKyS+a0 BUDEq+dL56ev9Q3V/52g85zdm/CSC+BME98LoZj6ayltw2lhQG7ykmKBrkr7gSH+yHzb EXFQ8Z+eu/ybiGHZdi71HA/DbeJsWqZyUkSnROMbkjkzFMQexWLJIGAQatF7h9ybl09X KkJiV3PHCejZT3rfztWuS+eYZNcRYLYZj5Bhx7NQBGGbtGGhA3m155eF8sxsY177s4tc QG2A== X-Forwarded-Encrypted: i=1; AJvYcCUF8AdePgg2lxaqdJbL8nwceDPvH6qgQvuGcIjxCY1gTzZVo2cnw8OSx+FrxgMc7yMPSr82LJBLFnDDFyThCqgjg81kQ+kKLItIec4= X-Gm-Message-State: AOJu0YybmuYAekpWdml3IWVeDZhJpus+guidEPJ+m5pEgbttDMnNH264 qMXy99Jki8VFrrdCyNdhwKh29CBU4RGZRXyzcjXtE29fifSjQ4TcKsAgsl/MRBc= X-Google-Smtp-Source: AGHT+IGr8pV0It2QpBVSB+Pd9tNgUL6Wc/gDbqEM/BPqbtguUMYzdOlXaG/lV8H4AQF8cjX7mO3v2w== X-Received: by 2002:ac2:47e3:0:b0:515:ad59:d46a with SMTP id b3-20020ac247e3000000b00515ad59d46amr184301lfp.21.1711562965051; Wed, 27 Mar 2024 11:09:25 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id z2-20020a1709060be200b00a45f2dc6795sm5702733ejg.137.2024.03.27.11.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:09:24 -0700 (PDT) From: Konrad Dybcio Date: Wed, 27 Mar 2024 19:08:57 +0100 Subject: [PATCH v3 19/19] media: venus: pm_helpers: Use reset_bulk API Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v3-19-79f23b81c261@linaro.org> References: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> In-Reply-To: <20230911-topic-mars-v3-0-79f23b81c261@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711562924; l=3507; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=3qglLyapUHx3u+l/QabEvMvzkmj10BvUO0XdDxR56GM=; b=7CWOWi2OztLdyQck6jwMllwgs6Ti7I20v4+82giroq/8iguIMd2hwLCi1bm402+/K/9ReYDt8 CtycxK0Qi43ABsCBsfUanSiexz7VGGmQiNhGh7FWiEdu5GvKpUlGAFC X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= All of the resets are toggled together. Use the bulk api to save on some code complexity. The delay between resets is now correctly determined by the reset framework. Reviewed-by: Philipp Zabel Signed-off-by: Konrad Dybcio Reviewed-by: Dikshita Agarwal --- drivers/media/platform/qcom/venus/core.c | 15 ++++++++++----- drivers/media/platform/qcom/venus/core.h | 4 ++-- drivers/media/platform/qcom/venus/pm_helpers.c | 15 +++------------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 6914fa991efb..f1762c725a11 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -328,11 +328,16 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; - for (i = 0; i < res->resets_num; i++) { - core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]); - if (IS_ERR(core->resets[i])) - return PTR_ERR(core->resets[i]); - } + core->resets = devm_kcalloc(dev, res->resets_num, sizeof(*core->resets), GFP_KERNEL); + if (res->resets_num && !core->resets) + return -ENOMEM; + + for (i = 0; i < res->resets_num; i++) + core->resets[i].id = res->resets[i]; + + ret = devm_reset_control_bulk_get_exclusive(dev, res->resets_num, core->resets); + if (ret) + return dev_err_probe(dev, ret, "Failed to get resets\n"); ret = venus_get_resources(core); if (ret) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b4c41dc0f8c7..287bcf905057 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -130,7 +130,7 @@ struct venus_format { * @pmdomains: a pointer to a list of pmdomains * @opp_dl_venus: an device-link for device OPP * @opp_pmdomain: an OPP power-domain - * @resets: an array of reset signals + * @resets: a reset_control_bulk_data array of hardware reset signals * @vdev_dec: a reference to video device structure for decoder instances * @vdev_enc: a reference to video device structure for encoder instances * @v4l2_dev: a holder for v4l2 device structure @@ -183,7 +183,7 @@ struct venus_core { struct dev_pm_domain_list *pmdomains; struct device_link *opp_dl_venus; struct device *opp_pmdomain; - struct reset_control *resets[VIDC_RESETS_NUM_MAX]; + struct reset_control_bulk_data *resets; struct video_device *vdev_dec; struct video_device *vdev_enc; struct v4l2_device v4l2_dev; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 5d174b83926b..7690f66d1184 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -865,21 +865,12 @@ void vcodec_domains_put(struct venus_core *core) static int core_resets_reset(struct venus_core *core) { const struct venus_resources *res = core->res; - unsigned int i; int ret; - for (i = 0; i < res->resets_num; i++) { - ret = reset_control_assert(core->resets[i]); - if (ret) - goto err; - - usleep_range(150, 250); - ret = reset_control_deassert(core->resets[i]); - if (ret) - goto err; - } + ret = reset_control_bulk_reset(res->resets_num, core->resets); + if (ret) + dev_err(core->dev, "Failed to toggle resets: %d\n", ret); -err: return ret; }