예제 #1
0
static int __init snd_stm_fli75xx_init(void)
{
	int result;

	snd_stm_printd(0, "%s()\n", __func__);

	switch (cpu_data->type) {
	case CPU_FLI7510:
	case CPU_FLI7520:
	case CPU_FLI7530:
	case CPU_FLI7540:
	case CPU_FLI7560:
		break;
	default:
		snd_stm_printe("Unsupported (non-Freeman) SOC detected!\n");
		result = -EINVAL;
		goto error_soc_type;
	}

	result = platform_driver_register(&snd_stm_fli75xx_glue_driver);
	if (result != 0) {
		snd_stm_printe("Failed to register audio glue driver!\n");
		goto error_glue_driver_register;
	}

	result = snd_stm_card_register();
	if (result != 0) {
		snd_stm_printe("Failed to register ALSA cards!\n");
		goto error_card_register;
	}

	return 0;

error_card_register:
	platform_driver_unregister(&snd_stm_fli75xx_glue_driver);
error_glue_driver_register:
error_soc_type:
	return result;
}
예제 #2
0
static int __init snd_stm_stih415_probe(struct platform_device *pdev)
{
	int result;

	dev_dbg(&pdev->dev, "%s()", __func__);

	if (!stm_soc_is_stih415()) {
		dev_err(&pdev->dev, "Unsupported (not STiH415) SOC detected!");
		return -EINVAL;
	}

	/* Claim external pcm clock sysconf */
	snd_stm_stih415_pcm_clk_sel = sysconf_claim(SYSCONF(331), 8, 11,
						       "PCM_CLK_SEL");
	if (!snd_stm_stih415_pcm_clk_sel) {
		dev_err(&pdev->dev, "Failed to claim PCM_CLK_SEL");
		return -EBUSY;
	}

	/* Claim bi-phase idle value sysconf */
	snd_stm_stih415_biphase_idle_value = sysconf_claim(SYSCONF(331), 7, 7,
						       "BIPHASE_IDLE_VALUE");
	if (!snd_stm_stih415_biphase_idle_value) {
		dev_err(&pdev->dev, "Failed to claim BIPHASE_IDLE_VALUE");
		result = -EBUSY;
		goto error_sysconf_claim_biphase_idle_value;
	}

	/* Claim voip sysconf */
	snd_stm_stih415_voip = sysconf_claim(SYSCONF(331), 2, 5, "VOIP");
	if (!snd_stm_stih415_voip) {
		dev_err(&pdev->dev, "Failed to claim VOIP");
		result = -EBUSY;
		goto error_sysconf_claim_voip;
	}

	/* Claim pcm player routing sysconf */
	snd_stm_stih415_pcmp_valid_sel = sysconf_claim(SYSCONF(331), 0, 1,
						       "PCMP_VALID_SEL");
	if (!snd_stm_stih415_pcmp_valid_sel) {
		dev_err(&pdev->dev, "Failed to claim PCMP_VALID_SEL");
		result = -EBUSY;
		goto error_sysconf_claim_pcmp_valid_sel;
	}

	/* Set the sysconf values */
	snd_stm_stih415_setup();

	/* Register the sound card */
	result = snd_stm_card_register();
	if (result) {
		dev_err(&pdev->dev, "Failed to register ALSA cards!");
		goto error_card_register;
	}

	/* Register a procfs file */
	result = snd_stm_info_register(&snd_stm_stih415_proc_entry,
			dev_name(&pdev->dev), snd_stm_stih415_procfs, NULL);
	if (result) {
		dev_err(&pdev->dev, "Failed to register with procfs");
		goto error_info_register;
	}

	return 0;

error_info_register:
error_card_register:
	sysconf_release(snd_stm_stih415_pcmp_valid_sel);
error_sysconf_claim_pcmp_valid_sel:
	sysconf_release(snd_stm_stih415_voip);
error_sysconf_claim_voip:
	sysconf_release(snd_stm_stih415_biphase_idle_value);
error_sysconf_claim_biphase_idle_value:
	sysconf_release(snd_stm_stih415_pcm_clk_sel);
	return result;
}