interconnect changes for 5.11
Here are the interconnect changes for the 5.10-rc1 merge window consisting of new driver and a cleanup. Driver changes: - New driver for Samsung Exynos SoCs - Misc cleanups Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJfyKneAAoJEIDQzArG2BZjxkgP/A5IFeYEpwhOcG0M8hWmufOD 7suY07nHOm2Ln2UA819nGaS3xew0+OSuFAoKQW+G+pzIxB/PZkOURUFzLLkvrDsg IWi7BH6Q3IYGmd9/KMx0AmVaFVV35HawQmuoqv/tpHE/E0nf6TyqtxK2HfvKt+Ch KMJea5gvnBPZlyItFltTq7XLbc+dyfIh9z37RaEuY2949WG47P4KVegi2RyXm2aL POkYmOxJz2XZxnzmCddl7yAGHr3e8mLc+A+kjGxJ8Dq0fiH7xzFnFEBkHMREaxXg e9XAtimrZ1/g0kdisfOecbcAnRpZCEwqGeZw+ThoczgD7gxF2HLTAbFXT0y+3jor RCT1+u2i6Qi9u0C+U/A1mCqgZ/QkjHoaKi0Habphwbeb59fC9hykU8BwXvlkFldZ xxHVlEdDnmwp3F+cGysgXRaGkRm9REMCG8FvGdKpuuKJpx/DWko+i8nheSBoG+ux tEuNmMiqnhtQ75lwZ0rj0T3cfhTBJJALVk5kX9gsifM7gdnXLnwq2HGhngxC4O5+ z3ngJ4PVc7mvzABWsJOBG+TfYyAHWt+R/LNpxq/2ajVO7NJ2jl6fHD949gtbhcqF NMtYD7EjW3xd0UTRB7Axkr85RE9Z+UNPE3BEHqXA9nNlp/hJzxMQbXgwICWI18tU +CmhQ/0i8RKr3PvvtRm7 =a7If -----END PGP SIGNATURE----- Merge tag 'icc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc into char-misc-next Georgi writes: interconnect changes for 5.11 Here are the interconnect changes for the 5.10-rc1 merge window consisting of new driver and a cleanup. Driver changes: - New driver for Samsung Exynos SoCs - Misc cleanups Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> * tag 'icc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc: MAINTAINERS: Add entry for Samsung interconnect drivers interconnect: Add generic interconnect driver for Exynos SoCs interconnect: qcom: Simplify the vcd compare function
This commit is contained in:
commit
9fb3b4cae4
|
@ -15373,6 +15373,14 @@ L: linux-fbdev@vger.kernel.org
|
|||
S: Maintained
|
||||
F: drivers/video/fbdev/s3c-fb.c
|
||||
|
||||
SAMSUNG INTERCONNECT DRIVERS
|
||||
M: Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
M: Artur Świgoń <a.swigon@samsung.com>
|
||||
L: linux-pm@vger.kernel.org
|
||||
L: linux-samsung-soc@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/interconnect/samsung/
|
||||
|
||||
SAMSUNG LAPTOP DRIVER
|
||||
M: Corentin Chary <corentin.chary@gmail.com>
|
||||
L: platform-driver-x86@vger.kernel.org
|
||||
|
|
|
@ -13,5 +13,6 @@ if INTERCONNECT
|
|||
|
||||
source "drivers/interconnect/imx/Kconfig"
|
||||
source "drivers/interconnect/qcom/Kconfig"
|
||||
source "drivers/interconnect/samsung/Kconfig"
|
||||
|
||||
endif
|
||||
|
|
|
@ -6,3 +6,4 @@ icc-core-objs := core.o bulk.o
|
|||
obj-$(CONFIG_INTERCONNECT) += icc-core.o
|
||||
obj-$(CONFIG_INTERCONNECT_IMX) += imx/
|
||||
obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/
|
||||
obj-$(CONFIG_INTERCONNECT_SAMSUNG) += samsung/
|
||||
|
|
|
@ -41,17 +41,10 @@ struct bcm_voter {
|
|||
|
||||
static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b)
|
||||
{
|
||||
const struct qcom_icc_bcm *bcm_a =
|
||||
list_entry(a, struct qcom_icc_bcm, list);
|
||||
const struct qcom_icc_bcm *bcm_b =
|
||||
list_entry(b, struct qcom_icc_bcm, list);
|
||||
const struct qcom_icc_bcm *bcm_a = list_entry(a, struct qcom_icc_bcm, list);
|
||||
const struct qcom_icc_bcm *bcm_b = list_entry(b, struct qcom_icc_bcm, list);
|
||||
|
||||
if (bcm_a->aux_data.vcd < bcm_b->aux_data.vcd)
|
||||
return -1;
|
||||
else if (bcm_a->aux_data.vcd == bcm_b->aux_data.vcd)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
return bcm_a->aux_data.vcd - bcm_b->aux_data.vcd;
|
||||
}
|
||||
|
||||
static u64 bcm_div(u64 num, u32 base)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config INTERCONNECT_SAMSUNG
|
||||
bool "Samsung SoC interconnect drivers"
|
||||
depends on ARCH_EXYNOS || COMPILE_TEST
|
||||
help
|
||||
Interconnect drivers for Samsung SoCs.
|
||||
|
||||
config INTERCONNECT_EXYNOS
|
||||
tristate "Exynos generic interconnect driver"
|
||||
depends on INTERCONNECT_SAMSUNG
|
||||
default y if ARCH_EXYNOS
|
||||
help
|
||||
Generic interconnect driver for Exynos SoCs.
|
|
@ -0,0 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
exynos-interconnect-objs := exynos.o
|
||||
|
||||
obj-$(CONFIG_INTERCONNECT_EXYNOS) += exynos-interconnect.o
|
|
@ -0,0 +1,199 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Exynos generic interconnect provider driver
|
||||
*
|
||||
* Copyright (c) 2020 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Authors: Artur Świgoń <a.swigon@samsung.com>
|
||||
* Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
*/
|
||||
#include <linux/device.h>
|
||||
#include <linux/interconnect-provider.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO 8
|
||||
|
||||
struct exynos_icc_priv {
|
||||
struct device *dev;
|
||||
|
||||
/* One interconnect node per provider */
|
||||
struct icc_provider provider;
|
||||
struct icc_node *node;
|
||||
|
||||
struct dev_pm_qos_request qos_req;
|
||||
u32 bus_clk_ratio;
|
||||
};
|
||||
|
||||
static struct icc_node *exynos_icc_get_parent(struct device_node *np)
|
||||
{
|
||||
struct of_phandle_args args;
|
||||
struct icc_node_data *icc_node_data;
|
||||
struct icc_node *icc_node;
|
||||
int num, ret;
|
||||
|
||||
num = of_count_phandle_with_args(np, "interconnects",
|
||||
"#interconnect-cells");
|
||||
if (num < 1)
|
||||
return NULL; /* parent nodes are optional */
|
||||
|
||||
/* Get the interconnect target node */
|
||||
ret = of_parse_phandle_with_args(np, "interconnects",
|
||||
"#interconnect-cells", 0, &args);
|
||||
if (ret < 0)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
icc_node_data = of_icc_get_from_provider(&args);
|
||||
of_node_put(args.np);
|
||||
|
||||
if (IS_ERR(icc_node_data))
|
||||
return ERR_CAST(icc_node_data);
|
||||
|
||||
icc_node = icc_node_data->node;
|
||||
kfree(icc_node_data);
|
||||
|
||||
return icc_node;
|
||||
}
|
||||
|
||||
static int exynos_generic_icc_set(struct icc_node *src, struct icc_node *dst)
|
||||
{
|
||||
struct exynos_icc_priv *src_priv = src->data, *dst_priv = dst->data;
|
||||
s32 src_freq = max(src->avg_bw, src->peak_bw) / src_priv->bus_clk_ratio;
|
||||
s32 dst_freq = max(dst->avg_bw, dst->peak_bw) / dst_priv->bus_clk_ratio;
|
||||
int ret;
|
||||
|
||||
ret = dev_pm_qos_update_request(&src_priv->qos_req, src_freq);
|
||||
if (ret < 0) {
|
||||
dev_err(src_priv->dev, "failed to update PM QoS of %s (src)\n",
|
||||
src->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = dev_pm_qos_update_request(&dst_priv->qos_req, dst_freq);
|
||||
if (ret < 0) {
|
||||
dev_err(dst_priv->dev, "failed to update PM QoS of %s (dst)\n",
|
||||
dst->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct icc_node *exynos_generic_icc_xlate(struct of_phandle_args *spec,
|
||||
void *data)
|
||||
{
|
||||
struct exynos_icc_priv *priv = data;
|
||||
|
||||
if (spec->np != priv->dev->parent->of_node)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
return priv->node;
|
||||
}
|
||||
|
||||
static int exynos_generic_icc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct exynos_icc_priv *priv = platform_get_drvdata(pdev);
|
||||
struct icc_node *parent_node, *node = priv->node;
|
||||
|
||||
parent_node = exynos_icc_get_parent(priv->dev->parent->of_node);
|
||||
if (parent_node && !IS_ERR(parent_node))
|
||||
icc_link_destroy(node, parent_node);
|
||||
|
||||
icc_nodes_remove(&priv->provider);
|
||||
icc_provider_del(&priv->provider);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int exynos_generic_icc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *bus_dev = pdev->dev.parent;
|
||||
struct exynos_icc_priv *priv;
|
||||
struct icc_provider *provider;
|
||||
struct icc_node *icc_node, *icc_parent_node;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
provider = &priv->provider;
|
||||
|
||||
provider->set = exynos_generic_icc_set;
|
||||
provider->aggregate = icc_std_aggregate;
|
||||
provider->xlate = exynos_generic_icc_xlate;
|
||||
provider->dev = bus_dev;
|
||||
provider->inter_set = true;
|
||||
provider->data = priv;
|
||||
|
||||
ret = icc_provider_add(provider);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
icc_node = icc_node_create(pdev->id);
|
||||
if (IS_ERR(icc_node)) {
|
||||
ret = PTR_ERR(icc_node);
|
||||
goto err_prov_del;
|
||||
}
|
||||
|
||||
priv->node = icc_node;
|
||||
icc_node->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
|
||||
bus_dev->of_node);
|
||||
if (of_property_read_u32(bus_dev->of_node, "samsung,data-clock-ratio",
|
||||
&priv->bus_clk_ratio))
|
||||
priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO;
|
||||
|
||||
/*
|
||||
* Register a PM QoS request for the parent (devfreq) device.
|
||||
*/
|
||||
ret = dev_pm_qos_add_request(bus_dev, &priv->qos_req,
|
||||
DEV_PM_QOS_MIN_FREQUENCY, 0);
|
||||
if (ret < 0)
|
||||
goto err_node_del;
|
||||
|
||||
icc_node->data = priv;
|
||||
icc_node_add(icc_node, provider);
|
||||
|
||||
icc_parent_node = exynos_icc_get_parent(bus_dev->of_node);
|
||||
if (IS_ERR(icc_parent_node)) {
|
||||
ret = PTR_ERR(icc_parent_node);
|
||||
goto err_pmqos_del;
|
||||
}
|
||||
if (icc_parent_node) {
|
||||
ret = icc_link_create(icc_node, icc_parent_node->id);
|
||||
if (ret < 0)
|
||||
goto err_pmqos_del;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pmqos_del:
|
||||
dev_pm_qos_remove_request(&priv->qos_req);
|
||||
err_node_del:
|
||||
icc_nodes_remove(provider);
|
||||
err_prov_del:
|
||||
icc_provider_del(provider);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct platform_driver exynos_generic_icc_driver = {
|
||||
.driver = {
|
||||
.name = "exynos-generic-icc",
|
||||
.sync_state = icc_sync_state,
|
||||
},
|
||||
.probe = exynos_generic_icc_probe,
|
||||
.remove = exynos_generic_icc_remove,
|
||||
};
|
||||
module_platform_driver(exynos_generic_icc_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Exynos generic interconnect driver");
|
||||
MODULE_AUTHOR("Artur Świgoń <a.swigon@samsung.com>");
|
||||
MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_ALIAS("platform:exynos-generic-icc");
|
Loading…
Reference in New Issue