From patchwork Fri Feb 9 21:10:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 199109 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1136146dyd; Fri, 9 Feb 2024 13:17:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVd6925JIRaZgwGMmix7yUSjQxGlqIp078Pb4xfeGphHqVe3/8IrsD6en7uhDpqjcDqFpEsjl6szgfg9dRKjAm+7ij10A== X-Google-Smtp-Source: AGHT+IE6+Omh2s+3N8PIQRjLuqngRVlgxB9bx1viICwPwBQSoLxNvh4A9s5lPo2Zn8HRC8UGmeYC X-Received: by 2002:a05:6214:29e4:b0:68c:a9fb:9a35 with SMTP id jv4-20020a05621429e400b0068ca9fb9a35mr400440qvb.25.1707513465475; Fri, 09 Feb 2024 13:17:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707513465; cv=pass; d=google.com; s=arc-20160816; b=H9F0byuev3hBEFyCgXTvKoq++I230YLBO0d3CDrndU8tUY++lCY11Nioj+/FkjK8B3 BVzKmPZmZJ4N11MNwPTE5FhgJXJw5UDIVwqIGzbp/d3ENwWCXaMU8Qm8kbncq4VrfaVw Lm8ADzTgCUz9CV1EECP4CrZj1epXo8ZzbKp8rA8ZOvU1odHQybFW2ykV18pYDoGKIw7m s6R/LQP4idOYjKHX1jEp93XM8JAL+wRw6kA4nGuaP9ycoTpjtSrUjIPCgdnW7KVjmjCG uDl95LUWthEWWNQlOydui26t2ulJdpYOQqfZFum+L1BXgkyDwq/F5gIAOHb3F2h7Mbh0 81Fg== 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=AlA4ayOmstDeitRRZ2W2c5UllMpUVoGUwWdDkp9v1as=; fh=xAx8HaTYcp6x3qHvZlDqhPuu1BP8Vnn7cU+fi0eDFUk=; b=Ecm/BABL5Ec8J5U72mozxtALJClnIsOk04XY6JalB1F8mI1qgmGv7sHNrLu+CElJZK NB9lbiAC/pH/i+kJegNJhzcYjvqBXPpvRegSEY/NsC+g43xQUGxL736vkDYBYJotpMPR 5W2ReRPI63/GvnR0T2n7wakI9/BsPqP9kYLy5BOS5kdImB8mKm2jTWGqXg3Ahl92clNT 6YINoJoC28cpagVEUFxSRiJPwgbMyCzbV1m/NmqmgilVlWrFJmZLKJenk3ds9Zuk58Si a94CMzPngdKi2um0ABYuWyrJGeThkKEFqEvC1ap1dtuh8O9LoAzn1NVwRXayxI+9tpat Nf/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QikG+afM; 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-60008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60008-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCXSFEwzk1v+Xjra2nWQ6e1bzKpNDDMHoG88JZXLx7hUkHNG3MlUyXwF6SWBdtOarizcQytqJi9OzUOrwKImyPsWVM9uBg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pr1-20020a056214140100b0068cd395cb6esi2046912qvb.14.2024.02.09.13.17.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:17:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QikG+afM; 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-60008-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60008-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 300AE1C224C9 for ; Fri, 9 Feb 2024 21:17:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57C3650A99; Fri, 9 Feb 2024 21:10:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QikG+afM" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 CB11C44384 for ; Fri, 9 Feb 2024 21:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707513022; cv=none; b=jKSp1EKw8wI2mxGb23qOoV0zuHaRTQHJI7a7gRZNrXLLJ/cOmJPJSxcRSsMW1vyR7a0AQNUO3OK/sWVGDYQXIR+bCDln8PrFv66140a1ztTRIBhSgjPyJrCAzKDbADJ0YCKBqZVEhPaunHk5Yhz9o5VU9HG7xBMR2OwhvmSIibk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707513022; c=relaxed/simple; bh=MLv2EGPhgvWgejpl7fbRFyjPDkfZHFECDfabJtkG8Ts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WptnesCsfuWYYtIVN9/b1f6J2TEbWAs51b2SjDkei9c48bsth1DWd+83rel3ctKTAbrJDx5bzw53qn2ESRN3E8WXeeDQwsYormyrbet6y2EXuFPZzRDqZEyg+MpzGjzJQXiYEX4IhZzGjqSg2r7K2C5vwFO/iCunja4XCqxh+v0= 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=QikG+afM; arc=none smtp.client-ip=209.85.208.175 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-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d0d7985dfdso19087191fa.2 for ; Fri, 09 Feb 2024 13:10:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707513018; x=1708117818; 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=AlA4ayOmstDeitRRZ2W2c5UllMpUVoGUwWdDkp9v1as=; b=QikG+afMnsM1kIM/Nzem4BffRaN2JoYMSspKt/5ZFkD4LBq8mEIg5ArRpYZCjyLS2m K4Nyr0q6AczPm6A3PYrol7Y9+el4d3dCsMdRYuEwyJI4mfmfbfie2dV/u0BxLGDd3Ev8 VhVcET9DcD4HCBR/d8122dlICEbLTRofa1vWifljz63CP7jo6xxnvzrA53rl8MdZHFmO IoErZn0/F9b8/XffsEeTyNoxh3iKlzKSfsky2FqqFMt49ZVDIUwnEp670e18JVDA/NGL iYzJm1ypLGQIfkVxWMmxynf0fQfUi16b/SOEgR74TdhS3vdpG3CiZtL8FHkTuYhhE/Sp n+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707513018; x=1708117818; 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=AlA4ayOmstDeitRRZ2W2c5UllMpUVoGUwWdDkp9v1as=; b=aI7aoXGKy34E0T0otFCnKoc1UPn7vYDECoiaLo1Xj/L6uegbkP/vI6nC2LmqFDrhmz hef8bn9WPKlkb9FXTZiPgOvpp1pUT/Q/gajKQkMrnufSBy3EkDgDG0K7XZANsYqEtXut wQoZKJJVKzdJ2WJp6JqhIbHDve8+InrQOhBsSzeS5D6PtXCpVYTAcrNPgThdh0qwAJgG 1Y0OjJFK8h3Y3BUUeORMjMb6FGLoUE76OnC56/LjGfa49xPKhvpmhkB8b7WilURmyxLK iddBuSEP+v6JbposPRmQlR9hCXGnGmtE6Ou23LajaeCLO9BZzSD2geMGAoCs5XPR5jX5 Z4fQ== X-Forwarded-Encrypted: i=1; AJvYcCXcbx6gg0brMTR594JTz8nlfPNrCMwIABUCDWv6SudpEPBKJo6SPpyxXJkBhd4AEZq9u9TBKmEI9hmRaraOzzXR8GviErKp8ie8LcY5 X-Gm-Message-State: AOJu0YxZc10uq3bcGH8yL/pA2K2eJbxxdQsb7/Tm3BerQpdleukbHwyg wRvVGF5TTeybHWREcXtzvGGzOkGf5zoviXy7S3wXimhSm4b7pqGM/MuBxwX+W5shDeF2a2fUnn5 P X-Received: by 2002:ac2:41ca:0:b0:511:1ed7:61b8 with SMTP id d10-20020ac241ca000000b005111ed761b8mr138919lfi.30.1707513017891; Fri, 09 Feb 2024 13:10:17 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV2vSXOWP0zPTdPzgr2OB7mO2zO/BBUb6MycDmMBo7iyCA2zGdMN08BEZkTi3oXHkq73Gyr6mJnMewJbhfCN0g3QgXHZE83t99O5gMpRiQ+ubauJZ069Kj4IH0j8fil17TwydvqiE7EyqiHHrOb/UA6FKnEiZJNKUHfSjovojWbyHOaHpYLii5mg5HTYW7nYf+rwGwyLwvqeDf1RQg7qpkrwja72n3pUtqIarC6ZjSKd4ffjkRFoiuj56ZKnjT/NP/f/8Z7Cz/WRodOnc1SJRsNEluaneAid6a1yoUhjvPYmgC+F+JBPRVdYbOgsHiruBK3bZQAhNDQYK785jNLXe5rGkMh/BRIzhzLhpTZGDUElUAvyrdhRYyVi3ScwZqKb7xeDiYH8VQyF09qpIx7yzzyWVUUyyS2pC1mZeifVQSKzHq/GzWUaMD5FLcw6vXU4ZCR86UO3Q19vs4Ql+yePMEtaF0N1jyReWzrh5HwS6usTMkP9XL6XtgESVKeiroCgPHkCQ== Received: from [10.167.154.1] (037008245233.garwolin.vectranet.pl. [37.8.245.233]) by smtp.gmail.com with ESMTPSA id vo5-20020a170907a80500b00a3be3b27d0bsm1056517ejc.49.2024.02.09.13.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:10:17 -0800 (PST) From: Konrad Dybcio Date: Fri, 09 Feb 2024 22:10:01 +0100 Subject: [PATCH v2 17/20] 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 Message-Id: <20230911-topic-mars-v2-17-3dac84b88c4b@linaro.org> References: <20230911-topic-mars-v2-0-3dac84b88c4b@linaro.org> In-Reply-To: <20230911-topic-mars-v2-0-3dac84b88c4b@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=1707512986; l=3311; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=MLv2EGPhgvWgejpl7fbRFyjPDkfZHFECDfabJtkG8Ts=; b=nU5akJ8S6NPlZWhfphKzyqepTvPetn6PGSgT5P4fuPWJfhCa9tlFcNZQek5SuRx1S+ZmHp2PL 7G4hT8ZVxMODhmSzX/S3H5V0Bz6ZahTDetAMN4Kw5+Ry9JuFZHzA73m X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790457639772747549 X-GMAIL-MSGID: 1790457639772747549 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 680674dd0d68..873affe17537 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 a292c788ffba..1cbcffbc29af 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) {