Skip to content
Permalink
Browse files
debug for headphone soundcard
[    1.443150] DEBUG: Passed mfd_add_device 170 name:rk817-codec
[    1.443557] DEBUG: Passed mfd_add_device 174
[    1.443839] DEBUG: Passed mfd_add_device 178
[    1.444118] DEBUG: Passed mfd_add_device 182
[    1.444398] DEBUG: Passed mfd_add_device 195 node:0xffffff807fbc4640,compatible:(null)
[    1.444992] DEBUG: Passed mfd_add_device 224
[    1.445261] DEBUG: Passed mfd_add_device 231
[    1.445532] DEBUG: Passed mfd_add_device 237
[    1.445821] DEBUG: Passed mfd_add_device 276
[    1.446095] DEBUG: Passed mfd_add_device 278 add_res-ret:0
[    1.446607] DEBUG: Passed mfd_add_device 283 device_add-ret:0
[    1.447013] DEBUG: Passed mfd_add_device 286
[    1.447284] DEBUG: Passed mfd_add_device 289

[    2.457176] DEBUG: Passed __simple_for_each_link 361
[    2.457570] DEBUG: Passed __simple_for_each_link 391 ret:-517
[    2.457995] DEBUG: Passed simple_for_each_link 437 ret:-517
[    2.458387] asoc-simple-card rk809-sound: DEBUG: Passed simple_parse_of 470 ret:-517
  • Loading branch information
frank-w committed Feb 13, 2022
1 parent 97e7bee commit 1699cddf654f06e318ea18f3cc11d29bb0e0d135
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 39 deletions.
@@ -113,37 +113,37 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
struct mfd_of_node_entry *of_entry;
const __be32 *reg;
u64 of_node_addr;

printk(KERN_ALERT "DEBUG: Passed %s %d cell-name:%s\n",__FUNCTION__,__LINE__,cell->name);
/* Skip if OF node has previously been allocated to a device */
list_for_each_entry(of_entry, &mfd_of_node_list, list)
if (of_entry->np == np)
return -EAGAIN;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
if (!cell->use_of_reg)
/* No of_reg defined - allocate first free compatible match */
goto allocate_of_node;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
/* We only care about each node's first defined address */
reg = of_get_address(np, 0, NULL, NULL);
if (!reg)
/* OF node does not contatin a 'reg' property to match to */
return -EAGAIN;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
of_node_addr = of_read_number(reg, of_n_addr_cells(np));

if (cell->of_reg != of_node_addr)
/* No match */
return -EAGAIN;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
allocate_of_node:
of_entry = kzalloc(sizeof(*of_entry), GFP_KERNEL);
if (!of_entry)
return -ENOMEM;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
of_entry->dev = &pdev->dev;
of_entry->np = np;
list_add_tail(&of_entry->list, &mfd_of_node_list);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
pdev->dev.of_node = np;
pdev->dev.fwnode = &np->fwnode;
#endif
@@ -167,19 +167,19 @@ static int mfd_add_device(struct device *parent, int id,
platform_id = id;
else
platform_id = id + cell->id;

printk(KERN_ALERT "DEBUG: Passed %s %d name:%s\n",__FUNCTION__,__LINE__,cell->name);
pdev = platform_device_alloc(cell->name, platform_id);
if (!pdev)
goto fail_alloc;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL);
if (!pdev->mfd_cell)
goto fail_device;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);
if (!res)
goto fail_device;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
pdev->dev.parent = parent;
pdev->dev.type = &mfd_dev_type;
pdev->dev.dma_mask = parent->dma_mask;
@@ -192,9 +192,10 @@ static int mfd_add_device(struct device *parent, int id,
cell->num_parent_supplies);
if (ret < 0)
goto fail_res;

