From patchwork Fri Jul 12 05:48:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 13731293 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 66D36224FD; Fri, 12 Jul 2024 05:49:23 +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=1720763365; cv=none; b=Bi5ejQFGAw7Rh6GEUuZhXIAjJJ+Nu3gLcu4Hlxx2Aw2w3zQkt2M1xcZIjKsQzTrRPSvcH3kAdTsn5ALgNhDsaMKKMDaoEj5MzXdlO/YxzjmEpQx49+9CYLU4V9D0feJFPrDGv4VCi7c0GimeRMzOM2Rq8RwgbpE+it4n6l89dsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720763365; c=relaxed/simple; bh=wP3SDvx8OfDrIGVvuNEUoyAcuewxx420nSKrf+kytOY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WtIC31qE5C7qANHeS78jPgU5tf0VHXl/Gi0i7+AKuStZwTJIfN7vlZUUUsAqSbBL3cV1IgCIRYFuJBVr/GmXud6ln10mTSMP7zm439pGTWAhRQqTB/SO3w5NpvwIDGN4y52NBNIH7D0Ixx5lno8cW9z6zhWbgsxLYuoEzJTVN0A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=LNNtCWma; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="LNNtCWma" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46BHKm6V032360; Fri, 12 Jul 2024 05:49:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=a9wiS4K7OGztqgFCkvlDKejP8Anlwdwfkaa47JEiWAA=; b=LN NtCWmaE9iVbj2gWNM/cXbFhwtSsO2URgQ599UTN75cpR7NNzTnlipt4ixrl7MNk+ halEbeyL8wmYoob2LLzBsfxarBztgfNFkYSTlzBJoVFg/opSBpfM4pWz+KL0tXn3 fFTHIVmtasfz15arwxOO0zBgKspmdMlavFTpd8rAQhtdVCMLXyJpCXauA8cfacdh pviJ+1gdccHEL1d65bSdM//tfGTSK8FPEIOQQmStXMQPaJ7ONnImw5O5fjNgmqaa tgEzNvDzeO9d8nWhXLr/WLF2IVur2nfO8PRfCSWb4n3r0J7itJk7mZ4p6cuhjuh2 Pe10GMztIPVGk+cTvzsQ== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40ac0gjh0k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 05:49:13 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTP id 46C5nApI020511; Fri, 12 Jul 2024 05:49:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 407g4fvaqa-1; Fri, 12 Jul 2024 05:49:10 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 46C5n960020505; Fri, 12 Jul 2024 05:49:09 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-dikshita-hyd.qualcomm.com [10.213.110.13]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 46C5n9AT020503; Fri, 12 Jul 2024 05:49:09 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 347544) id B3A781287; Fri, 12 Jul 2024 11:19:01 +0530 (+0530) From: Dikshita Agarwal To: "Rafael J. Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , Stanimir Varbanov , Vikash Garodia , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , Ulf Hansson , Philipp Zabel , "Bryan O'Donoghue" , Dikshita Agarwal Cc: Stanimir Varbanov , Mauro Carvalho Chehab , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 1/2] PM: domains: add device managed version of dev_pm_domain_attach|detach_list() Date: Fri, 12 Jul 2024 11:18:30 +0530 Message-Id: <1720763312-13018-2-git-send-email-quic_dikshita@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1720763312-13018-1-git-send-email-quic_dikshita@quicinc.com> References: <1720763312-13018-1-git-send-email-quic_dikshita@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Wvwl86paHEyAthcndckSETwmFaof1Sqm X-Proofpoint-GUID: Wvwl86paHEyAthcndckSETwmFaof1Sqm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_03,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 impostorscore=0 clxscore=1015 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120037 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This patch adds the devres-enabled version of dev_pm_domain_attach|detach_list. If client drivers use devm_pm_domain_attach_list() to attach the PM domains, devm_pm_domain_detach_list() will be invoked implicitly during remove phase. Signed-off-by: Dikshita Agarwal --- drivers/base/power/common.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 4 ++++ 2 files changed, 45 insertions(+) diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index 327d168..082691e 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c @@ -277,6 +277,47 @@ int dev_pm_domain_attach_list(struct device *dev, EXPORT_SYMBOL_GPL(dev_pm_domain_attach_list); /** + * dev_pm_domain_detach_list - devres-enabled version of dev_pm_domain_detach_list. + * @list: The list of PM domains to detach. + * + * This function reverse the actions from devm_pm_domain_attach_list(). + * it will be invoked during the remove phase from drivers implicitly if driver + * uses devm_pm_domain_attach_list() to attach the PM domains. + */ +void devm_pm_domain_detach_list(void *_list) +{ + struct dev_pm_domain_list *list = _list; + + dev_pm_domain_detach_list(list); +} +EXPORT_SYMBOL_GPL(devm_pm_domain_detach_list); + +/** + * devm_pm_domain_attach_list - devres-enabled version of dev_pm_domain_attach_list + * + * NOTE: this will also handle calling devm_pm_domain_detach_list() for + * you during remove phase. + * + * Returns the number of attached PM domains or a negative error code in case of + * a failure. + */ +int devm_pm_domain_attach_list(struct device *dev, + const struct dev_pm_domain_attach_data *data, + struct dev_pm_domain_list **list) +{ + int ret, num_pds = 0; + + num_pds = dev_pm_domain_attach_list(dev, data, list); + + ret = devm_add_action_or_reset(dev, devm_pm_domain_detach_list, (void *)list); + if (ret) + return ret; + + return num_pds; +} +EXPORT_SYMBOL_GPL(devm_pm_domain_attach_list); + +/** * dev_pm_domain_detach - Detach a device from its PM domain. * @dev: Device to detach. * @power_off: Used to indicate whether we should power off the device. diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 772d328..2f00150 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -450,8 +450,12 @@ struct device *dev_pm_domain_attach_by_name(struct device *dev, int dev_pm_domain_attach_list(struct device *dev, const struct dev_pm_domain_attach_data *data, struct dev_pm_domain_list **list); +int devm_pm_domain_attach_list(struct device *dev, + const struct dev_pm_domain_attach_data *data, + struct dev_pm_domain_list **list); void dev_pm_domain_detach(struct device *dev, bool power_off); void dev_pm_domain_detach_list(struct dev_pm_domain_list *list); +void devm_pm_domain_detach_list(void *list); int dev_pm_domain_start(struct device *dev); void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd); int dev_pm_domain_set_performance_state(struct device *dev, unsigned int state); From patchwork Fri Jul 12 05:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 13731292 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 0A4DC18037; Fri, 12 Jul 2024 05:49: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=1720763360; cv=none; b=miykWwrO81DkHH6x6QJOZUW9jhfN1wVFtuTEE5cycYlnrWPfQqAooHeJJ7u1cQqduTz+wm4hwkdnXjhpYe52v8VNiFqZIjJ5vWC4ExlsY43OiI9yQOH7W4+mfgTSUa6gAObkEPvnhSKIEnwsyo8POoO8fblveTQggY0EPha4LJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720763360; c=relaxed/simple; bh=+7i/mvK4BO4EMLBary6X/275tjfAShPzIcCzHahTn+A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=dF/15rSIJB/kROZSb5J19IJa5aqlesurQeF6+08dIadjRJlZBBmDleN2g3aLSV65tED55O0UNA+qdKUMjCQwikwWt1MQEh4mxgus0Lk73a8Q10gWGRVTOuKoSDGgpzkv9CICTv4NsErOQwxCIZAJC2Qcc6vi4LMMu+DzLBkbi6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=CM6nTm65; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CM6nTm65" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46BFmjKq000963; Fri, 12 Jul 2024 05:49:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=YZm05wKfpUPfrH6+CM0Xd1DQY1Cb9vjcNUETxPetjZQ=; b=CM 6nTm65X/kTmy6Nl0AeH4Kyg33kAIuvmM7jXXY0cf5SMzskfe+8h0NwqMFMWQaq/c viPDErLvWwSpmvdSKiaHJkcOb3g4cgKq1dHzrxuZffqJgy6Z48+n2+Nw1Mm51Pr+ AWs1zkuk5R9o2O5lbKTOFOiMkKLU5ThNBAT4GevUwm/a8u22Wst6r9o86u+0XlhD 0ZI8Y6KdJ9eZN8iFh8aUFu6mWBsMyjTzqPQyYw/in95+Xs90oCUmj16tOurzY5zK vkI7EMvuxQ4hpDeUOYomEjAZBUUvaOMYcw2AQPjjT3MHvxtN73dCS00FkghuWbMc NAT3eFl2KTIK80S2M9vQ== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40ajbqscq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 05:49:08 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTP id 46C5n5Ya020472; Fri, 12 Jul 2024 05:49:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 407g4fvapw-1; Fri, 12 Jul 2024 05:49:05 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 46C5n5AW020459; Fri, 12 Jul 2024 05:49:05 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-dikshita-hyd.qualcomm.com [10.213.110.13]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 46C5n4Lf020415; Fri, 12 Jul 2024 05:49:05 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 347544) id 076BD1B38; Fri, 12 Jul 2024 11:19:03 +0530 (+0530) From: Dikshita Agarwal To: "Rafael J. Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , Stanimir Varbanov , Vikash Garodia , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , Ulf Hansson , Philipp Zabel , "Bryan O'Donoghue" , Dikshita Agarwal Cc: Stanimir Varbanov , Mauro Carvalho Chehab , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/2] media: venus: use device managed APIs for power domains Date: Fri, 12 Jul 2024 11:18:31 +0530 Message-Id: <1720763312-13018-3-git-send-email-quic_dikshita@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1720763312-13018-1-git-send-email-quic_dikshita@quicinc.com> References: <1720763312-13018-1-git-send-email-quic_dikshita@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 9kE_piSDuUtR_aKSGxwXWGlckeaNex5t X-Proofpoint-ORIG-GUID: 9kE_piSDuUtR_aKSGxwXWGlckeaNex5t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_03,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120037 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Use devres-enabled version of power domain attach APIs. Signed-off-by: Dikshita Agarwal Reviewed-by: Bryan O'Donoghue --- drivers/media/platform/qcom/venus/pm_helpers.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 5028220..86221e0 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -869,7 +869,7 @@ static int vcodec_domains_get(struct venus_core *core) if (!res->vcodec_pmdomains_num) goto skip_pmdomains; - ret = dev_pm_domain_attach_list(dev, &vcodec_data, &core->pmdomains); + ret = devm_pm_domain_attach_list(dev, &vcodec_data, &core->pmdomains); if (ret < 0) return ret; @@ -895,14 +895,11 @@ static int vcodec_domains_get(struct venus_core *core) return 0; opp_attach_err: - dev_pm_domain_detach_list(core->pmdomains); return ret; } static void vcodec_domains_put(struct venus_core *core) { - dev_pm_domain_detach_list(core->pmdomains); - if (!core->has_opp_table) return;