linux/drivers/i2c/i2c-core-acpi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Linux I2C core ACPI support code
 *
 * Copyright (C) 2014 Intel Corp, Author: Lan Tianyu <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>

#include "i2c-core.h"

struct i2c_acpi_handler_data {};

struct gsb_buffer {} __packed;

struct i2c_acpi_lookup {};

/**
 * i2c_acpi_get_i2c_resource - Gets I2cSerialBus resource if type matches
 * @ares:	ACPI resource
 * @i2c:	Pointer to I2cSerialBus resource will be returned here
 *
 * Checks if the given ACPI resource is of type I2cSerialBus.
 * In this case, returns a pointer to it to the caller.
 *
 * Returns true if resource type is of I2cSerialBus, otherwise false.
 */
bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
			       struct acpi_resource_i2c_serialbus **i2c)
{}
EXPORT_SYMBOL_GPL();

static int i2c_acpi_resource_count(struct acpi_resource *ares, void *data)
{}

/**
 * i2c_acpi_client_count - Count the number of I2cSerialBus resources
 * @adev:	ACPI device
 *
 * Returns the number of I2cSerialBus resources in the ACPI-device's
 * resource-list; or a negative error code.
 */
int i2c_acpi_client_count(struct acpi_device *adev)
{}
EXPORT_SYMBOL_GPL();

static int i2c_acpi_fill_info(struct acpi_resource *ares, void *data)
{}

static const struct acpi_device_id i2c_acpi_ignored_device_ids[] =;

struct i2c_acpi_irq_context {};

static int i2c_acpi_do_lookup(struct acpi_device *adev,
			      struct i2c_acpi_lookup *lookup)
{}

static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *data)
{}

/**
 * i2c_acpi_get_irq - get device IRQ number from ACPI
 * @client: Pointer to the I2C client device
 * @wake_capable: Set to true if the IRQ is wake capable
 *
 * Find the IRQ number used by a specific client device.
 *
 * Return: The IRQ number or an error code.
 */
int i2c_acpi_get_irq(struct i2c_client *client, bool *wake_capable)
{}

static int i2c_acpi_get_info(struct acpi_device *adev,
			     struct i2c_board_info *info,
			     struct i2c_adapter *adapter,
			     acpi_handle *adapter_handle)
{}

static void i2c_acpi_register_device(struct i2c_adapter *adapter,
				     struct acpi_device *adev,
				     struct i2c_board_info *info)
{}

static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
				       void *data, void **return_value)
{}

#define I2C_ACPI_MAX_SCAN_DEPTH

/**
 * i2c_acpi_register_devices - enumerate I2C slave devices behind adapter
 * @adap: pointer to adapter
 *
 * Enumerate all I2C slave devices behind this adapter by walking the ACPI
 * namespace. When a device is found it will be added to the Linux device
 * model and bound to the corresponding ACPI handle.
 */
void i2c_acpi_register_devices(struct i2c_adapter *adap)
{}

static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] =;

static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
					   void *data, void **return_value)
{}

/**
 * i2c_acpi_find_bus_speed - find I2C bus speed from ACPI
 * @dev: The device owning the bus
 *
 * Find the I2C bus speed by walking the ACPI namespace for all I2C slaves
 * devices connected to this bus and use the speed of slowest device.
 *
 * Returns the speed in Hz or zero
 */
u32 i2c_acpi_find_bus_speed(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
{}
EXPORT_SYMBOL_GPL();

static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
{}

static struct i2c_adapter *i2c_acpi_find_adapter_by_adev(struct acpi_device *adev)
{}

static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
			   void *arg)
{}

struct notifier_block i2c_acpi_notifier =;

/**
 * i2c_acpi_new_device_by_fwnode - Create i2c-client for the Nth I2cSerialBus resource
 * @fwnode:  fwnode with the ACPI resources to get the client from
 * @index:   Index of ACPI resource to get
 * @info:    describes the I2C device; note this is modified (addr gets set)
 * Context: can sleep
 *
 * By default the i2c subsys creates an i2c-client for the first I2cSerialBus
 * resource of an acpi_device, but some acpi_devices have multiple I2cSerialBus
 * resources, in that case this function can be used to create an i2c-client
 * for other I2cSerialBus resources in the Current Resource Settings table.
 *
 * Also see i2c_new_client_device, which this function calls to create the
 * i2c-client.
 *
 * Returns a pointer to the new i2c-client, or error pointer in case of failure.
 * Specifically, -EPROBE_DEFER is returned if the adapter is not found.
 */
struct i2c_client *i2c_acpi_new_device_by_fwnode(struct fwnode_handle *fwnode,
						 int index,
						 struct i2c_board_info *info)
{}
EXPORT_SYMBOL_GPL();

bool i2c_acpi_waive_d0_probe(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_ACPI_I2C_OPREGION
static int acpi_gsb_i2c_read_bytes(struct i2c_client *client,
		u8 cmd, u8 *data, u8 data_len)
{}

static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
		u8 cmd, u8 *data, u8 data_len)
{}

static acpi_status
i2c_acpi_space_handler(u32 function, acpi_physical_address command,
			u32 bits, u64 *value64,
			void *handler_context, void *region_context)
{}


int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
{}

void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter)
{}
#endif /* CONFIG_ACPI_I2C_OPREGION */