linux/drivers/platform/chrome/wilco_ec/debugfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * debugfs attributes for Wilco EC
 *
 * Copyright 2019 Google LLC
 *
 * See Documentation/ABI/testing/debugfs-wilco-ec for usage.
 */

#include <linux/ctype.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_data/wilco-ec.h>
#include <linux/platform_device.h>

#define DRV_NAME

/* The raw bytes will take up more space when represented as a hex string */
#define FORMATTED_BUFFER_SIZE

struct wilco_ec_debugfs {};
static struct wilco_ec_debugfs *debug_info;

/**
 * parse_hex_sentence() - Convert a ascii hex representation into byte array.
 * @in: Input buffer of ascii.
 * @isize: Length of input buffer.
 * @out: Output buffer.
 * @osize: Length of output buffer, e.g. max number of bytes to parse.
 *
 * An valid input is a series of ascii hexadecimal numbers, separated by spaces.
 * An example valid input is
 * "   00 f2 0    000076 6 0  ff"
 *
 * If an individual "word" within the hex sentence is longer than MAX_WORD_SIZE,
 * then the sentence is illegal, and parsing will fail.
 *
 * Return: Number of bytes parsed, or negative error code on failure.
 */
static int parse_hex_sentence(const char *in, int isize, u8 *out, int osize)
{}

/* The message type takes up two bytes*/
#define TYPE_AND_DATA_SIZE

static ssize_t raw_write(struct file *file, const char __user *user_buf,
			 size_t count, loff_t *ppos)
{}

static ssize_t raw_read(struct file *file, char __user *user_buf, size_t count,
			loff_t *ppos)
{}

static const struct file_operations fops_raw =;

#define CMD_KB_CHROME
#define SUB_CMD_H1_GPIO
#define SUB_CMD_TEST_EVENT

struct ec_request {} __packed;

struct ec_response {} __packed;

static int send_ec_cmd(struct wilco_ec_device *ec, u8 sub_cmd, u8 *out_val)
{}

/**
 * h1_gpio_get() - Gets h1 gpio status.
 * @arg: The wilco EC device.
 * @val: BIT(0)=ENTRY_TO_FACT_MODE, BIT(1)=SPI_CHROME_SEL
 */
static int h1_gpio_get(void *arg, u64 *val)
{}

DEFINE_DEBUGFS_ATTRIBUTE();

/**
 * test_event_set() - Sends command to EC to cause an EC test event.
 * @arg: The wilco EC device.
 * @val: unused.
 */
static int test_event_set(void *arg, u64 val)
{}

/* Format is unused since it is only required for get method which is NULL */
DEFINE_DEBUGFS_ATTRIBUTE();

/**
 * wilco_ec_debugfs_probe() - Create the debugfs node
 * @pdev: The platform device, probably created in core.c
 *
 * Try to create a debugfs node. If it fails, then we don't want to change
 * behavior at all, this is for debugging after all. Just fail silently.
 *
 * Return: 0 always.
 */
static int wilco_ec_debugfs_probe(struct platform_device *pdev)
{}

static void wilco_ec_debugfs_remove(struct platform_device *pdev)
{}

static const struct platform_device_id wilco_ec_debugfs_id[] =;
MODULE_DEVICE_TABLE(platform, wilco_ec_debugfs_id);

static struct platform_driver wilco_ec_debugfs_driver =;

module_platform_driver();

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