linux/drivers/gpio/gpio-sim.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * GPIO testing driver based on configfs.
 *
 * Copyright (C) 2021 Bartosz Golaszewski <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/array_size.h>
#include <linux/bitmap.h>
#include <linux/cleanup.h>
#include <linux/completion.h>
#include <linux/configfs.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/minmax.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/sysfs.h>
#include <linux/types.h>

#define GPIO_SIM_NGPIO_MAX
#define GPIO_SIM_PROP_MAX
#define GPIO_SIM_NUM_ATTRS

static DEFINE_IDA(gpio_sim_ida);

struct gpio_sim_chip {};

struct gpio_sim_attribute {};

static struct gpio_sim_attribute *
to_gpio_sim_attr(struct device_attribute *dev_attr)
{}

static int gpio_sim_apply_pull(struct gpio_sim_chip *chip,
			       unsigned int offset, int value)
{}

static int gpio_sim_get(struct gpio_chip *gc, unsigned int offset)
{}

static void gpio_sim_set(struct gpio_chip *gc, unsigned int offset, int value)
{}

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

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

static int gpio_sim_direction_output(struct gpio_chip *gc,
				     unsigned int offset, int value)
{}

static int gpio_sim_direction_input(struct gpio_chip *gc, unsigned int offset)
{}

static int gpio_sim_get_direction(struct gpio_chip *gc, unsigned int offset)
{}

static int gpio_sim_set_config(struct gpio_chip *gc, unsigned int offset,
			       unsigned long config)
{}

static int gpio_sim_to_irq(struct gpio_chip *gc, unsigned int offset)
{}

static int gpio_sim_request(struct gpio_chip *gc, unsigned int offset)
{}

static void gpio_sim_free(struct gpio_chip *gc, unsigned int offset)
{}

static int gpio_sim_irq_requested(struct irq_domain *domain,
				  irq_hw_number_t hwirq, void *data)
{}

static void gpio_sim_irq_released(struct irq_domain *domain,
				  irq_hw_number_t hwirq, void *data)
{}

static const struct irq_sim_ops gpio_sim_irq_sim_ops =;

static void gpio_sim_dbg_show(struct seq_file *seq, struct gpio_chip *gc)
{}

static ssize_t gpio_sim_sysfs_val_show(struct device *dev,
				       struct device_attribute *attr, char *buf)
{}

static ssize_t gpio_sim_sysfs_val_store(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t count)
{}

static const char *const gpio_sim_sysfs_pull_strings[] =;

static ssize_t gpio_sim_sysfs_pull_show(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

static ssize_t gpio_sim_sysfs_pull_store(struct device *dev,
					 struct device_attribute *attr,
					 const char *buf, size_t len)
{}

static void gpio_sim_put_device(void *data)
{}

static void gpio_sim_dispose_mappings(void *data)
{}

static void gpio_sim_sysfs_remove(void *data)
{}

static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
{}

static int gpio_sim_dev_match_fwnode(struct device *dev, void *data)
{}

static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev)
{}

static int gpio_sim_probe(struct platform_device *pdev)
{}

static const struct of_device_id gpio_sim_of_match[] =;
MODULE_DEVICE_TABLE(of, gpio_sim_of_match);

static struct platform_driver gpio_sim_driver =;

struct gpio_sim_device {};

/* This is called with dev->lock already taken. */
static int gpio_sim_bus_notifier_call(struct notifier_block *nb,
				      unsigned long action, void *data)
{}

static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item)
{}

struct gpio_sim_bank {};

static struct gpio_sim_bank *to_gpio_sim_bank(struct config_item *item)
{}

static bool gpio_sim_bank_has_label(struct gpio_sim_bank *bank)
{}

static struct gpio_sim_device *
gpio_sim_bank_get_device(struct gpio_sim_bank *bank)
{}

struct gpio_sim_hog;

struct gpio_sim_line {};

static struct gpio_sim_line *to_gpio_sim_line(struct config_item *item)
{}

static struct gpio_sim_device *
gpio_sim_line_get_device(struct gpio_sim_line *line)
{}

struct gpio_sim_hog {};

static struct gpio_sim_hog *to_gpio_sim_hog(struct config_item *item)
{}

static struct gpio_sim_device *gpio_sim_hog_get_device(struct gpio_sim_hog *hog)
{}

static bool gpio_sim_device_is_live(struct gpio_sim_device *dev)
{}

static char *gpio_sim_strdup_trimmed(const char *str, size_t count)
{}

static ssize_t gpio_sim_device_config_dev_name_show(struct config_item *item,
						    char *page)
{}

