coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
rtd2132.c File Reference
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <device/smbus.h>
#include <device/pci.h>
#include "chip.h"
Include dependency graph for rtd2132.c:

Go to the source code of this file.

Macros

#define RTD2132_COMMAND   0x01
 
#define RTD2132_DATA   0x00
 
#define RTD2132_FIRMWARE   0x80
 
#define RTD2132_FIRMWARE_START   0x00
 
#define RTD2132_FIRMWARE_STOP   0x01
 
#define RTD2132_COMMAND_PWR_SEQ_T1   0x32 /* 1ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T2   0x33 /* 4ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T3   0x34 /* 1ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T4   0x35 /* 1ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T5   0x36 /* 4ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T6   0x37 /* 1ms units. */
 
#define RTD2132_COMMAND_PWR_SEQ_T7   0x38 /* 4ms units. */
 
#define RTD2132_COMMAND_SSCG_CONFIG_0   0x39
 
#define RTD2132_SSCG_ENABLE   0xa0
 
#define RTD2132_SSCG_DISABLE   0x20
 
#define RTD2132_COMMAND_SSCG_CONFIG_1   0x3a
 
#define RTD2132_SSCG_CONFIG_DISABLED   0x01 /* DISABLED */
 
#define RTD2132_SSCG_CONFIG_0_5   0x07 /* 0.5% */
 
#define RTD2132_SSCG_CONFIG_1_0   0x0f /* 1.0% */
 
#define RTD2132_SSCG_CONFIG_1_5   0x16 /* 1.5% */
 
#define RTD2132_COMMAND_LVDS_SWAP   0x3b
 
#define RTD2132_LVDS_SWAP_DUAL   0x80
 
#define RTD2132_LVDS_SWAP_NORMAL   0x04
 
#define RTD2132_LVDS_SWAP_MIRROR   0x14
 
#define RTD2132_LVDS_SWAP_P_N   0x24
 
#define RTD2132_LVDS_SWAP_MIRROR_P_N   0x34
 
#define RTD2132_LVDS_SWAP_R_L   0x0c
 
#define RTD2132_SSCG_PERCENT_0_0   0x00 /* DISABLED */
 
#define RTD2132_SSCG_PERCENT_0_5   0x05 /* 0.5% */
 
#define RTD2132_SSCG_PERCENT_1_0   0x10 /* 1.0% */
 
#define RTD2132_SSCG_PERCENT_1_5   0x15 /* 1.5% */
 
#define RTD2132_LVDS_SWAP_CFG_DUAL   0x80
 
#define RTD2132_LVDS_SWAP_CFG_NORMAL   0x00
 
#define RTD2132_LVDS_SWAP_CFG_MIRROR   0x01
 
#define RTD2132_LVDS_SWAP_CFG_P_N   0x02
 
#define RTD2132_LVDS_SWAP_CFG_MIRROR_P_N   0x03
 
#define RTD2132_LVDS_SWAP_CFG_R_L   0x04
 
#define RTD2132_DEBUG_REG   0
 

Functions

static void rtd2132_write_reg (struct device *dev, u8 reg, u8 value)
 
static void rtd2132_firmware_stop (struct device *dev)
 
static void rtd2132_firmware_start (struct device *dev)
 
static void rtd2132_pps (struct device *dev, struct drivers_i2c_rtd2132_config *cfg)
 
static void rtd2132_sscg_enable (struct device *dev, u8 sscg_percent)
 
static void rtd2132_sscg_disable (struct device *dev)
 
static void rtd2132_sscg (struct device *dev, struct drivers_i2c_rtd2132_config *cfg)
 
static void rtd2132_lvds_swap (struct device *dev, struct drivers_i2c_rtd2132_config *cfg)
 
static void rtd2132_defaults (struct device *dev)
 
static void rtd2132_setup (struct device *dev)
 
static void rtd2132_init (struct device *dev)
 
static void enable_dev (struct device *dev)
 

Variables

static struct device_operations rtd2132_operations
 
struct chip_operations drivers_i2c_rtd2132_ops
 

Macro Definition Documentation

◆ RTD2132_COMMAND

#define RTD2132_COMMAND   0x01

Definition at line 11 of file rtd2132.c.

◆ RTD2132_COMMAND_LVDS_SWAP

#define RTD2132_COMMAND_LVDS_SWAP   0x3b

Definition at line 37 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T1

#define RTD2132_COMMAND_PWR_SEQ_T1   0x32 /* 1ms units. */

Definition at line 18 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T2

#define RTD2132_COMMAND_PWR_SEQ_T2   0x33 /* 4ms units. */

