linux/drivers/devfreq/tegra30-devfreq.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * A devfreq driver for NVIDIA Tegra SoCs
 *
 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved.
 * Copyright (C) 2014 Google, Inc
 */

#include <linux/clk.h>
#include <linux/cpufreq.h>
#include <linux/devfreq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
#include <linux/reset.h>
#include <linux/workqueue.h>

#include <soc/tegra/fuse.h>

#include "governor.h"

#define ACTMON_GLB_STATUS
#define ACTMON_GLB_PERIOD_CTRL

#define ACTMON_DEV_CTRL
#define ACTMON_DEV_CTRL_K_VAL_SHIFT
#define ACTMON_DEV_CTRL_ENB_PERIODIC
#define ACTMON_DEV_CTRL_AVG_BELOW_WMARK_EN
#define ACTMON_DEV_CTRL_AVG_ABOVE_WMARK_EN
#define ACTMON_DEV_CTRL_CONSECUTIVE_BELOW_WMARK_NUM_SHIFT
#define ACTMON_DEV_CTRL_CONSECUTIVE_ABOVE_WMARK_NUM_SHIFT
#define ACTMON_DEV_CTRL_CONSECUTIVE_BELOW_WMARK_EN
#define ACTMON_DEV_CTRL_CONSECUTIVE_ABOVE_WMARK_EN
#define ACTMON_DEV_CTRL_ENB

#define ACTMON_DEV_CTRL_STOP

#define ACTMON_DEV_UPPER_WMARK
#define ACTMON_DEV_LOWER_WMARK
#define ACTMON_DEV_INIT_AVG
#define ACTMON_DEV_AVG_UPPER_WMARK
#define ACTMON_DEV_AVG_LOWER_WMARK
#define ACTMON_DEV_COUNT_WEIGHT
#define ACTMON_DEV_AVG_COUNT
#define ACTMON_DEV_INTR_STATUS

#define ACTMON_INTR_STATUS_CLEAR

#define ACTMON_DEV_INTR_CONSECUTIVE_UPPER
#define ACTMON_DEV_INTR_CONSECUTIVE_LOWER

#define ACTMON_ABOVE_WMARK_WINDOW
#define ACTMON_BELOW_WMARK_WINDOW
#define ACTMON_BOOST_FREQ_STEP

/*
 * ACTMON_AVERAGE_WINDOW_LOG2: default value for @DEV_CTRL_K_VAL, which
 * translates to 2 ^ (K_VAL + 1). ex: 2 ^ (6 + 1) = 128
 */
#define ACTMON_AVERAGE_WINDOW_LOG2
#define ACTMON_SAMPLING_PERIOD
#define ACTMON_DEFAULT_AVG_BAND

#define KHZ

#define KHZ_MAX

/* Assume that the bus is saturated if the utilization is 25% */
#define BUS_SATURATION_RATIO

/**
 * struct tegra_devfreq_device_config - configuration specific to an ACTMON
 * device
 *
 * Coefficients and thresholds are percentages unless otherwise noted
 */
struct tegra_devfreq_device_config {};

enum tegra_actmon_device {};

static const struct tegra_devfreq_device_config tegra124_device_configs[] =;

static const struct tegra_devfreq_device_config tegra30_device_configs[] =;

/**
 * struct tegra_devfreq_device - state specific to an ACTMON device
 *
 * Frequencies are in kHz.
 */
struct tegra_devfreq_device {};

struct tegra_devfreq_soc_data {};

struct tegra_devfreq {};

struct tegra_actmon_emc_ratio {};

static const struct tegra_actmon_emc_ratio actmon_emc_ratios[] =;

static u32 actmon_readl(struct tegra_devfreq *tegra, u32 offset)
{}

static void actmon_writel(struct tegra_devfreq *tegra, u32 val, u32 offset)
{}

static u32 device_readl(struct tegra_devfreq_device *dev, u32 offset)
{}

static void device_writel(struct tegra_devfreq_device *dev, u32 val,
			  u32 offset)
{}

static unsigned long do_percent(unsigned long long val, unsigned int pct)
{}

static void tegra_devfreq_update_avg_wmark(struct tegra_devfreq *tegra,
					   struct tegra_devfreq_device *dev)
{}

static void tegra_devfreq_update_wmark(struct tegra_devfreq *tegra,
				       struct tegra_devfreq_device *dev)
{}

static void actmon_isr_device(struct tegra_devfreq *tegra,
			      struct tegra_devfreq_device *dev)
{}

static unsigned long actmon_cpu_to_emc_rate(struct tegra_devfreq *tegra,
					    unsigned long cpu_freq)
{}

static unsigned long actmon_device_target_freq(struct tegra_devfreq *tegra,
					       struct tegra_devfreq_device *dev)
{}

static void actmon_update_target(struct tegra_devfreq *tegra,
				 struct tegra_devfreq_device *dev)
{}

static irqreturn_t actmon_thread_isr(int irq, void *data)
{}

static int tegra_actmon_clk_notify_cb(struct notifier_block *nb,
				      unsigned long action, void *ptr)
{}

static void tegra_actmon_delayed_update(struct work_struct *work)
{}

static unsigned long
tegra_actmon_cpufreq_contribution(struct tegra_devfreq *tegra,
				  unsigned int cpu_freq)
{}

static int tegra_actmon_cpu_notify_cb(struct notifier_block *nb,
				      unsigned long action, void *ptr)
{}

static void tegra_actmon_configure_device(struct tegra_devfreq *tegra,
					  struct tegra_devfreq_device *dev)
{}

static void tegra_actmon_stop_devices(struct tegra_devfreq *tegra)
{}

static int tegra_actmon_resume(struct tegra_devfreq *tegra)
{}

static int tegra_actmon_start(struct tegra_devfreq *tegra)
{}

static void tegra_actmon_pause(struct tegra_devfreq *tegra)
{}

static void tegra_actmon_stop(struct tegra_devfreq *tegra)
{}

static int tegra_devfreq_target(struct device *dev, unsigned long *freq,
				u32 flags)
{}

static int tegra_devfreq_get_dev_status(struct device *dev,
					struct devfreq_dev_status *stat)
{}

static struct devfreq_dev_profile tegra_devfreq_profile =;

static int tegra_governor_get_target(struct devfreq *devfreq,
				     unsigned long *freq)
{}

static int tegra_governor_event_handler(struct devfreq *devfreq,
					unsigned int event, void *data)
{}

static struct devfreq_governor tegra_devfreq_governor =;

static void devm_tegra_devfreq_deinit_hw(void *data)
{}

static int devm_tegra_devfreq_init_hw(struct device *dev,
				      struct tegra_devfreq *tegra)
{}

static int tegra_devfreq_config_clks_nop(struct device *dev,
					 struct opp_table *opp_table,
					 struct dev_pm_opp *opp, void *data,
					 bool scaling_down)
{}

static int tegra_devfreq_probe(struct platform_device *pdev)
{}

static const struct tegra_devfreq_soc_data tegra124_soc =;

static const struct tegra_devfreq_soc_data tegra30_soc =;

static const struct of_device_id tegra_devfreq_of_match[] =;

MODULE_DEVICE_TABLE(of, tegra_devfreq_of_match);

static struct platform_driver tegra_devfreq_driver =;
module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();