//+++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Function Name: DriverProbe // // Description: 'probe' call back function // //------------------------------------------------------------ static int __devinit DriverProbe(struct platform_device *pdev) { struct snd_card *card; int err; DEBUG("\n %lx:DriverProbe \n",jiffies); err = -ENODEV; if (!enable) return err; err = -ENOMEM; err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, sizeof(brcm_alsa_chip_t), &card); if (!card) goto err; g_brcm_alsa_chip = (brcm_alsa_chip_t*)card->private_data; g_brcm_alsa_chip->card = card; card->dev = &pdev->dev; strncpy(card->driver, pdev->dev.driver->name, sizeof(card->driver)); //PCM interface err = PcmDeviceNew(card); if (err) goto err; //CTRL interface err = ControlDeviceNew(card); if (err) goto err; //TODO: other interface strcpy(card->driver, "Broadcom"); strcpy(card->shortname, "Broadcom ALSA"); sprintf(card->longname, "Broadcom ALSA PCM %i", 0); err = snd_card_register(card); if (err==0) { int ret; platform_set_drvdata(pdev, card); ret = BrcmCreateControlSysFs(card); if(ret!=0) DEBUG("ALSA DriverProbe Error to create sysfs for FMDirectPlay ret = %d\n", ret); return 0; } err: DEBUG("\n probe failed =%d\n",err); if (card) snd_card_free(card); g_brcm_alsa_chip=NULL; return err; }
static int DriverProbe(struct platform_device *pdev) { struct snd_card *card; int err; aTrace(LOG_ALSA_INTERFACE, "ALSA-CAPH Driver Probe:\n"); aTrace(LOG_ALSA_INTERFACE, "\n %lx:DriverProbe\n", jiffies); if (pdev->dev.platform_data != NULL) { /* Copy over platform specific data */ memcpy(&sgCaphPlatInfo, pdev->dev.platform_data, sizeof(sgCaphPlatInfo)); /* Set the platform configuration data */ AUDCTRL_PlatCfgSet(&sgCaphPlatInfo.aud_ctrl_plat_cfg); } err = -ENODEV; err = -ENOMEM; err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, sizeof(brcm_alsa_chip_t), &card); if (!card) { aError("card is not created!!!!!!!!"); goto err; } sgpCaph_chip = (brcm_alsa_chip_t *) card->private_data; sgpCaph_chip->card = card; card->dev = &pdev->dev; strncpy(card->driver, pdev->dev.driver->name, sizeof(card->driver) - 1); /* add Null terminating character */ card->driver[sizeof(card->driver) - 1] = '\0'; /* PCM interface */ err = PcmDeviceNew(card); if (err) { aError("failed PcmDeviceNew"); goto err; } /* CTRL interface */ err = ControlDeviceNew(card); if (err) { aError("failed ControlDeviceNew"); goto err; } /* HWDEP interface */ /*err = HwdepDeviceNew(card);*/ voipchrdevpvtdata.card = card; err = voipdevicecreate(&voipchrdevpvtdata); if (err) { aError("voipDeviceCreate faileddddddddddddddd"); goto err; } /* HWDEP PTT interface */ err = HwdepPttDeviceNew(card); if (err) { aError("cannot create PTT HWDEP device\n"); goto err; } strncpy(card->driver, "Broadcom", 9); strncpy(card->shortname, "Broadcom ALSA", 14); snprintf(card->longname, 20, "Broadcom ALSA PCM %i", 0); err = snd_card_register(card); if (err == 0) { int ret; platform_set_drvdata(pdev, card); ret = BrcmCreateAuddrv_testSysFs(card); if (ret != 0) aError("ALSA DriverProbe Error ret= %d\n", ret); #ifdef CONFIG_BCM_AUDIO_SELFTEST ret = BrcmCreateAuddrv_selftestSysFs(card); if (ret != 0) aError("DriverProbe sysfs err ret = %d\n", ret); #endif return 0; } err: aError("\n probe failed =%d\n", err); if (card) snd_card_free(card); sgpCaph_chip = NULL; return err; }