当前位置: 首页>>代码示例>>C++>>正文


C++ psy_do_property函数代码示例

本文整理汇总了C++中psy_do_property函数的典型用法代码示例。如果您正苦于以下问题:C++ psy_do_property函数的具体用法?C++ psy_do_property怎么用?C++ psy_do_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了psy_do_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sec_bat_initial_check

static void sec_bat_initial_check(void)
{
	union power_supply_propval value;

	switch (abb_get_cable_status()) {
	case CABLE_TYPE_AC:
		value.intval = POWER_SUPPLY_TYPE_MAINS;
		break;
	case CABLE_TYPE_MISC:
		value.intval = POWER_SUPPLY_TYPE_MISC;
		break;
	case CABLE_TYPE_USB:
		value.intval = POWER_SUPPLY_TYPE_USB;
		break;
	case CABLE_TYPE_CARDOCK:
		value.intval = POWER_SUPPLY_TYPE_CARDOCK;
		break;
	case CABLE_TYPE_NONE:
		value.intval = POWER_SUPPLY_TYPE_BATTERY;
		break;
	default:
		pr_err("%s: invalid cable :%d\n",
			__func__, abb_get_cable_status());
		return;
	}

	psy_do_property("battery", set,
		POWER_SUPPLY_PROP_ONLINE, value);
}
开发者ID:1N4148,项目名称:android_kernel_samsung_golden,代码行数:29,代码来源:board-codina-battery.c

示例2: sec_bat_check_by_psy

