--- zzzz-none-000/linux-5.4.213/drivers/hwtracing/coresight/coresight-funnel.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/hwtracing/coresight/coresight-funnel.c 2024-08-14 09:01:58.000000000 +0000 @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2012,2017, 2020, The Linux Foundation. All rights reserved. * * Description: CoreSight Funnel driver */ @@ -32,6 +32,8 @@ DEFINE_CORESIGHT_DEVLIST(funnel_devs, "funnel"); +#define FUNNEL_MAX_PORT 7 + /** * struct funnel_drvdata - specifics associated to a funnel component * @base: memory mapped base address for this component. @@ -194,7 +196,26 @@ return sprintf(buf, "%#x\n", val); } -static DEVICE_ATTR_RO(funnel_ctrl); + +static ssize_t funnel_ctrl_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + int ret, port; + struct funnel_drvdata *drvdata = dev_get_drvdata(dev->parent); + + ret = kstrtoint(buf, 0, &port); + if (ret) + return ret; + + if (port < 0 || port > FUNNEL_MAX_PORT) + return -EINVAL; + + funnel_enable(drvdata->csdev, port, 0); + + return size; +} +static DEVICE_ATTR_RW(funnel_ctrl); static struct attribute *coresight_funnel_attrs[] = { &dev_attr_funnel_ctrl.attr, @@ -215,7 +236,8 @@ of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n"); - desc.name = coresight_alloc_device_name(&funnel_devs, dev); + if (of_property_read_string(dev->of_node, "coresight-name", &desc.name)) + desc.name = coresight_alloc_device_name(&funnel_devs, dev); if (!desc.name) return -ENOMEM; @@ -246,6 +268,8 @@ dev_set_drvdata(dev, drvdata); + spin_lock_init(&drvdata->spinlock); + pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) { ret = PTR_ERR(pdata);