Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a05cb661 authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Gustavo Solaira
Browse files

usb: gadget: Add support for IPC driver



IPC messages are to be exchanged between device and host using
the IPC router platform driver on the device side. For this
driver to use USB as transport layer, add support for function
driver which will configure Bulk IN and OUT endpoints and expose
proper callbacks to router driver for read and write operations.

Change-Id: I350624ccd24a6c6fd4bda5ea91379fb426fae742
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 4e8ac8e0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -203,6 +203,9 @@ config USB_F_AUDIO_SRC
config USB_F_ACC
	tristate

config USB_F_IPC
	tristate

choice
	tristate "USB Gadget Drivers"
	default USB_ETH
@@ -425,6 +428,7 @@ config USB_G_ANDROID
	select USB_F_UAC1 if SND_PCM
	select USB_F_UAC2 if SND_PCM
	select USB_F_UVC if MEDIA_SUPPORT
	select USB_F_IPC
	help
	  The Android Composite Gadget supports multiple USB
	  functions: adb, acm, mass storage, mtp, accessory
+33 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@
#include "u_qc_ether.c"
#include "f_gsi.c"
#include "f_mass_storage.h"
#include "f_ipc.h"

USB_ETHERNET_MODULE_PARAMETERS();
#ifdef CONFIG_MEDIA_SUPPORT
@@ -3283,6 +3284,36 @@ static struct android_usb_function dpl_gsi_function = {
	.bind_config	= dpl_gsi_function_bind_config,
};

static int ipc_function_init(struct android_usb_function *f,
				   struct usb_composite_dev *cdev)
{
	f->config = ipc_setup();

	return IS_ERR(f->config);
}

static void ipc_function_cleanup(struct android_usb_function *f)
{
	return ipc_cleanup(f->config);
}

static int ipc_function_bind_config(struct android_usb_function *f,
					    struct usb_configuration *c)
{
	struct usb_function *ipc_f = NULL;

	ipc_f = ipc_bind_config((struct usb_function_instance *)f->config);

	return usb_add_function(c, ipc_f);
}

static struct android_usb_function ipc_function = {
	.name           = "ipc",
	.init           = ipc_function_init,
	.cleanup        = ipc_function_cleanup,
	.bind_config    = ipc_function_bind_config,
};

static struct android_usb_function *supported_functions[] = {
	[ANDROID_FFS] = &ffs_function,
	[ANDROID_MBIM_BAM] = &mbim_function,
@@ -3316,6 +3347,7 @@ static struct android_usb_function *supported_functions[] = {
	[ANDROID_RMNET_GSI] = &rmnet_gsi_function,
	[ANDROID_MBIM_GSI] = &mbim_gsi_function,
	[ANDROID_DPL_GSI] = &dpl_gsi_function,
	[ANDROID_IPC] = &ipc_function,
	NULL
};

@@ -3351,6 +3383,7 @@ static struct android_usb_function *default_functions[] = {
#ifdef CONFIG_SND_RAWMIDI
	&midi_function,
#endif
	&ipc_function,
	NULL
};

+2 −0
Original line number Diff line number Diff line
@@ -46,5 +46,7 @@ usb_f_audio_source-y := f_audio_source.o
obj-$(CONFIG_USB_F_AUDIO_SRC)   += usb_f_audio_source.o
usb_f_accessory-y               := f_accessory.o
obj-$(CONFIG_USB_F_ACC)         += usb_f_accessory.o
usb_f_ipc-y                     := f_ipc.o
obj-$(CONFIG_USB_F_IPC)         += usb_f_ipc.o

+872 −0

File added.

Preview size limit exceeded, changes collapsed.

+20 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading