static int escore_slim_device_up(struct slim_device *sbdev) { const struct slim_driver *sdrv; const struct slim_device_id *id; int rc = 0; dev_dbg(&sbdev->dev, "%s: name=%s laddr=%d\n", __func__, sbdev->name, sbdev->laddr); sdrv = to_slim_driver(sbdev->dev.driver); id = (sdrv ? escore_slim_match(sdrv->id_table, sbdev) : NULL); mutex_lock(&slimbus_fw_load_mutex); /* * Allow device-up handling only for Generic device. * This is because only Generic device node's contains the * required DT properties. */ if (id && id->driver_data) { if (id->driver_data == ESCORE_GENERIC_DEVICE) { slim_set_clientdata(sbdev, &escore_priv); escore_priv.gen0_client = sbdev; escore_priv.device_up_called = 1; rc = escore_probe(&escore_priv, &escore_priv.gen0_client->dev, ES_SLIM_INTF, ES_CONTEXT_THREAD); if (rc) dev_err(&sbdev->dev, "%s(): error, rc = %d\n", __func__, rc); } } mutex_unlock(&slimbus_fw_load_mutex); return rc; }
static int es705_slim_probe(struct slim_device *sbdev) { int rc; #if defined(SLIMBUS_VER_1) struct task_struct *thread = NULL; #endif dev_info(&sbdev->dev, "%s(): sbdev->name = %s\n", __func__, sbdev->name); #ifdef CONFIG_SND_SOC_ES704_TEMP if (!strcmp(sbdev->name, "es704-codec-gen0")) { dev_info(&sbdev->dev, "%s() ES704 device, wait some time\n", __func__); msleep(10); if (dev_selected) { dev_info(&sbdev->dev, "%s(): dev_selected is True, return\n", __func__); return -1; } } #endif if (sbdev->dev.of_node) { rc = es705_slim_probe_dts(sbdev); if (rc) goto es705_core_probe_error; } else { es705_slim_probe_nodts(sbdev); } if (es705_priv.intf_client == NULL || es705_priv.gen0_client == NULL) { dev_dbg(&sbdev->dev, "%s(): incomplete initialization\n", __func__); return 0; } slim_set_clientdata(sbdev, &es705_priv); es705_priv.intf = ES705_SLIM_INTF; es705_priv.dev_read = es705_slim_read; es705_priv.dev_write = es705_slim_write; es705_priv.dev_write_then_read = es705_slim_write_then_read; es705_priv.vs_streaming = es705_slim_vs_streaming; es705_priv.streamdev = uart_streamdev; es705_priv.boot_setup = es705_slim_boot_setup; es705_priv.boot_finish = es705_slim_boot_finish; es705_priv.wakeup_bus = es705_slim_wakeup_bus; es705_priv.cmd = es705_slim_cmd; es705_priv.dev = &es705_priv.gen0_client->dev; rc = es705_core_probe(&es705_priv.gen0_client->dev); if (rc) { dev_err(&sbdev->dev, "%s(): es705_core_probe() failed %d\n", __func__, rc); goto es705_core_probe_error; } #if defined(SLIMBUS_VER_1) thread = kthread_run(es705_fw_thread, &es705_priv, "audience thread"); if (IS_ERR(thread)) { dev_err(&sbdev->dev, "%s(): can't create es705 firmware thread = %p\n", __func__, thread); return -1; } #endif return 0; es705_core_probe_error: dev_dbg(&sbdev->dev, "%s(): exit with error\n", __func__); return rc; }
static int escore_slim_probe(struct slim_device *sbdev) { struct escore_priv *escore = &escore_priv; const struct slim_driver *sdrv; const struct slim_device_id *id; static struct slim_device intf_dev; int rc = 0; dev_dbg(&sbdev->dev, "%s(): sbdev->name = %s\n", __func__, sbdev->name); #ifdef CONFIG_SLIMBUS_MSM_NGD mutex_lock(&slimbus_fw_load_mutex); if (escore->device_up_called) { dev_dbg(&sbdev->dev, "Device up already called\n"); goto out; } #endif if (sbdev->dev.of_node) { rc = populate_and_trigger_reset(&sbdev->dev); if (rc) { dev_err(&sbdev->dev, "%s(): chip reset failed : %d\n", __func__, rc); goto escore_core_probe_error; } } sdrv = to_slim_driver(sbdev->dev.driver); id = (sdrv ? escore_slim_match(sdrv->id_table, sbdev) : NULL); if (id->driver_data == ESCORE_GENERIC_DEVICE) { dev_dbg(&sbdev->dev, "%s(): generic device probe\n", __func__); escore_priv.gen0_client = sbdev; slim_set_clientdata(sbdev, &escore_priv); } if (!sbdev->dev.of_node) { if (id->driver_data == ESCORE_INTERFACE_DEVICE) { dev_dbg(&sbdev->dev, "%s(): interface device probe\n", __func__); escore_priv.intf_client = sbdev; slim_set_clientdata(sbdev, &escore_priv); } } else { escore_priv.intf_client = &intf_dev; } if (escore_priv.intf_client == NULL || escore_priv.gen0_client == NULL) { dev_dbg(&sbdev->dev, "%s() incomplete initialization\n", __func__); goto out; } if (escore_priv.gen0_client->dev.of_node) { rc = escore_dt_parse_slim_dev_info(escore_priv.gen0_client, escore_priv.intf_client); if (rc < 0) goto escore_core_probe_error; } if (escore->pri_intf == ES_SLIM_INTF) escore->bus.setup_prim_intf = escore_slim_setup_pri_intf; if (escore->high_bw_intf == ES_SLIM_INTF) escore->bus.setup_high_bw_intf = escore_slim_setup_high_bw_intf; #ifndef CONFIG_SLIMBUS_MSM_NGD rc = escore_probe(&escore_priv, &escore_priv.gen0_client->dev, ES_SLIM_INTF, ES_CONTEXT_PROBE); #endif #ifdef CONFIG_SLIMBUS_MSM_NGD mutex_unlock(&slimbus_fw_load_mutex); #endif return rc; escore_core_probe_error: dev_err(&sbdev->dev, "%s(): exit with error, rc = %d\n", __func__, rc); out: #ifdef CONFIG_SLIMBUS_MSM_NGD mutex_unlock(&slimbus_fw_load_mutex); #endif return rc; }