Skip to content

Commit 4b5675c

Browse files
greatgitsbyclaude
andcommitted
kernel/camera: attach CPAS to Titan Top GDSC power domain
Attach the CPAS device to the camcc's TITAN_TOP_GDSC power domain via of_genpd_add_device() and enable pm_runtime. This is the first step toward enabling the GDSC — the domain is attached but not yet powered on (pm_runtime_resume_and_get deadlocks in deferred probe context). Direct ioremap of the GDSC register (0xad0b134) is blocked by TrustZone on this platform, so the genpd framework is the only viable path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7dd5332 commit 4b5675c

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

kernel/camera/drivers/media/platform/msm/camera/cam_cpas/cam_cpas_intf.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,43 @@ static int cam_cpas_subdev_register(struct platform_device *pdev)
549549
return rc;
550550
}
551551

552+
/*
553+
* VAMOS: Enable Titan Top GDSC via the genpd framework.
554+
* We can't ioremap the GDSC register directly — TrustZone blocks it.
555+
* Instead, attach this device to the camcc's TITAN_TOP_GDSC power domain
556+
* and use pm_runtime to power it on.
557+
*/
558+
#include <linux/pm_domain.h>
559+
#include <linux/pm_runtime.h>
560+
#include <dt-bindings/clock/qcom,camcc-sdm845.h>
561+
562+
static int cam_cpas_gdsc_enable(struct platform_device *pdev)
563+
{
564+
struct device_node *camcc_np;
565+
struct of_phandle_args pd_args;
566+
int rc;
567+
568+
camcc_np = of_find_compatible_node(NULL, NULL, "qcom,sdm845-camcc");
569+
if (!camcc_np)
570+
return -ENODEV;
571+
572+
pd_args.np = camcc_np;
573+
pd_args.args_count = 1;
574+
pd_args.args[0] = TITAN_TOP_GDSC;
575+
576+
rc = of_genpd_add_device(&pd_args, &pdev->dev);
577+
of_node_put(camcc_np);
578+
if (rc) {
579+
CAM_ERR(CAM_CPAS, "genpd attach failed rc=%d", rc);
580+
return rc;
581+
}
582+
583+
/* Enable pm_runtime so genpd powers on when device is used */
584+
pm_runtime_enable(&pdev->dev);
585+
586+
return 0;
587+
}
588+
552589
static int cam_cpas_dev_probe(struct platform_device *pdev)
553590
{
554591
struct cam_cpas_hw_caps *hw_caps;
@@ -567,6 +604,11 @@ static int cam_cpas_dev_probe(struct platform_device *pdev)
567604
mutex_init(&g_cpas_intf->intf_lock);
568605
g_cpas_intf->pdev = pdev;
569606

607+
/* VAMOS: enable Titan Top GDSC before clocks */
608+
rc = cam_cpas_gdsc_enable(pdev);
609+
if (rc)
610+
CAM_ERR(CAM_CPAS, "GDSC enable failed rc=%d, continuing anyway", rc);
611+
570612
rc = cam_cpas_hw_probe(pdev, &g_cpas_intf->hw_intf);
571613
if (rc || (g_cpas_intf->hw_intf == NULL)) {
572614
CAM_ERR(CAM_CPAS, "Failed in hw probe, rc=%d", rc);

0 commit comments

Comments
 (0)