本文整理汇总了C++中pmic_get函数的典型用法代码示例。如果您正苦于以下问题:C++ pmic_get函数的具体用法?C++ pmic_get怎么用?C++ pmic_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmic_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: power_init_board
/* setup board specific PMIC */
int power_init_board(void)
{
int rc;
#ifndef CONFIG_DM_I2C
struct pmic *p = NULL;
#endif
if (board_is_idk()) {
rc = power_tps62362_init(0);
if (rc)
goto done;
#ifndef CONFIG_DM_I2C
p = pmic_get("TPS62362");
if (!p || pmic_probe(p))
goto done;
#endif
puts("PMIC: TPS62362\n");
} else {
rc = power_tps65218_init(0);
if (rc)
goto done;
#ifndef CONFIG_DM_I2C
p = pmic_get("TPS65218_PMIC");
if (!p || pmic_probe(p))
goto done;
#endif
puts("PMIC: TPS65218\n");
}
done:
return 0;
}
示例2: pmic_88pm880_init
int pmic_88pm880_init(struct pmic_chip_desc *chip)
{
struct pmic *p_base, *p_buck, *p_ldo, *p_gpadc, *p_led;
if (!chip) {
printf("---%s: chip is empty.\n", __func__);
return -EINVAL;
}
/*------------base page setting-----------*/
p_base = pmic_get(chip->base_name);
if (!p_base)
return -1;
if (pmic_probe(p_base))
return -1;
pmic_88pm880_base_init(p_base);
board_pmic_base_fixup(p_base);
/*------------gpadc page setting -----------*/
p_gpadc = pmic_get(chip->gpadc_name);
if (!p_gpadc)
return -1;
if (pmic_probe(p_gpadc))
return -1;
pmic_88pm880_gpadc_init(p_gpadc);
board_pmic_gpadc_fixup(p_gpadc);
/*------------buck page setting -----------*/
p_buck = pmic_get(chip->buck_name);
if (!p_buck)
return -1;
if (pmic_probe(p_buck))
return -1;
pmic_88pm880_buck_init(p_buck);
board_pmic_buck_fixup(p_buck);
/*------------ldo page setting ------------*/
p_ldo = pmic_get(chip->ldo_name);
if (!p_ldo)
return -1;
if (pmic_probe(p_ldo))
return -1;
pmic_88pm880_ldo_init(p_ldo);
board_pmic_ldo_fixup(p_ldo);
/*------------led page setting ------------*/
p_led = pmic_get(chip->led_name);
if (!p_led)
return -1;
if (pmic_probe(p_led))
return -1;
pmic_88pm880_led_init(p_led);
printf("PMIC init done!\n");
return 0;
}
示例3: exynos_power_init
int exynos_power_init(void)
{
struct udevice *dev;
int ret;
ret = pmic_get("max77686", &dev);
if (!ret) {
/* TODO([email protected]): Move into the clock/pmic API */
ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_32KHZ, 0,
MAX77686_32KHCP_EN);
if (ret)
return ret;
ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_BBAT, 0,
MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V);
if (ret)
return ret;
} else {
ret = pmic_get("s5m8767-pmic", &dev);
/* TODO([email protected]): Use driver model to access clock */
#ifdef CONFIG_PMIC_S5M8767
if (!ret)
s5m8767_enable_32khz_cp(dev);
#endif
}
if (ret == -ENODEV)
return 0;
ret = regulators_enable_boot_on(false);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_mif", 1100000);
if (ret)
return ret;
/*
* This would normally be 1.3V, but since we are running slowly 1.1V
* is enough. For spring it helps reduce CPU temperature and avoid
* hangs with the case open. 1.1V is minimum voltage borderline for
* chained bootloaders.
*/
ret = exynos_set_regulator("vdd_arm", 1100000);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_int", 1012500);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_g3d", 1200000);
if (ret)
return ret;
return 0;
}
示例4: press_onkey_check
int press_onkey_check(struct pmic_chip_desc *chip, int bootdelay)
{
int pressed;
int flag = 0;
struct pmic *p_base;
p_base = pmic_get(chip->base_name);
if (!p_base || pmic_probe(p_base)) {
printf("access pmic failed...\n");
return 0;
}
pressed = onkey_state(p_base);
while (bootdelay > 0) {
int i = 0;
--bootdelay;
if (pressed == 0) {
flag = 1;
break;
}
for (i = 0; i < 2; ++i)
udelay(10000);
pressed = onkey_state(p_base);
}
if (flag == 1) {
printf("Power key is pressed by mistake.Power down device here.\n");
pmic_pm880_powerdown(p_base);
return 0;
} else
return flag;
}
示例5: adc_power_control
static int adc_power_control(int on)
{
struct udevice *dev;
int ret;
u8 reg;
ret = pmic_get("max8998-pmic", &dev);
if (ret) {
puts("Failed to get MAX8998!\n");
return ret;
}
reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1);
if (on)
reg |= MAX8998_LDO4;
else
reg &= ~MAX8998_LDO4;
ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg);
if (ret) {
puts("MAX8998 LDO setting error\n");
return -EINVAL;
}
return 0;
}
示例6: board_usb_init
int board_usb_init(int index, enum usb_init_type init)
{
#ifdef CONFIG_CMD_USB
struct pmic *p_pmic;
/* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
/* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
if (gd->board_type == ODROID_TYPE_U3)
gpio_direction_output(EXYNOS4X12_GPIO_X30, 0);
else
gpio_direction_output(EXYNOS4X12_GPIO_X30, 1);
/* Disconnect, Reset, Connect */
gpio_direction_output(EXYNOS4X12_GPIO_X34, 0);
gpio_direction_output(EXYNOS4X12_GPIO_X35, 0);
gpio_direction_output(EXYNOS4X12_GPIO_X35, 1);
gpio_direction_output(EXYNOS4X12_GPIO_X34, 1);
/* Power off and on BUCK8 for LAN9730 */
debug("LAN9730 - Turning power buck 8 OFF and ON.\n");
p_pmic = pmic_get("MAX77686_PMIC");
if (p_pmic && !pmic_probe(p_pmic)) {
max77686_set_buck_voltage(p_pmic, 8, 750000);
max77686_set_buck_voltage(p_pmic, 8, 3300000);
}
#endif
debug("USB_udc_probe\n");
return s3c_udc_probe(&s5pc210_otg_data);
}
示例7: power_init_board
/* setup board specific PMIC */
int power_init_board(void)
{
struct pmic *p;
u32 reg;
int ret;
power_pfuze100_init(1);
p = pmic_get("PFUZE100");
if (!p)
return -EINVAL;
ret = pmic_probe(p);
if (ret)
return ret;
pmic_reg_read(p, PFUZE100_DEVICEID, ®);
printf("PMIC: PFUZE100 ID=0x%02x\n", reg);
/* Set SWBST to 5.0V and enable (for USB) */
pmic_reg_read(p, PFUZE100_SWBSTCON1, ®);
reg &= ~(SWBST_MODE_MASK | SWBST_VOL_MASK);
reg |= (SWBST_5_00V | SWBST_MODE_AUTO);
pmic_reg_write(p, PFUZE100_SWBSTCON1, reg);
return 0;
}
示例8: power_init_board
int power_init_board(void)
{
struct pmic *p;
int ret;
unsigned int reg, rev_id;
ret = power_pfuze3000_init(I2C_PMIC);
if (ret)
return ret;
p = pmic_get("PFUZE3000");
ret = pmic_probe(p);
if (ret)
return ret;
pmic_reg_read(p, PFUZE3000_DEVICEID, ®);
pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
/* disable Low Power Mode during standby mode */
pmic_reg_read(p, PFUZE3000_LDOGCTL, ®);
reg |= 0x1;
pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
return 0;
}
示例9: exynos_lcd_power_on
void exynos_lcd_power_on(void)
{
struct udevice *dev;
int ret;
u8 reg;
ret = pmic_get("max8998-pmic", &dev);
if (ret) {
puts("Failed to get MAX8998!\n");
return;
}
reg = pmic_reg_read(dev, MAX8998_REG_ONOFF3);
reg |= MAX8998_LDO17;
ret = pmic_reg_write(dev, MAX8998_REG_ONOFF3, reg);
if (ret) {
puts("MAX8998 LDO setting error\n");
return;
}
reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2);
reg |= MAX8998_LDO7;
ret = pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg);
if (ret) {
puts("MAX8998 LDO setting error\n");
return;
}
}
示例10: dm_test_power_pmic_io
/* Test PMIC I/O */
static int dm_test_power_pmic_io(struct unit_test_state *uts)
{
const char *name = "sandbox_pmic";
uint8_t out_buffer, in_buffer;
struct udevice *dev;
int reg_count, i;
ut_assertok(pmic_get(name, &dev));
reg_count = pmic_reg_count(dev);
ut_asserteq(reg_count, SANDBOX_PMIC_REG_COUNT);
/*
* Test PMIC I/O - write and read a loop counter.
* usually we can't write to all PMIC's registers in the real hardware,
* but we can to the sandbox pmic.
*/
for (i = 0; i < reg_count; i++) {
out_buffer = i;
ut_assertok(pmic_write(dev, i, &out_buffer, 1));
ut_assertok(pmic_read(dev, i, &in_buffer, 1));
ut_asserteq(out_buffer, in_buffer);
}
return 0;
}
示例11: power_init
static int power_init(void)
{
struct udevice *dev;
int ret;
ret = pmic_get("mc34708", &dev);
if (ret) {
printf("%s: mc34708 not found !\n", __func__);
return ret;
}
/* Set VDDGP to 1.110V for 800 MHz on SW1 */
pmic_clrsetbits(dev, REG_SW_0, SWx_VOLT_MASK_MC34708,
SWx_1_110V_MC34708);
/* Set VCC as 1.30V on SW2 */
pmic_clrsetbits(dev, REG_SW_1, SWx_VOLT_MASK_MC34708,
SWx_1_300V_MC34708);
/* Set global reset timer to 4s */
pmic_clrsetbits(dev, REG_POWER_CTL2, TIMER_MASK_MC34708,
TIMER_4S_MC34708);
return ret;
}
示例12: power_key_pressed
static int power_key_pressed(u32 reg)
{
struct pmic *pmic;
u32 status;
u32 mask;
pmic = pmic_get(KEY_PWR_PMIC_NAME);
if (!pmic) {
printf("%s: Not found\n", KEY_PWR_PMIC_NAME);
return 0;
}
if (pmic_probe(pmic))
return 0;
if (reg == KEY_PWR_STATUS_REG)
mask = KEY_PWR_STATUS_MASK;
else
mask = KEY_PWR_INTERRUPT_MASK;
if (pmic_reg_read(pmic, reg, &status))
return 0;
return !!(status & mask);
}
示例13: rtc_get
int rtc_get(struct rtc_time *rtc)
{
u32 day1, day2, time;
int tim, i = 0;
struct pmic *p = pmic_get("FSL_PMIC");
int ret;
if (!p)
return -1;
do {
ret = pmic_reg_read(p, REG_RTC_DAY, &day1);
if (ret < 0)
return -1;
ret = pmic_reg_read(p, REG_RTC_TIME, &time);
if (ret < 0)
return -1;
ret = pmic_reg_read(p, REG_RTC_DAY, &day2);
if (ret < 0)
return -1;
} while (day1 != day2 && i++ < 3);
tim = day1 * 86400 + time;
rtc_to_tm(tim, rtc);
rtc->tm_yday = 0;
rtc->tm_isdst = 0;
return 0;
}
示例14: exynos_power_init
int exynos_power_init(void)
{
struct udevice *dev;
int ret;
ret = pmic_get("max77686", &dev);
if (!ret) {
/* TODO([email protected]): Move into the clock/pmic API */
ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_32KHZ, 0,
MAX77686_32KHCP_EN);
if (ret)
return ret;
ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_BBAT, 0,
MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V);
if (ret)
return ret;
} else {
ret = pmic_get("s5m8767-pmic", &dev);
/* TODO([email protected]): Use driver model to access clock */
#ifdef CONFIG_PMIC_S5M8767
if (!ret)
s5m8767_enable_32khz_cp(dev);
#endif
}
if (ret == -ENODEV)
return 0;
ret = regulators_enable_boot_on(false);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_mif", 1100000);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_arm", 1300000);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_int", 1012500);
if (ret)
return ret;
ret = exynos_set_regulator("vdd_g3d", 1200000);
if (ret)
return ret;
return 0;
}
示例15: g_dnl_board_usb_cable_connected
int g_dnl_board_usb_cable_connected(void)
{
struct pmic *muic = pmic_get("MAX77693_MUIC");
if (!muic)
return 0;
return !!muic->chrg->chrg_type(muic);
}