Skip to content

Commit

Permalink
boards/arm/efr32_thunderboard: add Si7210 sensor
Browse files Browse the repository at this point in the history
Enable Si7210 hall & temp sensor on BG22 and BG27 thunderboards.

Signed-off-by: Roman Dobrodii <[email protected]>
  • Loading branch information
rdob-ant authored and carlescufi committed Apr 24, 2023
1 parent d641be7 commit 56c38bd
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
15 changes: 14 additions & 1 deletion boards/arm/efr32_thunderboard/efr32bg22_brd4184a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
aliases {
led0 = &led0;
sw0 = &button0;
i2c-pin = &i2c_pin;
spi-flash0 = &mx25r80;
spi0 = &usart0;
watchdog0 = &wdog0;
Expand Down Expand Up @@ -59,3 +58,17 @@
};
};
};

&sw_sensor_enable {
enable-gpios = <&gpioa GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
};


&sw_mic_enable {
enable-gpios = <&gpioa GECKO_PIN(0) GPIO_ACTIVE_HIGH>;
};


&sw_imu_enable {
enable-gpios = <&gpiob GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
};
3 changes: 3 additions & 0 deletions boards/arm/efr32_thunderboard/efr32bg22_brd4184a_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000
CONFIG_GECKO_BURTC_TIMER=y
CONFIG_CMU_BURTCCLK_LFXO=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024

CONFIG_REGULATOR=y
CONFIG_SI7210=y
15 changes: 14 additions & 1 deletion boards/arm/efr32_thunderboard/efr32bg27_brd2602a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
aliases {
led0 = &led0;
sw0 = &button0;
i2c-pin = &i2c_pin;
spi-flash0 = &mx25r80;
spi0 = &usart0;
watchdog0 = &wdog0;
Expand All @@ -29,6 +28,20 @@
gpios = <&gpioa GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
};

&sw_sensor_enable {
enable-gpios = <&gpioc GECKO_PIN(6) GPIO_ACTIVE_HIGH>;
};


&sw_mic_enable {
enable-gpios = <&gpioc GECKO_PIN(7) GPIO_ACTIVE_HIGH>;
};


&sw_imu_enable {
enable-gpios = <&gpiob GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
};

&button0 {
gpios = <&gpiob GECKO_PIN(3) GPIO_ACTIVE_LOW>;
};
3 changes: 3 additions & 0 deletions boards/arm/efr32_thunderboard/efr32bg27_brd2602a_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000
CONFIG_GECKO_BURTC_TIMER=y
CONFIG_CMU_BURTCCLK_LFXO=y
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024

CONFIG_REGULATOR=y
CONFIG_SI7210=y
34 changes: 27 additions & 7 deletions boards/arm/efr32_thunderboard/thunderboard.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
gpios = <&gpiob GECKO_PIN(0) GPIO_ACTIVE_HIGH>;
label = "LED 0";
};
/* Set this pin to high to enable I2C to board sensors */
i2c_pin: pin {
gpios = <&gpioa GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
};
};

buttons {
Expand All @@ -37,10 +33,28 @@
gpios = <&gpioa GECKO_PIN(5) GPIO_ACTIVE_LOW>;
};

spi_enable: peripheral-enable {
/* GPIOs that power up different sensors */
sw_sensor_enable: gpio_switch_0 {
compatible = "regulator-fixed";
regulator-name = "spi-enable-ctrl";
enable-gpios = <&gpiob GECKO_PIN(4) GPIO_ACTIVE_HIGH>;
status = "okay";
regulator-name = "sw_sensor_enable";
startup-delay-us = <100000>;
/* Always on since sensor drivers won't enable it automatically */
regulator-always-on;
};

sw_mic_enable: gpio_switch_1 {
compatible = "regulator-fixed";
status = "okay";
regulator-name = "sw_mic_enable";
startup-delay-us = <100000>;
};

sw_imu_enable: gpio_switch_2 {
compatible = "regulator-fixed";
status = "okay";
regulator-name = "sw_imu_enable";
startup-delay-us = <100000>;
};

};
Expand Down Expand Up @@ -127,6 +141,12 @@
location-sda = <GECKO_LOCATION(3) GECKO_PORT_D GECKO_PIN(2)>;
location-scl = <GECKO_LOCATION(3) GECKO_PORT_D GECKO_PIN(3)>;
status = "okay";

si7210@30 {
compatible = "silabs,si7210";
status = "okay";
reg = <0x30>;
};
};

&adc0 {
Expand Down

0 comments on commit 56c38bd

Please sign in to comment.