printk(KERN_ALERT "DEBUG: Passed %s %d node:0x%lx,compatible:%s\n",__FUNCTION__,__LINE__,(unsigned long)parent->of_node,cell->of_compatible);
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
for_each_child_of_node(parent->of_node, np) {
printk(KERN_ALERT "DEBUG: Passed %s %d cell-name:%s\n",__FUNCTION__,__LINE__,cell->name);
if (of_device_is_compatible(np, cell->of_compatible)) {
/* Ignore 'disabled' devices error free */
if (!of_device_is_available(np)) {
@@ -220,20 +221,20 @@ static int mfd_add_device(struct device *parent, int id,
}

mfd_acpi_add_device(cell, pdev);

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
if (cell->pdata_size) {
ret = platform_device_add_data(pdev,
cell->platform_data, cell->pdata_size);
if (ret)
goto fail_of_entry;
}

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
if (cell->swnode) {
ret = device_add_software_node(&pdev->dev, cell->swnode);
if (ret)
goto fail_of_entry;
}

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
for (r = 0; r < cell->num_resources; r++) {
res[r].name = cell->resources[r].name;
res[r].flags = cell->resources[r].flags;
@@ -272,18 +273,20 @@ static int mfd_add_device(struct device *parent, int id,
}
}
}

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
ret = platform_device_add_resources(pdev, res, cell->num_resources);
printk(KERN_ALERT "DEBUG: Passed %s %d add_res-ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret)
goto fail_res_conflict;

ret = platform_device_add(pdev);
printk(KERN_ALERT "DEBUG: Passed %s %d device_add-ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret)
goto fail_res_conflict;

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
if (cell->pm_runtime_no_callbacks)
pm_runtime_no_callbacks(&pdev->dev);

printk(KERN_ALERT "DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
kfree(res);

return 0;
@@ -416,20 +416,20 @@ static int rk817_probe(struct snd_soc_component *component)
{
struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component);
struct rk808 *rk808 = dev_get_drvdata(component->dev->parent);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
snd_soc_component_init_regmap(component, rk808->regmap);
rk817->component = component;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
snd_soc_component_write(component, RK817_CODEC_DTOP_LPT_SRST, 0x40);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
rk817_init(component);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
/* setting initial pll values so that we can continue to leverage simple-audio-card.
* The values aren't important since no parameters are used.
*/

snd_soc_component_set_pll(component, 0, 0, 0, 0);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
return 0;
}

@@ -353,12 +353,12 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv,
/* get platform */
plat = of_get_child_by_name(node, is_top ?
PREFIX "plat" : "plat");

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
/* get convert-xxx property */
memset(&adata, 0, sizeof(adata));
for_each_child_of_node(node, np)
simple_parse_convert(dev, np, &adata);

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);
/* loop for all CPU/Codec node */
for_each_child_of_node(node, np) {
if (plat == np)
@@ -378,7 +378,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv,
* Codec |return|Pass
*/
if (li->cpu != (np == codec))
ret = func_dpcm(priv, np, codec, li, is_top);
{ret = func_dpcm(priv, np, codec, li, is_top);printk(KERN_ALERT "DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);}
/* else normal sound */
} else {
/*
@@ -388,7 +388,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv,
* Codec |return|return
*/
if (li->cpu && (np != codec))
ret = func_noml(priv, np, codec, li, is_top);
{ret = func_noml(priv, np, codec, li, is_top);printk(KERN_ALERT "DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);}
}

if (ret < 0) {
@@ -433,6 +433,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
*/
for (li->cpu = 1; li->cpu >= 0; li->cpu--) {
ret = __simple_for_each_link(priv, li, func_noml, func_dpcm);
printk(KERN_ALERT "DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
break;
}
@@ -444,33 +445,38 @@ static int simple_parse_of(struct asoc_simple_priv *priv, struct link_info *li)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
int ret;

dev_err(card->dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
ret = asoc_simple_parse_widgets(card, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

ret = asoc_simple_parse_routing(card, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

ret = asoc_simple_parse_pin_switches(card, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

dev_err(card->dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
/* Single/Muti DAI link(s) & New style of DT node */
memset(li, 0, sizeof(*li));
ret = simple_for_each_link(priv, li,
simple_dai_link_of,
simple_dai_link_of_dpcm);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

ret = asoc_simple_parse_card_name(card, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

ret = snd_soc_of_parse_aux_devs(card, PREFIX "aux-devs");

dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
return ret;
}

@@ -591,12 +597,14 @@ static int simple_soc_probe(struct snd_soc_card *card)
{
struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card);
int ret;

dev_err(card->dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
ret = asoc_simple_init_hp(card, &priv->hp_jack, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

ret = asoc_simple_init_mic(card, &priv->mic_jack, PREFIX);
dev_err(card->dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

@@ -611,7 +619,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
struct snd_soc_card *card;
struct link_info *li;
int ret;

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
/* Allocate the private data and the DAI link array */
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -628,25 +636,28 @@ static int asoc_simple_probe(struct platform_device *pdev)
return -ENOMEM;

ret = simple_get_dais_count(priv, li);
dev_err(dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

if (!li->link)
return -EINVAL;

ret = asoc_simple_init_priv(priv, li);
dev_err(dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
return ret;

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
if (np && of_device_is_available(np)) {

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
ret = simple_parse_of(priv, li);
if (ret < 0) {
dev_err_probe(dev, ret, "parse error\n");
goto err;
}

} else {
dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
struct asoc_simple_card_info *cinfo;
struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link_component *codecs;
@@ -659,7 +670,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
dev_err(dev, "no info for asoc-simple-card\n");
return -EINVAL;
}

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
if (!cinfo->name ||
!cinfo->codec_dai.name ||
!cinfo->codec ||
@@ -689,12 +700,13 @@ static int asoc_simple_probe(struct platform_device *pdev)
memcpy(dai_props->codec_dai, &cinfo->codec_dai,
sizeof(*dai_props->codec_dai));
}

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
snd_soc_card_set_drvdata(card, priv);

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
asoc_simple_debug_info(priv);

dev_err(dev,"DEBUG: Passed %s %d\n",__FUNCTION__,__LINE__);
ret = devm_snd_soc_register_card(dev, card);
dev_err(dev,"DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
if (ret < 0)
goto err;

@@ -1065,7 +1065,9 @@ int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
if (component->driver->pcm_construct) {
ret = component->driver->pcm_construct(component, rtd);
if (ret < 0)
return soc_component_ret(component, ret);
{
printk(KERN_ALERT "DEBUG: Passed %s %d ret:%d\n",__FUNCTION__,__LINE__,ret);
return soc_component_ret(component, ret);}
}
}

0 comments on commit 1699cdd

Please sign in to comment.