/* Copyright 2021 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include #include / { aliases { bmi260-int = &ms_bmi260_accel; bmi160-int = &ms_bmi160_accel; lis2dw12-int = &ms_lis2dw12_accel; tcs3400-int = &tcs3400_clear; }; named-gpios { compatible = "named-gpios"; ec_batt_pres_odl { gpios = <&gpio0 1 GPIO_INPUT>; enum-name = "GPIO_BATT_PRES_ODL"; label = "EC_BATT_PRES_ODL"; }; acok_od { gpios = <&gpio0 2 GPIO_INPUT>; enum-name = "GPIO_AC_PRESENT"; label = "ACOK_OD"; }; /* In test WP is output because CBI use it, but it is also * input, because test_all_tags set it to enable write * protection. */ gpio_wp_l: wp_l { #gpio-cells = <0>; gpios = <&gpio0 3 (GPIO_INPUT | GPIO_OUTPUT)>; enum-name = "GPIO_WP_L"; label = "WP_L"; }; pg_ec_dsw_pwrok { gpios = <&gpio0 4 GPIO_INPUT>; enum-name = "GPIO_PG_EC_DSW_PWROK"; label = "PG_EC_DSW_PWROK"; }; ec_pch_wake_odl { gpios = <&gpio0 5 GPIO_OUT_HIGH>; enum-name = "GPIO_EC_PCH_WAKE_ODL"; label = "EC_PCH_WAKE_ODL"; }; /* Setup USB C1 pin as output to check their state in test */ usb_c1_ls_en { gpios = <&gpio0 6 (GPIO_INPUT | GPIO_PULL_UP | GPIO_OUTPUT)>; enum-name = "GPIO_USB_C1_LS_EN"; label = "USB_C1_LS_EN"; }; usb_c1_rt_rst_odl { gpios = <&gpio0 7 (GPIO_OUTPUT | GPIO_INPUT)>; enum-name = "GPIO_USB_C1_RT_RST_ODL"; label = "USB_C1_RT_RST_ODL"; }; }; named-i2c-ports { compatible = "named-i2c-ports"; usb-c0 { i2c-port = <&i2c0>; enum-name = "I2C_PORT_USB_C0"; label = "USB_C0"; }; usb-c1 { i2c-port = <&i2c0>; enum-name = "I2C_PORT_USB_C1"; label = "USB_C1"; }; battery { i2c-port = <&i2c0>; enum-name = "I2C_PORT_BATTERY"; label = "BATTERY"; }; power { i2c-port = <&i2c0>; enum-name = "I2C_PORT_POWER"; label = "POWER"; }; charger { i2c-port = <&i2c0>; enum-name = "I2C_PORT_CHARGER"; label = "CHARGER"; }; eeprom { i2c-port = <&i2c0>; enum-name = "I2C_PORT_EEPROM"; label = "EEPROM"; }; i2c_accel: accel { i2c-port = <&i2c0>; enum-name = "I2C_PORT_ACCEL"; label = "ACCEL"; }; i2c_sensor: sensor { i2c-port = <&i2c1>; enum-name = "I2C_PORT_SENSOR"; label = "SENSOR"; }; }; named-batteries { compatible = "named-batteries"; lgc011 { enum-name = "lgc011"; }; }; adc0: adc { compatible = "zephyr,adc-emul"; nchannels = <4>; ref-internal-mv = <3300>; #io-channel-cells = <1>; label = "ADC_0"; status = "okay"; }; named-adc-channels { compatible = "named-adc-channels"; adc_charger: charger { label = "ADC_TEMP_SENSOR_CHARGER"; enum-name = "ADC_TEMP_SENSOR_CHARGER"; channel = <0>; }; adc_pp3300_regulator: pp3300-regulator { label = "ADC_TEMP_SENSOR_PP3300_REGULATOR"; enum-name = "ADC_TEMP_SENSOR_PP3300_REGULATOR"; channel = <1>; }; adc_ddr_soc: ddr-soc { label = "ADC_TEMP_SENSOR_DDR_SOC"; enum-name = "ADC_TEMP_SENSOR_DDR_SOC"; channel = <2>; }; adc_fan: fan { label = "ADC_TEMP_SENSOR_FAN"; enum-name = "ADC_TEMP_SENSOR_FAN"; channel = <3>; }; }; named-temp-sensors { charger { thermistor = <&thermistor_3V3_13K7_47K_4050B>; status = "okay"; compatible = "cros-ec,temp-sensor"; label = "TEMP_SENSOR_CHARGER"; enum-name = "TEMP_SENSOR_CHARGER"; temp_fan_off = <40>; temp_fan_max = <55>; temp_host_high = <75>; temp_host_halt = <80>; temp_host_release_high = <65>; adc = <&adc_charger>; }; pp3300-regulator { thermistor = <&thermistor_3V3_30K9_47K_4050B>; status = "okay"; compatible = "cros-ec,temp-sensor"; label = "TEMP_SENSOR_PP3300_REGULATOR"; enum-name = "TEMP_SENSOR_PP3300_REGULATOR"; temp_fan_off = <40>; temp_fan_max = <55>; temp_host_high = <75>; temp_host_halt = <80>; temp_host_release_high = <65>; adc = <&adc_pp3300_regulator>; }; ddr-soc { thermistor = <&thermistor_3V3_51K1_47K_4050B>; status = "okay"; compatible = "cros-ec,temp-sensor"; label = "TEMP_SENSOR_DDR_SOC"; enum-name = "TEMP_SENSOR_DDR_SOC"; temp_fan_off = <35>; temp_fan_max = <50>; temp_host_high = <70>; temp_host_halt = <80>; temp_host_release_high = <65>; adc = <&adc_ddr_soc>; }; fan { thermistor = <&thermistor_3V0_22K6_47K_4050B>; status = "okay"; compatible = "cros-ec,temp-sensor"; label = "TEMP_SENSOR_FAN"; enum-name = "TEMP_SENSOR_FAN"; temp_fan_off = <35>; temp_fan_max = <50>; temp_host_high = <70>; temp_host_halt = <80>; temp_host_release_high = <65>; adc = <&adc_fan>; }; }; /* * Declare mutexes used by sensor drivers. * A mutex node is used to create an instance of mutex_t. * A mutex node is referenced by a sensor node if the * corresponding sensor driver needs to use the * instance of the mutex. */ motionsense-mutex { compatible = "cros-ec,motionsense-mutex"; mutex_bmi260: bmi260-mutex { label = "BMI260_MUTEX"; }; mutex_bmi160: bmi160-mutex { label = "BMI160_MUTEX"; }; mutex_lis2dw12: lis2dw12-mutex { label = "LIS2DW12_MUTEX"; }; }; /* * Driver specific data. A driver-specific data can be shared with * different motion sensors while they are using the same driver. */ motionsense-sensor-data { bmi260_data: bmi260-drv-data { compatible = "cros-ec,drvdata-bmi260"; status = "okay"; }; bmi160_data: bmi160-drv-data { compatible = "cros-ec,drvdata-bmi160"; status = "okay"; }; lis2dw12_data: lis2dw12-drv-data { compatible = "cros-ec,drvdata-lis2dw12"; status = "okay"; }; tcs_clear_data: tcs3400-clear-drv-data { compatible = "cros-ec,drvdata-tcs3400-clear"; status = "okay"; als-drv-data { compatible = "cros-ec,accelgyro-als-drv-data"; als-cal { scale = <1>; uscale = <0>; offset = <0>; als-channel-scale { compatible = "cros-ec,accelgyro-als-channel-scale"; k-channel-scale = <1>; cover-scale = <1>; }; }; }; }; tcs_rgb_data: tcs3400-rgb-drv-data { compatible = "cros-ec,drvdata-tcs3400-rgb"; status = "okay"; /* node for rgb_calibration_t defined in accelgyro.h */ rgb_calibration { compatible = "cros-ec,accelgyro-rgb-calibration"; irt = <1>; rgb-cal-x { offset = <0>; coeff = <0 1 0 0>; als-channel-scale { compatible = "cros-ec,accelgyro-als-channel-scale"; k-channel-scale = <1>; cover-scale = <1>; }; }; rgb-cal-y { offset = <0>; coeff = <0 0 1 0>; als-channel-scale { compatible = "cros-ec,accelgyro-als-channel-scale"; k-channel-scale = <1>; cover-scale = <1>; }; }; rgb-cal-z { offset = <0>; coeff = <0 0 0 1>; als-channel-scale { compatible = "cros-ec,accelgyro-als-channel-scale"; k-channel-scale = <1>; cover-scale = <1>; }; }; }; }; }; /* * List of motion sensors that creates motion_sensors array. * The label "lid_accel" and "base_accel" are used to indicate * motion sensor IDs for lid angle calculation. */ motionsense-sensor { ms_bmi260_accel: ms-bmi260-accel { compatible = "cros-ec,bmi260-accel"; status = "okay"; label = "BMI260 emul accel"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; port = <&i2c_accel>; drv-data = <&bmi260_data>; default-range = <4>; i2c-spi-addr-flags = "BMI260_ADDR0_FLAGS"; }; ms_bmi260_gyro: ms-bmi260-gyro { compatible = "cros-ec,bmi260-gyro"; status = "okay"; label = "BMI260 emul gyro"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi260>; port = <&i2c_accel>; drv-data = <&bmi260_data>; default-range = <1000>; /* dps */ i2c-spi-addr-flags = "BMI260_ADDR0_FLAGS"; }; ms_bmi160_accel: ms-bmi160-accel { compatible = "cros-ec,bmi160-accel"; status = "okay"; label = "BMI160 emul accel"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi160>; port = <&i2c_sensor>; drv-data = <&bmi160_data>; default-range = <4>; i2c-spi-addr-flags = "BMI160_ADDR0_FLAGS"; }; ms_bmi160_gyro: ms-bmi160-gyro { compatible = "cros-ec,bmi160-gyro"; status = "okay"; label = "BMI160 emul gyro"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_bmi160>; port = <&i2c_sensor>; drv-data = <&bmi160_data>; default-range = <1000>; /* dps */ i2c-spi-addr-flags = "BMI160_ADDR0_FLAGS"; }; ms_lis2dw12_accel: ms-lis2dw12-accel { compatible = "cros-ec,lis2dw12"; status = "okay"; label = "LIS2DW12"; location = "MOTIONSENSE_LOC_BASE"; mutex = <&mutex_lis2dw12>; port = <&i2c_accel>; drv-data = <&lis2dw12_data>; default-range = <2>; i2c-spi-addr-flags = "LIS2DWL_ADDR1_FLAGS"; }; tcs3400_clear: tcs3400-clear { compatible = "cros-ec,tcs3400-clear"; status = "okay"; label = "Clear Light"; location = "MOTIONSENSE_LOC_BASE"; port = <&i2c_sensor>; default-range = <0x10000>; drv-data = <&tcs_clear_data>; i2c-spi-addr-flags = "TCS3400_I2C_ADDR_FLAGS"; configs { compatible = "cros-ec,motionsense-sensor-config"; ec-s0 { /* Run ALS sensor in S0 */ label = "SENSOR_CONFIG_EC_S0"; odr = <1000>; }; }; }; tcs3400_rgb: tcs3400-rgb { compatible = "cros-ec,tcs3400-rgb"; status = "okay"; label = "RGB Light"; location = "MOTIONSENSE_LOC_BASE"; default-range = <0x10000>; /* scale = 1x, uscale = 0 */ drv-data = <&tcs_rgb_data>; }; }; /* * Second i2c bus is required, because there is already device with * address 0x68 on the first bus */ i2c1: i2c@400 { status = "okay"; compatible = "zephyr,i2c-emul-controller"; clock-frequency = ; #address-cells = <1>; #size-cells = <0>; reg = <0x400 4>; label = "I2C_1"; accel_bmi160: bmi160@68 { compatible = "zephyr,bmi"; reg = <0x68>; label = "BMI160"; device-model = "BMI_EMUL_160"; error-on-ro-write; error-on-wo-read; error-on-reserved-bit-write; simulate-command-exec-time; }; tcs_emul: tcs@39 { compatible = "zephyr,tcs3400"; reg = <0x39>; label = "TCS_EMUL"; error-on-ro-write; error-on-reserved-bit-write; error-on-msb-first-access; }; }; }; &espi0 { espi-host@0 { status = "okay"; compatible = "zephyr,espi-emul-espi-host"; reg = <0x0>; label = "ESPI_HOST"; }; }; &gpio0 { ngpios = <8>; }; &i2c0 { cbi_eeprom: eeprom@56 { compatible = "atmel,at24"; reg = <0x56>; label = "EEPROM_CBI"; size = <512>; pagesize = <8>; address-width = <8>; timeout = <5>; wp-gpios = <&gpio_wp_l>; }; battery: sb@b { compatible = "zephyr,smart-battery"; reg = <0xb>; label = "BATTERY"; cycle-count = <99>; version = "BATTERY_SPEC_VER_1_1_WITH_PEC"; }; bma_emul: bma@18 { compatible = "zephyr,bma255"; reg = <0x18>; label = "BMA_EMUL"; error-on-compensation-not-ready; error-on-ro-write; error-on-reserved-bit-write; error-on-msb-first-access; }; pi3usb9201_emul: pi3usb9201@5f { compatible = "zephyr,pi3usb9201-emul"; reg = <0x5f>; label = "PI3USB9201_EMUL"; }; syv682x_emul: syv682x@41 { compatible = "zephyr,syv682x-emul"; reg = <0x41>; label = "SYV682X_EMUL"; }; accel_bmi260: bmi260@68 { compatible = "zephyr,bmi"; reg = <0x68>; label = "BMI260"; device-model = "BMI_EMUL_260"; error-on-ro-write; error-on-wo-read; error-on-reserved-bit-write; simulate-command-exec-time; }; usb_c1_bb_retimer_emul: bbretimer@42 { compatible = "cros,bb-retimer-emul"; reg = <0x42>; label = "USB_C1_BB_RETIMER"; vendor = "BB_RETIMER_VENDOR_ID_1"; error-on-ro-write; error-on-reserved-bit-write; }; ln9310: ln9310@80 { compatible = "cros,ln9310-emul"; status = "okay"; reg = <0x80>; label = "LN9310"; }; lis2dw12_emul: lis2dw12@19 { compatible = "cros,lis2dw12-emul"; status = "okay"; reg = <0x19>; label = "LIS2DW12_EMUL"; }; i2c_mock: i2c_mock@84 { compatible = "cros,i2c-mock"; status = "okay"; reg = <0x84>; label = "I2C_MOCK"; }; }; /* Enable all thermistors for testing */ &thermistor_3V3_30K9_47K_4050B { status = "okay"; }; &thermistor_3V0_22K6_47K_4050B { status = "okay"; }; &thermistor_3V3_13K7_47K_4050B { status = "okay"; }; &thermistor_3V3_51K1_47K_4050B { status = "okay"; };