linux/drivers/platform/chrome/cros_ec_debugfs.c

// SPDX-License-Identifier: GPL-2.0+
// Debug logs for the ChromeOS EC
//
// Copyright (C) 2015 Google, Inc.

#include <linux/circ_buf.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_device.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/wait.h>

#define DRV_NAME

#define LOG_SHIFT
#define LOG_SIZE
#define LOG_POLL_SEC

#define CIRC_ADD(idx, size, value)

static unsigned int log_poll_period_ms =;
module_param(log_poll_period_ms, uint, 0644);
MODULE_PARM_DESC();

/* waitqueue for log readers */
static DECLARE_WAIT_QUEUE_HEAD(cros_ec_debugfs_log_wq);

/**
 * struct cros_ec_debugfs - EC debugging information.
 *
 * @ec: EC device this debugfs information belongs to
 * @dir: dentry for debugfs files
 * @log_buffer: circular buffer for console log information
 * @read_msg: preallocated EC command and buffer to read console log
 * @log_mutex: mutex to protect circular buffer
 * @log_poll_work: recurring task to poll EC for new console log data
 * @panicinfo_blob: panicinfo debugfs blob
 * @notifier_panic: notifier_block to let kernel to flush buffered log
 *                  when EC panic
 */
struct cros_ec_debugfs {};

/*
 * We need to make sure that the EC log buffer on the UART is large enough,
 * so that it is unlikely enough to overlow within log_poll_period_ms.
 */
static void cros_ec_console_log_work(struct work_struct *__work)
{}

static int cros_ec_console_log_open(struct inode *inode, struct file *file)
{}

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

static __poll_t cros_ec_console_log_poll(struct file *file,
					     poll_table *wait)
{}

static int cros_ec_console_log_release(struct inode *inode, struct file *file)
{}

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

static bool cros_ec_uptime_is_supported(struct cros_ec_device *ec_dev)
{}

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

static const struct file_operations cros_ec_console_log_fops =;

static const struct file_operations cros_ec_pdinfo_fops =;

static const struct file_operations cros_ec_uptime_fops =;

static int ec_read_version_supported(struct cros_ec_dev *ec)
{}

static int cros_ec_create_console_log(struct cros_ec_debugfs *debug_info)
{}

static void cros_ec_cleanup_console_log(struct cros_ec_debugfs *debug_info)
{}

/*
 * Returns the size of the panicinfo data fetched from the EC
 */
static int cros_ec_get_panicinfo(struct cros_ec_device *ec_dev, uint8_t *data,
				 int data_size)
{}

static int cros_ec_create_panicinfo(struct cros_ec_debugfs *debug_info)
{}

static int cros_ec_debugfs_panic_event(struct notifier_block *nb,
				       unsigned long queued_during_suspend, void *_notify)
{}

static int cros_ec_debugfs_probe(struct platform_device *pd)
{}

static void cros_ec_debugfs_remove(struct platform_device *pd)
{}

static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
{}

static int __maybe_unused cros_ec_debugfs_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(cros_ec_debugfs_pm_ops,
			 cros_ec_debugfs_suspend, cros_ec_debugfs_resume);

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

static struct platform_driver cros_ec_debugfs_driver =;

module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();