blob: 27c875cbec072998d762841617c1b767173a5084 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dirk Eibach94594332015-10-28 11:46:36 +01002/*
3 * (C) Copyright 2015
Mario Sixb4893582018-03-06 08:04:58 +01004 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
Dirk Eibach94594332015-10-28 11:46:36 +01005 */
6
Mario Six78510212019-03-29 10:18:10 +01007#ifdef CONFIG_GDSYS_LEGACY_DRIVERS
8
Dirk Eibach94594332015-10-28 11:46:36 +01009#include <common.h>
10#include <i2c.h>
11
12enum {
13 FAN_CONFIG = 0x03,
14 FAN_TACHLIM_LSB = 0x48,
15 FAN_TACHLIM_MSB = 0x49,
16 FAN_PWM_FREQ = 0x4D,
17};
18
19void init_fan_controller(u8 addr)
20{
21 int val;
22
23 /* set PWM Frequency to 2.5% resolution */
24 i2c_reg_write(addr, FAN_PWM_FREQ, 20);
25
26 /* set Tachometer Limit */
27 i2c_reg_write(addr, FAN_TACHLIM_LSB, 0x10);
28 i2c_reg_write(addr, FAN_TACHLIM_MSB, 0x0a);
29
30 /* enable Tach input */
31 val = i2c_reg_read(addr, FAN_CONFIG) | 0x04;
32 i2c_reg_write(addr, FAN_CONFIG, val);
33}
Mario Six78510212019-03-29 10:18:10 +010034
35#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */