coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
camera.c File Reference
#include <stdlib.h>
#include <acpi/acpi.h>
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
#include <acpi/acpigen_pci.h>
#include <arch/cpu.h>
#include <console/console.h>
#include <cpu/intel/cpu_ids.h>
#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <device/pci_def.h>
#include "chip.h"
Include dependency graph for camera.c:

Go to the source code of this file.

Macros

#define SENSOR_NAME_UUID   "822ace8f-2814-4174-a56b-5f029fe079ee"
 
#define SENSOR_TYPE_UUID   "26257549-9271-4ca4-bb43-c4899d5a4881"
 
#define DEFAULT_ENDPOINT   0
 
#define DEFAULT_REMOTE_NAME   "\\_SB.PCI0.CIO2"
 
#define CIO2_PCI_DEV   0x14
 
#define CIO2_PCI_FN   0x3
 
#define POWER_RESOURCE_NAME   "PRIC"
 
#define GUARD_VARIABLE_FORMAT   "RES%1d"
 
#define ENABLE_METHOD_FORMAT   "ENB%1d"
 
#define DISABLE_METHOD_FORMAT   "DSB%1d"
 
#define UNKNOWN_METHOD_FORMAT   "UNK%1d"
 
#define CLK_ENABLE_METHOD   "MCON"
 
#define CLK_DISABLE_METHOD   "MCOF"
 

Functions

static void resource_set_action_type (struct resource_config *res_config, enum action_type action)
 
static enum action_type resource_get_action_type (const struct resource_config *res_config)
 
static enum ctrl_type resource_get_ctrl_type (const struct resource_config *res_config)
 
static void resource_set_clk_config (struct resource_config *res_config, const struct clk_config *clk_conf)
 
static const struct clk_configresource_clk_config (const struct resource_config *res_config)
 
static void resource_set_gpio_config (struct resource_config *res_config, const struct gpio_config *gpio_conf)
 
static const struct gpio_configresource_gpio_config (const struct resource_config *res_config)
 
static void camera_fill_cio2 (const struct device *dev)
 
static void apply_pld_defaults (struct drivers_intel_mipi_camera_config *config)
 
static void camera_generate_pld (const struct device *dev)
 
static uint32_t address_for_dev_type (const struct device *dev, uint8_t dev_type)
 
static void camera_generate_dsm (const struct device *dev)
 
static void camera_fill_ssdb_defaults (struct drivers_intel_mipi_camera_config *config)
 
static void camera_fill_sensor (const struct device *dev)
 
static void camera_fill_nvm (const struct device *dev)
 
static void camera_fill_vcm (const struct device *dev)
 
static int get_resource_index (const struct resource_config *res_config)
 
static void add_guarded_method_namestring (struct resource_config *res_config, int res_index)
 
static void call_guarded_method (struct resource_config *res_config)
 
static void add_clk_op (const struct clk_config *clk_config, enum action_type action)
 
static void add_gpio_op (const struct gpio_config *gpio_config, enum action_type action)
 
static void add_power_operation (const struct resource_config *res_config)
 
static void write_guard_variable (uint8_t res_index)
 
static void write_enable_method (struct resource_config *res_config, uint8_t res_index)
 
static void write_disable_method (struct resource_config *res_config, uint8_t res_index)
 
static void add_guarded_operations (const struct drivers_intel_mipi_camera_config *config, const struct operation_seq *seq)
 
static void fill_power_res_sequence (struct drivers_intel_mipi_camera_config *config, struct operation_seq *seq)
 
static void write_pci_camera_device (const struct device *dev)
 
static void write_i2c_camera_device (const struct device *dev, const char *scope)
 
static void write_camera_device_common (const struct device *dev)
 
static void camera_fill_ssdt (const struct device *dev)
 
static const char * camera_acpi_name (const struct device *dev)
 
static void camera_enable (struct device *dev)
 

Variables

static struct camera_resource_manager res_mgr
 
static struct device_operations camera_ops
 
struct chip_operations drivers_intel_mipi_camera_ops
 

Macro Definition Documentation

◆ CIO2_PCI_DEV

#define CIO2_PCI_DEV   0x14

Definition at line 21 of file camera.c.

◆ CIO2_PCI_FN

#define CIO2_PCI_FN   0x3

Definition at line 22 of file camera.c.

◆ CLK_DISABLE_METHOD

#define CLK_DISABLE_METHOD   "MCOF"

Definition at line 29 of file camera.c.

◆ CLK_ENABLE_METHOD

#define CLK_ENABLE_METHOD   "MCON"

Definition at line 28 of file camera.c.

◆ DEFAULT_ENDPOINT

#define DEFAULT_ENDPOINT   0

Definition at line 19 of file camera.c.

◆ DEFAULT_REMOTE_NAME

