mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-20 05:11:30 +02:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
31 lines
667 B
C
31 lines
667 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2016
|
|
* Jelle van der Waa <jelle@vdwaa.nl>
|
|
*/
|
|
#include <common.h>
|
|
#include <i2c.h>
|
|
#include <sy8106a.h>
|
|
|
|
#define SY8106A_I2C_ADDR 0x65
|
|
#define SY8106A_VOUT1_SEL 1
|
|
#define SY8106A_VOUT1_SEL_ENABLE (1 << 7)
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
static u8 sy8106a_mvolt_to_cfg(int mvolt, int min, int max, int div)
|
|
{
|
|
if (mvolt < min)
|
|
mvolt = min;
|
|
else if (mvolt > max)
|
|
mvolt = max;
|
|
|
|
return (mvolt - min) / div;
|
|
}
|
|
|
|
int sy8106a_set_vout1(unsigned int mvolt)
|
|
{
|
|
u8 data = sy8106a_mvolt_to_cfg(mvolt, 680, 1950, 10) | SY8106A_VOUT1_SEL_ENABLE;
|
|
return i2c_write(SY8106A_I2C_ADDR, SY8106A_VOUT1_SEL, 1, &data, 1);
|
|
}
|
|
#endif
|