Example #1
0
static int rt5621_i2c_probe(struct i2c_client *i2c,
		    const struct i2c_device_id *id)
{
	struct rt5621_priv *rt5621;
	struct clk	*iis_clk;
	int ret;

	printk("%s\n", __FUNCTION__);

	iis_clk = clk_get_sys("rk29_i2s.0", "i2s");
	if (IS_ERR(iis_clk)) {
		dev_err(&i2c->dev, "failed to get i2s clk\n");
		ret = PTR_ERR(iis_clk);
	}else{
		clk_enable(iis_clk);
		clk_set_rate(iis_clk, 11289600);
		clk_put(iis_clk);
	}
	rk29_mux_api_set(GPIO2D0_I2S0CLK_MIIRXCLKIN_NAME, GPIO2H_I2S0_CLK); 

	ret = rk29_rt5621_detect_device(i2c);
	if(ret < 0){
		printk("%s: detect alc5621 error!\n", __FUNCTION__);
		return ret;
	}
	
	audio_card_init();

	rt5621 = kzalloc(sizeof(struct rt5621_priv), GFP_KERNEL);
	if (NULL == rt5621)
		return -ENOMEM;

	i2c_set_clientdata(i2c, rt5621);

	ret = snd_soc_register_codec(&i2c->dev,
		&soc_codec_dev_rt5621, &rt5621_dai, 1);
	if (ret < 0)
		kfree(rt5621);

	return ret;
}
Example #2
0
static int rt5633_i2c_probe(struct i2c_client *i2c,
		    const struct i2c_device_id *id)
{
	struct rt5633_priv *rt5633;
	int ret;
	
    printk("%s\n", __FUNCTION__);

	ret = rk29_rt5633_detect_device(i2c);
	if(ret < 0){
		printk("%s: detect alc5633 error!\n", __FUNCTION__);
		return ret;
	}

    audio_card_init();
    
	rt5633 = kzalloc(sizeof(struct rt5633_priv), GFP_KERNEL);
	if (NULL == rt5633)
		return -ENOMEM;

	i2c_set_clientdata(i2c, rt5633);

	ret = snd_soc_register_codec(&i2c->dev,
		&soc_codec_dev_rt5633, &rt5633_dai, 1);
	if (ret < 0)
		kfree(rt5633);

	#ifdef CONFIG_HDMI
	hdmi_codec_driver.name = i2c->name;
	ret = hdmi_codec_register(&hdmi_codec_driver);
    	if (ret != 0) {
		printk("Failed to register HDMI_codec: %d\n", ret);
		kfree(rt5633);

	}
	#endif


	return ret;
}