Skip to content
Snippets Groups Projects
Select Git revision
  • 05d7ae15cfb18f9ce55eef85bb6bcd62d31acc57
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

devfreq.c

Blame
  • devfreq.c 45.64 KiB
    // SPDX-License-Identifier: GPL-2.0-only
    /*
     * devfreq: Generic Dynamic Voltage and Frequency Scaling (DVFS) Framework
     *	    for Non-CPU Devices.
     *
     * Copyright (C) 2011 Samsung Electronics
     *	MyungJoo Ham <myungjoo.ham@samsung.com>
     */
    
    #include <linux/kernel.h>
    #include <linux/kmod.h>
    #include <linux/sched.h>
    #include <linux/errno.h>
    #include <linux/err.h>
    #include <linux/init.h>
    #include <linux/export.h>
    #include <linux/slab.h>
    #include <linux/stat.h>
    #include <linux/pm_opp.h>
    #include <linux/devfreq.h>
    #include <linux/workqueue.h>
    #include <linux/platform_device.h>
    #include <linux/list.h>
    #include <linux/printk.h>
    #include <linux/hrtimer.h>
    #include <linux/of.h>
    #include <linux/pm_qos.h>
    #include "governor.h"
    
    #define CREATE_TRACE_POINTS
    #include <trace/events/devfreq.h>
    
    #define HZ_PER_KHZ	1000
    
    static struct class *devfreq_class;
    
    /*
     * devfreq core provides delayed work based load monitoring helper
     * functions. Governors can use these or can implement their own
     * monitoring mechanism.
     */
    static struct workqueue_struct *devfreq_wq;
    
    /* The list of all device-devfreq governors */
    static LIST_HEAD(devfreq_governor_list);
    /* The list of all device-devfreq */
    static LIST_HEAD(devfreq_list);
    static DEFINE_MUTEX(devfreq_list_lock);
    
    /**
     * find_device_devfreq() - find devfreq struct using device pointer
     * @dev:	device pointer used to lookup device devfreq.
     *
     * Search the list of device devfreqs and return the matched device's
     * devfreq info. devfreq_list_lock should be held by the caller.
     */
    static struct devfreq *find_device_devfreq(struct device *dev)
    {
    	struct devfreq *tmp_devfreq;
    
    	if (IS_ERR_OR_NULL(dev)) {
    		pr_err("DEVFREQ: %s: Invalid parameters\n", __func__);
    		return ERR_PTR(-EINVAL);
    	}
    	WARN(!mutex_is_locked(&devfreq_list_lock),
    	     "devfreq_list_lock must be locked.");
    
    	list_for_each_entry(tmp_devfreq, &devfreq_list, node) {
    		if (tmp_devfreq->dev.parent == dev)
    			return tmp_devfreq;