linux/drivers/gpio/gpio-aggregator.c

// SPDX-License-Identifier: GPL-2.0-only
//
// GPIO Aggregator
//
// Copyright (C) 2019-2020 Glider bv

#define DRV_NAME
#define pr_fmt(fmt)

#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/overflow.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>

#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>

#define AGGREGATOR_MAX_GPIOS

/*
 * GPIO Aggregator sysfs interface
 */

struct gpio_aggregator {};

static DEFINE_MUTEX(gpio_aggregator_lock);	/* protects idr */
static DEFINE_IDR(gpio_aggregator_idr);

static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
			 int hwnum, unsigned int *n)
{}

static int aggr_parse(struct gpio_aggregator *aggr)
{}

static ssize_t new_device_store(struct device_driver *driver, const char *buf,
				size_t count)
{}

static DRIVER_ATTR_WO(new_device);

static void gpio_aggregator_free(struct gpio_aggregator *aggr)
{}

static ssize_t delete_device_store(struct device_driver *driver,
				   const char *buf, size_t count)
{}
static DRIVER_ATTR_WO(delete_device);

static struct attribute *gpio_aggregator_attrs[] =;
ATTRIBUTE_GROUPS();

static int __exit gpio_aggregator_idr_remove(int id, void *p, void *data)
{}

static void __exit gpio_aggregator_remove_all(void)
{}


/*
 *  GPIO Forwarder
 */

struct gpiochip_fwd_timing {};

struct gpiochip_fwd {};

#define fwd_tmp_values(fwd)
#define fwd_tmp_descs(fwd)

#define fwd_tmp_size(ngpios)

static int gpio_fwd_get_direction(struct gpio_chip *chip, unsigned int offset)
{}

static int gpio_fwd_direction_input(struct gpio_chip *chip, unsigned int offset)
{}

static int gpio_fwd_direction_output(struct gpio_chip *chip,
				     unsigned int offset, int value)
{}

static int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset)
{}

static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
				 unsigned long *bits)
{}

static int gpio_fwd_get_multiple_locked(struct gpio_chip *chip,
					unsigned long *mask, unsigned long *bits)
{}

static void gpio_fwd_delay(struct gpio_chip *chip, unsigned int offset, int value)
{}

static void gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int value)
{}

static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
				  unsigned long *bits)
{}

static void gpio_fwd_set_multiple_locked(struct gpio_chip *chip,
					 unsigned long *mask, unsigned long *bits)
{}

static int gpio_fwd_set_config(struct gpio_chip *chip, unsigned int offset,
			       unsigned long config)
{}

static int gpio_fwd_to_irq(struct gpio_chip *chip, unsigned int offset)
{}

/*
 * The GPIO delay provides a way to configure platform specific delays
 * for the GPIO ramp-up or ramp-down delays. This can serve the following
 * purposes:
 *   - Open-drain output using an RC filter
 */
#define FWD_FEATURE_DELAY

#ifdef CONFIG_OF_GPIO
static int gpiochip_fwd_delay_of_xlate(struct gpio_chip *chip,
				       const struct of_phandle_args *gpiospec,
				       u32 *flags)
{}

static int gpiochip_fwd_setup_delay_line(struct device *dev, struct gpio_chip *chip,
					 struct gpiochip_fwd *fwd)
{}
#else
static int gpiochip_fwd_setup_delay_line(struct device *dev, struct gpio_chip *chip,
					 struct gpiochip_fwd *fwd)
{
	return 0;
}
#endif	/* !CONFIG_OF_GPIO */

/**
 * gpiochip_fwd_create() - Create a new GPIO forwarder
 * @dev: Parent device pointer
 * @ngpios: Number of GPIOs in the forwarder.
 * @descs: Array containing the GPIO descriptors to forward to.
 *         This array must contain @ngpios entries, and must not be deallocated
 *         before the forwarder has been destroyed again.
 * @features: Bitwise ORed features as defined with FWD_FEATURE_*.
 *
 * This function creates a new gpiochip, which forwards all GPIO operations to
 * the passed GPIO descriptors.
 *
 * Return: An opaque object pointer, or an ERR_PTR()-encoded negative error
 *         code on failure.
 */
static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
						unsigned int ngpios,
						struct gpio_desc *descs[],
						unsigned long features)
{}


/*
 *  GPIO Aggregator platform device
 */

static int gpio_aggregator_probe(struct platform_device *pdev)
{}

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

static struct platform_driver gpio_aggregator_driver =;

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

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

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