Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp227050lqo; Wed, 27 Mar 2024 11:13:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWbO8EvbPOKPpwiYEpHF5P22W2O4fhEGupfHue/iR0VF0c1wNBSOXmqv0HAMI7DZOyAuNqrP5/CrY/T5bq9WCrduZDB93qJezeZaFxeew== X-Google-Smtp-Source: AGHT+IE5SDSHfSC9Kw8Yf9rmiKqLvpFLKNh+IWxthcRt9kYcUzpQVab+BApkn/w05iSTTwSGFr+4 X-Received: by 2002:a17:906:aac8:b0:a47:df55:cf6c with SMTP id kt8-20020a170906aac800b00a47df55cf6cmr195955ejb.63.1711563211651; Wed, 27 Mar 2024 11:13:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711563211; cv=pass; d=google.com; s=arc-20160816; b=f49W8V9EITookyNps1mOfLJXAONMfanWaEYWzvLysV1ncIpAGfSJpVjDVF/uH2S/J+ TzG0zYsZ93YPFGY6KYZAixhnhG4qJDmhahwjwVjo2ltkpdxram6h+YnhURAm3DK2KDYi oznOFIuGs/6Msjcspry7Y8Kr1loQ88/dAuidHTX1ikHYDV4sfdLW5RIaPK3+uby36qlZ KeEbfxFf2QeriKnD6U17IQXn5QDPOrHVzHm95aHKo9wxRhHCok5bZJO0QmUadu9KF5ja EYUOpi8rfJZp28F+dsQX2okFD/Bkp6cmG6nXszNW858ZsX72t/zqVvtudf0xqX9zbWQT VGWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=+hgrsUJ/GR8AiL4ulZYMnT6DC/W7yW/8RHSfzLSDdCI=; fh=mJ4fd4SE3R6NqvmD0GnVOV7xW0+b59zMvn/UjK1f+4E=; b=f1uGh0Ci+LW1WVVsmLtPhw228e7WEaUug+hwx6aw15V1OMzFX83mAQoVEl0sS8CMvv 9aW2yJihGypgXmzB2qofTMfnPsp8hUew5Aq8SrIfQC4CDZec+qbshYXdQnJuivx7/nbL AWySrKayz8NnI+ymR7/aOQNYBknMavF41csU2tiKp0EZC5wmlo7FTqgx/gHn2RWXrVb+ LsshRVxzPSh4kNPXibQ/UuQ9wBkO8Jd3co0+bYxo5+xCG/6XUPfeFJWxOoMK5RdVsJlx Y86t7rwTdPURrlitJ7w8zTAERGq5oRPYhd0BvFXolL9ci7Bek2c4anFRjWKFExAGYfyz oAKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ShAPU6yN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-121802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o4-20020a1709064f8400b00a45a3e58134si4806321eju.604.2024.03.27.11.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:13:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ShAPU6yN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-121802-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0ACE81F3B87A for ; Wed, 27 Mar 2024 18:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A603915443C; Wed, 27 Mar 2024 18:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ShAPU6yN" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.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 BC884153BF2 for ; Wed, 27 Mar 2024 18:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562961; cv=none; b=dxAMQd6QfR2l6r2nSIv2wdgpXHlFu4cqVwd8tLd3joV4DJnx8z/Fwy74bGW1aZXRYiUWXkjjnmmF4R7HKfT85K5QvHDaibrkrL1zID3HBJ3DfbiJsr5Swo0C6grDSstUnjy7xFULJ+dO/TQbPdKHLazROEMQMpJZDTXPWeJB1+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711562961; c=relaxed/simple; bh=rfeCKF0TDJxow2k4V6ytPA8cst5sc8C0h2kYpOgo/rw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S2XGEnuW7ZZ/bztRd1n5vv6GZfuvE00TIAbALodiXwOG5t1sQbAaoz3LHr2Jfv8CzlvwTPksb/L4uFOXZZEri+9FYj8tO/KgnySore6wzfZTl9oMc0ou7jlSEqrEUxtCZI/qBSzgMspNsFDH2gHV5anfemgLZRVKtJmYpDx5khM= 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.208.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 Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so166579a12.0 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=snuSHIHSzcR8uFW8gdRvHaSJY88Dxd2RoikW0P7nYUzL1qNQcwbXxNT0z3uamY6YpE d+cguHs9J6YzlhFZXY+50n0qjBO1/vmRLx+Mj4zTykhYBGNZabgl2VLG3kWBFfsVo4q7 zuJOvYmN8TWLqYOQhVlh/8FPyzIAqWcLRWDdngsejGG8hW4Y4XTx3i0BE4bIUFRvTG+f hqR2EX+x1n9+ChOyR0+T5XkxyfuFRrlucZg8D1Fyv9pJTxzlc1qRITUo2xHAJhTTeCgx MW/ypvimCUH5CXQOcvD72sM8BdC6GEw8YrQo4LJSanQrH5ykBM9aL3/D1ut25rli2XgQ fwbg== X-Forwarded-Encrypted: i=1; AJvYcCVO6gzhqZ8Dz448aQF4V163MH0P+FEJm3hXCnle62rFyMaC8rWQ7PS52WhbStH2zExf7nPL+nmwEdeXshU5ArXvv5LuBVJaZFoIbwT8 X-Gm-Message-State: AOJu0Yx0V3qSI44faWBeMhaghL/wlX/877WbXboBwlKM2AXgGLKhmqah 4jcjDMYhPZjg4QsOWr15R67LJR2PkFi8Y68KYYAPDTa+Rn9cpzMcRKSmiS+u0Pk= 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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) { -- 2.44.0