Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1673785lqg; Sun, 3 Mar 2024 23:14:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGSHu2RURs5O4n0xujxETUa27m0T3GoN1+EwaYOxXdWhiiflVN8vVoBrtuGM8guW//tYql6LFjSJdZ8i9KNMXusz5XQdoIlzsk/vinvw== X-Google-Smtp-Source: AGHT+IGpGp6sAqwS29nvg3IpB5CsRnXUMgG/0LTXwueKSfkpJs/2tJzKxz8K+3UFJIHq81BSARy5 X-Received: by 2002:a05:6870:91c9:b0:21f:a194:2350 with SMTP id c9-20020a05687091c900b0021fa1942350mr9793423oaf.14.1709536479684; Sun, 03 Mar 2024 23:14:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709536479; cv=pass; d=google.com; s=arc-20160816; b=DUC8BjtDU84mQZKSt4MaAUusf7CFHPjcUvq6qjS6sq035wbr29QnZekqNQ0IaEkDog SXtupzNk30CauPwjh2aJkTlD12eLzrn4ZQZMq/sLiKV3DHsOD4mkp9vHvMvXIjqHO67b uj+R8vUgO2cXsDuOA43/IRnFmaLpgEw77l/Gxuf0sWWO5op6N4KqMmBhMZgkXm2EywDW TbfscifIA/iY0bHgCJqRJmd7a4wUlJk8iqHjWenZWEEik61vbEJl9/iy5Dmg7H/Mo3y4 nJilAEdZswsDFbnVdR2oY3QeEHcUAQZDIesN3CuRqayw8MAFeSiB1IYWegb1wIzp+XfW 7A7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=U2JdFd5CI+xPoF0BmAoKSwWEqK+npy6K8jjMHaRuY0g=; fh=l93zIHXyMEdGgv/YBnM8dl+iIeD4yDszaEdpnp/NB80=; b=nBESDFgPgjnq7TkBydwH8NXXTUiajlbvk4/4XuWQsEwLtkW26iT4V5rXDdtn2t3IcN OcXgxhlr46LDo94TXCArbNVBUksNh2i+863LBdpcvcPyLqlNx7DLVn8GYl+ahnFX3m0I 9WHKDlylecpPRpyxdAOhV1jteHhVeYveUVai5YRDj155h/6+62dPEWXdTQV5EI+tLa73 p8fRM3oHxFK3wHQFiWZEa3HwEQTgKKKKEMRKbe5e3jD39wxPLcjqwP7oEh8Wefs/Ncx+ DjGd11bEwCgKRwWSlyXSHWVULb1xGTvfrlAfCLER3e5Najrk6QixZYnc2Hvojm6VjZxe /31Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RmZVSl7m; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-90117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90117-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 34-20020a630e62000000b005d8b2b582dfsi7820871pgo.837.2024.03.03.23.14.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 23:14:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=RmZVSl7m; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-90117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90117-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A0E2BB209ED for ; Mon, 4 Mar 2024 07:14:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B25E713AED; Mon, 4 Mar 2024 07:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RmZVSl7m" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F8BA53A6; Mon, 4 Mar 2024 07:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709536460; cv=none; b=GkM59HJJlIH5M3j/91HyURXXudbIyOrpLn0yoOQx5XqB2Biu3FxN9y6piu7eGlr3Gaggfl0kLR+VnwXrP4VzsNs7wrD+QjUJAGWiAvuExjCSuiXBgLYMayIaQIhI1VaisFnqFFUoHI06+kmX9cY2aawwOYisw07LXUMRhJUNToY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709536460; c=relaxed/simple; bh=gVsVNLNVa0dJxjHZAr8Aqx+FAvYC02+mioXz3XFBbL4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=LTk6eZrAae2vHAnzbN3nlt+Fup9bO9eYA8SfbWHk1XyMJ06kq+0JSGu/Og3YH3ip09kCRecV9at6lRsXhdSmzFqZHn04vqfPoxTrJE33NmZUzeRvWENJpOFdgA3Tpw5DLB7iNGTzENBTADul6hVgNibS3FPBmw6pQ23EQnwlZgE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=RmZVSl7m; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4244wLHh022950; Mon, 4 Mar 2024 07:14:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=U2JdFd5CI+xPoF0BmAoKSwWEqK+npy6K8jjMHaRuY0g=; b=Rm ZVSl7m3jcpY1Bn1mrZKnQiKwWoUNqWe/3ZLWLD0wRBgAia2lBvcSlOSuFXGyukaK rQBJD6cyPn7vQYPcS86aoo19rdXqaFeFdeShXLfDXYOmU0BQ5ITp5JSAuCsh82qD XgNhgKi8Bgf8OjTcDiz4jZnZIfl79xJf8lEOGbmv/hBgyGxxzWwTd0aHZ3QPJYF/ rZ5Q7QsI9Za8MhejTMSEeTo5CSqjh3hj8goAcT55eH8j6ldFe1c2NRhu4ZMtqlhn DhEF85QpZD7RYi0+Cp9/kVvk7i64W4C1T+7ml/lvsob4yYudrivbKie+yJ+7OT+z eHkMmOPW77tCwbNASiMQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wn420rh5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Mar 2024 07:14:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4247E82Y018457 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Mar 2024 07:14:08 GMT Received: from [10.50.22.179] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Sun, 3 Mar 2024 23:14:03 -0800 Message-ID: <11164c40-492c-60a0-72a8-1176e017ffb1@quicinc.com> Date: Mon, 4 Mar 2024 12:43:59 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 17/20] media: venus: pm_helpers: Commonize getting clocks and GenPDs Content-Language: en-US To: Konrad Dybcio , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , "Mauro Carvalho Chehab" , Philipp Zabel CC: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , , , References: <20230911-topic-mars-v2-0-3dac84b88c4b@linaro.org> <20230911-topic-mars-v2-17-3dac84b88c4b@linaro.org> From: Dikshita Agarwal In-Reply-To: <20230911-topic-mars-v2-17-3dac84b88c4b@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Pl7DWGCCY5NFwBNkxjRnHMgGv_tLYcrd X-Proofpoint-GUID: Pl7DWGCCY5NFwBNkxjRnHMgGv_tLYcrd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-04_02,2024-03-01_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403040053 On 2/10/2024 2:40 AM, Konrad Dybcio wrote: > 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, core_get is initialized with venus_clks_get in patch 4 and then being removed here. It would be better to combine both patches. > .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) > { >