mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00

Refreshed patches for qualcommb/ipq95xx by running make target/linux/refresh after creating a .config containing: CONFIG_TARGET_qualcommbe=y CONFIG_TARGET_qualcommbe_ipq95xx=y CONFIG_TARGET_qualcommbe_ipq95xx_DEVICE_qcom_rdp433=y Signed-off-by: John Audia <therealgraysky@proton.me> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
108 lines
3.3 KiB
Diff
108 lines
3.3 KiB
Diff
From 265b07df758a998f60cf5b5aec6bd72ca676655e Mon Sep 17 00:00:00 2001
|
|
From: Shradha Todi <shradha.t@samsung.com>
|
|
Date: Tue, 20 Feb 2024 14:10:45 +0530
|
|
Subject: [PATCH] clk: Provide managed helper to get and enable bulk clocks
|
|
|
|
Provide a managed devm_clk_bulk* wrapper to get and enable all
|
|
bulk clocks in order to simplify drivers that keeps all clocks
|
|
enabled for the time of driver operation.
|
|
|
|
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
|
|
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
|
|
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
|
Signed-off-by: Shradha Todi <shradha.t@samsung.com>
|
|
Link: https://lore.kernel.org/r/20240220084046.23786-2-shradha.t@samsung.com
|
|
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
|
|
---
|
|
drivers/clk/clk-devres.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
include/linux/clk.h | 22 ++++++++++++++++++++++
|
|
2 files changed, 62 insertions(+)
|
|
|
|
--- a/drivers/clk/clk-devres.c
|
|
+++ b/drivers/clk/clk-devres.c
|
|
@@ -182,6 +182,46 @@ int __must_check devm_clk_bulk_get_all(s
|
|
}
|
|
EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all);
|
|
|
|
+static void devm_clk_bulk_release_all_enable(struct device *dev, void *res)
|
|
+{
|
|
+ struct clk_bulk_devres *devres = res;
|
|
+
|
|
+ clk_bulk_disable_unprepare(devres->num_clks, devres->clks);
|
|
+ clk_bulk_put_all(devres->num_clks, devres->clks);
|
|
+}
|
|
+
|
|
+int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
|
|
+ struct clk_bulk_data **clks)
|
|
+{
|
|
+ struct clk_bulk_devres *devres;
|
|
+ int ret;
|
|
+
|
|
+ devres = devres_alloc(devm_clk_bulk_release_all_enable,
|
|
+ sizeof(*devres), GFP_KERNEL);
|
|
+ if (!devres)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ ret = clk_bulk_get_all(dev, &devres->clks);
|
|
+ if (ret > 0) {
|
|
+ *clks = devres->clks;
|
|
+ devres->num_clks = ret;
|
|
+ } else {
|
|
+ devres_free(devres);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ ret = clk_bulk_prepare_enable(devres->num_clks, *clks);
|
|
+ if (!ret) {
|
|
+ devres_add(dev, devres);
|
|
+ } else {
|
|
+ clk_bulk_put_all(devres->num_clks, devres->clks);
|
|
+ devres_free(devres);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all_enable);
|
|
+
|
|
static int devm_clk_match(struct device *dev, void *res, void *data)
|
|
{
|
|
struct clk **c = res;
|
|
--- a/include/linux/clk.h
|
|
+++ b/include/linux/clk.h
|
|
@@ -479,6 +479,22 @@ int __must_check devm_clk_bulk_get_all(s
|
|
struct clk_bulk_data **clks);
|
|
|
|
/**
|
|
+ * devm_clk_bulk_get_all_enable - Get and enable all clocks of the consumer (managed)
|
|
+ * @dev: device for clock "consumer"
|
|
+ * @clks: pointer to the clk_bulk_data table of consumer
|
|
+ *
|
|
+ * Returns success (0) or negative errno.
|
|
+ *
|
|
+ * This helper function allows drivers to get all clocks of the
|
|
+ * consumer and enables them in one operation with management.
|
|
+ * The clks will automatically be disabled and freed when the device
|
|
+ * is unbound.
|
|
+ */
|
|
+
|
|
+int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
|
|
+ struct clk_bulk_data **clks);
|
|
+
|
|
+/**
|
|
* devm_clk_get - lookup and obtain a managed reference to a clock producer.
|
|
* @dev: device for clock "consumer"
|
|
* @id: clock consumer ID
|
|
@@ -968,6 +984,12 @@ static inline int __must_check devm_clk_
|
|
return 0;
|
|
}
|
|
|
|
+static inline int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
|
|
+ struct clk_bulk_data **clks)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static inline struct clk *devm_get_clk_from_child(struct device *dev,
|
|
struct device_node *np, const char *con_id)
|
|
{
|