static bool sec_bat_check_by_psy(struct sec_battery_info *battery)
{
	char *psy_name;
	union power_supply_propval value;
	bool ret;
	ret = true;

	switch (battery->pdata->battery_check_type) {
	case SEC_BATTERY_CHECK_PMIC:
		psy_name = battery->pdata->pmic_name;
		break;
	case SEC_BATTERY_CHECK_FUELGAUGE:
		psy_name = "sec-fuelgauge";
		break;
	case SEC_BATTERY_CHECK_CHARGER:
		psy_name = "sec-charger";
		break;
	default:
		pr_err("%s: Invalid Battery Check Type\n",
			__func__);
		ret = false;
		goto battery_check_error;
		break;
	}

	psy_do_property(psy_name, get,
		POWER_SUPPLY_PROP_PRESENT, value);
	ret = (bool)value.intval;

battery_check_error:
	return ret;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:32,代码来源:sec_battery.c

示例3: sec_bat_ovp_uvlo_by_psy

static bool sec_bat_ovp_uvlo_by_psy(struct sec_battery_info *battery)
{
	char *psy_name;
	union power_supply_propval value;
	bool ret;
	ret = true;

	switch (battery->pdata->ovp_uvlo_check_type) {
	case SEC_BATTERY_OVP_UVLO_PMICPOLLING:
		psy_name = battery->pdata->pmic_name;
		break;
	case SEC_BATTERY_OVP_UVLO_CHGPOLLING:
		psy_name = "sec-charger";
		break;
	default:
		pr_err("%s: Invalid OVP/UVLO Check Type\n",
			__func__);
		ret = false;
		goto ovp_uvlo_check_error;
		break;
	}

	psy_do_property(psy_name, get,
		POWER_SUPPLY_PROP_HEALTH, value);

	if (value.intval != POWER_SUPPLY_HEALTH_GOOD) {
		battery->health = value.intval;
		ret = false;
	}

ovp_uvlo_check_error:
	return ret;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:33,代码来源:sec_battery.c

示例4: otg_accessory_power

static int otg_accessory_power(bool enable)
{
	u8 on = (u8)!!enable;
	union power_supply_propval val;
	struct device_node *np_charger = NULL;
	char *charger_name;

	pr_info("otg accessory power = %d\n", on);

	np_charger = of_find_node_by_name(NULL, "battery");
	if (!np_charger) {
		pr_err("%s: failed to get the battery device node\n", __func__);
		return 0;
	} else {
		if (!of_property_read_string(np_charger, "battery,charger_name",
					(char const **)&charger_name)) {
			pr_info("%s: charger_name = %s\n", __func__,
					charger_name);
		} else {
			pr_err("%s: failed to get the charger name\n"
								, __func__);
			return 0;
		}
	}

	val.intval = enable;
	psy_do_property(charger_name, set,
			POWER_SUPPLY_PROP_CHARGE_OTG_CONTROL, val);

	return 0;
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:31,代码来源:usb_notifier.c

示例5: bq51221_wireless_chg_init

void bq51221_wireless_chg_init(struct i2c_client *client)
{
	int data = 0;
	union power_supply_propval value;
	struct bq51221_charger_data *charger = i2c_get_clientdata(client);

	pr_info("%s\n", __func__);

	psy_do_property("battery", get,
				POWER_SUPPLY_PROP_CAPACITY, value);
	/* init I limit(IOREG) */
	bq51221_reg_write(client, BQ51221_REG_CURRENT_REGISTER2, BQ51221_IOREG_100_VALUE);
	data = bq51221_reg_read(client, BQ51221_REG_CURRENT_REGISTER2);
	pr_info("%s IOREG = 0x%x \n", __func__, data);

	/* init CEP timing */

	/* init RCVD PWR */

	/* read pad mode */
	bq51221_get_pad_mode(client);

	pr_info("%s siop = %d \n" ,__func__, charger->pdata->siop_level );
	if ((value.intval < charger->pdata->wireless_cc_cv) &&
		(charger->pdata->pad_mode == BQ51221_PAD_MODE_WPC) &&
		(charger->pdata->siop_level == 100) &&
		!charger->pdata->default_voreg) {
		/* set VOREG set 5.5V*/
		bq51221_set_voreg(charger->client, 0);
	} else {
		/* init VOREG with default value */
		bq51221_set_voreg(charger->client, 1);
	}
}
开发者ID:HRTKernel,项目名称:Hacker_Kernel_SM-G92X_MM_Beta,代码行数:34,代码来源:bq51221_charger.c

示例6: SM5414_get_charging_status

static int SM5414_get_charging_status(struct i2c_client *client)
{
	int status = POWER_SUPPLY_STATUS_UNKNOWN;
	struct sec_charger_info *charger = i2c_get_clientdata(client);
	int nCHG;
	u8 int2, chg_en;
	union power_supply_propval value;

	SM5414_i2c_read(client, SM5414_INT2, &int2);
	SM5414_i2c_read(client, SM5414_CTRL, &chg_en);

	if((int2 & SM5414_INT2_DONE) || (int2 & SM5414_INT2_TOPOFF)) {
		psy_do_property(charger->pdata->fuelgauge_name, get,
				POWER_SUPPLY_PROP_CAPACITY, value);
		if ((value.intval > 96) &&
			(charger->cable_type != POWER_SUPPLY_TYPE_BATTERY)) {
				status = POWER_SUPPLY_STATUS_FULL;
				charger->is_fullcharged = true;
				dev_info(&client->dev,
					"%s : Power Supply Full\n", __func__);
		}
	} else if (chg_en & CHARGE_EN) {
		nCHG = gpio_get_value(charger->pdata->chg_gpio_en);
		if ((nCHG) || (charger_health != POWER_SUPPLY_HEALTH_GOOD))
			status = POWER_SUPPLY_STATUS_DISCHARGING;
		else
			status = POWER_SUPPLY_STATUS_CHARGING;
	} else {
		status = POWER_SUPPLY_STATUS_DISCHARGING;
	}

	return (int)status;
}
开发者ID:GalaxyTab4,项目名称:android_kernel_samsung_matissewifi.bak,代码行数:33,代码来源:sm5414_charger.c

示例7: bq51221_set_voreg

int bq51221_set_voreg(struct i2c_client *client, int default_value)
{
	u8 data = 0;
	int ret = 0;
	int retry_cnt =0;
	union power_supply_propval value;
	struct bq51221_charger_data *charger = i2c_get_clientdata(client);

	return 0; // concept chagned, vout is always 5V

	if (charger->pdata->pad_mode == BQ51221_PAD_MODE_PMA) {
		pr_info("%s PMA MODE, do not set Voreg \n", __func__);
		return 0;
	}

	psy_do_property("battery", get,
				POWER_SUPPLY_PROP_CAPACITY, value);

	if ((value.intval >= charger->pdata->wireless_cc_cv) && !default_value)
		default_value = 1;

	if (default_value) {
		/* init VOREG with default value */
		ret = bq51221_reg_write(client, BQ51221_REG_CURRENT_REGISTER, 0x01);
		if(ret < 0) {
			while(retry_cnt++ < 3) {
				msleep(50);
				pr_debug("%s retry_cnt = %d, ret =%d \n",__func__, retry_cnt, ret);
				/* init VOREG with default value */
				ret = bq51221_reg_write(client, BQ51221_REG_CURRENT_REGISTER, 0x01);
				data = bq51221_reg_read(client, BQ51221_REG_CURRENT_REGISTER);
				if(ret >= 0) {
					pr_debug("%s VOREG = 0x%x \n", __func__, data);
					break;
				}
			}
		}
		data = bq51221_reg_read(client, BQ51221_REG_CURRENT_REGISTER);
		pr_info("%s VOREG = 0x%x 5.0V, cnt(%d)\n", __func__, data, retry_cnt);
	} else {
		ret = bq51221_reg_write(client, BQ51221_REG_CURRENT_REGISTER, 0x02);
		if(ret < 0) {
			while(retry_cnt++ < 3) {
				msleep(50);
				pr_debug("%s retry_cnt = %d, ret =%d \n",__func__, retry_cnt, ret);
				/* init VOREG with default value */
				ret = bq51221_reg_write(client, BQ51221_REG_CURRENT_REGISTER, 0x02);
				data = bq51221_reg_read(client, BQ51221_REG_CURRENT_REGISTER);
				if(ret >= 0) {
					pr_debug("%s VOREG = 0x%x \n", __func__, data);
					break;
				}
			}
		}
		data = bq51221_reg_read(client, BQ51221_REG_CURRENT_REGISTER);
		pr_info("%s VOREG = 0x%x 5.5V, cnt(%d)\n", __func__, data, retry_cnt);
	}
	return ret;
}
开发者ID:HRTKernel,项目名称:Hacker_Kernel_SM-G92X_MM_Beta,代码行数:59,代码来源:bq51221_charger.c

示例8: sec_bat_initial_check

static void sec_bat_initial_check(void)
{
	union power_supply_propval value;

	if (!gpio_get_value_cansleep(
		PM8921_GPIO_PM_TO_SYS(PMIC_GPIO_TA_nCONNECTED)))
		psy_do_property("battery", set,
			POWER_SUPPLY_PROP_ONLINE, value);
}
开发者ID:AnDr0id,项目名称:SGH-I747,代码行数:9,代码来源:board-espresso-battery.c

示例9: adc_get_current

static int adc_get_current(struct i2c_client *client)
{
	union power_supply_propval value;

	psy_do_property("sec-charger", get,
		POWER_SUPPLY_PROP_CURRENT_NOW, value);

	return value.intval;
}
开发者ID:junkyde,项目名称:vikinger-stock,代码行数:9,代码来源:adc_fuelgauge.c

示例10: sec_bat_initial_check

static void sec_bat_initial_check(void)
{
	union power_supply_propval value;

	if (POWER_SUPPLY_TYPE_BATTERY < current_cable_type) {
		value.intval = current_cable_type<<ONLINE_TYPE_MAIN_SHIFT;
		psy_do_property("battery", set,
				POWER_SUPPLY_PROP_ONLINE, value);
	} else {
		psy_do_property("sec-charger", get,
				POWER_SUPPLY_PROP_ONLINE, value);
		if (value.intval == POWER_SUPPLY_TYPE_WIRELESS) {
			value.intval =
			POWER_SUPPLY_TYPE_WIRELESS<<ONLINE_TYPE_MAIN_SHIFT;
			psy_do_property("battery", set,
					POWER_SUPPLY_PROP_ONLINE, value);
		}
	}
}
开发者ID:F4k,项目名称:android_kernel_samsung_msm8930-common,代码行数:19,代码来源:board-serrano-battery.c

示例11: sec_bat_initial_check

static void sec_bat_initial_check(void)
{
	union power_supply_propval value;

	if (POWER_SUPPLY_TYPE_BATTERY != current_cable_type) {
		value.intval = current_cable_type;
		psy_do_property("battery", set,
			POWER_SUPPLY_PROP_ONLINE, value);
	}
}
开发者ID:nyterage,项目名称:Galaxy_Tab_3_217s,代码行数:10,代码来源:board-biscotto-battery.c

示例12: cable_initial_check

void cable_initial_check(struct sec_battery_info *battery)
{
  union power_supply_propval value;

  pr_info("%s : current_cable_type : (%d)\n", __func__, current_cable_type);
  if (POWER_SUPPLY_TYPE_BATTERY != current_cable_type) {
    value.intval = current_cable_type;
    psy_do_property("battery", set,
        POWER_SUPPLY_PROP_ONLINE, value);
  } else {
    psy_do_property(battery->pdata->charger_name, get,
        POWER_SUPPLY_PROP_ONLINE, value);
    if (value.intval == POWER_SUPPLY_TYPE_WIRELESS) {
      value.intval = 1;
      psy_do_property("wireless", set,
          POWER_SUPPLY_PROP_ONLINE, value);
    }
  }
}
开发者ID:Kamin4ri,项目名称:android_kernel_samsung_msm8916,代码行数:19,代码来源:sec_board-msm8916.c

示例13: sec_bat_set_charge

static int sec_bat_set_charge(
				struct sec_battery_info *battery,
				bool enable)
{
	union power_supply_propval val;
	int ret;

	if ((battery->cable_type != POWER_SUPPLY_TYPE_BATTERY) &&
		(battery->health != POWER_SUPPLY_HEALTH_GOOD)) {
		pr_info("%s: Battery is NOT good!\n", __func__);
		return -EPERM;
	}

	if (enable) {
		val.intval = battery->cable_type;
		/*Reset charging start time only in initial charging start */
		if (battery->charging_start_time == 0) {
			battery->charging_start_time = jiffies;
			battery->charging_next_time =
				battery->pdata->charging_reset_time;
		}
	} else {
		val.intval = POWER_SUPPLY_TYPE_BATTERY;
		battery->charging_start_time = 0;
		battery->charging_passed_time = 0;
		battery->charging_next_time = 0;
		battery->full_check_cnt = 0;
	}

	battery->temp_high_cnt = 0;
	battery->temp_low_cnt = 0;
	battery->temp_recover_cnt = 0;

	psy_do_property("sec-charger", set,
		POWER_SUPPLY_PROP_ONLINE, val);

	psy_do_property("sec-fuelgauge", set,
		POWER_SUPPLY_PROP_ONLINE, val);

	return 0;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:41,代码来源:sec_battery.c

示例14: sii8240_vbus_present

static bool sii8240_vbus_present(void)
{
	union power_supply_propval value;

	psy_do_property("sec-charger", get, POWER_SUPPLY_PROP_ONLINE, value);
	pr_info("sii8240: sec-charger : %d\n", value.intval);

	if (value.intval == POWER_SUPPLY_TYPE_BATTERY ||
			value.intval == POWER_SUPPLY_TYPE_WPC)
		return false;
	else
		return true;
}
开发者ID:PompeyDroid,项目名称:Galaxy-Tab-S-Kernel,代码行数:13,代码来源:board-universal5420-mhl.c

示例15: sec_bat_ovp_uvlo_result_callback

static bool sec_bat_ovp_uvlo_result_callback(int health) {
	union power_supply_propval value;

	psy_do_property("sec-charger", get,
				POWER_SUPPLY_PROP_HEALTH, value);

	if (value.intval  == POWER_SUPPLY_HEALTH_OVERVOLTAGE) {
		is_ovlo_state = true;
	} else {
		is_ovlo_state = false;
	}

	return true;
}
开发者ID:Exynos-CyanogenMod,项目名称:android_kernel_samsung_ha3g,代码行数:14,代码来源:board-universal5420-battery.c


注:本文中的psy_do_property函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。