Definition at line 19 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T3

#define RTD2132_COMMAND_PWR_SEQ_T3   0x34 /* 1ms units. */

Definition at line 20 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T4

#define RTD2132_COMMAND_PWR_SEQ_T4   0x35 /* 1ms units. */

Definition at line 21 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T5

#define RTD2132_COMMAND_PWR_SEQ_T5   0x36 /* 4ms units. */

Definition at line 22 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T6

#define RTD2132_COMMAND_PWR_SEQ_T6   0x37 /* 1ms units. */

Definition at line 23 of file rtd2132.c.

◆ RTD2132_COMMAND_PWR_SEQ_T7

#define RTD2132_COMMAND_PWR_SEQ_T7   0x38 /* 4ms units. */

Definition at line 24 of file rtd2132.c.

◆ RTD2132_COMMAND_SSCG_CONFIG_0

#define RTD2132_COMMAND_SSCG_CONFIG_0   0x39

Definition at line 27 of file rtd2132.c.

◆ RTD2132_COMMAND_SSCG_CONFIG_1

#define RTD2132_COMMAND_SSCG_CONFIG_1   0x3a

Definition at line 30 of file rtd2132.c.

◆ RTD2132_DATA

#define RTD2132_DATA   0x00

Definition at line 12 of file rtd2132.c.

◆ RTD2132_DEBUG_REG

#define RTD2132_DEBUG_REG   0

Definition at line 58 of file rtd2132.c.

◆ RTD2132_FIRMWARE

#define RTD2132_FIRMWARE   0x80

Definition at line 13 of file rtd2132.c.

◆ RTD2132_FIRMWARE_START

#define RTD2132_FIRMWARE_START   0x00

Definition at line 14 of file rtd2132.c.

◆ RTD2132_FIRMWARE_STOP

#define RTD2132_FIRMWARE_STOP   0x01

Definition at line 15 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_DUAL

#define RTD2132_LVDS_SWAP_CFG_DUAL   0x80

Definition at line 51 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_MIRROR

#define RTD2132_LVDS_SWAP_CFG_MIRROR   0x01

Definition at line 53 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_MIRROR_P_N

#define RTD2132_LVDS_SWAP_CFG_MIRROR_P_N   0x03

Definition at line 55 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_NORMAL

#define RTD2132_LVDS_SWAP_CFG_NORMAL   0x00

Definition at line 52 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_P_N

#define RTD2132_LVDS_SWAP_CFG_P_N   0x02

Definition at line 54 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_CFG_R_L

#define RTD2132_LVDS_SWAP_CFG_R_L   0x04

Definition at line 56 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_DUAL

#define RTD2132_LVDS_SWAP_DUAL   0x80

Definition at line 38 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_MIRROR

#define RTD2132_LVDS_SWAP_MIRROR   0x14

Definition at line 40 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_MIRROR_P_N

#define RTD2132_LVDS_SWAP_MIRROR_P_N   0x34

Definition at line 42 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_NORMAL

#define RTD2132_LVDS_SWAP_NORMAL   0x04

Definition at line 39 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_P_N

#define RTD2132_LVDS_SWAP_P_N   0x24

Definition at line 41 of file rtd2132.c.

◆ RTD2132_LVDS_SWAP_R_L

#define RTD2132_LVDS_SWAP_R_L   0x0c

Definition at line 43 of file rtd2132.c.

◆ RTD2132_SSCG_CONFIG_0_5

#define RTD2132_SSCG_CONFIG_0_5   0x07 /* 0.5% */

Definition at line 32 of file rtd2132.c.

◆ RTD2132_SSCG_CONFIG_1_0

#define RTD2132_SSCG_CONFIG_1_0   0x0f /* 1.0% */

Definition at line 33 of file rtd2132.c.

◆ RTD2132_SSCG_CONFIG_1_5

#define RTD2132_SSCG_CONFIG_1_5   0x16 /* 1.5% */

Definition at line 34 of file rtd2132.c.

◆ RTD2132_SSCG_CONFIG_DISABLED

#define RTD2132_SSCG_CONFIG_DISABLED   0x01 /* DISABLED */

Definition at line 31 of file rtd2132.c.

◆ RTD2132_SSCG_DISABLE

#define RTD2132_SSCG_DISABLE   0x20

Definition at line 29 of file rtd2132.c.

◆ RTD2132_SSCG_ENABLE

#define RTD2132_SSCG_ENABLE   0xa0

Definition at line 28 of file rtd2132.c.

◆ RTD2132_SSCG_PERCENT_0_0

#define RTD2132_SSCG_PERCENT_0_0   0x00 /* DISABLED */

