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

Commit e5249a30 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

char: Add DIAG driver

parent 9d8d63a5
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __LINUX_USB_DIAG_BRIDGE_H__
#define __LINUX_USB_DIAG_BRIDGE_H__

struct diag_bridge_ops {
	void *ctxt;
	void (*read_complete_cb)(void *ctxt, char *buf,
			int buf_size, int actual);
	void (*write_complete_cb)(void *ctxt, char *buf,
			int buf_size, int actual);
	int (*suspend)(void *ctxt);
	void (*resume)(void *ctxt);
};

#if defined(CONFIG_USB_QCOM_DIAG_BRIDGE) \
	|| defined(CONFIG_USB_QCOM_DIAG_BRIDGE_MODULE)

extern int diag_bridge_read(char *data, int size);
extern int diag_bridge_write(char *data, int size);
extern int diag_bridge_open(struct diag_bridge_ops *ops);
extern void diag_bridge_close(void);

#else

static int __maybe_unused diag_bridge_read(char *data, int size)
{
	return -ENODEV;
}

static int __maybe_unused diag_bridge_write(char *data, int size)
{
	return -ENODEV;
}

static int __maybe_unused diag_bridge_open(struct diag_bridge_ops *ops)
{
	return -ENODEV;
}

static void __maybe_unused diag_bridge_close(void) { }

#endif

#endif
+58 −0
Original line number Diff line number Diff line
/* include/asm-arm/arch-msm/usbdiag.h
 *
 * Copyright (c) 2008-2010, The Linux Foundation. All rights reserved.
 *
 * All source code in this file is licensed under the following license except
 * where indicated.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can find it at http://www.fsf.org
 */

#ifndef _DRIVERS_USB_DIAG_H_
#define _DRIVERS_USB_DIAG_H_

#define DIAG_LEGACY		"diag"
#define DIAG_MDM		"diag_mdm"

#define USB_DIAG_CONNECT	0
#define USB_DIAG_DISCONNECT	1
#define USB_DIAG_WRITE_DONE	2
#define USB_DIAG_READ_DONE	3

struct diag_request {
	char *buf;
	int length;
	int actual;
	int status;
	void *context;
};

struct usb_diag_ch {
	const char *name;
	struct list_head list;
	void (*notify)(void *priv, unsigned event, struct diag_request *d_req);
	void *priv;
	void *priv_usb;
};

struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
		void (*notify)(void *, unsigned, struct diag_request *));
void usb_diag_close(struct usb_diag_ch *ch);
int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read);
void usb_diag_free_req(struct usb_diag_ch *ch);
int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req);
int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req);

int diag_read_from_cb(unsigned char * , int);

#endif /* _DRIVERS_USB_DIAG_H_ */
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ config SGI_MBCS

source "drivers/tty/serial/Kconfig"

source "drivers/char/diag/Kconfig"

config TTY_PRINTK
	bool "TTY driver to output user messages via printk"
	depends on EXPERT && TTY
+1 −0
Original line number Diff line number Diff line
@@ -65,3 +65,4 @@ js-rtc-y = rtc.o
obj-$(CONFIG_TILE_SROM)		+= tile-srom.o
obj-$(CONFIG_MSM_ROTATOR)	+= msm_rotator.o
obj-$(CONFIG_MMC_GENERIC_CSDIO)	+= csdio.o
obj-$(CONFIG_DIAG_CHAR)		+= diag/
+41 −0
Original line number Diff line number Diff line
menu "Diag Support"

config DIAG_CHAR
	tristate "char driver interface and diag forwarding to/from modem"
	default m
	depends on USB_G_ANDROID || USB_FUNCTION_DIAG || USB_QCOM_MAEMO
	depends on ARCH_MSM
	help
	 Char driver interface for diag user space and diag-forwarding to modem ARM and back.
	 This enables diagchar for maemo usb gadget or android usb gadget based on config selected.
endmenu

menu "DIAG traffic over USB"

config DIAG_OVER_USB
	bool "Enable DIAG traffic to go over USB"
        depends on ARCH_MSM
	default y
	help
	 This feature helps segregate code required for DIAG traffic to go over USB.
endmenu

menu "SDIO support for DIAG"

config DIAG_SDIO_PIPE
	depends on MSM_SDIO_AL
	default y
	bool "Enable 9K DIAG traffic over SDIO"
	help
	 SDIO Transport Layer for DIAG Router
endmenu

menu "HSIC support for DIAG"

config DIAG_BRIDGE_CODE
	depends on USB_QCOM_DIAG_BRIDGE
	default y
	bool "Enable QSC/9K DIAG traffic over SMUX/HSIC"
	help
	 SMUX/HSIC Transport Layer for DIAG Router
endmenu
Loading