summaryrefslogtreecommitdiff
path: root/drivers/devfreq/devfreq.c
AgeCommit message (Collapse)Author
2020-03-08Merge branch 'android-4.4-p' of ↵Michael Bestas
https://android.googlesource.com/kernel/common into lineage-17.1-caf-msm8998 This brings LA.UM.8.4.r1-05200-8x98.0 up to date with https://android.googlesource.com/kernel/common/ android-4.4-p at commit: 4db1ebdd40ec0 FROMLIST: HID: nintendo: add nintendo switch controller driver Conflicts: arch/arm64/boot/Makefile arch/arm64/kernel/psci.c arch/x86/configs/x86_64_cuttlefish_defconfig drivers/md/dm.c drivers/of/Kconfig drivers/thermal/thermal_core.c fs/proc/meminfo.c kernel/locking/spinlock_debug.c kernel/time/hrtimer.c net/wireless/util.c Change-Id: I5b5163497b7c6ab8487ffbb2d036e4cda01ed670
2020-01-12PM / devfreq: Don't fail devfreq_dev_release if not in listLeonard Crestez
[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ] Right now devfreq_dev_release will print a warning and abort the rest of the cleanup if the devfreq instance is not part of the global devfreq_list. But this is a valid scenario, for example it can happen if the governor can't be found or on any other init error that happens after device_register. Initialize devfreq->node to an empty list head in devfreq_add_device so that list_del becomes a safe noop inside devfreq_dev_release and we can continue the rest of the cleanup. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-03-01Merge android-4.4.117 (4ec3656) into msm-4.4Srinivasarao P
* refs/heads/tmp-4ec3656 Linux 4.4.117 media: r820t: fix r820t_write_reg for KASAN ARM: dts: s5pv210: add interrupt-parent for ohci ARM: pxa/tosa-bt: add MODULE_LICENSE tag vfs: don't do RCU lookup of empty pathnames x86: fix build warnign with 32-bit PAE dm: correctly handle chained bios in dec_pending() mvpp2: fix multicast address filter ALSA: seq: Fix racy pool initializations ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204 ALSA: hda/realtek: PCI quirk for Fujitsu U7x7 ALSA: usb-audio: Fix UAC2 get_ctl request with a RANGE attribute ALSA: hda - Fix headset mic detection problem for two Dell machines Btrfs: fix unexpected -EEXIST when creating new inode Btrfs: fix crash due to not cleaning up tree log block's dirty bits Btrfs: fix deadlock in run_delalloc_nocow rtlwifi: rtl8821ae: Fix connection lost problem correctly console/dummy: leave .con_font_get set to NULL video: fbdev: atmel_lcdfb: fix display-timings lookup mm: hide a #warning for COMPILE_TEST ext4: correct documentation for grpid mount option ext4: save error to disk in __ext4_grp_locked_error() rtc-opal: Fix handling of firmware error codes, prevent busy loops drm/radeon: adjust tested variable x86/cpu: Change type of x86_cache_size variable to unsigned int KVM/x86: Reduce retpoline performance impact in slot_handle_level_range(), by always inlining iterator helper methods ALSA: seq: Fix regression by incorrect ioctl_mutex usages arm: spear13xx: Fix spics gpio controller's warning arm: spear13xx: Fix dmas cells arm: spear600: Add missing interrupt-parent of rtc ARM: dts: STi: Add gpio polarity for "hdmi,hpd-gpio" property s390: fix handling of -1 in set{,fs}[gu]id16 syscalls PM / devfreq: Propagate error from devfreq_add_device() IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports BACKPORT: tee: shm: Potential NULL dereference calling tee_shm_register() BACKPORT: tee: shm: don't put_page on null shm->pages BACKPORT: tee: shm: make function __tee_shm_alloc static BACKPORT: tee: optee: check type of registered shared memory BACKPORT: tee: add start argument to shm_register callback BACKPORT: tee: optee: fix header dependencies BACKPORT: tee: shm: inline tee_shm_get_id() BACKPORT: tee: use reference counting for tee_context BACKPORT: tee: optee: enable dynamic SHM support BACKPORT: tee: optee: add optee-specific shared pool implementation BACKPORT: tee: optee: store OP-TEE capabilities in private data BACKPORT: tee: optee: add registered buffers handling into RPC calls BACKPORT: tee: optee: add registered shared parameters handling BACKPORT: tee: optee: add shared buffer registration functions BACKPORT: tee: optee: add page list manipulation functions BACKPORT: tee: optee: Update protocol definitions BACKPORT: tee: shm: add page accessor functions BACKPORT: tee: shm: add accessors for buffer size and page offset BACKPORT: tee: add register user memory BACKPORT: tee: flexible shared memory pool creation BACKPORT: optee: support asynchronous supplicant requests BACKPORT: tee: add TEE_IOCTL_PARAM_ATTR_META BACKPORT: tee: add tee_param_is_memref() for driver use f2fs: fix build error with multiply defined inode_nohighmem() Change-Id: I6b4b025e4b03fe9433de0bf2ff292a8f24e3c3cb Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
2018-02-22PM / devfreq: Propagate error from devfreq_add_device()Bjorn Andersson
commit d1bf2d30728f310f72296b54f0651ecdb09cbb12 upstream. Propagate the error of devfreq_add_device() in devm_devfreq_add_device() rather than statically returning ENOMEM. This makes it slightly faster to pinpoint the cause of a returned error. Fixes: 8cd84092d35e ("PM / devfreq: Add resource-managed function for devfreq device") Cc: stable@vger.kernel.org Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-09PM / devfreq: Restart previous governor if new governor fails to startSaravana Kannan
If the new governor fails to start, switch back to old governor so that the devfreq state is not left in some weird limbo. Change-Id: I7cf1e6ceb63d27ce08b2d17b97a9844d257464ce Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23PM/devfreq: Remove redundant put_device()Hanumant Singh
When unregistering devfreq device (devfreq_remove_device()), there is an additional call to put_device, after device_unregister().This causes data aborts in case of access to a kobj in put_device(), that was already freed by preceding device_unregister() CRs-Fixed: 841819 Change-Id: I98bd9e4cc9ecfbc48a0bfe72fc47e362a6697741 Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
2016-03-23PM / devfreq: Fix NULL pointer dereference if freq_table is emptyJunjie Wu
If max_state is 0, freq_table will be empty. Change do-while loop to while loop to avoid dereferencing freq_table. Change-Id: I4a24e9b8cab8073db429c74e627b7fb50076ea93 Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23PM / devfreq: Use freq_table for available_frequenciesSaravana Kannan
Some devices use freq_table instead of OPP. For those devices, the available_frequencies file shows up empty. Fix that by using freq_table to generate the available_frequencies data when OPP is not present. Change-Id: Ibea8b388ee81c55d2eeddd8a1e2c18c91faed8c7 Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23PM / devfreq: Allow the governors to set the target flagLucille Sylvester
The devfreq framework calls a frequency targeting function with a flag parameter. Allow the governors to influence that parameter. Change-Id: I4058bd9dcd027dd246ccdb90d25c68f1dc055901 Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
2016-03-23FROMLIST: PM / devfreq: set min/max freq limit from freq tableRajagopal Venkat
Set devfreq device min and max frequency limits when device is added to devfreq, provided frequency table is supplied. This helps governors to suggest target frequency with in limits. Change-Id: Iab24aef59bfeffcfb3c3118c12ba58e25cd9d479 Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org> Patch-mainline: linux-pm @ 01/08/13, 05:50 Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2016-03-22PM / devfreq: allow governors to use devfreq_get_freq_levelJeremy Gebben
Level based governors may need to perform this lookup to interpret the current frequency of the device. Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org> Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
2015-10-02PM / devfreq: fix double kfreeGeliang Tang
When device_register() fails, kfree(devfreq) is called already in devfreq_dev_release(), hence there is no need to call kfree(devfreq) in err_dev again. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2015-09-30PM / devfreq: Fix governor_store()Tobias Jakobi
Writing the currently set governor into sysfs currently seems to fail. Fix this by setting the return code to zero before leaving governor_store(). Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2015-09-11PM / devfreq: Fix incorrect type issue.Xiaolong Ye
time_in_state in struct devfreq is defined as unsigned long, so devm_kzalloc should use sizeof(unsigned long) as argument instead of sizeof(unsigned int), otherwise it will cause unexpected result in 64bit system. Signed-off-by: Xiaolong Ye <yexl@marvell.com> Signed-off-by: Kevin Liu <kliu5@marvell.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2015-09-11PM / devfreq: drop comment about thermal setting max_freqJavi Merino
The thermal infrastructure should use the devfreq cooling device, which uses the OPP library to disable OPPs as necessary. Fix a couple of typos in the same comment while we are at it. Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2015-09-11PM / devfreq: Drop unlikely before IS_ERR(_OR_NULL)Viresh Kumar
IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there is no need to do that again from its callers. Drop it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2015-03-30PM / devfreq: correct misleading commentMyungJoo Ham
_remove_devfreq() does not have @skip anymore after 3.16. The comment for _remove_devfreq() has been updated correspondingly. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-09-29PM / devfreq: Export helper functions for driversÃrjan Eide
These functions are indended for use by drivers and should be available also when the driver is built as a module. Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Ãrjan Eide <orjan.eide@arm.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-05-24PM / devfreq: Add devm_devfreq_{register,unregister}_opp_notfier functionChanwoo Choi
This patch add resource-managed function for devfreq opp as following functions. The devm_devfreq_register_opp_notifier() manages automatically the registration of devfreq opp using device resource management. - devm_devfreq_register_opp_notifier - devm_devfreq_unregister_opp_notifier() Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-05-24PM / devfreq: Add resource-managed function for devfreq deviceChanwoo Choi
This patch add resource-managed function for devfreq device as following functions. The devm_devfreq_add_device() manages automatically the memory of devfreq device using device resource management. - devm_devfreq_add_device() - devm_devfreq_remove_device() Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-05-24PM / devfreq: Fix devfreq_remove_device() to improve the sequence of ↵Chanwoo Choi
resource free This patch modify devfreq_remove_device() to improve the sequence of resource free. If executing existing devfreq_remove_device(), this function always executes _remove_devfreq() twice. In result, second _remove_devfreq() always return error value. So, This patch resolves complicated function sequence as following: [Flow sequence before modification] devfreq_remove_device() _remove_devfreq(devfreq, false) kfree(devfreq); /* Free devfreq */ if (!skip ...) { /* skip is false */ device_unregister(&devfreq->dev) put_device(&devfreq->dev); ... dev->release() devfreq_dev_release() _remove_devfreq(devfreq, true) <- Recall to free devfreq /* * Always return error without freeing resource because * already _remove_devfreq() frees the memory of devfreq. */ } [Flow sequence after modification] devfreq_remove_device device_unregister(&devfreq->dev) put_device(&devfreq->dev); .. dev->release() devfreq_dev_release() _remove_devfreq() kfree(devfreq); /* Free devfreq */ Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> [Merge conflict resolved by MyungJoo] Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-03-21PM / devfreq: Rewrite devfreq_update_status() to fix multiple bugsSaravana Kannan
The current devfreq_update_status() has the following bugs: - If previous frequency doesn't have a valid level, it does an out of bounds access into the trans_table and causes memory corruption. - When the new frequency doesn't have a valid level, the time spent in the new frequency is counted towards the next valid frequency switch instead of being ignored. - The time spent on the previous frequency is added to the new frequency's stats instead of the previous frequency's stats. This patch fixes all of this. Signed-off-by: Saravana Kannan <skannan@codeaurora.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2013-11-07Merge branch 'pm-devfreq'Rafael J. Wysocki
* pm-devfreq: PM / devfreq: create_freezable_workqueue() doesn't return an ERR_PTR PM / devfreq: Remove duplicate header file inclusion in exynos5_bus.c PM / devfreq: Use devm_* APIs in exynos5_bus.c PM / devfreq: Remove redundant platform_set_drvdata() in exynos5_bus.c PM / devfreq: Fix incorrect usage of IS_ERR_OR_NULL in exynos5_bus.c
2013-10-28PM / devfreq: create_freezable_workqueue() doesn't return an ERR_PTRDan Carpenter
The create_freezable_workqueue() function returns a NULL on error and not an ERR_PTR. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2013-10-25PM / OPP: rename header to linux/pm_opp.hNishanth Menon
Since Operating Performance Points (OPP) functions are specific to device specific power management, be specific and rename opp.h to pm_opp.h Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-10-25PM / OPP: rename data structures to dev_pm equivalentsNishanth Menon
Since Operating Performance Points (OPP) data structures are specific to device specific power management, be specific and rename opp_* data structures in OPP library with dev_pm_opp_* equivalent. Affected structures are: struct opp enum opp_event Minor checkpatch warning resulting of this change was fixed as well. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-10-25PM / OPP: rename functions to dev_pm_opp*Nishanth Menon
Since Operating Performance Points (OPP) functions are specific to device specific power management, be specific and rename opp_* accessors in OPP library with dev_pm_opp_* equivalent. Affected functions are: opp_get_voltage opp_get_freq opp_get_opp_count opp_find_freq_exact opp_find_freq_floor opp_find_freq_ceil opp_add opp_enable opp_disable opp_get_notifier opp_init_cpufreq_table opp_free_cpufreq_table Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-08-19devfreq: convert devfreq_class to use dev_groupsGreg Kroah-Hartman
The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the devfreq_class code to use the correct field. Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-03Merge branch 'akpm' (updates from Andrew Morton)Linus Torvalds
Merge first patch-bomb from Andrew Morton: - various misc bits - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been distracted. There has been quite a bit of activity. - About half the MM queue - Some backlight bits - Various lib/ updates - checkpatch updates - zillions more little rtc patches - ptrace - signals - exec - procfs - rapidio - nbd - aoe - pps - memstick - tools/testing/selftests updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits) tools/testing/selftests: don't assume the x bit is set on scripts selftests: add .gitignore for kcmp selftests: fix clean target in kcmp Makefile selftests: add .gitignore for vm selftests: add hugetlbfstest self-test: fix make clean selftests: exit 1 on failure kernel/resource.c: remove the unneeded assignment in function __find_resource aio: fix wrong comment in aio_complete() drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode drivers/memstick/host/r592.c: convert to module_pci_driver drivers/memstick/host/jmb38x_ms: convert to module_pci_driver pps-gpio: add device-tree binding and support drivers/pps/clients/pps-gpio.c: convert to module_platform_driver drivers/pps/clients/pps-gpio.c: convert to devm_* helpers drivers/parport/share.c: use kzalloc Documentation/accounting/getdelays.c: avoid strncpy in accounting tool aoe: update internal version number to v83 aoe: update copyright date aoe: perform I/O completions in parallel ...
2013-07-03drivers: avoid format string in dev_set_nameKees Cook
Calling dev_set_name with a single paramter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents, including wrappers like device_create*() and bdi_register(). Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-06-03PM / devfreq: add comments and DocumentationMyungJoo Ham
- Added missing ABI documents - Added comments to clarify the objectives of functions Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: Nishanth Menon <nm@ti.com> Acked-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
2013-06-03PM / devfreq: account suspend/resume for statsRajagopal Venkat
devfreq stats is not taking device suspend and resume into account. Fix it. Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2013-01-22PM / devfreq: add locking documentation for recommended_oppNishanth Menon
OPP pointers are protected by RCU locks, the pointer validity is permissible only under the section of rcu_read_lock to rcu_read_unlock Add documentation to the effect. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-12-07Merge branch 'pm-devfreq'Rafael J. Wysocki
* pm-devfreq: (23 commits) PM / devfreq: remove compiler error with module governors (2) PM / devfreq: Fix return value in devfreq_remove_governor() PM / devfreq: Fix incorrect argument in error message PM / devfreq: missing rcu_read_lock() added for find_device_opp() PM / devfreq: remove compiler error when a governor is module PM / devfreq: exynos4_bus.c: Fixed an alignment of the func call args. PM / devfreq: Add sysfs node to expose available governors PM / devfreq: allow sysfs governor node to switch governor PM / devfreq: governors: add GPL module license and allow module build PM / devfreq: map devfreq drivers to governor using name PM / devfreq: register governors with devfreq framework PM / devfreq: provide hooks for governors to be registered PM / devfreq: export update_devfreq PM / devfreq: Add sysfs node for representing frequency transition information. PM / devfreq: Add sysfs node to expose available frequencies PM / devfreq: documentation cleanups for devfreq header PM / devfreq: Use devm_* functions in exynos4_bus.c PM / devfreq: make devfreq_class static PM / devfreq: fix sscanf handling for writable sysfs entries PM / devfreq: kernel-doc typo corrections ...
2012-11-28PM / devfreq: remove compiler error with module governors (2)MyungJoo Ham
Governors compiled as modules may use these functions. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-26PM / devfreq: Fix return value in devfreq_remove_governor()Sachin Kamat
Use the value obtained from the function instead of -EINVAL. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-26PM / devfreq: Fix incorrect argument in error messageSachin Kamat
'g' is cast to the error return code. Hence gives the following error which is fixed by this patch. drivers/devfreq/devfreq.c:645 devfreq_remove_governor() error: 'g' dereferencing possible ERR_PTR() Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-26PM / devfreq: missing rcu_read_lock() added for find_device_opp()MyungJoo Ham
opp_get_notifier() uses find_device_opp(), which requires to held rcu_read_lock. In order to keep the notifier-header valid, we have added rcu_read_lock(). Reported-by: Kees Cook <keescook@chromium.org> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: Add sysfs node to expose available governorsNishanth Menon
Now that governor list can be variable, knowing the available governors is useful to be able to select a governor using relevant sysfs node. Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: allow sysfs governor node to switch governorNishanth Menon
This allows us to select governor runtime from the default configuration without having to rebuild kernel or the devfreq driver using the sysfs node: /sys/class/devfreq/.../governor cat of the governor will return valid governor and an echo 'governor_name'>governor will switch governor Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: map devfreq drivers to governor using nameNishanth Menon
Allow devfreq drivers to register a preferred governor name and when the devfreq governor loads itself at a later point required drivers are managed appropriately, at the time of unload of a devfreq governor, stop managing those drivers as well. Since the governor structures do not need to be exposed anymore, remove the definitions and make them static NOTE: devfreq_list_lock is now used to protect governor start and stop - as this allows us to protect governors and devfreq with the proper dependencies as needed. As part of this change, change the registration of exynos bus driver to request for ondemand using the governor name. Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> [Merge conflict resolved by MyungJoo Ham] Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: provide hooks for governors to be registeredNishanth Menon
Add devfreq_add_governor and devfreq_remove_governor which can be invoked by governors to register with devfreq. This sets up the stage to dynamically switch governors and allow governors to be dynamically loaded as well. Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: export update_devfreqNishanth Menon
Allow update_devfreq to be used by devfreq governor built as modules Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: Add sysfs node for representing frequency transition information.Jonghwa Lee
This patch adds sysfs node which can be used to get information of frequency transition. It represents transition table which contains total number of transition of each freqeuncy state and time spent. It is inspired CPUFREQ's status driver. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> [Added Documentation/ABI entry, updated kernel-doc, and resolved merge conflict] Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-20PM / devfreq: Add sysfs node to expose available frequenciesNishanth Menon
devfreq governors such as ondemand are controlled by a min and max frequency, while governors like userspace governor allow us to set a specific frequency. However, for the same specific device, depending on the SoC, the available frequencies can vary. So expose the available frequencies as a snapshot over sysfs to allow informed decisions. This was inspired by cpufreq framework's equivalent for similar usage sysfs node: scaling_available_frequencies. Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Kevin Hilman <khilman@ti.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-11-15PM / OPP: predictable fail results for opp_find* functions, v2Nishanth Menon
Currently the opp_find* functions return -ENODEV when: a) it cant find a device (e.g. request for an OPP search on device which was not registered) b) When it cant find a match for the search strategy used This makes life a little in-efficient for users such as devfreq to make reasonable judgement before switching search strategies. So, standardize the return results as following: -EINVAL for bad pointer parameters -ENODEV when device cannot be found -ERANGE when search fails This has the following benefit for devfreq implementation: The search fails when an unregistered device pointer is provided. This is a trigger to change the search direction and search for a better fit, however, if we cannot differentiate between a valid search range failure Vs an unregistered device, second search goes through the same fail return condition. This can be avoided by appropriate handling of error return code. With this change, we also fix devfreq for the improved search strategy with updated error code. Signed-off-by: Nishanth Menon <nm@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-15PM / devfreq: make devfreq_class staticNishanth Menon
devfreq_class is used internally by devfreq and has no need to be globally available. This also fixes the following sparse warning: drivers/devfreq/devfreq.c:30:14: warning: symbol 'devfreq_class' was not declared. Should it be static? Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-15PM / devfreq: fix sscanf handling for writable sysfs entriesNishanth Menon
sscanf returns 0 when an invalid parameter like: echo -n "a">min_freq is attempted. Returning back the return result(0) will cause the command not to return back to command prompt. Instead, just return -EINVAL when sscanf does not return 1. This is done for min_freq, max_freq and polling_interval Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-15PM / devfreq: kernel-doc typo correctionsNishanth Menon
Parameter documentation needs a ':' for scripts/kernel-doc to parse properly. Minor fixes for ones warned by: ./scripts/kernel-doc -text drivers/devfreq/devfreq.c>/dev/null Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-15PM / devfreq: Add current freq callback in device profileRajagopal Venkat
Devfreq returns governor predicted frequency as current frequency via sysfs interface. But device may not support all frequencies that governor predicts. So add a callback in device profile to get current freq from driver. Also add a new sysfs node to expose governor predicted next target frequency. Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>