linux/drivers/platform/chrome/cros_hps_i2c.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for the ChromeOS human presence sensor (HPS), attached via I2C.
 *
 * The driver exposes HPS as a character device, although currently no read or
 * write operations are supported. Instead, the driver only controls the power
 * state of the sensor, keeping it on only while userspace holds an open file
 * descriptor to the HPS device.
 *
 * Copyright 2022 Google LLC.
 */

#include <linux/acpi.h>
#include <linux/fs.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>

#define HPS_ACPI_ID

struct hps_drvdata {};

static void hps_set_power(struct hps_drvdata *hps, bool state)
{}

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

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

static const struct file_operations hps_fops =;

static int hps_i2c_probe(struct i2c_client *client)
{}

static void hps_i2c_remove(struct i2c_client *client)
{}

static int hps_suspend(struct device *dev)
{}

static int hps_resume(struct device *dev)
{}
static DEFINE_RUNTIME_DEV_PM_OPS(hps_pm_ops, hps_suspend, hps_resume, NULL);

static const struct i2c_device_id hps_i2c_id[] =;
MODULE_DEVICE_TABLE(i2c, hps_i2c_id);

#ifdef CONFIG_ACPI
static const struct acpi_device_id hps_acpi_id[] =;
MODULE_DEVICE_TABLE(acpi, hps_acpi_id);
#endif /* CONFIG_ACPI */

static struct i2c_driver hps_i2c_driver =;
module_i2c_driver();

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