summaryrefslogtreecommitdiff
path: root/common/pwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/pwm.c')
-rw-r--r--common/pwm.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/common/pwm.c b/common/pwm.c
index a4edfdd5a5..9019a329b4 100644
--- a/common/pwm.c
+++ b/common/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,9 +13,8 @@
#ifdef CONFIG_PWM
-#define PWM_RAW_TO_PERCENT(v) \
- DIV_ROUND_NEAREST((uint32_t)(v) * 100, UINT16_MAX)
-#define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v) * UINT16_MAX / 100)
+#define PWM_RAW_TO_PERCENT(v) DIV_ROUND_NEAREST((uint32_t)(v)*100, UINT16_MAX)
+#define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v)*UINT16_MAX / 100)
/*
* Get target channel based on type / index host command parameters.
@@ -71,8 +70,7 @@ host_command_pwm_set_duty(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
- host_command_pwm_set_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY, host_command_pwm_set_duty,
EC_VER_MASK(0));
static enum ec_status
@@ -92,8 +90,7 @@ host_command_pwm_get_duty(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
- host_command_pwm_get_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty,
EC_VER_MASK(0));
/**
@@ -112,13 +109,13 @@ static void print_channel(enum pwm_channel ch, int max_duty)
ccprintf(" %d: disabled\n", ch);
}
-static int cc_pwm_duty(int argc, char **argv)
+static int cc_pwm_duty(int argc, const char **argv)
{
int value = 0;
int max_duty = 100;
int ch;
char *e;
- char *raw;
+ const char *raw;
if (argc < 2) {
ccprintf("PWM channels:\n");
@@ -153,7 +150,7 @@ static int cc_pwm_duty(int argc, char **argv)
ccprintf("Setting channel %d to %d\n", ch, value);
pwm_enable(ch, 1);
(max_duty == 100) ? pwm_set_duty(ch, value) :
- pwm_set_raw_duty(ch, value);
+ pwm_set_raw_duty(ch, value);
}
}