From: Mark A. Greer Date: Thu, 21 May 2015 22:56:59 +0000 (-0700) Subject: greybus: gb-audio: Add I2C device for rt5647 codec X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1521^2~18 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=415b83111caac7cd1b90e0df104f81bae8e6e4dd;p=karo-tx-linux.git greybus: gb-audio: Add I2C device for rt5647 codec Add the I2C device node for the rt5647 codec. Eventually, this will be done automatically somewhere else but for now its done in the audio driver. Signed-off-by: Mark A. Greer Acked-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/audio.c b/drivers/staging/greybus/audio.c index d4d1eff2d099..1cc7c04d562b 100644 --- a/drivers/staging/greybus/audio.c +++ b/drivers/staging/greybus/audio.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -157,6 +156,9 @@ static int gb_i2s_transmitter_connection_init(struct gb_connection *connection) struct gb_snd *snd_dev; struct platform_device *codec, *dai; struct asoc_simple_card_info *simple_card; +#if USE_RT5645 + struct i2c_board_info rt5647_info; +#endif unsigned long flags; int ret; @@ -219,6 +221,18 @@ static int gb_i2s_transmitter_connection_init(struct gb_connection *connection) goto out_get_ver; } +#if USE_RT5645 + rt5647_info.addr = RT5647_I2C_ADDR; + strlcpy(rt5647_info.type, "rt5647", I2C_NAME_SIZE); + + snd_dev->rt5647 = i2c_new_device(i2c_get_adapter(RT5647_I2C_ADAPTER_NR), + &rt5647_info); + if (!snd_dev->rt5647) { + pr_err("can't create rt5647 i2c device\n"); + goto out_get_ver; + } +#endif + return 0; out_get_ver: @@ -238,6 +252,10 @@ static void gb_i2s_transmitter_connection_exit(struct gb_connection *connection) snd_dev = (struct gb_snd *)connection->private; +#if USE_RT5645 + i2c_unregister_device(snd_dev->rt5647); +#endif + platform_device_unregister(&snd_dev->card); platform_device_unregister(&snd_dev->cpu_dai); platform_device_unregister(snd_dev->codec); diff --git a/drivers/staging/greybus/audio.h b/drivers/staging/greybus/audio.h index 5095df9096f6..020a8fc1d267 100644 --- a/drivers/staging/greybus/audio.h +++ b/drivers/staging/greybus/audio.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include "greybus.h" @@ -41,6 +42,7 @@ struct gb_snd { struct platform_device cpu_dai; struct platform_device *codec; struct asoc_simple_card_info *simple_card_info; + struct i2c_client *rt5647; struct gb_connection *mgmt_connection; struct gb_connection *i2s_tx_connection; struct gb_connection *i2s_rx_connection;