#define DEFAULT_REMOTE_NAME   "\\_SB.PCI0.CIO2"

Definition at line 20 of file camera.c.

◆ DISABLE_METHOD_FORMAT

#define DISABLE_METHOD_FORMAT   "DSB%1d"

Definition at line 26 of file camera.c.

◆ ENABLE_METHOD_FORMAT

#define ENABLE_METHOD_FORMAT   "ENB%1d"

Definition at line 25 of file camera.c.

◆ GUARD_VARIABLE_FORMAT

#define GUARD_VARIABLE_FORMAT   "RES%1d"

Definition at line 24 of file camera.c.

◆ POWER_RESOURCE_NAME

#define POWER_RESOURCE_NAME   "PRIC"

Definition at line 23 of file camera.c.

◆ SENSOR_NAME_UUID

#define SENSOR_NAME_UUID   "822ace8f-2814-4174-a56b-5f029fe079ee"

Definition at line 17 of file camera.c.

◆ SENSOR_TYPE_UUID

#define SENSOR_TYPE_UUID   "26257549-9271-4ca4-bb43-c4899d5a4881"

Definition at line 18 of file camera.c.

◆ UNKNOWN_METHOD_FORMAT

#define UNKNOWN_METHOD_FORMAT   "UNK%1d"

Definition at line 27 of file camera.c.

Function Documentation

◆ add_clk_op()

static void add_clk_op ( const struct clk_config clk_config,
enum action_type  action 
)
static

◆ add_gpio_op()

static void add_gpio_op ( const struct gpio_config gpio_config,
enum action_type  action 
)
static

Definition at line 614 of file camera.c.

References acpigen_soc_clear_tx_gpio(), acpigen_soc_set_tx_gpio(), acpigen_write_debug_string(), BIOS_ERR, DISABLE, ENABLE, gpio_config::gpio_num, NULL, and printk.

Referenced by add_power_operation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_guarded_method_namestring()

static void add_guarded_method_namestring ( struct resource_config res_config,
int  res_index 
)
static

Definition at line 551 of file camera.c.

References ACPI_NAME_BUFFER_SIZE, acpigen_emit_namestring(), BIOS_ERR, DISABLE, DISABLE_METHOD_FORMAT, ENABLE, ENABLE_METHOD_FORMAT, printk, resource_get_action_type(), snprintf(), and UNKNOWN_METHOD_FORMAT.

Referenced by call_guarded_method().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_guarded_operations()

◆ add_power_operation()

static void add_power_operation ( const struct resource_config res_config)
static

Definition at line 633 of file camera.c.

References add_clk_op(), add_gpio_op(), BIOS_ERR, GPIO, gpio_config, IMGCLK, NULL, printk, resource_clk_config(), resource_get_action_type(), resource_get_ctrl_type(), resource_gpio_config(), and type.

Referenced by write_disable_method(), and write_enable_method().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ address_for_dev_type()

static uint32_t address_for_dev_type ( const struct device dev,
uint8_t  dev_type 
)
static

Definition at line 208 of file camera.c.

References device::bus, device::chip_info, config, DEV_TYPE_ROM, DEV_TYPE_SENSOR, DEV_TYPE_VCM, i2c_path::device, device_path::i2c, device::path, and bus::secondary.

Referenced by camera_generate_dsm().

Here is the caller graph for this function:

◆ apply_pld_defaults()

static void apply_pld_defaults ( struct drivers_intel_mipi_camera_config config)
static

Definition at line 160 of file camera.c.

References config, PLD_HORIZONTAL_POSITION_CENTER, and PLD_PANEL_FRONT.

Referenced by camera_generate_pld().

Here is the caller graph for this function:

◆ call_guarded_method()

static void call_guarded_method ( struct resource_config res_config)
static

Definition at line 571 of file camera.c.

References add_guarded_method_namestring(), get_resource_index(), and NULL.

Referenced by fill_power_res_sequence().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ camera_acpi_name()

static const char* camera_acpi_name ( const struct device dev)
static

◆ camera_enable()

static void camera_enable ( struct device dev)
static

Definition at line 1039 of file camera.c.

References camera_ops, and device::ops.

◆ camera_fill_cio2()

static void camera_fill_cio2 ( const struct device dev)
static

◆ camera_fill_nvm()

static void camera_fill_nvm ( const struct device dev)
static

Definition at line 467 of file camera.c.

References acpi_dp_add_integer(), acpi_dp_add_string(), acpi_dp_new_table(), acpi_dp_write(), device::chip_info, and config.

Referenced by write_camera_device_common().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ camera_fill_sensor()

◆ camera_fill_ssdb_defaults()

◆ camera_fill_ssdt()

◆ camera_fill_vcm()

static void camera_fill_vcm ( const struct device dev)
static

