mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 16:16:15 -04:00
neuron: ch_haven: Add support for svm device tree format
The secondary vm device tree will have a different format than the primary vm. Try parsing the node as a secondary vm node if the shared-buffer region does not exist. Change-Id: Id794a1b21507329f4e16f1335a17a2262ecabd5a Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
parent
66af98dc3f
commit
d5e3b87efb
2 changed files with 72 additions and 4 deletions
|
|
@ -372,6 +372,37 @@ static int channel_hh_rm_cb(struct notifier_block *nb, unsigned long cmd,
|
|||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct device_node *
|
||||
channel_hh_svm_of_parse(struct neuron_mq_data_priv *priv, struct device *dev)
|
||||
{
|
||||
const char *compat = "qcom,neuron-channel-haven-shmem-gen";
|
||||
struct device_node *np = NULL;
|
||||
struct device_node *shm_np;
|
||||
u32 label;
|
||||
int ret;
|
||||
|
||||
while ((np = of_find_compatible_node(np, NULL, compat))) {
|
||||
ret = of_property_read_u32(np, "qcom,label", &label);
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
continue;
|
||||
}
|
||||
if (label == priv->haven_label)
|
||||
break;
|
||||
|
||||
of_node_put(np);
|
||||
}
|
||||
if (!np)
|
||||
return NULL;
|
||||
|
||||
shm_np = of_parse_phandle(np, "memory-region", 0);
|
||||
if (!shm_np)
|
||||
dev_err(dev, "cant parse svm shared mem node!\n");
|
||||
|
||||
of_node_put(np);
|
||||
return shm_np;
|
||||
}
|
||||
|
||||
static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
|
||||
struct device *dev)
|
||||
{
|
||||
|
|
@ -382,8 +413,11 @@ static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
|
|||
|
||||
np = of_parse_phandle(dev->of_node, "shared-buffer", 0);
|
||||
if (!np) {
|
||||
dev_err(dev, "shared-buffer node missing!\n");
|
||||
return -EINVAL;
|
||||
np = channel_hh_svm_of_parse(priv, dev);
|
||||
if (!np) {
|
||||
dev_err(dev, "cant parse shared mem node!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
ret = of_address_to_resource(np, 0, &priv->buffer);
|
||||
|
|
|
|||
|
|
@ -355,6 +355,37 @@ static int channel_hh_rm_cb(struct notifier_block *nb, unsigned long cmd,
|
|||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct device_node *
|
||||
channel_hh_svm_of_parse(struct neuron_mq_data_priv *priv, struct device *dev)
|
||||
{
|
||||
const char *compat = "qcom,neuron-channel-haven-shmem-gen";
|
||||
struct device_node *np = NULL;
|
||||
struct device_node *shm_np;
|
||||
u32 label;
|
||||
int ret;
|
||||
|
||||
while ((np = of_find_compatible_node(np, NULL, compat))) {
|
||||
ret = of_property_read_u32(np, "qcom,label", &label);
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
continue;
|
||||
}
|
||||
if (label == priv->haven_label)
|
||||
break;
|
||||
|
||||
of_node_put(np);
|
||||
}
|
||||
if (!np)
|
||||
return NULL;
|
||||
|
||||
shm_np = of_parse_phandle(np, "memory-region", 0);
|
||||
if (!shm_np)
|
||||
dev_err(dev, "cant parse svm shared mem node!\n");
|
||||
|
||||
of_node_put(np);
|
||||
return shm_np;
|
||||
}
|
||||
|
||||
static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
|
||||
struct device *dev)
|
||||
{
|
||||
|
|
@ -365,8 +396,11 @@ static int channel_hh_map_memory(struct neuron_mq_data_priv *priv,
|
|||
|
||||
np = of_parse_phandle(dev->of_node, "shared-buffer", 0);
|
||||
if (!np) {
|
||||
dev_err(dev, "shared-buffer node missing!\n");
|
||||
return -EINVAL;
|
||||
np = channel_hh_svm_of_parse(priv, dev);
|
||||
if (!np) {
|
||||
dev_err(dev, "cant parse shared mem node!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
ret = of_address_to_resource(np, 0, &priv->buffer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue