Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp567352rdh; Wed, 14 Feb 2024 05:32:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVaypJFQN5pXCfeYxkQcMJYE+9h7UqN0fHAwXetSSITD3YozAvw/PDxJKbYRLW6IpkYm/liOObW6GakWlOIaWMnm7FvpbEoAbumL2Aq4g== X-Google-Smtp-Source: AGHT+IE9fpuhU2dkE7m+iIcyp82ewYwO4PdPZ+xhMPUvtMlF3Lymi47XxNRYziwKX2C3Z57chnoF X-Received: by 2002:a17:906:dd6:b0:a3d:2970:32f1 with SMTP id p22-20020a1709060dd600b00a3d297032f1mr1931181eji.8.1707917524557; Wed, 14 Feb 2024 05:32:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707917524; cv=pass; d=google.com; s=arc-20160816; b=qzpqaCzMy+2/z5uI56J88ACdj4rg480x65gtWH0m/Kwa4cAXrJkgbDY/ye5yFxtXhg gSACkpPxY1xBIUwSk7nbgwMP80Dx7Ea6T2fzEezqqd1NKlG2D+ajCm0n/fV2gpwGZ6Eb XhDwa1GmqlFBN+CWcYWuqlLLXUMRiQNT/v3ERTEt8tSicOUkBK9gof9h7F5UPpAK4rV5 OK48Gav3Wk6/feDWKPN4u0DGxZKzm/U9JvNe2ImKDVyZ8OPir8PD/TglPCWdhgta0V56 yNIQ37inS6PC0dcR0RwvU8tLzBVRaSe3Fk94W7cKngjpGq0zsSyoPARhm1Q26yp6u7JC Aizw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=QhEmw6uhdjptWwkC2Nn4VHIZood5ct9xyBmUaaoU8pA=; fh=vrk19K5u6FaIEUnkuKp/VRaZt8RyS87EhdRQ6KPaB+o=; b=qHFl9K6Ek3hRuk9Lv10FAGJzLUMpDnrwi2EhC+AD1WZW+yk4RV44BlMcWweMICaXZq mutTa3PbURq8rxyCZeE/lDNFSTFoXDfKSFCHv+1gZwgPqqM3Qr9I9HfwxoOXNBQzSSXH OFxLRDYuo19PclEBw+JJEFUUJrWyMAhoJjqd6qIN9gbMwK10oWnbMIAqW0JBDsFItFJJ wCj4z6QnEckvHaQXcWG/YZj2Cc9q1QrTLJrQy56qklsqAYq+wJQU6eTUOLcJkKDHae6j diCVNnfIP4it6cCxm/mfGr4k+AGsnI+deH294x8NEDn5IVNsODTRaKYyl826w1gH7eKT ahvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-65280-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65280-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUDnPm/GngaVsv0fMpIVaL+Y+JN+jkA5A0pb81JBTF8H94+NVL2iXzOQspeVzzg3/9+IGJXLc0BuTNsw46itOXgtplwtE4GJ0Rm8IysLg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z17-20020a170906435100b00a361240236esi2352079ejm.777.2024.02.14.05.32.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 05:32:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65280-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-65280-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65280-linux.lists.archive=gmail.com@vger.kernel.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 4F01E1F25283 for ; Wed, 14 Feb 2024 13:31:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5EA854BCB; Wed, 14 Feb 2024 13:31:47 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 158591CA80 for ; Wed, 14 Feb 2024 13:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707917507; cv=none; b=ljktlZEn57oxKs9kcwleCAd/1UHy5htbK7N4A4pq9eLUQalSSWTQ91un9cH3VaCpQePfpX9wntFMp31jUHhIwsQts204iPDcwwQ6cx/uLeub6gIggHNs4CDWVz9ktGvLCko9Qrbj1GPZ7lHm5pjVVwH2XF056DVf+lZ7xecQyHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707917507; c=relaxed/simple; bh=g7+dYMrf4hQ0Bbepi6j5xfvu9bdIju/3TxK2e2upb9Q=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=OJkT25OVEQ99peUiGJ8V//20EkPdWQV+6cNboD5u5KhRfz99NpnFLzevUW4LicQ1LLa4sqPwdfK+MLD1ZwJVnVuLOvyUlL/zYcUAJ/twYVtVzPWxcEKveI0d/ZIrWeuA7Wxyli9fUBmz8hibdRC6maKM2dVExL44FF78ctWki/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raFM1-0005aN-6M; Wed, 14 Feb 2024 14:31:13 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1raFLy-000hZq-4h; Wed, 14 Feb 2024 14:31:10 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1raFLy-000ARF-0F; Wed, 14 Feb 2024 14:31:10 +0100 Message-ID: Subject: Re: [PATCH v2 20/20] media: venus: pm_helpers: Use reset_bulk API From: Philipp Zabel To: Konrad Dybcio , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 14 Feb 2024 14:31:09 +0100 In-Reply-To: <20230911-topic-mars-v2-20-3dac84b88c4b@linaro.org> References: <20230911-topic-mars-v2-0-3dac84b88c4b@linaro.org> <20230911-topic-mars-v2-20-3dac84b88c4b@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi Konrad, On Fr, 2024-02-09 at 22:10 +0100, Konrad Dybcio wrote: > All of the resets are toggled together. Use the bulk api to save on some > code complexity. >=20 > The delay between resets is now correctly determined by the reset > framework. If this is a recent change, could you reference the commit? > 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(-) >=20 > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/pla= tform/qcom/venus/core.c > index 873affe17537..ff5601a5ce77 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; > =20 > - for (i =3D 0; i < res->resets_num; i++) { > - core->resets[i] =3D devm_reset_control_get_exclusive(dev, res->resets[= i]); > - if (IS_ERR(core->resets[i])) > - return PTR_ERR(core->resets[i]); > - } > + core->resets =3D devm_kcalloc(dev, res->resets_num, sizeof(*core->reset= s), GFP_KERNEL); Since VIDC_RESETS_NUM_MAX is only 2, I don't think a separate allocation is worth it. > + if (res->resets_num && !core->resets) > + return -ENOMEM; > + > + for (i =3D 0; i < res->resets_num; i++) > + core->resets[i].id =3D res->resets[i]; > + > + ret =3D devm_reset_control_bulk_get_exclusive(dev, res->resets_num, cor= e->resets); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to get resets\n"); > =20 > ret =3D venus_get_resources(core); > if (ret) > diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/pla= tform/qcom/venus/core.h > index 6ecaa3e38cac..2376b9cbdf2c 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 instance= s > * @vdev_enc: a reference to video device structure for encoder instance= s > * @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; Any reason not to just keep this as an array[VIDC_RESETS_NUM_MAX]? > 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/med= ia/platform/qcom/venus/pm_helpers.c > index 9df8f2292c17..170fb131cb1e 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 =3D core->res; > - unsigned int i; > int ret; > =20 > - for (i =3D 0; i < res->resets_num; i++) { > - ret =3D reset_control_assert(core->resets[i]); > - if (ret) > - goto err; > - > - usleep_range(150, 250); > - ret =3D reset_control_deassert(core->resets[i]); > - if (ret) > - goto err; > - } > + ret =3D reset_control_bulk_reset(res->resets_num, core->resets); > + if (ret) > + dev_err(core->dev, "Failed to toggle resets: %d\n", ret); > =20 > -err: > return ret; Could be simplified to: return reset_control_bulk_reset(res->resets_num, core- >resets); regards Philipp