Add stub for tas5825m driver and add it to oryp6 model
This commit is contained in:
5
src/drivers/i2c/tas5825m/Kconfig
Normal file
5
src/drivers/i2c/tas5825m/Kconfig
Normal file
@@ -0,0 +1,5 @@
|
||||
config DRIVERS_I2C_TAS5825M
|
||||
bool
|
||||
default n
|
||||
help
|
||||
Enable support for TI TAS5825M Amplifier.
|
1
src/drivers/i2c/tas5825m/Makefile.inc
Normal file
1
src/drivers/i2c/tas5825m/Makefile.inc
Normal file
@@ -0,0 +1 @@
|
||||
ramstage-$(CONFIG_DRIVERS_I2C_TAS5825M) += tas5825m.c
|
5
src/drivers/i2c/tas5825m/chip.h
Normal file
5
src/drivers/i2c/tas5825m/chip.h
Normal file
@@ -0,0 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
struct drivers_i2c_tas5825m_config {
|
||||
//TODO
|
||||
};
|
68
src/drivers/i2c/tas5825m/tas5825m.c
Normal file
68
src/drivers/i2c/tas5825m/tas5825m.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <console/console.h>
|
||||
#include <delay.h>
|
||||
#include <device/device.h>
|
||||
#include <device/smbus.h>
|
||||
#include <device/pci.h>
|
||||
#include "chip.h"
|
||||
|
||||
static int tas5825m_setup(struct device *dev) {
|
||||
struct drivers_i2c_tas5825m_config *config = dev->chip_info;
|
||||
|
||||
if (!config) {
|
||||
printk(BIOS_ERR, "tas5825m: failed to find config\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//TODO: handle errors
|
||||
int res;
|
||||
#define R(F, E) { \
|
||||
res = F; \
|
||||
if (res < 0) { \
|
||||
printk(BIOS_ERR, "tas5825m: %s\n", E); \
|
||||
return res; \
|
||||
} \
|
||||
}
|
||||
|
||||
// Set page to 0
|
||||
R(smbus_write_byte(dev, 0x00, 0x00), "failed to set page");
|
||||
|
||||
// Set book to 0
|
||||
R(smbus_write_byte(dev, 0x7F, 0x00), "failed to set book");
|
||||
|
||||
// Get DIE_ID
|
||||
R(smbus_read_byte(dev, 0x67), "failed to read die id");
|
||||
printk(BIOS_DEBUG, "tas5825m: DIE_ID=%02X\n", res);
|
||||
|
||||
#undef R
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tas5825m_init(struct device *dev) {
|
||||
if (dev->enabled && dev->path.type == DEVICE_PATH_I2C &&
|
||||
ops_smbus_bus(get_pbus_smbus(dev))) {
|
||||
printk(BIOS_DEBUG, "tas5825m at %s\n", dev_path(dev));
|
||||
int res = tas5825m_setup(dev);
|
||||
if (res) {
|
||||
printk(BIOS_ERR, "tas5825m init failed: %d\n", res);
|
||||
} else {
|
||||
printk(BIOS_DEBUG, "tas5825m init successful\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct device_operations tas5825m_operations = {
|
||||
.read_resources = noop_read_resources,
|
||||
.set_resources = noop_set_resources,
|
||||
.init = tas5825m_init,
|
||||
};
|
||||
|
||||
static void tas5825m_enable_dev(struct device *dev) {
|
||||
dev->ops = &tas5825m_operations;
|
||||
}
|
||||
|
||||
struct chip_operations drivers_i2c_tas5825m_ops = {
|
||||
CHIP_NAME("TI TAS5825M Amplifier")
|
||||
.enable_dev = tas5825m_enable_dev,
|
||||
};
|
@@ -4,6 +4,7 @@ config BOARD_SPECIFIC_OPTIONS
|
||||
def_bool y
|
||||
select BOARD_ROMSIZE_KB_16384
|
||||
select DRIVERS_I2C_HID
|
||||
select DRIVERS_I2C_TAS5825M
|
||||
select DRIVERS_SYSTEM76_EC
|
||||
select EC_ACPI
|
||||
select HAVE_ACPI_RESUME
|
||||
|
@@ -322,7 +322,11 @@ chip soc/intel/cannonlake
|
||||
device pci 1f.1 off end # P2SB
|
||||
device pci 1f.2 off end # Power Management Controller
|
||||
device pci 1f.3 on end # Intel HDA
|
||||
device pci 1f.4 on end # SMBus
|
||||
device pci 1f.4 on
|
||||
chip drivers/i2c/tas5825m
|
||||
device i2c 4e on end # (8bit address: 0x9c)
|
||||
end # tas5825m
|
||||
end # SMBus
|
||||
device pci 1f.5 on end # PCH SPI
|
||||
device pci 1f.6 off end # GbE
|
||||
end
|
||||
|
Reference in New Issue
Block a user