linux/drivers/hid/hid-mcp2200.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * MCP2200 - Microchip USB to GPIO bridge
 *
 * Copyright (c) 2023, Johannes Roith <[email protected]>
 *
 * Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/22228A.pdf
 * App Note for HID: https://ww1.microchip.com/downloads/en/DeviceDoc/93066A.pdf
 */
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/hid.h>
#include <linux/hidraw.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include "hid-ids.h"

/* Commands codes in a raw output report */
#define SET_CLEAR_OUTPUTS
#define CONFIGURE
#define READ_EE
#define WRITE_EE
#define READ_ALL

/* MCP GPIO direction encoding */
enum MCP_IO_DIR {};

/* Altternative pin assignments */
#define TXLED
#define RXLED
#define USBCFG
#define SSPND
#define MCP_NGPIO

/* CMD to set or clear a GPIO output */
struct mcp_set_clear_outputs {} __packed;

/* CMD to configure the IOs */
struct mcp_configure {} __packed;

/* CMD to read all parameters */
struct mcp_read_all {} __packed;

/* Response to the read all cmd */
struct mcp_read_all_resp {} __packed;

struct mcp2200 {};

/* this executes the READ_ALL cmd */
static int mcp_cmd_read_all(struct mcp2200 *mcp)
{}

static void mcp_set_multiple(struct gpio_chip *gc, unsigned long *mask,
			     unsigned long *bits)
{}

static void mcp_set(struct gpio_chip *gc, unsigned int gpio_nr, int value)
{}

static int mcp_get_multiple(struct gpio_chip *gc, unsigned long *mask,
		unsigned long *bits)
{}

static int mcp_get(struct gpio_chip *gc, unsigned int gpio_nr)
{}

static int mcp_get_direction(struct gpio_chip *gc, unsigned int gpio_nr)
{}

static int mcp_set_direction(struct gpio_chip *gc, unsigned int gpio_nr,
			     enum MCP_IO_DIR io_direction)
{}

static int mcp_direction_input(struct gpio_chip *gc, unsigned int gpio_nr)
{}

static int mcp_direction_output(struct gpio_chip *gc, unsigned int gpio_nr,
				int value)
{}

static const struct gpio_chip template_chip =;

/*
 * MCP2200 uses interrupt endpoint for input reports. This function
 * is called by HID layer when it receives i/p report from mcp2200,
 * which is actually a response to the previously sent command.
 */
static int mcp2200_raw_event(struct hid_device *hdev, struct hid_report *report,
		u8 *data, int size)
{}

static int mcp2200_probe(struct hid_device *hdev, const struct hid_device_id *id)
{}

static void mcp2200_remove(struct hid_device *hdev)
{}

static const struct hid_device_id mcp2200_devices[] =;
MODULE_DEVICE_TABLE(hid, mcp2200_devices);

static struct hid_driver mcp2200_driver =;

/* Register with HID core */
module_hid_driver();

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