esoc: add support for additonal physical link info

Some of the device configurations support multiple external SOCs.
To differentiate physical links, add support for additonal info
about the physical link.

CRs-Fixed: 2024578
Change-Id: If71bf23d798f8bf0b6594a686415fe9b806e4226
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Satya Durga Srinivasu Prabhala 2017-03-14 16:51:50 -07:00
parent 27489753bf
commit 090a6c0e90
6 changed files with 32 additions and 4 deletions

View file

@ -108,6 +108,8 @@ Optional driver parameters:
- qcom,sysmon-id: platform device id that sysmon is probed with for the subsystem.
- qcom,pil-force-shutdown: Boolean. If set, the SSR framework will not trigger graceful shutdown
on behalf of the subsystem driver.
- qcom,mdm-link-info: a string indicating additional info about the physical link.
For example: "devID_domain.bus.slot" in case of PCIe.
Example:
mdm0: qcom,mdm0 {

View file

@ -937,6 +937,10 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm,
mdm->dual_interface = of_property_read_bool(node,
"qcom,mdm-dual-link");
esoc->link_name = MDM9x55_PCIE;
ret = of_property_read_string(node, "qcom,mdm-link-info",
&esoc->link_info);
if (ret)
dev_info(mdm->dev, "esoc link info missing\n");
esoc->clink_ops = clink_ops;
esoc->parent = mdm->dev;
esoc->owner = THIS_MODULE;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -46,6 +46,7 @@ struct esoc_eng {
* struct esoc_clink: Representation of external esoc device
* @name: Name of the external esoc.
* @link_name: name of the physical link.
* @link_info: additional info about the physical link.
* @parent: parent device.
* @dev: device for userspace interface.
* @id: id of the external device.
@ -62,6 +63,7 @@ struct esoc_eng {
struct esoc_clink {
const char *name;
const char *link_name;
const char *link_info;
struct device *parent;
struct device dev;
unsigned int id;

View file

@ -32,10 +32,19 @@ esoc_link_show(struct device *dev, struct device_attribute *attr,
to_esoc_clink(dev)->link_name);
}
static ssize_t
esoc_link_info_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
return snprintf(buf, ESOC_LINK_LEN, "%s",
to_esoc_clink(dev)->link_info);
}
static struct device_attribute esoc_clink_attrs[] = {
__ATTR_RO(esoc_name),
__ATTR_RO(esoc_link),
__ATTR_RO(esoc_link_info),
__ATTR_NULL,
};

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -43,7 +43,7 @@ struct esoc_desc *devm_register_esoc_client(struct device *dev,
struct device_node *np = dev->of_node;
struct esoc_clink *esoc_clink;
struct esoc_desc *desc;
char *esoc_name, *esoc_link;
char *esoc_name, *esoc_link, *esoc_link_info;
for (index = 0;; index++) {
esoc_prop = kasprintf(GFP_KERNEL, "esoc-%d", index);
@ -85,16 +85,26 @@ struct esoc_desc *devm_register_esoc_client(struct device *dev,
kfree(esoc_name);
return ERR_PTR(-ENOMEM);
}
esoc_link_info = kasprintf(GFP_KERNEL, "%s",
esoc_clink->link_info);
if (IS_ERR_OR_NULL(esoc_link_info)) {
dev_err(dev, "unable to alloc link info name\n");
kfree(esoc_name);
kfree(esoc_link);
return ERR_PTR(-ENOMEM);
}
desc = devres_alloc(devm_esoc_desc_release,
sizeof(*desc), GFP_KERNEL);
if (IS_ERR_OR_NULL(desc)) {
kfree(esoc_name);
kfree(esoc_link);
kfree(esoc_link_info);
dev_err(dev, "unable to allocate esoc descriptor\n");
return ERR_PTR(-ENOMEM);
}
desc->name = esoc_name;
desc->link = esoc_link;
desc->link_info = esoc_link_info;
desc->priv = esoc_clink;
devres_add(dev, desc);
return desc;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -24,6 +24,7 @@
struct esoc_desc {
const char *name;
const char *link;
const char *link_info;
void *priv;
};