mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
1. pwm, add frequency select function for pwm channels. 2. timer, add external timer 3~8 apis. 3. add fan control module for emulation board. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=console command "faninfo, fanset, fanduty, and fanauto" fanset 3333 Setting fan 0 rpm target to 3333 faninfo Actual: 3390 rpm Target: 3333 rpm Duty: 35% Status: 1 (changing) Mode: rpm Auto: no Enable: yes faninfo Actual: 3301 rpm Target: 3333 rpm Duty: 34% Status: 2 (locked) Mode: rpm Auto: no Enable: yes fanduty 80 Setting fan 0 duty cycle to 80% faninfo Actual: 5952 rpm Target: 3333 rpm Duty: 80% Status: 2 (locked) Mode: duty Auto: no Enable: yes faninfo Actual: 5971 rpm Target: 3333 rpm Duty: 80% Status: 2 (locked) Mode: duty Auto: no Enable: yes fanauto faninfo Actual: 3330 rpm Target: 3333 rpm Duty: 36% Status: 2 (locked) Mode: rpm Auto: yes Enable: yes fanset 8000 Setting fan 0 rpm target to 8000 faninfo Actual: 6793 rpm Target: 8000 rpm Duty: 100% Status: 3 (frustrated) Mode: rpm Auto: no Enable: yes fanset 3456 Setting fan 0 rpm target to 3456 faninfo Actual: 5053 rpm Target: 3456 rpm Duty: 56% Status: 1 (changing) Mode: rpm Auto: no Enable: yes faninfo Actual: 3440 rpm Target: 3456 rpm Duty: 34% Status: 2 (locked) Mode: rpm Auto: no Enable: yes /* force stop the fan */ [87.035136 Fan 0 stalled!] [87.035520 event set 0x00000400] [88.035712 Fan 0 stalled!] [89.036288 Fan 0 stalled!] [90.036864 Fan 0 stalled!] [91.037440 Fan 0 stalled!] [92.038016 Fan 0 stalled!] [93.038592 Fan 0 stalled!] [94.039168 Fan 0 stalled!] /* release */ faninfo Actual: 3427 rpm Target: 3456 rpm Duty: 35% Status: 2 (locked) Mode: rpm Auto: no Enable: yes Change-Id: Icbe1917902d033a8be42b8d834ffc6045d08b985 Reviewed-on: https://chromium-review.googlesource.com/266625 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw>
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
/* Copyright 2015 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.
|
|
*/
|
|
|
|
/* External timers control module for IT83xx. */
|
|
|
|
#ifndef __CROS_EC_HWTIMER_CHIP_H
|
|
#define __CROS_EC_HWTIMER_CHIP_H
|
|
|
|
#define FAN_CTRL_EXT_TIMER EXT_TIMER_5
|
|
|
|
enum ext_timer_clock_source {
|
|
EXT_PSR_32P768K_HZ = 0,
|
|
EXT_PSR_1P024K_HZ = 1,
|
|
EXT_PSR_32_HZ = 2,
|
|
EXT_PSR_8M_HZ = 3
|
|
};
|
|
|
|
enum ext_timer_sel {
|
|
/* For WDT capture important state information before being reset */
|
|
EXT_TIMER_3 = 0,
|
|
/* reserved */
|
|
EXT_TIMER_4,
|
|
/* For fan control */
|
|
EXT_TIMER_5,
|
|
/* reserved */
|
|
EXT_TIMER_6,
|
|
/* reserved */
|
|
EXT_TIMER_7,
|
|
/* reserved */
|
|
EXT_TIMER_8,
|
|
EXT_TIMER_COUNT,
|
|
};
|
|
|
|
struct ext_timer_ctrl_t {
|
|
volatile uint8_t *mode;
|
|
volatile uint8_t *polarity;
|
|
uint8_t mask;
|
|
uint8_t irq;
|
|
};
|
|
|
|
extern const struct ext_timer_ctrl_t et_ctrl_regs[];
|
|
void ext_timer_start(enum ext_timer_sel ext_timer, int en_irq);
|
|
void ext_timer_stop(enum ext_timer_sel ext_timer, int dis_irq);
|
|
void fan_ext_timer_interrupt(void);
|
|
int ext_timer_ms(enum ext_timer_sel ext_timer,
|
|
enum ext_timer_clock_source ext_timer_clock,
|
|
int start,
|
|
int et_int,
|
|
int32_t ms,
|
|
int first_time_enable);
|
|
|
|
#endif /* __CROS_EC_HWTIMER_CHIP_H */
|