/* 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;
}


void pwm_task(void)
{
	/* Do nothing */
	while (1)
		usleep(5000000);
}

/* 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)
		usleep(5000000);
}

Fix unit test compilation error
Fix unit test compilation error

A host command to set fan duty cycle is recently added and mock PWM
module doesn't provide the implementation. This breaks our unit test.
Let's fix this.

BUG=chrome-os-partner:10820
TEST='thermal' unit test passed.

Change-Id: I8644742cfec7d2112d7ff1e266b5ac3429c46945
Reviewed-on: https://gerrit.chromium.org/gerrit/26019
Reviewed-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>
Commit-Ready: Vic Yang <5fd92abeee651458f98e2856f4f200ee971cee4d@chromium.org>
Tested-by: Vic Yang <5fd92abeee651458f98e2856f4f200ee971cee4d@chromium.org>
