Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Dirk Eibach | 9459433 | 2015-10-28 11:46:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2015 |
Mario Six | b489358 | 2018-03-06 08:04:58 +0100 | [diff] [blame] | 4 | * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc |
Dirk Eibach | 9459433 | 2015-10-28 11:46:36 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Mario Six | 7851021 | 2019-03-29 10:18:10 +0100 | [diff] [blame] | 7 | #ifdef CONFIG_GDSYS_LEGACY_DRIVERS |
| 8 | |
Dirk Eibach | 9459433 | 2015-10-28 11:46:36 +0100 | [diff] [blame] | 9 | #include <common.h> |
| 10 | #include <i2c.h> |
| 11 | |
| 12 | enum { |
| 13 | FAN_CONFIG = 0x03, |
| 14 | FAN_TACHLIM_LSB = 0x48, |
| 15 | FAN_TACHLIM_MSB = 0x49, |
| 16 | FAN_PWM_FREQ = 0x4D, |
| 17 | }; |
| 18 | |
| 19 | void 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 Six | 7851021 | 2019-03-29 10:18:10 +0100 | [diff] [blame] | 34 | |
| 35 | #endif /* CONFIG_GDSYS_LEGACY_DRIVERS */ |