diff options
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig | 4 | ||||
-rw-r--r-- | zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig | 4 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/include/pwm_map.h | 16 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/prj.conf | 3 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/pwm.dts | 32 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx7/zmake.yaml | 1 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/include/pwm_map.h | 16 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/prj.conf | 3 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/pwm.dts | 32 | ||||
-rw-r--r-- | zephyr/projects/npcx_evb/npcx9/zmake.yaml | 1 |
10 files changed, 112 insertions, 0 deletions
diff --git a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig index e9d9fc3bac..dcfed07291 100644 --- a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig +++ b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig @@ -39,3 +39,7 @@ CONFIG_I2C=y # ADC CONFIG_ADC=y CONFIG_ADC_SHELL=n + +# PWM +CONFIG_PWM=y +CONFIG_PWM_SHELL=n diff --git a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig index d812f7d690..955aef4c4a 100644 --- a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig +++ b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig @@ -38,3 +38,7 @@ CONFIG_I2C=y # ADC CONFIG_ADC=y CONFIG_ADC_SHELL=n + +# PWM +CONFIG_PWM=y +CONFIG_PWM_SHELL=n diff --git a/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h b/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h new file mode 100644 index 0000000000..371e95c116 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h @@ -0,0 +1,16 @@ +/* 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. + */ + +#ifndef __ZEPHYR_PWM_MAP_H +#define __ZEPHYR_PWM_MAP_H + +#include <devicetree.h> + +#include "pwm/pwm.h" + +#define PWM_CH_FAN NAMED_PWM(fan) +#define PWM_CH_KBLIGHT NAMED_PWM(kblight) + +#endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/npcx_evb/npcx7/prj.conf b/zephyr/projects/npcx_evb/npcx7/prj.conf index 16a01208e9..4b49332a6d 100644 --- a/zephyr/projects/npcx_evb/npcx7/prj.conf +++ b/zephyr/projects/npcx_evb/npcx7/prj.conf @@ -21,6 +21,9 @@ CONFIG_PLATFORM_EC_VSTORE=n # Board version is selected over GPIO board ID pins. CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y +# PWM +CONFIG_PLATFORM_EC_PWM=y + # Zephyr feature CONFIG_ASSERT=y CONFIG_SHELL_MINIMAL=n diff --git a/zephyr/projects/npcx_evb/npcx7/pwm.dts b/zephyr/projects/npcx_evb/npcx7/pwm.dts new file mode 100644 index 0000000000..3b7b88c235 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx7/pwm.dts @@ -0,0 +1,32 @@ +/* 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. + */ + +/ { + named-pwms { + compatible = "named-pwms"; + + fan { + pwms = <&pwm0 0 0>; + label = "FAN"; + frequency = <25000>; + }; + kblight { + pwms = <&pwm2 0 0>; + label = "KBLIGHT"; + frequency = <10000>; + }; + }; +}; + +/* fan */ +&pwm0 { + status = "okay"; + drive-open-drain; +}; + +/* kblight */ +&pwm2 { + status = "okay"; +}; diff --git a/zephyr/projects/npcx_evb/npcx7/zmake.yaml b/zephyr/projects/npcx_evb/npcx7/zmake.yaml index 10cb8dffb7..710e0a7568 100644 --- a/zephyr/projects/npcx_evb/npcx7/zmake.yaml +++ b/zephyr/projects/npcx_evb/npcx7/zmake.yaml @@ -5,6 +5,7 @@ board: npcx7_evb dts-overlays: - gpio.dts + - pwm.dts supported-zephyr-versions: - v2.6 toolchain: coreboot-sdk diff --git a/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h b/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h new file mode 100644 index 0000000000..371e95c116 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h @@ -0,0 +1,16 @@ +/* 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. + */ + +#ifndef __ZEPHYR_PWM_MAP_H +#define __ZEPHYR_PWM_MAP_H + +#include <devicetree.h> + +#include "pwm/pwm.h" + +#define PWM_CH_FAN NAMED_PWM(fan) +#define PWM_CH_KBLIGHT NAMED_PWM(kblight) + +#endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/npcx_evb/npcx9/prj.conf b/zephyr/projects/npcx_evb/npcx9/prj.conf index 98474940ba..e124930bfc 100644 --- a/zephyr/projects/npcx_evb/npcx9/prj.conf +++ b/zephyr/projects/npcx_evb/npcx9/prj.conf @@ -25,6 +25,9 @@ CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y # Board version is selected over GPIO board ID pins. CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y +# PWM +CONFIG_PLATFORM_EC_PWM=y + # Zephyr feature CONFIG_ASSERT=y CONFIG_SHELL_MINIMAL=n diff --git a/zephyr/projects/npcx_evb/npcx9/pwm.dts b/zephyr/projects/npcx_evb/npcx9/pwm.dts new file mode 100644 index 0000000000..3b7b88c235 --- /dev/null +++ b/zephyr/projects/npcx_evb/npcx9/pwm.dts @@ -0,0 +1,32 @@ +/* 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. + */ + +/ { + named-pwms { + compatible = "named-pwms"; + + fan { + pwms = <&pwm0 0 0>; + label = "FAN"; + frequency = <25000>; + }; + kblight { + pwms = <&pwm2 0 0>; + label = "KBLIGHT"; + frequency = <10000>; + }; + }; +}; + +/* fan */ +&pwm0 { + status = "okay"; + drive-open-drain; +}; + +/* kblight */ +&pwm2 { + status = "okay"; +}; diff --git a/zephyr/projects/npcx_evb/npcx9/zmake.yaml b/zephyr/projects/npcx_evb/npcx9/zmake.yaml index 5aaa630542..29443aba14 100644 --- a/zephyr/projects/npcx_evb/npcx9/zmake.yaml +++ b/zephyr/projects/npcx_evb/npcx9/zmake.yaml @@ -5,6 +5,7 @@ board: npcx9_evb dts-overlays: - gpio.dts + - pwm.dts supported-zephyr-versions: - v2.6 toolchain: coreboot-sdk |