From d2c3fc38fb4afcb34503e121ccc1acda00c56dcd Mon Sep 17 00:00:00 2001 From: Puneet Saxena Date: Thu, 1 Mar 2018 16:02:31 +0530 Subject: video: tegra: nvmap: add runtime busy/idle calls CVSRAM falls under cvnas cluster. nvmap_alloc/free from cvsram heap requires CV rail to be power ungated/gated. Presently CV rail is always on/not power gated as CVNAS power gating is called from driver remove and cvnas driver is statically loaded The change registers runtime cvnas busy/idle callbacks at cvsram carveout creation. It exports CVNAS power gate(nvcvnas_idle()) and CVNAS power ungate(nvcvnas_busy). The callbacks are used during nvmap_alloc/free from CVSRAM. Bug 200383595 Change-Id: I545c18ea7bcf61bb6356e2d6d05c2f4f9b1f5368 Signed-off-by: Puneet Saxena Reviewed-on: https://git-master.nvidia.com/r/1666574 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Rajkumar Kasirajan Reviewed-by: Sachin Nikam Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/linux/nvmap.h | 16 ++++++++++++++++ include/linux/nvmap_t19x.h | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/nvmap.h b/include/linux/nvmap.h index 1b8020e9b..6e441aad8 100644 --- a/include/linux/nvmap.h +++ b/include/linux/nvmap.h @@ -69,6 +69,21 @@ ulong nvmap_iovmm_get_used_pages(void); int nvmap_register_vidmem_carveout(struct device *dma_dev, phys_addr_t base, size_t size); +/* + * A heap can be mapped to memory other than DRAM. + * The HW, controls the memory, can be power gated/ungated + * based upon the clients using the memory. + * if no client/alloc happens from the memory, the HW needs + * to be power gated. Similarly it should power ungated if + * alloc happens from the memory. + * int (*busy)(void) - trigger runtime power ungate + * int (*idle)(void) - trigger runtime power gate + */ +struct nvmap_pm_ops { + int (*busy)(void); + int (*idle)(void); +}; + struct nvmap_platform_carveout { const char *name; unsigned int usage_mask; @@ -87,6 +102,7 @@ struct nvmap_platform_carveout { bool disable_dynamic_dma_map; bool no_cpu_access; /* carveout can't be accessed from cpu at all */ bool init_done; /* FIXME: remove once all caveouts use reserved-memory */ + struct nvmap_pm_ops pm_ops; }; struct nvmap_platform_data { diff --git a/include/linux/nvmap_t19x.h b/include/linux/nvmap_t19x.h index 86e7271e3..0820e0618 100644 --- a/include/linux/nvmap_t19x.h +++ b/include/linux/nvmap_t19x.h @@ -3,7 +3,7 @@ * * structure declarations for nvmem and nvmap user-space ioctls * - * Copyright (c) 2009-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2009-2018, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -25,7 +25,8 @@ #define NVMAP_HEAP_CARVEOUT_GOS (1ul<<24) int nvmap_register_cvsram_carveout(struct device *dma_dev, - phys_addr_t base, size_t size); + phys_addr_t base, size_t size, + int (*pmops_busy)(void), int (*pmops_idle)(void)); struct cv_dev_info { struct device_node *np; -- cgit v1.2.2