Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp551015lqp; Fri, 5 Apr 2024 01:30:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNJtUHMhZEaZZluogwJHNIcHBqM32EL+R60dYHtcp6ZpUN7ED2ef/f5P7oLxe9/M3cUHxa2s0yOaTuTnYWuj21gp7lupa4kk0OJar0Gw== X-Google-Smtp-Source: AGHT+IGfTwobFTByIZHg3S6btPFB3qKUvBwMi08F5tcCQix3mg8sAZzeY6D5fcNJLicsVi5n3KPA X-Received: by 2002:a17:906:5a8b:b0:a51:a9d5:dca8 with SMTP id l11-20020a1709065a8b00b00a51a9d5dca8mr432761ejq.27.1712305843512; Fri, 05 Apr 2024 01:30:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712305843; cv=pass; d=google.com; s=arc-20160816; b=RAgiTd9NH8/td/eRMfqD6JSw8Hp074IIQyWPMVmEAQKnPvmkgK12IYJ0E5gjP7yvZk bHv/1nsfBXB2XuBdqMaSakaxvp/9AcbIe6t5FCiqpp+JpZYHl8dxrRzzIws9pK5cc2jg YFI6i96yYZDDyEUYQwZgJEhBf6KVWfLNfoTjT3PUUOMeBJkBwW06/gHrGkR+oIjSIgUw 3oqqWsVbgGQDEQvNWLxQi627sfXQ4Oq97V+jSVQnYhuyBwshgoizkpiCVQmeFge86CJI Knjekf0AaQUmVK3iNGd4xmu4kcDxssEXuBjSmhCdMaMvXvjvawENlMDbBFwXer4hW5op NRgw== 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=+G0j8IW88PEArlm/qC8NPfjW9x8m5NPgi3w8vh4fE6E=; fh=l93zIHXyMEdGgv/YBnM8dl+iIeD4yDszaEdpnp/NB80=; b=cPFHzmbWkbUGb9ZxrIBmY9hDXV2YPxMOQ4NbNAmkN0Oqb55TTxaO3F6opCGI5d970p XX03QiLCd6/9syBUhdh0mGh7ivHltlzS1HPsLjXNGssnfQssx1gZ84RCQYfszWqJaaKV gg4Y/5iCHm5PQIKaSi1nBa99vUK0y465v5shBzNhouazvZhUIHSD5T15vpWVnDPwbzFa 9V5uI+SLuQ31ki7CxwVPdSzeoF4APNVFYbY4jvP0jj5gWR6LogQh191WfSr6c3v+GlN8 g0HmcuMIqrAkIZIjq9Bafpbs7gDcayz9XDZVPQDJ08qPsjOmHU2+xWdXtganHASi+/EM vzpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="GsFLDj/e"; 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-132654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kt22-20020a170906aad600b00a519c91118dsi491951ejb.501.2024.04.05.01.30.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 01:30:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132654-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=@quicinc.com header.s=qcppdkim1 header.b="GsFLDj/e"; 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-132654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132654-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 172011F21AF4 for ; Fri, 5 Apr 2024 08:30:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 864D214D702; Fri, 5 Apr 2024 08:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GsFLDj/e" 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 18C8D14D2AB; Fri, 5 Apr 2024 08:30:31 +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=1712305833; cv=none; b=doOkKmon5hXjXn1ybMsrD1H7bt4wbd5Wo3ku6UnTt051GKfLgVIvFtiZF9XpSw2Sg5pKzYaPGnb4lDWyrOUmwoqHeSdtJa+aQBq2lOaKl8kjdl3abmDi2fsqODJlIGdudoPnqB6Zxr9h/EQUE18slPHa6WXRuk7YOu069/HYZXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712305833; c=relaxed/simple; bh=LE9kcDHuYvI9jTeyySzcqd6yMPIj1SuKKRQt/X3Sinc=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=nxbPAqvxhY30F7CzeJ1Zoc3FqLKth4ZiaiMC6fLVgch3qMtpQlvAJorQwYeq3nj/pFc1ZHSYhtsQhjE76mE8DNFbyVNOyIG1sJIQh7AcZ/3a8QQFcH8lW70Bi39+zsTj0s9jPYWxRHpJxHCRvftiqHfarB0+ywgs2bPP7oKZ4QQ= 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=GsFLDj/e; 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4355Bn2N010957; Fri, 5 Apr 2024 08:30:22 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=+G0j8IW88PEArlm/qC8NPfjW9x8m5NPgi3w8vh4fE6E=; b=Gs FLDj/eJNmlCCaVQ9fTZteD1rohCIcJtSJmDVdGw4+iHDmhDoEy3Rj/qCK4+g+muK R+03247s4RZrA++7VRQ47bjj73rDruP51pPKnK1JnmthvgqcwivFKJSJ324fwpJ+ okdu5/MPUFzvdtvfqOyarSzi/nyrEh1wrux3FibE4X9jq84aiQgys/hXJnGsucEp vZbVZYBmQT4v2gi9C2OzIhFS9KRHk+wjv0S3OLsSGTf7mSFQjHmPzyPggMFDOHeb kG6U1gYYH1BDeqaswa8Lrja9siZYGmfUrBV3DHUAUYoUI6ZCGRtykcdQTaJac3NS 6M6tEB6g9YBCWJrtea5w== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xa2q397a2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Apr 2024 08:30:21 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4358UK4Q022917 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 5 Apr 2024 08:30:20 GMT Received: from [10.216.11.24] (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.1544.4; Fri, 5 Apr 2024 01:30:16 -0700 Message-ID: <79c2b0eb-e7f3-3826-d977-3c4367d42d7f@quicinc.com> Date: Fri, 5 Apr 2024 14:00:11 +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 v3 19/19] media: venus: pm_helpers: Use reset_bulk API 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-v3-0-79f23b81c261@linaro.org> <20230911-topic-mars-v3-19-79f23b81c261@linaro.org> From: Dikshita Agarwal In-Reply-To: <20230911-topic-mars-v3-19-79f23b81c261@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: LwJS-YydmJf_7PgsKyOs2GUSgD952wXE X-Proofpoint-GUID: LwJS-YydmJf_7PgsKyOs2GUSgD952wXE 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-04-05_07,2024-04-04_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 bulkscore=0 mlxlogscore=999 adultscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404050062 On 3/27/2024 11:38 PM, Konrad Dybcio wrote: > 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 > --- > 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; > } > > Reviewed-by: Dikshita Agarwal