mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 23:41:50 +00:00

The Acer Iconia A500 is a tablet computer designed, developed and marketed by Acer Inc. It is powered by 1 GHz Nvidia Tegra 2 processor and 1GB DDR2 RAM. The A500 is sold with 64 GB, although both 16 GB and 32 GB models are available. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2010,2011
|
|
* NVIDIA Corporation <www.nvidia.com>
|
|
*
|
|
* (C) Copyright 2024
|
|
* Svyatoslav Ryhel <clamor95@gmail.com>
|
|
*/
|
|
|
|
/* Picasso derives from Ventana board */
|
|
|
|
#include <dm.h>
|
|
#include <i2c.h>
|
|
#include <log.h>
|
|
#include <linux/delay.h>
|
|
|
|
#define TPS6586X_I2C_ADDRESS 0x34
|
|
#define TPS6586X_SUPPLYENE 0x14
|
|
#define EXITSLREQ_BIT BIT(1)
|
|
#define SLEEP_MODE_BIT BIT(3)
|
|
|
|
#ifdef CONFIG_CMD_POWEROFF
|
|
int do_poweroff(struct cmd_tbl *cmdtp,
|
|
int flag, int argc, char *const argv[])
|
|
{
|
|
struct udevice *dev;
|
|
uchar data_buffer[1];
|
|
int ret;
|
|
|
|
ret = i2c_get_chip_for_busnum(0, TPS6586X_I2C_ADDRESS, 1, &dev);
|
|
if (ret) {
|
|
log_debug("cannot find PMIC I2C chip\n");
|
|
return 0;
|
|
}
|
|
|
|
ret = dm_i2c_read(dev, TPS6586X_SUPPLYENE, data_buffer, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
data_buffer[0] &= ~EXITSLREQ_BIT;
|
|
|
|
ret = dm_i2c_write(dev, TPS6586X_SUPPLYENE, data_buffer, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
data_buffer[0] |= SLEEP_MODE_BIT;
|
|
|
|
ret = dm_i2c_write(dev, TPS6586X_SUPPLYENE, data_buffer, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
// wait some time and then print error
|
|
mdelay(5000);
|
|
printf("Failed to power off!!!\n");
|
|
return 1;
|
|
}
|
|
#endif
|