Commit 3c5597e3 authored by Mike Leach's avatar Mike Leach Committed by Greg Kroah-Hartman

coresight: cti: Add connection information to sysfs

Dynamically adds sysfs attributes for all connections defined in the CTI.

Each connection has a triggers<N> sub-directory with name, in_signals,
in_types, out_signals and out_types as read-only parameters in the
directory. in_ or out_ parameters may be omitted if there are no in or
out signals for the connection.

Additionally each device has a nr_cons in the connections sub-directory.

This allows clients to explore the connection and trigger signal details
without needing to refer to device tree or specification of the device.

Standardised type information is provided for certain common functions -
e.g. snk_full for a trigger from a sink indicating full. Otherwise type
defaults to genio.
Signed-off-by: default avatarMike Leach <mike.leach@linaro.org>
Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200320165303.13681-10-mathieu.poirier@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 177af828
...@@ -673,12 +673,20 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -673,12 +673,20 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id)
goto err_out; goto err_out;
} }
/* create dynamic attributes for connections */
ret = cti_create_cons_sysfs(dev, drvdata);
if (ret) {
dev_err(dev, "%s: create dynamic sysfs entries failed\n",
cti_desc.name);
goto err_out;
}
/* set up coresight component description */ /* set up coresight component description */
cti_desc.pdata = pdata; cti_desc.pdata = pdata;
cti_desc.type = CORESIGHT_DEV_TYPE_ECT; cti_desc.type = CORESIGHT_DEV_TYPE_ECT;
cti_desc.subtype.ect_subtype = CORESIGHT_DEV_SUBTYPE_ECT_CTI; cti_desc.subtype.ect_subtype = CORESIGHT_DEV_SUBTYPE_ECT_CTI;
cti_desc.ops = &cti_ops; cti_desc.ops = &cti_ops;
cti_desc.groups = coresight_cti_groups; cti_desc.groups = drvdata->ctidev.con_groups;
cti_desc.dev = dev; cti_desc.dev = dev;
drvdata->csdev = coresight_register(&cti_desc); drvdata->csdev = coresight_register(&cti_desc);
if (IS_ERR(drvdata->csdev)) { if (IS_ERR(drvdata->csdev)) {
......
...@@ -74,6 +74,8 @@ struct cti_trig_grp { ...@@ -74,6 +74,8 @@ struct cti_trig_grp {
* @con_dev: coresight device connected to the CTI, NULL if not CS device * @con_dev: coresight device connected to the CTI, NULL if not CS device
* @con_dev_name: name of connected device (CS or CPU) * @con_dev_name: name of connected device (CS or CPU)
* @node: entry node in list of connections. * @node: entry node in list of connections.
* @con_attrs: Dynamic sysfs attributes specific to this connection.
* @attr_group: Dynamic attribute group created for this connection.
*/ */
struct cti_trig_con { struct cti_trig_con {
struct cti_trig_grp *con_in; struct cti_trig_grp *con_in;
...@@ -81,6 +83,8 @@ struct cti_trig_con { ...@@ -81,6 +83,8 @@ struct cti_trig_con {
struct coresight_device *con_dev; struct coresight_device *con_dev;
const char *con_dev_name; const char *con_dev_name;
struct list_head node; struct list_head node;
struct attribute **con_attrs;
struct attribute_group *attr_group;
}; };
/** /**
...@@ -91,12 +95,15 @@ struct cti_trig_con { ...@@ -91,12 +95,15 @@ struct cti_trig_con {
* assumed there is a single CTM per SoC, ID 0). * assumed there is a single CTM per SoC, ID 0).
* @trig_cons: list of connections to this device. * @trig_cons: list of connections to this device.
* @cpu: CPU ID if associated with CPU, -1 otherwise. * @cpu: CPU ID if associated with CPU, -1 otherwise.
* @con_groups: combined static and dynamic sysfs groups for trigger
* connections.
*/ */
struct cti_device { struct cti_device {
int nr_trig_con; int nr_trig_con;
u32 ctm_id; u32 ctm_id;
struct list_head trig_cons; struct list_head trig_cons;
int cpu; int cpu;
const struct attribute_group **con_groups;
}; };
/** /**
...@@ -214,6 +221,7 @@ int cti_channel_gate_op(struct device *dev, enum cti_chan_gate_op op, ...@@ -214,6 +221,7 @@ int cti_channel_gate_op(struct device *dev, enum cti_chan_gate_op op,
u32 channel_idx); u32 channel_idx);
int cti_channel_setop(struct device *dev, enum cti_chan_set_op op, int cti_channel_setop(struct device *dev, enum cti_chan_set_op op,
u32 channel_idx); u32 channel_idx);
int cti_create_cons_sysfs(struct device *dev, struct cti_drvdata *drvdata);
struct coresight_platform_data * struct coresight_platform_data *
coresight_cti_get_platform_data(struct device *dev); coresight_cti_get_platform_data(struct device *dev);
const char *cti_plat_get_node_name(struct fwnode_handle *fwnode); const char *cti_plat_get_node_name(struct fwnode_handle *fwnode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment