summaryrefslogtreecommitdiff
path: root/board/madoo
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-08-17 11:49:49 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-21 18:27:22 +0000
commit906dea8f53aeca97488a73f5fcfc4d16106d7ea8 (patch)
tree167bb368837350f1b9aa792625af2a5ea8096ab5 /board/madoo
parentf832dc1f14ee2086d1903c5e38e927485eb067dc (diff)
downloadchrome-ec-906dea8f53aeca97488a73f5fcfc4d16106d7ea8.tar.gz
Dedede: Move PWM to board level
Move the PWM related defines and arrays into the board level, to allow customization of what PWM channels boards use (if they choose to use the PWM at all). BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id417a7be079511c17de9f2e5d03c729467435804 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2358899 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/madoo')
-rw-r--r--board/madoo/board.c24
-rw-r--r--board/madoo/board.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/board/madoo/board.c b/board/madoo/board.c
index d39e6de7dd..8a798788ad 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -33,6 +33,8 @@
#include "motion_sense.h"
#include "power.h"
#include "power_button.h"
+#include "pwm.h"
+#include "pwm_chip.h"
#include "stdbool.h"
#include "switch.h"
#include "system.h"
@@ -510,6 +512,28 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
},
};
+/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
+const struct pwm_t pwm_channels[] = {
+ [PWM_CH_KBLIGHT] = {
+ .channel = 3,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 10000,
+ },
+
+ [PWM_CH_LED1_AMBER] = {
+ .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq = 2400,
+ },
+
+ [PWM_CH_LED2_WHITE] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq = 2400,
+ }
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
.bus_type = EC_BUS_TYPE_I2C,
diff --git a/board/madoo/board.h b/board/madoo/board.h
index 7eb7e0af30..f9185e3825 100644
--- a/board/madoo/board.h
+++ b/board/madoo/board.h
@@ -45,6 +45,10 @@
#define CONFIG_LED_PWM_SOC_SUSPEND_COLOR EC_LED_COLOR_WHITE
#define CONFIG_LED_PWM_LOW_BATT_COLOR EC_LED_COLOR_AMBER
+/* PWM */
+#define CONFIG_PWM
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+
/* USB */
#define CONFIG_BC12_DETECT_PI3USB9201
#define CONFIG_USBC_RETIMER_NB7V904M