linux/drivers/gpio/gpio-cros-ec.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright 2024 Google LLC
 *
 * This driver provides the ability to control GPIOs on the Chrome OS EC.
 * There isn't any direction control, and setting values on GPIOs is only
 * possible when the system is unlocked.
 */

#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/gpio/driver.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>

/* Prefix all names to avoid collisions with EC <-> AP nets */
static const char cros_ec_gpio_prefix[] =;

/* Setting gpios is only supported when the system is unlocked */
static void cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
{}

static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio)
{}

#define CROS_EC_GPIO_INPUT
#define CROS_EC_GPIO_OUTPUT

static int cros_ec_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
{}

/* Query EC for all gpio line names */
static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_chip *gc)
{}

/* Query EC for number of gpios */
static int cros_ec_gpio_ngpios(struct cros_ec_device *cros_ec)
{}

static int cros_ec_gpio_probe(struct platform_device *pdev)
{}

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

static struct platform_driver cros_ec_gpio_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();