Definition at line 46 of file rtd2132.c.

◆ RTD2132_SSCG_PERCENT_0_5

#define RTD2132_SSCG_PERCENT_0_5   0x05 /* 0.5% */

Definition at line 47 of file rtd2132.c.

◆ RTD2132_SSCG_PERCENT_1_0

#define RTD2132_SSCG_PERCENT_1_0   0x10 /* 1.0% */

Definition at line 48 of file rtd2132.c.

◆ RTD2132_SSCG_PERCENT_1_5

#define RTD2132_SSCG_PERCENT_1_5   0x15 /* 1.5% */

Definition at line 49 of file rtd2132.c.

Function Documentation

◆ enable_dev()

static void enable_dev ( struct device dev)
static

Definition at line 232 of file rtd2132.c.

◆ rtd2132_defaults()

static void rtd2132_defaults ( struct device dev)
static

Definition at line 171 of file rtd2132.c.

References ARRAY_SIZE, rtd2132_write_reg(), and value.

Referenced by rtd2132_setup().

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

◆ rtd2132_firmware_start()

static void rtd2132_firmware_start ( struct device dev)
static

Definition at line 74 of file rtd2132.c.

References RTD2132_FIRMWARE, RTD2132_FIRMWARE_START, and smbus_write_byte().

Referenced by rtd2132_setup().

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

◆ rtd2132_firmware_stop()

static void rtd2132_firmware_stop ( struct device dev)
static

Definition at line 68 of file rtd2132.c.

References mdelay(), RTD2132_FIRMWARE, RTD2132_FIRMWARE_STOP, and smbus_write_byte().

Referenced by rtd2132_setup().

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

◆ rtd2132_init()

static void rtd2132_init ( struct device dev)
static

Definition at line 218 of file rtd2132.c.

References DEVICE_PATH_I2C, device::enabled, get_pbus_smbus(), ops_smbus_bus(), device::path, rtd2132_setup(), and device_path::type.

Here is the call graph for this function:

◆ rtd2132_lvds_swap()

◆ rtd2132_pps()

◆ rtd2132_setup()

static void rtd2132_setup ( struct device dev)
static

Definition at line 192 of file rtd2132.c.

References device::chip_info, config, rtd2132_defaults(), rtd2132_firmware_start(), rtd2132_firmware_stop(), rtd2132_lvds_swap(), rtd2132_pps(), and rtd2132_sscg().

Referenced by rtd2132_init().

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

◆ rtd2132_sscg()

static void rtd2132_sscg ( struct device dev,
struct drivers_i2c_rtd2132_config cfg 
)
static

◆ rtd2132_sscg_disable()

static void rtd2132_sscg_disable ( struct device dev)
static

Definition at line 101 of file rtd2132.c.

References RTD2132_COMMAND_SSCG_CONFIG_0, RTD2132_COMMAND_SSCG_CONFIG_1, RTD2132_SSCG_CONFIG_DISABLED, RTD2132_SSCG_DISABLE, and rtd2132_write_reg().

Referenced by rtd2132_sscg().

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

◆ rtd2132_sscg_enable()

static void rtd2132_sscg_enable ( struct device dev,
u8  sscg_percent 
)
static

Definition at line 91 of file rtd2132.c.

References RTD2132_COMMAND_SSCG_CONFIG_0, RTD2132_COMMAND_SSCG_CONFIG_1, RTD2132_SSCG_ENABLE, and rtd2132_write_reg().

Referenced by rtd2132_sscg().

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

◆ rtd2132_write_reg()

static void rtd2132_write_reg ( struct device dev,
u8  reg,
u8  value 
)
static

Definition at line 60 of file rtd2132.c.

References BIOS_DEBUG, printk, RTD2132_COMMAND, RTD2132_DATA, RTD2132_DEBUG_REG, smbus_write_byte(), and value.

Referenced by rtd2132_defaults(), rtd2132_lvds_swap(), rtd2132_pps(), rtd2132_sscg_disable(), and rtd2132_sscg_enable().

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

Variable Documentation

◆ drivers_i2c_rtd2132_ops

struct chip_operations drivers_i2c_rtd2132_ops
Initial value:
= {
.enable_dev = enable_dev,
}
static void enable_dev(struct device *dev)
Definition: rtd2132.c:232

Definition at line 232 of file rtd2132.c.

◆ rtd2132_operations

struct device_operations rtd2132_operations
static
Initial value:
= {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.init = rtd2132_init,
}
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
static void rtd2132_init(struct device *dev)
Definition: rtd2132.c:218

Definition at line 218 of file rtd2132.c.