linux/drivers/iio/accel/bmc150-accel-i2c.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * 3-axis accelerometer driver supporting many I2C Bosch-Sensortec chips
 * Copyright (c) 2014, Intel Corporation.
 */

#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/regmap.h>

#include "bmc150-accel.h"

#ifdef CONFIG_ACPI
static const struct acpi_device_id bmc150_acpi_dual_accel_ids[] =;

/*
 * The DUAL250E ACPI device for 360° hinges type 2-in-1s with 1 accelerometer
 * in the display and 1 in the hinge has an ACPI-method (DSM) to tell the
 * ACPI code about the angle between the 2 halves. This will make the ACPI
 * code enable/disable the keyboard and touchpad. We need to call this to avoid
 * the keyboard being disabled when the 2-in-1 is turned-on or resumed while
 * fully folded into tablet mode (which gets detected with a HALL-sensor).
 * If we don't call this then the keyboard won't work even when the 2-in-1 is
 * changed to be used in laptop mode after the power-on / resume.
 *
 * This DSM takes 2 angles, selected by setting aux0 to 0 or 1, these presumably
 * define the angle between the gravity vector measured by the accelerometer in
 * the display (aux0=0) resp. the base (aux0=1) and some reference vector.
 * The 2 angles get subtracted from each other so the reference vector does
 * not matter and we can simply leave the second angle at 0.
 */

#define BMC150_DSM_GUID
#define DUAL250E_SET_ANGLE_FN_INDEX

struct dual250e_set_angle_args {} __packed;

static bool bmc150_acpi_set_angle_dsm(struct i2c_client *client, u32 aux0, u32 ang0)
{}

static bool bmc150_acpi_enable_keyboard(struct i2c_client *client)
{}

static void bmc150_acpi_resume_work(struct work_struct *work)
{}

static void bmc150_acpi_resume_handler(struct device *dev)
{}

/*
 * Some acpi_devices describe 2 accelerometers in a single ACPI device,
 * try instantiating a second i2c_client for an I2cSerialBusV2 ACPI resource
 * with index 1.
 */
static void bmc150_acpi_dual_accel_probe(struct i2c_client *client)
{}

static void bmc150_acpi_dual_accel_remove(struct i2c_client *client)
{}
#else
static void bmc150_acpi_dual_accel_probe(struct i2c_client *client) {}
static void bmc150_acpi_dual_accel_remove(struct i2c_client *client) {}
#endif

static int bmc150_accel_probe(struct i2c_client *client)
{}

static void bmc150_accel_remove(struct i2c_client *client)
{}

static const struct acpi_device_id bmc150_accel_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);

static const struct i2c_device_id bmc150_accel_id[] =;

MODULE_DEVICE_TABLE(i2c, bmc150_accel_id);

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

static struct i2c_driver bmc150_accel_driver =;
module_i2c_driver();

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