Definition at line 504 of file camera.c.

References acpi_dp_add_integer(), acpi_dp_add_string(), acpi_dp_new_table(), acpi_dp_write(), device::chip_info, and config.

Referenced by write_camera_device_common().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ camera_generate_dsm()

◆ camera_generate_pld()

static void camera_generate_pld ( const struct device dev)
static

Definition at line 196 of file camera.c.

References acpigen_write_pld(), apply_pld_defaults(), device::chip_info, and config.

Referenced by camera_fill_sensor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_power_res_sequence()

static void fill_power_res_sequence ( struct drivers_intel_mipi_camera_config config,
struct operation_seq seq 
)
static

◆ get_resource_index()

static int get_resource_index ( const struct resource_config res_config)
static

◆ resource_clk_config()

static const struct clk_config* resource_clk_config ( const struct resource_config res_config)
static

Definition at line 59 of file camera.c.

References resource_config::clk_conf, and NULL.

Referenced by add_power_operation(), and get_resource_index().

Here is the caller graph for this function:

◆ resource_get_action_type()

static enum action_type resource_get_action_type ( const struct resource_config res_config)
static

Definition at line 33 of file camera.c.

References resource_config::action.

Referenced by add_guarded_method_namestring(), and add_power_operation().

Here is the caller graph for this function:

◆ resource_get_ctrl_type()

static enum ctrl_type resource_get_ctrl_type ( const struct resource_config res_config)
static

Definition at line 33 of file camera.c.

Referenced by add_power_operation(), and get_resource_index().

Here is the caller graph for this function:

◆ resource_gpio_config()

static const struct gpio_config* resource_gpio_config ( const struct resource_config res_config)
static

Definition at line 73 of file camera.c.

References resource_config::gpio_conf, and NULL.

Referenced by add_power_operation(), and get_resource_index().

Here is the caller graph for this function:

◆ resource_set_action_type()

static void resource_set_action_type ( struct resource_config res_config,
enum action_type  action 
)
static

Definition at line 33 of file camera.c.

Referenced by fill_power_res_sequence(), write_disable_method(), and write_enable_method().

Here is the caller graph for this function:

◆ resource_set_clk_config()

static void resource_set_clk_config ( struct resource_config res_config,
const struct clk_config clk_conf 
)
static

Definition at line 50 of file camera.c.

References resource_config::clk_conf, IMGCLK, and resource_config::type.

Referenced by add_guarded_operations(), and fill_power_res_sequence().

Here is the caller graph for this function:

◆ resource_set_gpio_config()

static void resource_set_gpio_config ( struct resource_config res_config,
const struct gpio_config gpio_conf 
)
static

Definition at line 64 of file camera.c.

References GPIO, resource_config::gpio_conf, and resource_config::type.

Referenced by add_guarded_operations(), and fill_power_res_sequence().

Here is the caller graph for this function:

◆ write_camera_device_common()

◆ write_disable_method()

static void write_disable_method ( struct resource_config res_config,
uint8_t  res_index 
)
static

◆ write_enable_method()

static void write_enable_method ( struct resource_config res_config,
uint8_t  res_index 
)
static

◆ write_guard_variable()

static void write_guard_variable ( uint8_t  res_index)
static

Definition at line 659 of file camera.c.

References ACPI_NAME_BUFFER_SIZE, acpigen_write_name_integer(), GUARD_VARIABLE_FORMAT, and snprintf().

Referenced by add_guarded_operations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_i2c_camera_device()

◆ write_pci_camera_device()

static void write_pci_camera_device ( const struct device dev)
static

Definition at line 791 of file camera.c.

References acpi_device_name(), acpigen_write_ADR_pci_device(), acpigen_write_device(), acpigen_write_name_string(), BIOS_ERR, DEVICE_PATH_PCI, device::path, printk, and device_path::type.

Referenced by camera_fill_ssdt().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ camera_ops

struct device_operations camera_ops
static
Initial value:
= {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.acpi_name = camera_acpi_name,
.acpi_fill_ssdt = camera_fill_ssdt,
}
static void camera_fill_ssdt(const struct device *dev)
Definition: camera.c:932
static const char * camera_acpi_name(const struct device *dev)
Definition: camera.c:991
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74

Definition at line 991 of file camera.c.

Referenced by camera_enable().

◆ drivers_intel_mipi_camera_ops

struct chip_operations drivers_intel_mipi_camera_ops
Initial value:
= {
.enable_dev = camera_enable
}
static void camera_enable(struct device *dev)
Definition: camera.c:1039

Definition at line 1039 of file camera.c.

◆ res_mgr

struct camera_resource_manager res_mgr
static

Definition at line 1 of file camera.c.

Referenced by add_guarded_operations(), and get_resource_index().