summaryrefslogtreecommitdiff
path: root/chip/host
diff options
context:
space:
mode:
Diffstat (limited to 'chip/host')
-rw-r--r--chip/host/build.mk5
-rw-r--r--chip/host/i2c.c21
2 files changed, 25 insertions, 1 deletions
diff --git a/chip/host/build.mk b/chip/host/build.mk
index f57fe85502..9d77937776 100644
--- a/chip/host/build.mk
+++ b/chip/host/build.mk
@@ -8,8 +8,9 @@
CORE:=host
-chip-y=system.o gpio.o uart.o persistence.o flash.o lpc.o reboot.o i2c.o \
+chip-y=system.o gpio.o uart.o persistence.o flash.o lpc.o reboot.o \
clock.o spi_master.o trng.o
+
ifndef CONFIG_KEYBOARD_NOT_RAW
chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o
endif
@@ -21,6 +22,8 @@ dirs-y += chip/g/dcrypto
endif
dirs-y += chip/host/dcrypto
+chip-$(CONFIG_I2C)+= i2c.o
+
chip-$(CONFIG_DCRYPTO)+= dcrypto/aes.o
chip-$(CONFIG_DCRYPTO)+= dcrypto/app_cipher.o
chip-$(CONFIG_DCRYPTO)+= dcrypto/app_key.o
diff --git a/chip/host/i2c.c b/chip/host/i2c.c
index 5b863c1d41..f474c38ef1 100644
--- a/chip/host/i2c.c
+++ b/chip/host/i2c.c
@@ -7,6 +7,7 @@
#include "hooks.h"
#include "i2c.h"
+#include "i2c_private.h"
#include "link_defs.h"
#include "test_util.h"
@@ -95,6 +96,26 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags,
return EC_ERROR_UNKNOWN;
}
+int chip_i2c_set_freq(int port, enum i2c_freq freq)
+{
+ return EC_ERROR_UNIMPLEMENTED;
+}
+
+enum i2c_freq chip_i2c_get_freq(int port)
+{
+ switch (i2c_ports[port].kbps) {
+ case 1000:
+ return I2C_FREQ_1000KHZ;
+ case 400:
+ return I2C_FREQ_400KHZ;
+ case 100:
+ return I2C_FREQ_100KHZ;
+ }
+
+ /* fallback to 100k */
+ return I2C_FREQ_100KHZ;
+}
+
int i2c_raw_get_scl(int port)
{
return 1;