Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp538011rdh; Thu, 26 Oct 2023 08:51:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzAIy2xli6P5J/rRERvfBv3ZK9RtB8HSpQENPrcn6ho45locgys+4T2C0vf700dHVVRm/y X-Received: by 2002:a05:6808:17a2:b0:3a9:c647:c9ca with SMTP id bg34-20020a05680817a200b003a9c647c9camr24249566oib.5.1698335469794; Thu, 26 Oct 2023 08:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698335469; cv=none; d=google.com; s=arc-20160816; b=L8gD4NJl9+U4T9K9CFnCVORZaibswnq/sdxVMsdGlfJRftcy6TnXCyCJ4e+lqcfaOI cELXZA39K+kWjH8T0vwOf0P4fOl6KLn40srTLYX1Eej9ZP9UYBe2gHlqGMRwrv3NoESr B781MrEN9V8sX4gscw+SeLh574/orqdsJJuoNpXHHyittl73E8hyU+vhSZgkc82PJ89u CEegQSHgxAEhd1ba2to/5w0YHZfFQq1wpghZGjvGS764jpcmx5i2FAhj2BDmyZBGmz4d 6plsbWG6D2fSlHXg5EDJBXxEnrNlDW6jvtvKkN4gjb63yl4G0KkKQqHKtvl6imHJ/Swx Ycqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4YU00avEttChWoKTeHCnTvaWaEc1lCuq+WqQjs5hraA=; fh=EDIpuMICZLR0WVxMad9x0w3NcC1c7tvexkVv5l4gf40=; b=NmlIjTDw4SRPh15/fA1dV0Dodu6Mzn5Z1fIP7//E4WHS/6VWKtYEv9RmKFIYpgqKca KLY3eS5gKu+m88aLsiR6PPiCgCOJ4SxJTNp0MNHDgFyXEHcPFtblIJBs0W/dQpQxpWnp hi65OOEVHrzmZYvBapbVuFxoWma/d79GTUtkVO1Hicok+nRfHZ2GFFkCKjVYS38j3TH/ zClHC0Q+gNytsKrM7m+IcgZnwTZ6gq2Z3/aRn0qYE6ZcFScOQlPuKo0Uq/5pipz4vHNS vFpAaiPiM6grt0CasXNJypxqhSkWwLeP2GzTwuE7i6yJX2pE8sb79fDv3zVWIBUwxxXV F8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fsGsAYjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l40-20020a25ad68000000b00da07ec3f394si5296962ybe.635.2023.10.26.08.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 08:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fsGsAYjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 333B5821822B; Thu, 26 Oct 2023 08:51:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345520AbjJZPvA (ORCPT + 99 others); Thu, 26 Oct 2023 11:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345491AbjJZPuw (ORCPT ); Thu, 26 Oct 2023 11:50:52 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B91C1AE for ; Thu, 26 Oct 2023 08:50:49 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4083740f92dso8654995e9.3 for ; Thu, 26 Oct 2023 08:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698335448; x=1698940248; 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=4YU00avEttChWoKTeHCnTvaWaEc1lCuq+WqQjs5hraA=; b=fsGsAYjw+UfsJK6wpUtA/VquQcFbKgsFkstuZW+7Qi9HutVg01IsTgTKiKNOy4OiVi JWAUd4f7+lIFzo+fMyoY+YkAp9uAvZjlcBFNkyYPxxRJa94gjiwQMUXpfL/WTMUjlniz KnPAv7L9jq9TI/P+AA9Bs5mRXvEuCL3A+EAZFG4ZkT4aoz4CxushTby7y36D6uahZhwl P1G/5OpPj4EUvHrrSyUOp9uzWzdiaEMxdHkschh8KyvD7g5XJKuLc95F4zEVwA1JuhDh bv0OP/M6a6wDPfBW47VzkGc5wQJFLVXD1Ya/v4v9APWgCdHlTO2OtpsTuqC152CDjgbA xZrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698335448; x=1698940248; 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=4YU00avEttChWoKTeHCnTvaWaEc1lCuq+WqQjs5hraA=; b=sMZweAeEcxx/VJFByzXjl6oyZtA82R69rso6QPfeHnrJN4ZJCMIwZvT/OxxrhwWj0e 6rVcDu0eotiXe7j25yCLJFrK73YuJ47EzQ4XbCSLi2Foyy8JDxpo+J+4L1yuPeqQOXmF UQh+Z93c0a68hLuKgchZJATD8E5EOrGn4zbKcA6ItM/T4AaVXsuOzfb3MWY+K0Yp7yZr sw/WGSxiTV0qcUbWy1XqwFNRUNHDfRusFfR+vAtvy880Aqg0FAH3QDz3+s2ZtemxtWlr dRMT8qLhP2cD2Dh4XUNTeDd0m0/Vs06lYOv+pxSOy3+b7xFmj2e1QYiE0rC0LORJY9U0 IxHA== X-Gm-Message-State: AOJu0YwaAUaP1b6w0ezBc+hOW3XxZfUhO1tXWyqDXkBbexUcX0fpbfBt 3V3L96C1x0RAOpvjnt2IxLX8kw== X-Received: by 2002:a05:600c:1c93:b0:408:3c8a:65ec with SMTP id k19-20020a05600c1c9300b004083c8a65ecmr189703wms.8.1698335447649; Thu, 26 Oct 2023 08:50:47 -0700 (PDT) Received: from sagittarius-a.nxsw.local ([37.228.218.3]) by smtp.gmail.com with ESMTPSA id m28-20020a05600c3b1c00b003feae747ff2sm2938289wms.35.2023.10.26.08.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 08:50:47 -0700 (PDT) From: Bryan O'Donoghue To: hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, rfoss@kernel.org, todor.too@gmail.com, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, bryan.odonoghue@linaro.org Subject: [PATCH v2 2/5] media: qcom: camss: Convert to per-VFE pointer for power-domain linkages Date: Thu, 26 Oct 2023 16:50:39 +0100 Message-ID: <20231026155042.551731-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231026155042.551731-1-bryan.odonoghue@linaro.org> References: <20231026155042.551731-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 08:51:08 -0700 (PDT) Right now we use the top-level camss structure to provide pointers via VFE id index back to genpd linkages. In effect this hard-codes VFE indexes to power-domain indexes in the dtsi and mandates a very particular ordering of power domains in the dtsi, which bears no relationship to a real hardware dependency. As a first step to rationalising the VFE power-domain code and breaking the magic indexing in dtsi use per-VFE pointers to genpd linkages. The top-level index in msm_vfe_subdev_init is still used to attain the initial so no functional or logical change arises from this change. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe-170.c | 15 +++++++-------- drivers/media/platform/qcom/camss/camss-vfe-4-7.c | 15 +++++---------- drivers/media/platform/qcom/camss/camss-vfe-4-8.c | 13 +++++-------- drivers/media/platform/qcom/camss/camss-vfe-480.c | 15 +++++++-------- drivers/media/platform/qcom/camss/camss-vfe.c | 3 +++ drivers/media/platform/qcom/camss/camss-vfe.h | 2 ++ 6 files changed, 29 insertions(+), 34 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c index 0b211fed12760..7451484317cc3 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -638,7 +638,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) if (vfe->id >= camss->res->vfe_num) return; - device_link_del(camss->genpd_link[vfe->id]); + device_link_del(vfe->genpd_link); } /* @@ -648,16 +648,15 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) static int vfe_pm_domain_on(struct vfe_device *vfe) { struct camss *camss = vfe->camss; - enum vfe_line_id id = vfe->id; - if (id >= camss->res->vfe_num) + if (vfe->id >= camss->res->vfe_num) return 0; - camss->genpd_link[id] = device_link_add(camss->dev, camss->genpd[id], - DL_FLAG_STATELESS | - DL_FLAG_PM_RUNTIME | - DL_FLAG_RPM_ACTIVE); - if (!camss->genpd_link[id]) + vfe->genpd_link = device_link_add(camss->dev, vfe->genpd, + DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (!vfe->genpd_link) return -EINVAL; return 0; diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c index b65ed0fef595e..2b4e7e039407b 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c @@ -1109,14 +1109,10 @@ static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1) */ static void vfe_pm_domain_off(struct vfe_device *vfe) { - struct camss *camss; - if (!vfe) return; - camss = vfe->camss; - - device_link_del(camss->genpd_link[vfe->id]); + device_link_del(vfe->genpd_link); } /* @@ -1126,13 +1122,12 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) static int vfe_pm_domain_on(struct vfe_device *vfe) { struct camss *camss = vfe->camss; - enum vfe_line_id id = vfe->id; - camss->genpd_link[id] = device_link_add(camss->dev, camss->genpd[id], DL_FLAG_STATELESS | - DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); + vfe->genpd_link = device_link_add(camss->dev, vfe->genpd, DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); - if (!camss->genpd_link[id]) { - dev_err(vfe->camss->dev, "Failed to add VFE#%d to power domain\n", id); + if (!vfe->genpd_link) { + dev_err(vfe->camss->dev, "Failed to add VFE#%d to power domain\n", vfe->id); return -EINVAL; } diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c index 7b3805177f037..5e95343241304 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c @@ -1099,9 +1099,7 @@ static void vfe_isr_read(struct vfe_device *vfe, u32 *value0, u32 *value1) */ static void vfe_pm_domain_off(struct vfe_device *vfe) { - struct camss *camss = vfe->camss; - - device_link_del(camss->genpd_link[vfe->id]); + device_link_del(vfe->genpd_link); } /* @@ -1111,13 +1109,12 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) static int vfe_pm_domain_on(struct vfe_device *vfe) { struct camss *camss = vfe->camss; - enum vfe_line_id id = vfe->id; - camss->genpd_link[id] = device_link_add(camss->dev, camss->genpd[id], DL_FLAG_STATELESS | - DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); + vfe->genpd_link = device_link_add(camss->dev, vfe->genpd, DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); - if (!camss->genpd_link[id]) { - dev_err(vfe->camss->dev, "Failed to add VFE#%d to power domain\n", id); + if (!vfe->genpd_link) { + dev_err(vfe->camss->dev, "Failed to add VFE#%d to power domain\n", vfe->id); return -EINVAL; } diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c index f2368b77fc6d6..a70b8633bb3eb 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -463,7 +463,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) if (vfe->id >= camss->res->vfe_num) return; - device_link_del(camss->genpd_link[vfe->id]); + device_link_del(vfe->genpd_link); } /* @@ -473,16 +473,15 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) static int vfe_pm_domain_on(struct vfe_device *vfe) { struct camss *camss = vfe->camss; - enum vfe_line_id id = vfe->id; - if (id >= camss->res->vfe_num) + if (vfe->id >= camss->res->vfe_num) return 0; - camss->genpd_link[id] = device_link_add(camss->dev, camss->genpd[id], - DL_FLAG_STATELESS | - DL_FLAG_PM_RUNTIME | - DL_FLAG_RPM_ACTIVE); - if (!camss->genpd_link[id]) + vfe->genpd_link = device_link_add(camss->dev, vfe->genpd, + DL_FLAG_STATELESS | + DL_FLAG_PM_RUNTIME | + DL_FLAG_RPM_ACTIVE); + if (!vfe->genpd_link) return -EINVAL; return 0; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 4839e2cedfe58..94267b9974554 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1347,6 +1347,9 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, if (!res->line_num) return -EINVAL; + if (res->has_pd) + vfe->genpd = camss->genpd[id]; + vfe->line_num = res->line_num; vfe->ops->subdev_init(dev, vfe); diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index 09baded0dcdd6..c1c50023d4876 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -150,6 +150,8 @@ struct vfe_device { const struct vfe_hw_ops_gen1 *ops_gen1; struct vfe_isr_ops isr_ops; struct camss_video_ops video_ops; + struct device *genpd; + struct device_link *genpd_link; }; struct camss_subdev_resources; -- 2.42.0