summaryrefslogtreecommitdiff
path: root/src/drivers/i2c
diff options
context:
space:
mode:
authorTim Crawford <tcrawford@system76.com>2024-03-07 15:21:59 -0700
committerFelix Held <felix-coreboot@felixheld.de>2024-03-23 18:07:12 +0000
commitca11545ca6d6bbc399cacc0c56b0212880fdeafb (patch)
treea30d02e2ce2b1aac804a8033f2c7e89ee45afd26 /src/drivers/i2c
parentcb92d28d7a22811f5399c589e5b231508ff42370 (diff)
drivers/i2c/tas5825m: Allow using I2C bus
The latest Clevo boards connect the TAS5825M to one of the I2C connections instead of the SMBus connection. The I2C ops are compatible with SMBus, so always use them. Tested on system76/oryp6 (uses SMBus) and in-development system76/oryp12 (uses I2C3). TAS5825M init is successful and speaker output works. Change-Id: I2233d6977fd460b53e27260cdfabe42e30b98041 Signed-off-by: Tim Crawford <tcrawford@system76.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81126 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jeremy Soller <jeremy@system76.com>
Diffstat (limited to 'src/drivers/i2c')
-rw-r--r--src/drivers/i2c/tas5825m/tas5825m.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/drivers/i2c/tas5825m/tas5825m.c b/src/drivers/i2c/tas5825m/tas5825m.c
index 9f14059a8e..ead1b167e8 100644
--- a/src/drivers/i2c/tas5825m/tas5825m.c
+++ b/src/drivers/i2c/tas5825m/tas5825m.c
@@ -1,23 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
-#include <device/smbus.h>
-#include <device/pci.h>
+#include <device/i2c_bus.h>
#include "chip.h"
#include "tas5825m.h"
int tas5825m_write_at(struct device *dev, uint8_t addr, uint8_t value)
{
- return smbus_write_byte(dev, addr, value);
+ return i2c_dev_writeb_at(dev, addr, value);
}
-//TODO: use I2C block write for better performance
int tas5825m_write_block_at(struct device *dev, uint8_t addr,
const uint8_t *values, uint8_t length)
{
+ // TODO: use I2C block write for better performance; SMBus does not
+ // have `transfer` op for it.
+
int res = 0;
for (uint8_t i = 0; i < length; i++) {
- res = smbus_write_byte(dev, addr + i, values[i]);
+ res = i2c_dev_writeb_at(dev, addr + i, values[i]);
if (res < 0)
return res;
}
@@ -45,8 +46,7 @@ __weak int tas5825m_setup(struct device *dev, int id)
static void tas5825m_init(struct device *dev)
{
- if (dev->enabled && dev->path.type == DEVICE_PATH_I2C &&
- ops_smbus_bus(get_pbus_smbus(dev))) {
+ if (dev->enabled && dev->path.type == DEVICE_PATH_I2C && i2c_link(dev)) {
printk(BIOS_DEBUG, "tas5825m at %s\n", dev_path(dev));
struct drivers_i2c_tas5825m_config *config = dev->chip_info;