diff options
Diffstat (limited to 'drivers')
23 files changed, 320 insertions, 27 deletions
diff --git a/drivers/crypto/tegra-se.c b/drivers/crypto/tegra-se.c index d6d17445c0c2..baaf58680708 100644 --- a/drivers/crypto/tegra-se.c +++ b/drivers/crypto/tegra-se.c @@ -44,7 +44,7 @@ #include <crypto/internal/hash.h> #include <crypto/sha.h> #include <linux/pm_runtime.h> -#include <mach/pm_domains.h> +#include <linux/tegra_pm_domains.h> #include "tegra-se.h" diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index f3bf037c08db..3efc84eb4b2f 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c @@ -35,8 +35,8 @@ #include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/clk/tegra.h> +#include <linux/tegra_pm_domains.h> -#include <mach/pm_domains.h> #include "dmaengine.h" #define TEGRA_APBDMA_GENERAL 0x0 diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 7e2b9afb07f1..f206fd7d50b8 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -40,11 +40,11 @@ #include <linux/debugfs.h> #include <linux/spinlock.h> #include <linux/tegra-powergate.h> +#include <linux/tegra_pm_domains.h> #include <linux/sched.h> #include <linux/input-cfboost.h> -#include <mach/pm_domains.h> #include "gk20a.h" #include "debug_gk20a.h" diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index dff98ef3a273..a5d5ad3e35c8 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -21,8 +21,9 @@ #include <linux/nvhost_ioctl.h> #include <linux/dma-buf.h> #include <linux/nvmap.h> +#include <linux/tegra_pm_domains.h> + #include <mach/irqs.h> -#include <mach/pm_domains.h> #include "../../../arch/arm/mach-tegra/iomap.h" diff --git a/drivers/media/platform/soc_camera/tegra_camera/common.c b/drivers/media/platform/soc_camera/tegra_camera/common.c index f0a250678cca..0076fbb6a4fc 100644 --- a/drivers/media/platform/soc_camera/tegra_camera/common.c +++ b/drivers/media/platform/soc_camera/tegra_camera/common.c @@ -22,9 +22,9 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/of_platform.h> +#include <linux/tegra_pm_domains.h> #include <mach/powergate.h> -#include <mach/pm_domains.h> #include <media/soc_camera.h> #include <media/soc_mediabus.h> diff --git a/drivers/media/platform/tegra/nvavp/nvavp_dev.c b/drivers/media/platform/tegra/nvavp/nvavp_dev.c index 7a2fe8a0d2a4..2e51c8737767 100644 --- a/drivers/media/platform/tegra/nvavp/nvavp_dev.c +++ b/drivers/media/platform/tegra/nvavp/nvavp_dev.c @@ -44,8 +44,8 @@ #include <linux/sched.h> #include <linux/memblock.h> #include <linux/anon_inodes.h> +#include <linux/tegra_pm_domains.h> -#include <mach/pm_domains.h> #include <linux/pm_qos.h> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 34a6792af251..545985821d9f 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -32,6 +32,7 @@ #include <linux/regulator/consumer.h> #include <linux/delay.h> #include <linux/pm_runtime.h> +#include <linux/tegra_pm_domains.h> #ifndef CONFIG_ARM64 #include <asm/gpio.h> @@ -45,7 +46,6 @@ #include <linux/platform_data/mmc-sdhci-tegra.h> #include <mach/pinmux.h> -#include <mach/pm_domains.h> #include "sdhci-pltfm.h" diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 0806ea73d3b8..455ae530a621 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -48,13 +48,13 @@ #include <linux/pci-tegra.h> #include <linux/of_device.h> #include <linux/of_gpio.h> +#include <linux/tegra_pm_domains.h> #include <asm/sizes.h> #include <asm/mach/pci.h> #include <asm/io.h> #include <mach/tegra_usb_pad_ctrl.h> -#include <mach/pm_domains.h> #include <mach/io_dpd.h> #include <mach/pinmux.h> #include <mach/pinmux-t12.h> diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig index 69616aeaa966..6d36c5e4f3ef 100644 --- a/drivers/platform/Kconfig +++ b/drivers/platform/Kconfig @@ -4,4 +4,6 @@ endif if GOLDFISH source "drivers/platform/goldfish/Kconfig" endif - +if ARCH_TEGRA +source "drivers/platform/tegra/Kconfig" +endif diff --git a/drivers/platform/tegra/Kconfig b/drivers/platform/tegra/Kconfig new file mode 100644 index 000000000000..25916fd9c38e --- /dev/null +++ b/drivers/platform/tegra/Kconfig @@ -0,0 +1,23 @@ + +# Copyright (c) 2012-2014, 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, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +comment "NVIDIA Tegra options" + +config TEGRA_MC_DOMAINS + bool "Enable Tegra MC PM domain" + depends on PM_GENERIC_DOMAINS + default n + help + When enabled, clock gates MC when it's not needed. diff --git a/drivers/platform/tegra/Makefile b/drivers/platform/tegra/Makefile index c82cc3403b4b..918e2af246b6 100644 --- a/drivers/platform/tegra/Makefile +++ b/drivers/platform/tegra/Makefile @@ -16,6 +16,8 @@ obj-y += mc/ obj-$(CONFIG_PM_SLEEP) += pm-irq.o obj-y += pmc.o +obj-$(CONFIG_TEGRA_MC_DOMAINS) += pm_domains.o + ifneq ($(CONFIG_ARM64),) ccflags-y += -I$(srctree)/arch/arm/mach-tegra/include \ @@ -48,8 +50,6 @@ obj-y += powergate-ops-txx.o obj-y += powergate-ops-t1xx.o obj-$(CONFIG_ARCH_TEGRA_12x_SOC) += powergate-t12x.o -obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o - obj-y += dvfs.o obj-$(CONFIG_ARCH_TEGRA_13x_SOC) += tegra13_dvfs.o obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o @@ -77,6 +77,8 @@ obj-y += tegra_emc.o obj-$(CONFIG_ARCH_TEGRA_12x_SOC) += tegra12_emc.o obj-$(CONFIG_ARCH_TEGRA_12x_SOC) += tegra_emc_dt_parse.o +obj-$(CONFIG_TEGRA_MC_DOMAINS) += pm_domains.o + obj-y += flowctrl.o obj-y += reset.o obj-$(CONFIG_DEBUG_ICEDCC) += sysfs-dcc.o diff --git a/drivers/platform/tegra/pm_domains.c b/drivers/platform/tegra/pm_domains.c index 19d305704a7d..d98999562b95 100644 --- a/drivers/platform/tegra/pm_domains.c +++ b/drivers/platform/tegra/pm_domains.c @@ -1,2 +1,270 @@ -/* Automatically generated file; DO NOT EDIT. */ -#include "../../../arch/arm/mach-tegra/pm_domains.c" +/* + * drivers/platform/tegra/pm_domains.c + * + * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. + * + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/module.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> +#include <linux/pm_domain.h> +#include <linux/tegra_pm_domains.h> + +#ifdef CONFIG_TEGRA_MC_DOMAINS +#define TEGRA_PD_DEV_CALLBACK(callback, dev) \ +({ \ + int (*__routine)(struct device *__d); \ + int __ret = 0; \ + \ + if (dev->type && dev->type->pm) \ + __routine = dev->type->pm->callback; \ + else if (dev->class && dev->class->pm) \ + __routine = dev->class->pm->callback; \ + else if (dev->bus && dev->bus->pm) \ + __routine = dev->bus->pm->callback; \ + else \ + __routine = NULL; \ + \ + if (!__routine && dev->driver && dev->driver->pm) \ + __routine = dev->driver->pm->callback; \ + \ + if (__routine) \ + __ret = __routine(dev); \ + __ret; \ +}) + +struct domain_client { + const char *name; + struct generic_pm_domain *domain; +}; + +#ifdef CONFIG_PM_SLEEP + +static int tegra_pd_suspend_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(suspend, dev); +} + +static int tegra_pd_suspend_late(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(suspend_late, dev); +} + +static int tegra_pd_resume_early(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(resume_early, dev); +} + +static int tegra_pd_resume_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(resume, dev); +} + +static int tegra_pd_freeze_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(freeze, dev); +} + +static int tegra_pd_freeze_late(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(freeze_late, dev); +} + +static int tegra_pd_thaw_early(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(thaw_early, dev); +} + +static int tegra_pd_thaw_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(thaw, dev); +} +#else /* !CONFIG_PM_SLEEP */ + +#define tegra_pd_suspend_dev NULL +#define tegra_pd_suspend_late NULL +#define tegra_pd_resume_early NULL +#define tegra_pd_resume_dev NULL +#define tegra_pd_freeze_dev NULL +#define tegra_pd_freeze_late NULL +#define tegra_pd_thaw_early NULL +#define tegra_pd_thaw_dev NULL + +#endif /* !CONFIG_PM_SLEEP */ + +static bool tegra_pd_active_wakeup(struct device *dev) +{ + return device_may_wakeup(dev); +} + +static int tegra_pd_save_dev(struct device *dev) +{ + return 0; +} + +static int tegra_pd_restore_dev(struct device *dev) +{ + return 0; +} + +static int tegra_pd_stop_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(runtime_suspend, dev); +} + +static int tegra_pd_start_dev(struct device *dev) +{ + return TEGRA_PD_DEV_CALLBACK(runtime_resume, dev); +} + +struct gpd_dev_ops tegra_pd_ops = { + .active_wakeup = tegra_pd_active_wakeup, + .save_state = tegra_pd_save_dev, + .restore_state = tegra_pd_restore_dev, + .stop = tegra_pd_stop_dev, + .start = tegra_pd_start_dev, + .suspend = tegra_pd_suspend_dev, + .suspend_late = tegra_pd_suspend_late, + .resume_early = tegra_pd_resume_early, + .resume = tegra_pd_resume_dev, + .freeze = tegra_pd_freeze_dev, + .freeze_late = tegra_pd_freeze_late, + .thaw_early = tegra_pd_thaw_early, + .thaw = tegra_pd_thaw_dev, +}; + +static int tegra_mc_clk_power_off(struct generic_pm_domain *genpd) +{ + struct tegra_pm_domain *pd = to_tegra_pd(genpd); + + if (!pd) + return -EINVAL; + + if (IS_ERR_OR_NULL(pd->clk)) + return 0; + + clk_disable_unprepare(pd->clk); + + return 0; +} + +static int tegra_mc_clk_power_on(struct generic_pm_domain *genpd) +{ + struct tegra_pm_domain *pd = to_tegra_pd(genpd); + + if (!pd) + return -EINVAL; + + if (IS_ERR_OR_NULL(pd->clk)) + return 0; + + clk_prepare_enable(pd->clk); + + return 0; +} + +static struct tegra_pm_domain tegra_nvavp = { + .gpd.name = "tegra_nvavp", +}; + +static struct tegra_pm_domain tegra_mc_clk = { + .gpd.name = "tegra_mc_clk", + .gpd.power_off = tegra_mc_clk_power_off, + .gpd.power_on = tegra_mc_clk_power_on, +}; + +static struct domain_client client_list[] = { + { .name = "tegradc", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra30-hda", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-apbdma", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-otg", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-ehci", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-xhci", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-host1x", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra_nvavp", .domain = &tegra_mc_clk.gpd }, + { .name = "nvavp", .domain = &tegra_nvavp.gpd }, + { .name = "sdhci-tegra", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra11-se", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra12-se", .domain = &tegra_mc_clk.gpd }, + { .name = "tegra-pcie", .domain = &tegra_mc_clk.gpd }, + { .name = "gpu", .domain = &tegra_mc_clk.gpd }, + {}, +}; + +static int __init tegra_init_pm_domain(void) +{ + pm_genpd_init(&tegra_mc_clk.gpd, &simple_qos_governor, false); + + pm_genpd_init(&tegra_nvavp.gpd, &simple_qos_governor, false); + tegra_pd_add_sd(&tegra_nvavp.gpd); + + return 0; +} +core_initcall(tegra_init_pm_domain); + +static struct generic_pm_domain *tegra_pd_get_domain(const char *client) +{ + const char *s; + struct domain_client *clients = client_list; + + while ((s = clients->name) != NULL) { + if (!strncmp(s, client, strlen(s))) + return clients->domain; + + clients++; + } + return NULL; +} + +void tegra_pd_add_device(struct device *dev) +{ + struct generic_pm_domain *master = tegra_pd_get_domain(dev_name(dev)); + + if (!master) + return; + + device_set_wakeup_capable(dev, 1); + pm_genpd_add_device(master, dev); + pm_genpd_dev_need_save(dev, false); + pm_genpd_add_callbacks(dev, &tegra_pd_ops, NULL); +} +EXPORT_SYMBOL(tegra_pd_add_device); + +void tegra_pd_remove_device(struct device *dev) +{ + struct generic_pm_domain *genpd = dev_to_genpd(dev); + + if (!IS_ERR_OR_NULL(genpd)) + pm_genpd_remove_device(genpd, dev); +} +EXPORT_SYMBOL(tegra_pd_remove_device); + +void tegra_pd_add_sd(struct generic_pm_domain *sd) +{ + struct generic_pm_domain *master = tegra_pd_get_domain(sd->name); + + if (!master) + return; + + pm_genpd_add_subdomain(master, sd); +} +EXPORT_SYMBOL(tegra_pd_add_sd); +#else +struct tegra_pm_domain tegra_mc_clk; +EXPORT_SYMBOL(tegra_mc_clk); +struct tegra_pm_domain tegra_mc_chain_a; +EXPORT_SYMBOL(tegra_mc_chain_a); +struct tegra_pm_domain tegra_mc_chain_b; +EXPORT_SYMBOL(tegra_mc_chain_b); +#endif diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 6fb05ea20e50..56ea68ec4861 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -30,7 +30,7 @@ #include <linux/usb/tegra_usb_phy.h> -#include <mach/pm_domains.h> +#include <linux/tegra_pm_domains.h> #include <linux/pm_qos.h> /* HACK! This needs to come from DT */ diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index ddc1f3b8dde9..559fab9810cb 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -41,10 +41,10 @@ #include <linux/of_device.h> #include <linux/of_gpio.h> #include <linux/tegra-fuse.h> +#include <linux/tegra_pm_domains.h> #include <mach/tegra_usb_pad_ctrl.h> #include <mach/tegra_usb_pmc.h> -#include <mach/pm_domains.h> #include <mach/mc.h> #include <mach/xusb.h> diff --git a/drivers/usb/phy/tegra-otg.c b/drivers/usb/phy/tegra-otg.c index 0709fe6a282f..7d8d84b34fb6 100644 --- a/drivers/usb/phy/tegra-otg.c +++ b/drivers/usb/phy/tegra-otg.c @@ -36,8 +36,8 @@ #include <linux/gpio.h> #include <linux/regulator/consumer.h> #include <linux/usb/hcd.h> +#include <linux/tegra_pm_domains.h> -#include <mach/pm_domains.h> #include <mach/tegra_usb_pad_ctrl.h> #define USB_PHY_WAKEUP 0x408 diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 12252eff9ef7..57f9fa935122 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -45,6 +45,7 @@ #endif #include <linux/of_irq.h> #include <linux/of_address.h> +#include <linux/tegra_pm_domains.h> #define CREATE_TRACE_POINTS #include <trace/events/display.h> @@ -55,7 +56,6 @@ #include <linux/nvhost.h> #include <linux/nvhost_ioctl.h> #include <mach/latency_allowance.h> -#include <mach/pm_domains.h> #include "dc_reg.h" #include "dc_config.h" diff --git a/drivers/video/tegra/host/host1x/host1x.c b/drivers/video/tegra/host/host1x/host1x.c index f13200a06e5b..7f34b36e97cf 100644 --- a/drivers/video/tegra/host/host1x/host1x.c +++ b/drivers/video/tegra/host/host1x/host1x.c @@ -31,6 +31,7 @@ #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/tegra-soc.h> +#include <linux/tegra_pm_domains.h> #include "dev.h" #include <trace/events/nvhost.h> @@ -38,8 +39,6 @@ #include <linux/nvhost.h> #include <linux/nvhost_ioctl.h> -#include <mach/pm_domains.h> - #include "debug.h" #include "bus_client.h" #include "nvhost_acm.h" diff --git a/drivers/video/tegra/host/isp/isp.c b/drivers/video/tegra/host/isp/isp.c index f89393dd9149..887be6b46413 100644 --- a/drivers/video/tegra/host/isp/isp.c +++ b/drivers/video/tegra/host/isp/isp.c @@ -26,8 +26,7 @@ #include <linux/of_platform.h> #include <linux/irq.h> #include <linux/workqueue.h> - -#include <mach/pm_domains.h> +#include <linux/tegra_pm_domains.h> #include "dev.h" #include "bus_client.h" diff --git a/drivers/video/tegra/host/msenc/msenc.c b/drivers/video/tegra/host/msenc/msenc.c index fef034bdfdff..7f566b058ee2 100644 --- a/drivers/video/tegra/host/msenc/msenc.c +++ b/drivers/video/tegra/host/msenc/msenc.c @@ -29,8 +29,7 @@ #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/dma-mapping.h> - -#include <mach/pm_domains.h> +#include <linux/tegra_pm_domains.h> #include "dev.h" #include "msenc.h" diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c index 616a20daecb2..d7ba643277b9 100644 --- a/drivers/video/tegra/host/nvhost_acm.c +++ b/drivers/video/tegra/host/nvhost_acm.c @@ -34,9 +34,9 @@ #include <linux/tegra-soc.h> #include <trace/events/nvhost.h> #include <linux/platform_data/tegra_edp.h> +#include <linux/tegra_pm_domains.h> #include <mach/mc.h> -#include <mach/pm_domains.h> #include "nvhost_acm.h" #include "nvhost_channel.h" diff --git a/drivers/video/tegra/host/tsec/tsec.c b/drivers/video/tegra/host/tsec/tsec.c index 6afc05852470..3f71b2482c0f 100644 --- a/drivers/video/tegra/host/tsec/tsec.c +++ b/drivers/video/tegra/host/tsec/tsec.c @@ -29,8 +29,8 @@ #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/dma-mapping.h> +#include <linux/tegra_pm_domains.h> -#include <mach/pm_domains.h> #include <mach/hardware.h> #include "dev.h" diff --git a/drivers/video/tegra/host/vi/vi.c b/drivers/video/tegra/host/vi/vi.c index 901ffad30457..94d426363a72 100644 --- a/drivers/video/tegra/host/vi/vi.c +++ b/drivers/video/tegra/host/vi/vi.c @@ -26,8 +26,8 @@ #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk/tegra.h> +#include <linux/tegra_pm_domains.h> -#include <mach/pm_domains.h> #include <media/tegra_v4l2_camera.h> #include "dev.h" diff --git a/drivers/video/tegra/host/vic03/vic03.c b/drivers/video/tegra/host/vic03/vic03.c index 2a62262a2df6..3b5726012df0 100644 --- a/drivers/video/tegra/host/vic03/vic03.c +++ b/drivers/video/tegra/host/vic03/vic03.c @@ -29,6 +29,7 @@ #include <linux/dma-mapping.h> #include <linux/tegra-powergate.h> #include <linux/tegra-soc.h> +#include <linux/tegra_pm_domains.h> #include "dev.h" #include "class_ids.h" @@ -46,7 +47,6 @@ #include "t124/hardware_t124.h" /* for nvhost opcodes*/ #include "t124/t124.h" -#include <mach/pm_domains.h> #include "../../../../../arch/arm/mach-tegra/iomap.h" |