linux/drivers/hid/hid-goodix-spi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Goodix GT7986U SPI Driver Code for HID.
 *
 * Copyright (C) 2024 Godix, Inc.
 */
#include <linux/unaligned.h>
#include <linux/delay.h>
#include <linux/hid.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/sizes.h>
#include <linux/spi/spi.h>

#define GOODIX_DEV_CONFIRM_ADDR
#define GOODIX_HID_DESC_ADDR
#define GOODIX_HID_REPORT_DESC_ADDR
#define GOODIX_HID_SIGN_ADDR

#define GOODIX_HID_GET_REPORT_CMD
#define GOODIX_HID_SET_REPORT_CMD

#define GOODIX_HID_MAX_INBUF_SIZE
#define GOODIX_HID_ACK_READY_FLAG
#define GOODIX_HID_REPORT_READY_FLAG

#define GOODIX_DEV_CONFIRM_VAL

#define GOODIX_SPI_WRITE_FLAG
#define GOODIX_SPI_READ_FLAG
#define GOODIX_SPI_TRANS_PREFIX_LEN
#define GOODIX_REGISTER_WIDTH
#define GOODIX_SPI_READ_DUMMY_LEN
#define GOODIX_SPI_READ_PREFIX_LEN
#define GOODIX_SPI_WRITE_PREFIX_LEN

#define GOODIX_CHECKSUM_SIZE
#define GOODIX_NORMAL_RESET_DELAY_MS

struct goodix_hid_report_header {} __packed;
#define GOODIX_HID_ACK_HEADER_SIZE

struct goodix_hid_report_package {};

#define GOODIX_HID_PKG_LEN_SIZE
#define GOODIX_HID_COOR_DATA_LEN
#define GOODIX_HID_COOR_PKG_LEN

/* power state */
#define GOODIX_SPI_POWER_ON
#define GOODIX_SPI_POWER_SLEEP

/* flags used to record the current device operating state */
#define GOODIX_HID_STARTED

struct goodix_hid_report_event {} __packed;

struct goodix_hid_desc {} __packed;

struct goodix_ts_data {};

static void *goodix_get_event_report(struct goodix_ts_data *ts, u32 addr,
				     u8 *data, size_t len)
{}

static int goodix_spi_read(struct goodix_ts_data *ts, u32 addr,
			   void *data, size_t len)
{}

static int goodix_spi_write(struct goodix_ts_data *ts, u32 addr,
			    const void *data, size_t len)
{}

static int goodix_dev_confirm(struct goodix_ts_data *ts)
{}

/**
 * goodix_hid_parse() - hid-core .parse() callback
 * @hid: hid device instance
 *
 * This function gets called during call to hid_add_device
 *
 * Return: 0 on success and non zero on error
 */
static int goodix_hid_parse(struct hid_device *hid)
{}

static int goodix_hid_get_report_length(struct hid_report *report)
{}

static void goodix_hid_find_max_report(struct hid_device *hid, unsigned int type,
				       unsigned int *max)
{}

static int goodix_hid_start(struct hid_device *hid)
{}

static void goodix_hid_stop(struct hid_device *hid)
{}

static int goodix_hid_open(struct hid_device *hid)
{}

static void goodix_hid_close(struct hid_device *hid)
{}

/* Return date length of response data */
static int goodix_hid_check_ack_status(struct goodix_ts_data *ts, u32 *resp_len)
{}

/**
 * goodix_hid_get_raw_report() - Process hidraw GET REPORT operation
 * @hid: hid device instance
 * @reportnum: Report ID
 * @buf: Buffer for store the report date
 * @len: Length fo report data
 * @report_type: Report type
 *
 * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
 * get report request. The transmitted data follows the standard i2c-hid
 * protocol with a specified header.
 *
 * Return: The length of the data in the buf on success, negative error code
 */
static int goodix_hid_get_raw_report(struct hid_device *hid,
				     unsigned char reportnum,
				     u8 *buf, size_t len,
				     unsigned char report_type)
{}

/**
 * goodix_hid_set_raw_report() - process hidraw SET REPORT operation
 * @hid: HID device
 * @reportnum: Report ID
 * @buf: Buffer for communication
 * @len: Length of data in the buffer
 * @report_type: Report type
 *
 * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
 * set report request. The transmitted data follows the standard i2c-hid
 * protocol with a specified header.
 *
 * Return: The length of the data sent, negative error code on failure
 */
static int goodix_hid_set_raw_report(struct hid_device *hid,
				     unsigned char reportnum,
				     __u8 *buf, size_t len,
				     unsigned char report_type)
{}

static int goodix_hid_raw_request(struct hid_device *hid,
				  unsigned char reportnum,
				  __u8 *buf, size_t len,
				  unsigned char rtype, int reqtype)
{}

static struct hid_ll_driver goodix_hid_ll_driver =;

static irqreturn_t goodix_hid_irq(int irq, void *data)
{}

static int goodix_hid_init(struct goodix_ts_data *ts)
{}

static int goodix_spi_probe(struct spi_device *spi)
{}

static void goodix_spi_remove(struct spi_device *spi)
{}

static int goodix_spi_set_power(struct goodix_ts_data *ts, int power_state)
{}

static int goodix_spi_suspend(struct device *dev)
{}

static int goodix_spi_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(goodix_spi_pm_ops,
				goodix_spi_suspend, goodix_spi_resume);

#ifdef CONFIG_ACPI
static const struct acpi_device_id goodix_spi_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match);
#endif

static const struct spi_device_id goodix_spi_ids[] =;
MODULE_DEVICE_TABLE(spi, goodix_spi_ids);

static struct spi_driver goodix_spi_driver =;
module_spi_driver();

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