linux/drivers/misc/mei/vsc-tp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2023, Intel Corporation.
 * Intel Visual Sensing Controller Transport Layer Linux driver
 */

#include <linux/acpi.h>
#include <linux/cleanup.h>
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/irq.h>
#include <linux/irqreturn.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/types.h>

#include "vsc-tp.h"

#define VSC_TP_RESET_PIN_TOGGLE_INTERVAL_MS
#define VSC_TP_ROM_BOOTUP_DELAY_MS
#define VSC_TP_ROM_XFER_POLL_TIMEOUT_US
#define VSC_TP_ROM_XFER_POLL_DELAY_US
#define VSC_TP_WAIT_FW_POLL_TIMEOUT
#define VSC_TP_WAIT_FW_POLL_DELAY_US
#define VSC_TP_MAX_XFER_COUNT

#define VSC_TP_PACKET_SYNC
#define VSC_TP_CRC_SIZE
#define VSC_TP_MAX_MSG_SIZE
/* SPI xfer timeout size */
#define VSC_TP_XFER_TIMEOUT_BYTES
#define VSC_TP_PACKET_PADDING_SIZE
#define VSC_TP_PACKET_SIZE(pkt)
#define VSC_TP_MAX_PACKET_SIZE
#define VSC_TP_MAX_XFER_SIZE
#define VSC_TP_NEXT_XFER_LEN(len, offset)

struct vsc_tp_packet {};

struct vsc_tp {};

/* GPIO resources */
static const struct acpi_gpio_params wakeuphost_gpio =;
static const struct acpi_gpio_params wakeuphostint_gpio =;
static const struct acpi_gpio_params resetfw_gpio =;
static const struct acpi_gpio_params wakeupfw =;

static const struct acpi_gpio_mapping vsc_tp_acpi_gpios[] =;

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

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

/* wakeup firmware and wait for response */
static int vsc_tp_wakeup_request(struct vsc_tp *tp)
{}

static void vsc_tp_wakeup_release(struct vsc_tp *tp)
{}

static int vsc_tp_dev_xfer(struct vsc_tp *tp, void *obuf, void *ibuf, size_t len)
{}

static int vsc_tp_xfer_helper(struct vsc_tp *tp, struct vsc_tp_packet *pkt,
			      void *ibuf, u16 ilen)
{}

/**
 * vsc_tp_xfer - transfer data to firmware
 * @tp: vsc_tp device handle
 * @cmd: the command to be sent to the device
 * @obuf: the tx buffer to be sent to the device
 * @olen: the length of tx buffer
 * @ibuf: the rx buffer to receive from the device
 * @ilen: the length of rx buffer
 * Return: the length of received data in case of success,
 *	otherwise negative value
 */
int vsc_tp_xfer(struct vsc_tp *tp, u8 cmd, const void *obuf, size_t olen,
		void *ibuf, size_t ilen)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_rom_xfer - transfer data to rom code
 * @tp: vsc_tp device handle
 * @obuf: the data buffer to be sent to the device
 * @ibuf: the buffer to receive data from the device
 * @len: the length of tx buffer and rx buffer
 * Return: 0 in case of success, negative value in case of error
 */
int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)
{}

/**
 * vsc_tp_reset - reset vsc transport layer
 * @tp: vsc_tp device handle
 */
void vsc_tp_reset(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_need_read - check if device has data to sent
 * @tp: vsc_tp device handle
 * Return: true if device has data to sent, otherwise false
 */
bool vsc_tp_need_read(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_register_event_cb - register a callback function to receive event
 * @tp: vsc_tp device handle
 * @event_cb: callback function
 * @context: execution context of event callback
 * Return: 0 in case of success, negative value in case of error
 */
int vsc_tp_register_event_cb(struct vsc_tp *tp, vsc_tp_event_cb_t event_cb,
			    void *context)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_request_irq - request irq for vsc_tp device
 * @tp: vsc_tp device handle
 */
int vsc_tp_request_irq(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_free_irq - free irq for vsc_tp device
 * @tp: vsc_tp device handle
 */
void vsc_tp_free_irq(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_intr_synchronize - synchronize vsc_tp interrupt
 * @tp: vsc_tp device handle
 */
void vsc_tp_intr_synchronize(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_intr_enable - enable vsc_tp interrupt
 * @tp: vsc_tp device handle
 */
void vsc_tp_intr_enable(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * vsc_tp_intr_disable - disable vsc_tp interrupt
 * @tp: vsc_tp device handle
 */
void vsc_tp_intr_disable(struct vsc_tp *tp)
{}
EXPORT_SYMBOL_NS_GPL();

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

static int vsc_tp_probe(struct spi_device *spi)
{}

static void vsc_tp_remove(struct spi_device *spi)
{}

static void vsc_tp_shutdown(struct spi_device *spi)
{}

static const struct acpi_device_id vsc_tp_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, vsc_tp_acpi_ids);

static struct spi_driver vsc_tp_driver =;
module_spi_driver();

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