summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/voltage.c
AgeCommit message (Collapse)Author
2023-01-09ARM: omap2: make functions staticArnd Bergmann
A number of functions are only called from the file they are defined in, so remove the extern declarations and make them local to those files. Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07ARM: OMAP2+: avoid NULL pointer dereferenceNicolae Rosia
For OMAP4, volt_data is set in omap44xx_voltagedomains_init. If the SoC is neither OMAP443X or OMAP446X, we end up with a NULL in volt_data which causes a kernel oops. This is the case when booting OMAP4470. Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2015-01-07ARM: OMAP2+: voltage: Remove some unused functionsRickard Strandqvist
Removes some functions that are not used anywhere: omap_change_voltscale_method() voltdm_add_pwrdm() voltdm_for_each() voltdm_for_each_pwrdm() And remove define VOLTSCALE_VPFORCEUPDATE and VOLTSCALE_VCBYPASS This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Tony Lindgren <tony@atomide.com>
2014-09-18arm: mach-omap2: Convert pr_warning to pr_warnJoe Perches
Use the more common pr_warn. Other miscellanea: o Realign arguments Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2012-09-12ARM: OMAP: unwrap stringsPaul Walmsley
Find and unwrap wrapped strings in the style: pr_debug("clockdomain: hardware cannot set/clear wake up of " "%s when %s wakes up\n", clkdm1->name, clkdm2->name); Keeping these strings contiguous seems to be the current Linux kernel policy. The offending lines were found with the following command: pcregrep -rnM '"\s*$\s*"' arch/arm/*omap* While here, some messages have been clarified, some pr_warning( ... calls have been converted to pr_warn( ..., and some printk(KERN_* ... have been converted to pr_*. Signed-off-by: Paul Walmsley <paul@pwsan.com>
2012-03-06ARM: OMAP2+: voltage: ensure voltage used is exact voltage from OPP tableKevin Hilman
When using the SMPS regulators to scale voltages, the regulator framework may pass a minimum voltage that is not an exact OPP voltage. For the VC/VP controlled voltage domains, we must ensure that the voltage requested is the exact voltage from the OPP table. This is especially critical when using SR. To fix, voltdm_scale() uses the target voltage passed to walk through the OPP voltages until it finds a voltage that is >= one of the OPP voltages. Cc: Tero Kristo <t-kristo@ti.com> Cc: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-11-17ARM: 7159/1: OMAP: Introduce local common.h filesTony Lindgren
As suggested by Russell King - ARM Linux <linux@arm.linux.org.uk>, there's no need to keep local prototypes in non-local headers. Add mach-omap1/common.h and mach-omap2/common.h and move the local prototypes there from plat/common.h and mach/omap4-common.h. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-11-06Merge branch 'modsplit-Oct31_2011' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
2011-10-31arm: Add export.h to ARM specific files as required.Paul Gortmaker
These files all make use of one of the EXPORT_SYMBOL variants or the THIS_MODULE macro. So they will need <linux/export.h> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-09-15OMAP3+: voltage: update nominal voltage in voltdm_scale() not VC post-scaleKevin Hilman
Currently, the nominal voltage is updated in the VC post-scale function which is common to both scaling methods. However, this has readabiliy problems as this update is not where it might be expected. Instead, move the updated into voltdm_scale() upon a successful return of voltdm->scale() Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: rename omap_voltage_get_nom_volt -> voltdm_get_voltageKevin Hilman
Use preferred voltdm_ naming for getting current nominal voltage. No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltdm: final removal of omap_vdd_infoKevin Hilman
Remove last remaining member (volt_data) from omap_vdd_info into struct voltagedomain and removal remaining usage and reference to omap_vdd_info. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: move/rename curr_volt from vdd_info into struct voltagedomainKevin Hilman
Track current nominal voltage as part of struct voltagedomain instead of omap_vdd_info, which will soon be removed. Also renames field from curr_volt to nominal_volt. No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: rename scale and reset functions using voltdm_ prefixKevin Hilman
Rename voltage scaling related functions to use voltdm_ prefix intead of omap_voltage_, and cleanup kerneldoc comments in the process. s/omap_voltage_scale_vdd/voltdm_scale/ s/omap_voltage_reset/voltdm_reset/ Also, in voltdm_reset() s/target_uvdc/target_volt/ to be consistent with naming throughout the file. No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: VP: move voltage scale function pointer into struct voltagedomainKevin Hilman
Function pointer used for actual voltage scaling (e.g. VP force update or VC bypass) is moved from omap_vdd_info into struct voltagedomain, resulting in renames s/vdd->volt_scale/voltdm->scale/ No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: VP: move timing calculation/config into VP initKevin Hilman
Move VP timing calcluation (based on sys clock) and register programming into VP init. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: VP: move SoC-specific sys clock rate retreival late initKevin Hilman
Add sys clock name and rate to struct voltage domain. SoC specific voltagedomain init code initializes sys clock name. After clock framework is initialized, voltage late init will then use use the sys_clk rate to calculate the various timing that depend on that rate. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: VP: struct omap_vp_common: replace shift with __ffs(mask)Kevin Hilman
In struct omap_vp_common, the shift value can be derived from the mask value by using __ffs(), so remove the shift value for the various VPCONFIG bitfields, and use __ffs() in the code for the shift value. While here, rename field names in kerneldoc comment to match actual field names in structure. Also, cleanup indendentaion for other VP register accesses in omap_vp_init(). No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: remove unneeded debugfs interfaceKevin Hilman
Remove read-only debugfs interface to VP values. Most of the values are init-time only and never change. Current voltage value should be retreived from the (eventual) regulator framework interface to the voltage domain. Fixes to original version provided by Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renamesKevin Hilman
- move VP instance struct from vdd_info into struct voltage domain - remove _data suffix from structure name - rename vp_ prefix from vp_common field: accesses are now vp->common - move vp_enabled bool from vdd_info into VP instance - remove remaining references to omap_vdd_info No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage domain: move PMIC struct from vdd_info into struct voltagedomainKevin Hilman
Move structure containing PMIC configurable settings into struct voltagedomain. In the process, rename from omap_volt_pmic_info to omap_voltdm_pmic (_info suffix is not helpful.) No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: convert to PRM register access functionsKevin Hilman
Convert VC/VP register access to use PRM VC/VP accessor functions. In the process, move the read/write function pointers from vdd_info into struct voltagedomain. No functional changes. Additional cleanup: - remove prm_mod field from VC/VP data structures, the PRM register access functions know which PRM module to use. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: split out voltage processor (VP) code into new layerKevin Hilman
This patch is primarily a move of VP specific code from voltage.c into its own code in vp.c and adds prototypes to vp.h No functional changes, except debugfs... VP debugfs moved to 'vp' subdir of <debugfs>/voltage/ and 'vp_' prefixes removed from all debugfs filenames. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: enable VC bypass scale method when VC is initializedKevin Hilman
VC is initialized first, set default scaling method to VC bypass. If/when VP is initialized, default scaling method will be changed to VP force-update. Enabling VC bypass as default as soon as VC is initialized allows for VC bypass scaling to work when no VP is configured/initialized for a given voltage domain. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: move VC into struct voltagedomain, misc. renamesKevin Hilman
Move the VC instance struct from omap_vdd_info into struct voltagedomain. While moving, perform some misc. renames for readability. No functional changes. Summary of renames: - rename omap_vc_instance to omap_vc_channel, since there is only one instance of the VC IP and this actually represents channels using TRM terminology. - rename 'vc_common' field of VC channel which led to: s/vc->vc_common/vc->common/ - remove redundant '_data' suffix - OMAP3: vc1 --> vc_mpu, vc2 --> vc_core - omap_vc_bypass_scale_voltage() -> omap_vc_bypass_scale() Signed-off-by: Kevin Hilman <khilman@ti.com> merge
2011-09-15OMAP2+: voltage: split voltage controller (VC) code into dedicated layerKevin Hilman
As part of the voltage layer cleanup, split out VC specific code into a dedicated VC layer. This patch primarily just moves VC code from voltage.c into vc.c, and adds prototypes to vc.h. No functional changes. For readability, each function was given a local 'vc' pointer: struct omap_vc_instance_data *vc = voltdm->vdd->vc_data; and a global replace of s/vdd->vc_data/vc/ was done. Also vc_init was renamed to vc_init_channel to reflect that this is per-VC channel initializtion. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: keep track of powerdomains in each voltagedomainKevin Hilman
When a powerdomain is registered and it has an associated voltage domain, add the powerdomain to the voltagedomain using voltdm_add_pwrdm(). Also add voltagedomain iterator helper functions to iterate over all registered voltagedomains and all powerdomains associated with a voltagedomain. Modeled after a similar relationship between clockdomains and powerdomains. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP3+: voltage: add scalable flag to voltagedomainKevin Hilman
Add a 'bool scalable' flag to the struct powerdomain and set it for the scalable domains on OMAP3 and OMAP4. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: start towards a new voltagedomain layerKevin Hilman
Start cleaning up the voltage layer to have a voltage domain layer that resembles the structure of the existing clock and power domain layers. To that end: - move the 'struct voltagedomain' out of 'struct omap_vdd_info' to become the primary data structure. - convert any functions taking a pointer to struct omap_vdd_info into functions taking a struct voltagedomain pointer. - convert the register & initialize of voltage domains to look like that of powerdomains - convert omap_voltage_domain_lookup() to voltdm_lookup(), modeled after the current powerdomain and clockdomain lookup functions. - omap_voltage_late_init(): only configure VDD info when the vdd_info struct is non-NULL Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: move prm_irqst_reg from VP into voltage domainKevin Hilman
The prm_irqst_reg is not part of the VP. Move it up into the common voltage domain struct. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-09-15OMAP2+: voltage: move PRCM mod offets into VC/VP structuresKevin Hilman
Eliminate need for global variables for the various PRM module offsets by making them part of the VP/VC common structures Eventually, these will likely be moved again, or more likely removed when VP/VC code is isolated, but for now just getting rid of them as global variabes so that the voltage domain initialization can be cleaned up. Signed-off-by: Kevin Hilman <khilman@ti.com>
2011-05-17Merge branches 'devel-fixes', 'devel-cleanup' and 'devel-genirq' into for-nextTony Lindgren
2011-05-03OMAP3+: voltage: remove spurious pr_notice for debugfsNishanth Menon
cat of debugfs entry for vp_volt provides voltage. The additional pr_notice is just spam on console and provides no additional information. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2011-04-26OMAP3+: voltage: remove initial voltageNishanth Menon
Blindly setting 1.2V in the initial structure may not even match the default voltages stored in the voltage table which are supported for the domain. For example, OMAP3430 core domain does not use 1.2V and ends up generating a warning on the first transition. Further, since omap2_set_init_voltage is called as part of the pm framework's initialization sequence to configure the voltage required for the current OPP, the call does(and has to) setup the system voltage(curr_volt as a result) using the right mechanisms appropriate for the system at that point of time. This also overrides initialization we are currently doing in voltage.c making it redundant. So, remove the wrong and redundant initialization. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-10OMAP2+: voltage: reorganize, split code from dataPaul Walmsley
This is a first pass at reorganizing mach-omap2/voltage.c: - Separate almost all of the data from the code of mach-omap2/voltage.c. The code remains in mach-omap2/voltage.c. The data goes into one of several places, depending on what type of data it is: - Silicon process/validation data: mach-omap2/opp*_data.c - VC (Voltage Controller) data: mach-omap2/vc*_data.c - VP (Voltage Processor) data: mach-omap2/vp*_data.c - Voltage domain data: mach-omap2/voltagedomains*_data.c The ultimate goal is for all this data to be autogenerated, the same way we autogenerate the rest of our data. - Separate VC and VP common data from VDD-specific VC and VP data. - Separate common voltage.c code from SoC-specific code; reuse common code. - Reorganize structures to avoid unnecessary memory loss due to unpacked fields. There is much left to be done. VC code and VP code should be separated out into vc*.c and vp*.c files. Many fields in the existing structures are superfluous, and should be removed. Some code in voltage.c seems to be duplicated; that code should be moved into functions of its own. Proper voltage domain code should be created, as was done with the powerdomain and clockdomains, and powerdomains should reference voltagedomains. Thanks to Shweta Gulati <shweta.gulati@ti.com> for comments. Thanks to Rajendra Nayak <rnayak@ti.com> for finding and fixing some bugs that prevented OMAP4 from booting: https://patchwork.kernel.org/patch/587311/ His patch has been folded into this one to avoid breaking OMAP4 between patches. Thanks also to Kevin Hilman <khilman@ti.com> for finding and fixing a compile problem when !CONFIG_PM: http://www.spinics.net/lists/arm-kernel/msg118067.html His patch has also been folded into this one to avoid breaking !CONFIG_PM builds. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Shweta Gulati <shweta.gulati@ti.com> Cc: Rajendra Nayak <rnayak@ti.com> Cc: Kevin Hilman <khilman@ti.com>
2011-03-07OMAP: voltage: move plat/voltage.h to mach-omap2/voltage.hPaul Walmsley
At this point in time, there's no reason for this header file to be in plat-omap/include/plat/voltage.h. It should not be included by device drivers, and the code that uses it is currently all under mach-omap2/. Signed-off-by: Paul Walmsley <paul@pwsan.com>
2011-01-31arm: mach-omap2: voltage: debugfs: fix memory leakAaro Koskinen
The temporary string holding the directory name to be created should be released. Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
2010-12-22OMAP4: Adding voltage driver supportThara Gopinath
OMAP4 has three scalable voltage domains vdd_mpu, vdd_iva and vdd_core. This patch adds the voltage tables and other configurable voltage processor and voltage controller settings to control these three scalable domains in OMAP4. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
2010-12-22OMAP3: PM: Adding debug support to Voltage and Smartreflex driversThara Gopinath
This patch adds debug support to the voltage and smartreflex drivers. This means a whole bunch of voltage processor and smartreflex parameters are now visible through the pm debugfs. The voltage parameters can be viewed at /debug/voltage/vdd_<x>/<parameter> and the smartreflex parameters can be viewed at /debug/voltage/vdd_<x>/smartreflex/<parameter> Also smartreflex n-target values are now exposed out at /debug/voltage/vdd_<x>/smartreflex/nvalue/<voltage> This is a read-write interface which means user has the flexibility to change the n-target values for any opp. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
2010-12-22OMAP3: PM: Adding voltage driver support.Thara Gopinath
This patch adds voltage driver support for OMAP3. The driver allows configuring the voltage controller and voltage processors during init and exports APIs to enable/disable voltage processors, scale voltage and reset voltage. The driver maintains the global voltage table on a per VDD basis which contains the various voltages supported by the VDD along with per voltage dependent data like smartreflex efuse offset, errminlimit and voltage processor errorgain. The driver also allows the voltage parameters dependent on the PMIC to be passed from the PMIC file through an API. The driver allows scaling of VDD voltages either through "vc bypass method" or through "vp forceupdate method" the choice being configurable through the board file. This patch contains code originally in linux omap pm branch smartreflex driver. Major contributors to this driver are Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley, Nishant Menon, Kevin Hilman. The separation of PMIC parameters into a separate structure which can be populated from the PMIC file is based on the work of Lun Chang from Motorola in an internal tree. Signed-off-by: Thara Gopinath <thara@ti.com> [khilman: fixed link error for OMAP2-only defconfig] Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>