Exemplo n.º 1
0
static int __init stih415_audio_devices_setup(void)
{
	if (!stm_soc_is_stih415()) {
		BUG();
		return -ENODEV;
	}

	return platform_add_devices(stih415_audio_devices,
					ARRAY_SIZE(stih415_audio_devices));
}
Exemplo n.º 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;
}