summaryrefslogtreecommitdiff
path: root/chip/lm4/mock_pwm.c
blob: b269b8f1169ecafead0eaf2a4298b1ff44530ac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* Copyright (c) 2012 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.
 */

/* Mock PWM control module for Chrome EC */

#include "pwm.h"
#include "timer.h"
#include "uart.h"

static int fan_target_rpm;
static int kblight;

int pwm_set_fan_target_rpm(int rpm)
{
	uart_printf("Fan RPM: %d\n", rpm);
	fan_target_rpm = rpm;
	return EC_SUCCESS;
}


int pwm_get_fan_target_rpm(void)
{
	return fan_target_rpm;
}


int pwm_set_keyboard_backlight(int percent)
{
	uart_printf("KBLight: %d\n", percent);
	kblight = percent;
	return EC_SUCCESS;
}


int pwm_get_keyboard_backlight(void)
{
	return kblight;
}


int pwm_get_keyboard_backlight_enabled(void)
{
	/* Always enabled */
	return 1;
}


int pwm_enable_keyboard_backlight(int enable)
{
	/* Not implemented */
	return EC_SUCCESS;
}


int pwm_set_fan_duty(int percent)
{
	/* Not implemented */
	return EC_SUCCESS;
}


void pwm_task(void)
{
	/* Do nothing */
	while (1)
		sleep(5);
}