- Oct 27, 2021
-
-
Samuel Holland authored
Since commit ea572f81 ("PM / devfreq: Change return type of devfreq_set_freq_table()"), all devfreq devices are expected to have a valid freq_table. The devfreq core unconditionally dereferences freq_table in the sysfs code and in get_freq_range(). Therefore, we need to ensure that freq_table is both non-null and non-empty (length is > 0). If either check fails, replace the table using set_freq_table() or return the error. Signed-off-by:
Samuel Holland <samuel@sholland.org> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Krzysztof Kozlowski authored
When parsing devicetree, the function of_get_devfreq_events(), for each device child node, iterates over array of possible events "ppmu_events" till it finds one matching by node name. When match is found the ppmu_events[i] points to element having both the name of the event and the counters ID. Each PPMU device child node might have an "event-name" property with the name of the event, however due to the design of devfreq it must be the same as the device node name. If it is not the same, the devfreq client won't be able to use it via devfreq_event_get_edev_by_phandle(). Since PPMU device child node name must be equal to the "event-name" property (event-name == ppmu_events[i].name), there is no need to find the counters ID by the "event-name". Instead use ppmu_events[i].id which must be equal to it. Signed-off-by:
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Tested-by:
Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Krzysztof Kozlowski authored
Devicetree naming convention requires device node names to use hyphens instead of underscore, so Exynos5422 devfreq event name "ppmu-event3-dmc0_0" should be "ppmu-event3-dmc0-0". Newly introduced dtschema enforces this, however the driver still expects old name with an underscore. Add new events for Exynos5422 while still accepting old name for backwards compatibility. Signed-off-by:
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Tested-by:
Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Oct 05, 2021
-
-
Dmitry Osipenko authored
EMC clock is always-on and can't be zero. Check whether clk_round_rate() returns zero rate and error out if it does. It can return zero if clock tree isn't initialized properly. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
Dmitry Osipenko authored
Use resource-managed API helpers to simplify driver's probe() function, making code cleaner. Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
Dmitry Osipenko authored
Add resource-managed variant of devfreq_add_governor(). Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
- Sep 08, 2021
-
-
Daniel Lezcano authored
HZ unit conversion macros are available in units.h, use them and remove the duplicate definition. The new macro has an unsigned long type. All the code is dealing with unsigned long and the code using the macro is doing a coercitive cast to unsigned long. Link: https://lkml.kernel.org/r/20210816114732.1834145-5-daniel.lezcano@linaro.org Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Christian Eggers <ceggers@arri.de> Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Lukasz Luba <lukasz.luba@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Jun 24, 2021
-
-
Chanwoo Choi authored
The 86ad9a24 ("PM / devfreq: Add required OPPs support to passive governor") supported the required-opp property for using devfreq passive governor. But, 86ad9a24 has caused the problem on use-case when required-opp is not used such as exynos-bus.c devfreq driver. So that fix the get_target_freq of passive governor for supporting the case of when required-opp is not used. Fixes: 86ad9a24 ("PM / devfreq: Add required OPPs support to passive governor") Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Jun 17, 2021
-
-
YueHaibing authored
Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by:
YueHaibing <yuehaibing@huawei.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- May 21, 2021
-
-
Dong Aisheng authored
The driver can't support simple ondemand governor due to missing .get_dev_status() capability. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dmitry Osipenko authored
Expose ACTMON devfreq device as a cooling device in order to throttle memory freq on overheat. Throttling of memory freq has a significant cooling effect on NVIDIA Tegra SoCs since higher memory freqs require higher SoC core voltage which is one of the main causes of the heating. Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
Current driver actually does not support simple ondemand governor as it's unable to provide device load information. So removing the unnecessary callback to avoid confusing. Right now the driver is using userspace governor by default. polling_ms was also dropped as it's not needed for non-ondemand governor. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- May 20, 2021
-
-
YueHaibing authored
Set err code in the error path before jumping to the end of the function. Fixes: 4dc3bab8 ("PM / devfreq: Add support delayed timer for polling mode") Signed-off-by:
YueHaibing <yuehaibing@huawei.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Apr 08, 2021
-
-
Fabio Estevam authored
i.MX is a DT-only platform, so of_match_ptr() can be safely removed. Remove the unneeded of_match_ptr(). Signed-off-by:
Fabio Estevam <festevam@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Fabio Estevam authored
i.MX is a DT-only platform, so of_match_ptr() can be safely removed. Remove the unneeded of_match_ptr(). Signed-off-by:
Fabio Estevam <festevam@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
Current driver actually does not support simple ondemand governor as it's unable to provide device load information. So removing the unnecessary callback to avoid confusing. Right now the driver is using userspace governor by default. polling_ms was also dropped as it's not needed for non-ondemand governor. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
First of all, no_central_polling was removed since commit 7e6fdd4b ("PM / devfreq: Core updates to support devices which can idle") Secondly, get_target_freq() is not only called only with update_devfreq() notified by OPP now, but also min/max freq qos notifier. So remove this invalid description now to avoid confusing. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
Check .get_dev_status() in devfreq_update_stats in case it's abused when a device does not provide it. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
Fix the wrong set_freq path for userspace governor in Kconfig. Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Krzysztof Kozlowski authored
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by:
Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dong Aisheng authored
Use the more accurate returned new_freq as resume_freq. It's the same as how devfreq->previous_freq was updated. Fixes: 83f8ca45 ("PM / devfreq: add support for suspend/resume of a devfreq device") Signed-off-by:
Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Lukasz Luba authored
The devfreq->lock is held for time of setup. Release the lock in the error path, before jumping to the end of the function. Change the goto destination which frees the allocated memory. Cc: v5.9+ <stable@vger.kernel.org> # v5.9+ Fixes: 4dc3bab8 ("PM / devfreq: Add support delayed timer for polling mode") Signed-off-by:
Lukasz Luba <lukasz.luba@arm.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Mar 09, 2021
-
-
Daniel Lezcano authored
Currently the default behavior is to manually having the devfreq backend to register themselves as a devfreq cooling device. Instead of adding the code in the drivers for the thermal cooling device registering, let's provide a flag in the devfreq's profile to tell the common devfreq code to register the newly created devfreq as a cooling device. Suggested-by:
Chanwoo Choi <cwchoi00@gmail.com> Signed-off-by:
Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by:
Steven Price <steven.price@arm.com> Reviewed-by:
Lukasz Luba <lukasz.luba@arm.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Feb 04, 2021
-
-
Saravana Kannan authored
Look at the required OPPs of the "parent" device to determine the OPP that is required from the slave device managed by the passive governor. This allows having mappings between a parent device and a slave device even when they don't have the same number of OPPs. While at it do a minor spell-fix and remove out label. Signed-off-by:
Saravana Kannan <saravanak@google.com> Acked-by:
MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Hsin-Yi Wang <hsinyi@chromium.org> [ Viresh: Rearranged code and clean error paths ] Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
Saravana Kannan authored
The OPP table can be used often in devfreq. Trying to get it each time can be expensive, so cache it in the devfreq struct. Signed-off-by:
Saravana Kannan <saravanak@google.com> Acked-by:
MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Hsin-Yi Wang <hsinyi@chromium.org> [ Viresh: Added a blank line ] Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
- Feb 02, 2021
-
-
Yang Li authored
Eliminate the following coccicheck warning: ./drivers/devfreq/rk3399_dmc.c:403:2-3: Unneeded semicolon Reported-by:
Abaci Robot <abaci@linux.alibaba.com> Signed-off-by:
Yang Li <yang.lee@linux.alibaba.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Viresh Kumar authored
dev_pm_opp_set_bw() is getting removed and dev_pm_opp_set_opp() should be used instead. Migrate to the new API. We don't want the OPP core to manage the clk for this driver, migrate to dev_pm_opp_of_add_table_noclk() to make sure dev_pm_opp_set_opp() doesn't have any side effects. Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Tested-by:
Dmitry Osipenko <digetx@gmail.com>
-
- Jan 05, 2021
-
-
pierre Kuo authored
In devfreq_add_device, replace devfreq->dev.parent as dev to keep code simple. Signed-off-by:
pierre Kuo <vichy.kuo@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Lukasz Luba authored
The device attribute exposed in sysfs is called 'polling_interval'. Align the comment. Signed-off-by:
Lukasz Luba <lukasz.luba@arm.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Dec 09, 2020
-
-
Viresh Kumar authored
The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so there is no need for us to carry the extra check. Drop them. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Viresh Kumar <viresh.kumar@linaro.org>
-
- Dec 07, 2020
-
-
Dmitry Osipenko authored
Previously we were using count-weight of the T124 for T30 in order to get EMC clock rate that was reasonable for T30. In fact the count-weight should be x2 times smaller on T30, but then devfreq was producing a bit too low EMC clock rate for ISO memory clients, like display controller for example. Now both Tegra ACTMON and Tegra DRM display drivers support interconnect framework and display driver tells to ICC what a minimum memory bandwidth is needed, preventing FIFO underflows. Thus, now we can use a proper count-weight value for Tegra30 and MC_ALL device config needs a bit more aggressive boosting. Add a separate ACTMON driver configuration that is specific to Tegra30. Tested-by:
Peter Geis <pgwipeout@gmail.com> Tested-by:
Nicolas Chauvet <kwizart@gmail.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dmitry Osipenko authored
This patch moves ACTMON driver away from generating OPP table by itself, transitioning it to use the table which comes from device-tree. This change breaks compatibility with older device-trees and brings support for the interconnect framework to the driver. This is a mandatory change which needs to be done in order to implement interconnect-based memory DVFS, i.e. device-trees need to be updated. Now ACTMON issues a memory bandwidth requests using dev_pm_opp_set_bw() instead of driving EMC clock rate directly. Tested-by:
Peter Geis <pgwipeout@gmail.com> Tested-by:
Nicolas Chauvet <kwizart@gmail.com> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Nov 23, 2020
-
-
Dmitry Osipenko authored
Remove tegra20-devfreq in order to replace it with a EMC_STAT based devfreq driver. Previously we were going to use MC_STAT based tegra20-devfreq driver because EMC_STAT wasn't working properly, but now that problem is resolved. This resolves complications imposed by the removed driver since it was depending on both EMC and MC drivers simultaneously. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Nov 13, 2020
-
-
Sylwester Nawrocki authored
This patch adds registration of a child platform device for the exynos interconnect driver. It is assumed that the interconnect provider will only be needed when #interconnect-cells property is present in the bus DT node, hence the child device will be created only when such a property is present. Acked-by:
Krzysztof Kozlowski <krzk@kernel.org> Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
- Oct 26, 2020
-
-
Dmitry Osipenko authored
Tegra EMC driver was turned into a regular kernel driver, meaning that it could be compiled as a loadable kernel module now. Hence EMC clock isn't guaranteed to be available and clk_get("emc") may return -EPROBE_DEFER. Let's silence the deferred probe error. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dmitry Osipenko authored
The Tegra EMC driver now could be compiled as a loadable kernel module. Currently devfreq driver depends on the EMC/MC drivers in Kconfig, and thus, devfreq is forced to be a kernel module if EMC is compiled as a module. This build dependency could be relaxed since devfreq driver checks MC/EMC presence on probe, allowing kernel configuration where devfreq is a built-in driver and EMC driver is a loadable module. This change puts Tegra20 devfreq Kconfig entry on a par with the Tegra30 devfreq entry. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Dmitry Osipenko authored
Tegra EMC driver was turned into a regular kernel driver, meaning that it could be compiled as a loadable kernel module now. Hence EMC clock isn't guaranteed to be available and clk_get("emc") may return -EPROBE_DEFER. Let's silence the deferred probe error. Acked-by:
Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Chanwoo Choi authored
The devfreq structure instance contains the governor_name and a governor instance. When need to show the governor name, better to use the name of devfreq_governor structure. So, governor_name variable in struct devfreq is a redundant and unneeded variable. Remove the redundant governor_name of struct devfreq and then use the name of devfreq_governor instance. Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Chanwoo Choi authored
DEVFREQ supports the default governors like performance, simple_ondemand and also allows the devfreq driver to add their own governor like tegra30-devfreq.c according to their requirement. In result, some sysfs attributes are useful or not useful. Prior to that the user can access all sysfs attributes regardless of the available attributes. So, clarify the access permission of sysfs attributes according to governor. When adding the devfreq governor, can specify the available attribute information by using DEVFREQ_GOV_ATTR_* constant variable. The user can read or write the sysfs attributes in accordance to the specified attributes. When adding the governor, can add the following attributes according to the governor feature. [Definition for speific sysfs attributes] - DEVFREQ_GOV_ATTR_POLLING_INTERVAL to update polling interval for timer. : /sys/class/devfreq/[devfreq dev name]/polling_interval - DEVFREQ_GOV_ATTR_TIMER to change the type of timer on either deferrable or dealyed timer. : /sys/class/devfreq/[devfreq dev name]/timer And all devfreq governors have to support the following common attributes. The common attributes are added to devfreq class by default. - governor - available_governors - available_frequencies - cur_freq - target_freq - min_freq - max_freq - trans_stat [Table of governor attribute flags for devfreq governors] ------------------------------------------------------------------------------ | simple | perfor | power | user | passive | tegra30 | ondemand | mance | save | space| | ------------------------------------------------------------------------------ governor | O | O | O | O | O | O available_governors | O | O | O | O | O | O available_frequencies | O | O | O | O | O | O cur_freq | O | O | O | O | O | O target_freq | O | O | O | O | O | O min_freq | O | O | O | O | O | O max_freq | O | O | O | O | O | O trans_stat | O | O | O | O | O | O -------------------------------------------------------- polling_interval | O | X | X | X | X | O timer | O | X | X | X | X | X ------------------------------------------------------------------------------ Reviewed-by:
Dmitry Osipenko <digetx@gmail.com> Tested-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-
Chanwoo Choi authored
The devfreq governor is able to have the specific flag as follows in order to implement the specific feature. For example, devfreq allows user to change the governors on runtime via sysfs interface. But, if devfreq device uses 'passive' governor, don't allow user to change the governor. For this case, define the DEVFREQ_GOV_FLAG_IMMUTABLE and set it to flag of passive governor. [Definition for governor flag] - DEVFREQ_GOV_FLAG_IMMUTABLE : If immutable flag is set, governor is never changeable to other governors. - DEVFREQ_GOV_FLAG_IRQ_DRIVEN : Devfreq core won't schedule polling work for this governor if value is set. [Table of governor flag for devfreq governors] ------------------------------------------------------------------------------ | simple | perfor | power | user | passive | tegra30 | ondemand | mance | save | space| | ------------------------------------------------------------------------------ immutable | X | X | X | X | O | O interrupt_driven | X(polling)| X | X | X | X | O (irq) ------------------------------------------------------------------------------ Reviewed-by:
Dmitry Osipenko <digetx@gmail.com> Tested-by:
Dmitry Osipenko <digetx@gmail.com> Signed-off-by:
Chanwoo Choi <cw00.choi@samsung.com>
-