CONFIGFS_ATTR_RO();

static ssize_t
gpio_sim_device_config_live_show(struct config_item *item, char *page)
{}

static unsigned int gpio_sim_get_line_names_size(struct gpio_sim_bank *bank)
{}

static void
gpio_sim_set_line_names(struct gpio_sim_bank *bank, char **line_names)
{}

static void gpio_sim_remove_hogs(struct gpio_sim_device *dev)
{}

static int gpio_sim_add_hogs(struct gpio_sim_device *dev)
{}

static struct fwnode_handle *
gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank,
			  struct fwnode_handle *parent)
{}

static void gpio_sim_remove_swnode_recursive(struct fwnode_handle *swnode)
{}

static bool gpio_sim_bank_labels_non_unique(struct gpio_sim_device *dev)
{}

static int gpio_sim_device_activate(struct gpio_sim_device *dev)
{}

static void gpio_sim_device_deactivate(struct gpio_sim_device *dev)
{}

static ssize_t
gpio_sim_device_config_live_store(struct config_item *item,
				  const char *page, size_t count)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *gpio_sim_device_config_attrs[] =;

struct gpio_sim_chip_name_ctx {};

static int gpio_sim_emit_chip_name(struct device *dev, void *data)
{}

static ssize_t gpio_sim_bank_config_chip_name_show(struct config_item *item,
						   char *page)
{}

CONFIGFS_ATTR_RO();

static ssize_t
gpio_sim_bank_config_label_show(struct config_item *item, char *page)
{}

static ssize_t gpio_sim_bank_config_label_store(struct config_item *item,
						const char *page, size_t count)
{}

CONFIGFS_ATTR();

static ssize_t
gpio_sim_bank_config_num_lines_show(struct config_item *item, char *page)
{}

static ssize_t
gpio_sim_bank_config_num_lines_store(struct config_item *item,
				     const char *page, size_t count)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *gpio_sim_bank_config_attrs[] =;

static ssize_t
gpio_sim_line_config_name_show(struct config_item *item, char *page)
{}

static ssize_t gpio_sim_line_config_name_store(struct config_item *item,
					       const char *page, size_t count)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *gpio_sim_line_config_attrs[] =;

static ssize_t gpio_sim_hog_config_name_show(struct config_item *item,
					     char *page)
{}

static ssize_t gpio_sim_hog_config_name_store(struct config_item *item,
					      const char *page, size_t count)
{}

CONFIGFS_ATTR();

static ssize_t gpio_sim_hog_config_direction_show(struct config_item *item,
						  char *page)
{}

static ssize_t
gpio_sim_hog_config_direction_store(struct config_item *item,
				    const char *page, size_t count)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *gpio_sim_hog_config_attrs[] =;

static void gpio_sim_hog_config_item_release(struct config_item *item)
{}

static struct configfs_item_operations gpio_sim_hog_config_item_ops =;

static const struct config_item_type gpio_sim_hog_config_type =;

static struct config_item *
gpio_sim_line_config_make_hog_item(struct config_group *group, const char *name)
{}

static void gpio_sim_line_config_group_release(struct config_item *item)
{}

static struct configfs_item_operations gpio_sim_line_config_item_ops =;

static struct configfs_group_operations gpio_sim_line_config_group_ops =;

static const struct config_item_type gpio_sim_line_config_type =;

static struct config_group *
gpio_sim_bank_config_make_line_group(struct config_group *group,
				     const char *name)
{}

static void gpio_sim_bank_config_group_release(struct config_item *item)
{}

static struct configfs_item_operations gpio_sim_bank_config_item_ops =;

static struct configfs_group_operations gpio_sim_bank_config_group_ops =;

static const struct config_item_type gpio_sim_bank_config_group_type =;

static struct config_group *
gpio_sim_device_config_make_bank_group(struct config_group *group,
				       const char *name)
{}

static void gpio_sim_device_config_group_release(struct config_item *item)
{}

static struct configfs_item_operations gpio_sim_device_config_item_ops =;

static struct configfs_group_operations gpio_sim_device_config_group_ops =;

static const struct config_item_type gpio_sim_device_config_group_type =;

static struct config_group *
gpio_sim_config_make_device_group(struct config_group *group, const char *name)
{}

static struct configfs_group_operations gpio_sim_config_group_ops =;

static const struct config_item_type gpio_sim_config_type =;

static struct configfs_subsystem gpio_sim_config_subsys =;

static int __init gpio_sim_init(void)
{}
module_init();

static void __exit gpio_sim_exit(void)
{}
module_exit(gpio_sim_exit);

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