drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / ec / clevo / it5570e / i2ec.c
blob2d7dd6c37c05af8408d73385d25861f57bc205ec
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/pnp_ops.h>
5 #include "i2ec.h"
7 #define SIO_DEV PNP_DEV(0x2e, 0)
9 /* SIO depth 2 index/data pair */
10 #define D2ADR 0x2e
11 #define D2DAT 0x2f
13 /* SIO depth 2 address space */
14 #define I2EC_ADDR_L 0x10
15 #define I2EC_ADDR_H 0x11
16 #define I2EC_DATA 0x12
19 * Read/write SIO "depth 2" registers
22 static uint8_t sio_d2_read(uint8_t addr)
24 pnp_write_config(SIO_DEV, D2ADR, addr);
25 return pnp_read_config(SIO_DEV, D2DAT);
28 static void sio_d2_write(uint8_t addr, uint8_t val)
30 pnp_write_config(SIO_DEV, D2ADR, addr);
31 pnp_write_config(SIO_DEV, D2DAT, val);
35 * Read/write I2EC registers through SIO "depth 2" address space
38 uint8_t ec_d2i2ec_read(uint16_t addr)
40 sio_d2_write(I2EC_ADDR_H, addr >> 8 & 0xff);
41 sio_d2_write(I2EC_ADDR_L, addr & 0xff);
42 return sio_d2_read(I2EC_DATA);
45 void ec_d2i2ec_write(uint16_t addr, uint8_t val)
47 sio_d2_write(I2EC_ADDR_H, addr >> 8 & 0xff);
48 sio_d2_write(I2EC_ADDR_L, addr & 0xff);
49 sio_d2_write(I2EC_DATA, val);