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 <mgreer@animalcreek.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Mark A. Greer 2015-05-21 15:56:59 -07:00 committed by Greg Kroah-Hartman
parent 827e27e8fe
commit 415b83111c
2 changed files with 21 additions and 1 deletions

View File

@ -4,7 +4,6 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/i2c.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@ -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);

View File

@ -4,6 +4,7 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <sound/soc.h>
#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;