From nobody Thu Nov 28 11:32:41 2024 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 25CCD1D07BD for ; Wed, 2 Oct 2024 12:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727871780; cv=none; b=KHf71Ze8zbrYXMXV201Zr+4EzcW7p4dAwHsC9Wq0EzaK6FnT8oSl6umtQKBeDanjXzQeSykaO05KulloQbuM3jUw24be+0G/DjjDoD2g1AaHul7BODFCqvhB5dZJ137IqEzIVnknfYYqOGgZxpv9lsQoreYbaY6CWidKaeQfhts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727871780; c=relaxed/simple; bh=KxhfgynaXl+ts0gFVfYweXnYNKp5iegvppU1weAPpVk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S2y31ezRQ89R5dJZUhwW4ZVwj4JH+S3XjnZv8tcxdKU4Cru87/IZ6b+yLCC8RqEjKwDiUMpjGE0/RmceceFYZn7j/Du5ST4ACS+EkfmfcS8yiX5wKiSZaedIuFS+Fwr49TLX3I7xxw4tMz5isFfaBTxpndgixxvbvfJ43bUTG7w= 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=uz5UTbpL; arc=none smtp.client-ip=209.85.167.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uz5UTbpL" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5398e53ca28so4351509e87.3 for ; Wed, 02 Oct 2024 05:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727871777; x=1728476577; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EWiwvj5KSak5iw1HXEVPujm6Q2wWyAwA6z/lZYjaN0g=; b=uz5UTbpL6IF1Qs6U3c7ARIytAVMOGbEwfX+WXh1Ba64C+KZqZy6e592h9Vq5Ipcs3a S5V5zSzMg+ZOeChhJqiseohFIRvyKHObDlZl7HXVQNYgIB8Dve2IJYHbJ/XGGRCTPwzX TFDcHThn1TIOnVbEH3ff2C7NkeW3N/Sbva0YqKdk7x5CXFM2VQdzCHSIWHVpGuaYso82 BEeJ/InCcgTaXy9pI7Xee/jSApaBkh4++MOuA0xUCw70RLUYcv2pPjNjc+1rcQbG84PV AsZ7W2UNjAKvOx4WoPE57HojnkJRCEI/N4bdyloVoMF0/zdkkkHn8W2Byda+hmm2Jmeq qqRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727871777; x=1728476577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EWiwvj5KSak5iw1HXEVPujm6Q2wWyAwA6z/lZYjaN0g=; b=gFWnoM0FVDpZXQ+PIwvdEgRi2xIeEBUkNikkd3JyL+zBjTqeD7cDzwvfaTZu9ZRnN1 s6rgcQoFD+LeeDoxvcDrhxq4Kd9/bA7Wm/oIe/oY9bPA6+vH/pFTTcTtx7jwcSr9gzO9 tPp3dllyXJ7rCcueUuR2vbNidLsNX9JmPdQ4YLQ6PoNA9oP0lXhY6kyhP9C2no/MmT4S RKcjr/F72v0ucOE1g3OHSMjXsjuoiY0SvqOtYpTX0ag2bXAIrPOpCOcf8WWECvukH0MS oGkLyliLAo1+G+nCd5xcM+vObjeSZvJjVJMwDI55ZcDvsjI4m3IkDK5g5V0y47HeZRHA aTlw== X-Forwarded-Encrypted: i=1; AJvYcCVeDCneiMRPV5aR5DwFlPbgS1UEW51h1d5s6+fUmnbfLXPthK1PXE74onR5QatixhUNPcNI+OnHZbwb8DU=@vger.kernel.org X-Gm-Message-State: AOJu0YzUKIziWsd5f2Ho7WbDZOMDKAj8qrm0SGVX5WqeBmeB7Oi5aIYH IYAgD72nn4BHmyxc2Y77S56p/FoMf7wu9CfCCPpV+RLFofuay4jlRXxMAdtjuR0= X-Google-Smtp-Source: AGHT+IG2YfIlzqOBf8Qe1+i7eKAaGcPaaQ69rOLevaHyKiEZfEu6G3jNyhzopd/Ym4Ztq1N1Cwr9lw== X-Received: by 2002:a05:6512:33d4:b0:52d:b226:9428 with SMTP id 2adb3069b0e04-539a065c7d5mr1786952e87.6.1727871777108; Wed, 02 Oct 2024 05:22:57 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-538a043204fsm1912659e87.165.2024.10.02.05.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 05:22:55 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: "Rafael J . Wysocki" , Dikshita Agarwal , Vedang Nagar , Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Stephan Gerhold , Ilia Lin , Stanimir Varbanov , Vikash Garodia , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Viresh Kumar , Thierry Reding Subject: [PATCH v4 08/11] drm/tegra: gr3d: Convert into devm_pm_domain_attach_list() Date: Wed, 2 Oct 2024 14:22:29 +0200 Message-Id: <20241002122232.194245-9-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002122232.194245-1-ulf.hansson@linaro.org> References: <20241002122232.194245-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rather than hooking up the PM domains through devm_pm_opp_attach_genpd() and manage the device-link, let's avoid the boilerplate-code by converting into devm_pm_domain_attach_list(). Acked-by: Viresh Kumar Acked-by: Thierry Reding Signed-off-by: Ulf Hansson --- Changes in v4: - Minor. Use PD_FLAG_REQUIRED_OPP. --- drivers/gpu/drm/tegra/gr3d.c | 39 ++++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 00c8564520e7..caee824832b3 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -46,6 +46,7 @@ struct gr3d { unsigned int nclocks; struct reset_control_bulk_data resets[RST_GR3D_MAX]; unsigned int nresets; + struct dev_pm_domain_list *pd_list; =20 DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); }; @@ -369,18 +370,13 @@ static int gr3d_power_up_legacy_domain(struct device = *dev, const char *name, return 0; } =20 -static void gr3d_del_link(void *link) -{ - device_link_del(link); -} - static int gr3d_init_power(struct device *dev, struct gr3d *gr3d) { - static const char * const opp_genpd_names[] =3D { "3d0", "3d1", NULL }; - const u32 link_flags =3D DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME; - struct device **opp_virt_devs, *pd_dev; - struct device_link *link; - unsigned int i; + struct dev_pm_domain_attach_data pd_data =3D { + .pd_names =3D (const char *[]) { "3d0", "3d1" }, + .num_pd_names =3D 2, + .pd_flags =3D PD_FLAG_REQUIRED_OPP, + }; int err; =20 err =3D of_count_phandle_with_args(dev->of_node, "power-domains", @@ -414,29 +410,10 @@ static int gr3d_init_power(struct device *dev, struct= gr3d *gr3d) if (dev->pm_domain) return 0; =20 - err =3D devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); - if (err) + err =3D devm_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list); + if (err < 0) return err; =20 - for (i =3D 0; opp_genpd_names[i]; i++) { - pd_dev =3D opp_virt_devs[i]; - if (!pd_dev) { - dev_err(dev, "failed to get %s power domain\n", - opp_genpd_names[i]); - return -EINVAL; - } - - link =3D device_link_add(dev, pd_dev, link_flags); - if (!link) { - dev_err(dev, "failed to link to %s\n", dev_name(pd_dev)); - return -EINVAL; - } - - err =3D devm_add_action_or_reset(dev, gr3d_del_link, link); - if (err) - return err; - } - return 0; } =20 --=20 2.34.1