linux/drivers/usb/misc/usb-ljca.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Intel La Jolla Cove Adapter USB driver
 *
 * Copyright (c) 2023, Intel Corporation.
 */

#include <linux/acpi.h>
#include <linux/auxiliary_bus.h>
#include <linux/dev_printk.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/usb.h>
#include <linux/usb/ljca.h>

#include <asm/unaligned.h>

/* command flags */
#define LJCA_ACK_FLAG
#define LJCA_RESP_FLAG
#define LJCA_CMPL_FLAG

#define LJCA_MAX_PACKET_SIZE
#define LJCA_MAX_PAYLOAD_SIZE

#define LJCA_WRITE_TIMEOUT_MS
#define LJCA_WRITE_ACK_TIMEOUT_MS
#define LJCA_ENUM_CLIENT_TIMEOUT_MS

/* ljca client type */
enum ljca_client_type {};

/* MNG client commands */
enum ljca_mng_cmd {};

/* ljca client acpi _ADR */
enum ljca_client_acpi_adr {};

/* ljca cmd message structure */
struct ljca_msg {} __packed;

struct ljca_i2c_ctr_info {} __packed;

struct ljca_i2c_descriptor {} __packed;

struct ljca_spi_ctr_info {} __packed;

struct ljca_spi_descriptor {} __packed;

struct ljca_bank_descriptor {} __packed;

struct ljca_gpio_descriptor {} __packed;

/**
 * struct ljca_adapter - represent a ljca adapter
 *
 * @intf: the usb interface for this ljca adapter
 * @usb_dev: the usb device for this ljca adapter
 * @dev: the specific device info of the usb interface
 * @rx_pipe: bulk in pipe for receive data from firmware
 * @tx_pipe: bulk out pipe for send data to firmware
 * @rx_urb: urb used for the bulk in pipe
 * @rx_buf: buffer used to receive command response and event
 * @rx_len: length of rx buffer
 * @ex_buf: external buffer to save command response
 * @ex_buf_len: length of external buffer
 * @actual_length: actual length of data copied to external buffer
 * @tx_buf: buffer used to download command to firmware
 * @tx_buf_len: length of tx buffer
 * @lock: spinlock to protect tx_buf and ex_buf
 * @cmd_completion: completion object as the command receives ack
 * @mutex: mutex to avoid command download concurrently
 * @client_list: client device list
 * @disconnect: usb disconnect ongoing or not
 * @reset_id: used to reset firmware
 */
struct ljca_adapter {};

struct ljca_match_ids_walk_data {};

static const struct acpi_device_id ljca_gpio_hids[] =;

static const struct acpi_device_id ljca_i2c_hids[] =;

static const struct acpi_device_id ljca_spi_hids[] =;

static void ljca_handle_event(struct ljca_adapter *adap,
			      struct ljca_msg *header)
{}

/* process command ack and received data if available */
static void ljca_handle_cmd_ack(struct ljca_adapter *adap, struct ljca_msg *header)
{}

static void ljca_recv(struct urb *urb)
{}

static int ljca_send(struct ljca_adapter *adap, u8 type, u8 cmd,
		     const u8 *obuf, u8 obuf_len, u8 *ibuf, u8 ibuf_len,
		     bool ack, unsigned long timeout)
{}

int ljca_transfer(struct ljca_client *client, u8 cmd, const u8 *obuf,
		  u8 obuf_len, u8 *ibuf, u8 ibuf_len)
{}
EXPORT_SYMBOL_NS_GPL();

int ljca_transfer_noack(struct ljca_client *client, u8 cmd, const u8 *obuf,
			u8 obuf_len)
{}
EXPORT_SYMBOL_NS_GPL();

int ljca_register_event_cb(struct ljca_client *client, ljca_event_cb_t event_cb,
			   void *context)
{}
EXPORT_SYMBOL_NS_GPL();

void ljca_unregister_event_cb(struct ljca_client *client)
{}
EXPORT_SYMBOL_NS_GPL();

static int ljca_match_device_ids(struct acpi_device *adev, void *data)
{}

/* bind auxiliary device to acpi device */
static void ljca_auxdev_acpi_bind(struct ljca_adapter *adap,
				  struct auxiliary_device *auxdev,
				  u64 adr, u8 id)
{}

static void ljca_auxdev_release(struct device *dev)
{}

static int ljca_new_client_device(struct ljca_adapter *adap, u8 type, u8 id,
				  char *name, void *data, u64 adr)
{}

static int ljca_enumerate_gpio(struct ljca_adapter *adap)
{}

static int ljca_enumerate_i2c(struct ljca_adapter *adap)
{}

static int ljca_enumerate_spi(struct ljca_adapter *adap)
{}

static int ljca_reset_handshake(struct ljca_adapter *adap)
{}

static int ljca_enumerate_clients(struct ljca_adapter *adap)
{}

static int ljca_probe(struct usb_interface *interface,
		      const struct usb_device_id *id)
{}

static void ljca_disconnect(struct usb_interface *interface)
{}

static int ljca_suspend(struct usb_interface *interface, pm_message_t message)
{}

static int ljca_resume(struct usb_interface *interface)
{}

static const struct usb_device_id ljca_table[] =;
MODULE_DEVICE_TABLE(usb, ljca_table);

static struct usb_driver ljca_driver =;
module_usb_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();