static void platform_clvp_init_chrg_params(
		struct bq24192_platform_data *pdata)
{
	if (msic_battery_check())
		pdata->sfi_tabl_present = true;
	else
		pdata->sfi_tabl_present = false;

	pdata->throttle_states = bq24192_throttle_states;
	pdata->supplied_to = bq24192_supplied_to;
	pdata->num_throttle_states = ARRAY_SIZE(bq24192_throttle_states);
	pdata->num_supplicants = ARRAY_SIZE(bq24192_supplied_to);
	pdata->supported_cables = POWER_SUPPLY_CHARGER_TYPE_USB;
	pdata->init_platform_data = initialize_platform_data;
	pdata->get_irq_number = platform_get_irq_number;
	pdata->drive_vbus = platform_drive_vbus;
	pdata->get_battery_pack_temp = NULL;
	pdata->query_otg = NULL;
	pdata->free_platform_data = platform_free_data;
	pdata->slave_mode = 0;
	pdata->max_cc = 1216;	/* 1216 mA */
	pdata->max_cv = 4200;	/* 4200 mV */
	pdata->max_temp = 60;	/* 60 DegC */
	pdata->min_temp = 0;	/* 0 DegC */

#ifndef CONFIG_ACPI
	register_rpmsg_service("rpmsg_bq24192", RPROC_SCU,
				RP_BQ24192);
	/* WA for pmic rpmsg service registration
	   for power source detection driver */
	register_rpmsg_service("rpmsg_pmic_charger", RPROC_SCU,
				RP_PMIC_CHARGER);
#endif
}
Esempio n. 2
0
static void init_platform_params(struct max17042_platform_data *pdata)
{
	pdata->fg_algo_model = 100;

	if (msic_battery_check(pdata)) {
		pdata->enable_current_sense = true;
		pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
		pdata->file_sys_storage_enabled = 1;
		pdata->soc_intr_mode_enabled = true;
		pdata->valid_battery = true;
	}
	pdata->is_init_done = 0;
}
static void init_platform_params(struct max17042_platform_data *pdata)
{
	pdata->fg_algo_model = 100;

	if (INTEL_MID_BOARD(1, PHONE, MFLD)) {
		/* MFLD phones */
		if (!(INTEL_MID_BOARD(2, PHONE, MFLD, LEX, ENG)) ||
			!(INTEL_MID_BOARD(2, PHONE, MFLD, LEX, PRO)))
			/* MFLD phones except Lex phones */
			pdata->fg_algo_model = 70;
		if (msic_battery_check(pdata)) {
			pdata->enable_current_sense = true;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
			pdata->valid_battery = true;
		} else {
			pdata->enable_current_sense = false;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
			pdata->valid_battery = false;
		}
	} else if (INTEL_MID_BOARD(2, TABLET, MFLD, YKB, ENG) ||
		INTEL_MID_BOARD(2, TABLET, MFLD, YKB, PRO)) {
		/* Yukka beach Tablet */
		if (msic_battery_check(pdata)) {
			pdata->enable_current_sense = true;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
			pdata->valid_battery = true;
		} else {
			pdata->enable_current_sense = false;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
			pdata->valid_battery = false;
		}
	} else if (INTEL_MID_BOARD(2, TABLET, MFLD, RR, ENG) ||
			INTEL_MID_BOARD(2, TABLET, MFLD, RR, PRO) ||
			INTEL_MID_BOARD(2, TABLET, MFLD, SLP, ENG) ||
			INTEL_MID_BOARD(2, TABLET, MFLD, SLP, PRO)) {
		/* MFLD  Redridge and Salitpa Tablets */
		pdata->enable_current_sense = true;
		pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
		pdata->valid_battery = true;
	} else if (INTEL_MID_BOARD(1, PHONE, CLVTP) ||
				INTEL_MID_BOARD(1, TABLET, CLVT)) {
		if (msic_battery_check(pdata)) {
			pdata->enable_current_sense = true;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
			pdata->file_sys_storage_enabled = 1;
			pdata->soc_intr_mode_enabled = true;
			pdata->valid_battery = true;
		}
	} else if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
				INTEL_MID_BOARD(1, TABLET, MRFL) ||
				INTEL_MID_BOARD(1, PHONE, MOFD) ||
				INTEL_MID_BOARD(1, TABLET, MOFD)) {
		if (msic_battery_check(pdata)) {
			pdata->enable_current_sense = true;
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
			pdata->file_sys_storage_enabled = 1;
			pdata->soc_intr_mode_enabled = true;
			pdata->valid_battery = true;
		}
	} else if (INTEL_MID_BOARD(1, TABLET, BYT) ||
			INTEL_MID_BOARD(1, TABLET, CHT)) {
		if (max17042_is_valid_batid()) {
			snprintf(pdata->battid, (BATTID_LEN + 1),
						"%s", "INTN0001");
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_LION;
			pdata->enable_current_sense = true;
			pdata->valid_battery = true;
		} else {
			snprintf(pdata->battid, (BATTID_LEN + 1),
						"%s", "UNKNOWNB");
			pdata->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
			pdata->enable_current_sense = false;
			pdata->valid_battery = false;
		}
		pdata->en_vmax_intr = true;
		pdata->file_sys_storage_enabled = 1;
		pdata->soc_intr_mode_enabled = true;
		snprintf(pdata->model_name, (MODEL_NAME_LEN + 1),
					"%s", pdata->battid);
		snprintf(pdata->serial_num, (SERIAL_NUM_LEN + 1), "%s",
				pdata->battid + MODEL_NAME_LEN);
	}

	pdata->is_init_done = 0;
}
void *max17042_platform_data(void *info)
{
	static struct max17042_platform_data platform_data;
	struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
#ifdef CONFIG_BOARD_CTP /* TODO: get rid of this... */
	int intr = get_gpio_by_name("max17042");
	intr = 94; /* TODO: remove this(workaorund for IAFW) */
#else
	int intr = get_gpio_by_name("max_fg_alert");
#endif

	i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;

	if (msic_battery_check(platform_data.battid)) {
		platform_data.enable_current_sense = true;
		platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;

	} else {
		platform_data.enable_current_sense = false;
		platform_data.technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
	}

	platform_data.is_init_done = 0;
	platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
#ifdef CONFIG_BATTERY_INTEL_MDF /* blackbay, not redridge, not ctp */
	platform_data.current_sense_enabled =
		intel_msic_is_current_sense_enabled;
	platform_data.battery_present = intel_msic_check_battery_present;
	platform_data.battery_health = intel_msic_check_battery_health;
	platform_data.battery_status = intel_msic_check_battery_status;
	platform_data.battery_pack_temp = intel_msic_get_battery_pack_temp;
	platform_data.save_config_data = intel_msic_save_config_data;
	platform_data.restore_config_data = intel_msic_restore_config_data;

	platform_data.is_cap_shutdown_enabled =
					intel_msic_is_capacity_shutdown_en;
	platform_data.is_volt_shutdown_enabled = intel_msic_is_volt_shutdown_en;
	platform_data.is_lowbatt_shutdown_enabled =
					intel_msic_is_lowbatt_shutdown_en;
	platform_data.get_vmin_threshold = intel_msic_get_vsys_min;
#endif
#ifdef CONFIG_BOARD_REDRIDGE /* TODO: get rid of this */
	platform_data.enable_current_sense = true;
	platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
	platform_data.temp_min_lim = 0;
	platform_data.temp_max_lim = 60;
	platform_data.volt_min_lim = 3200;
	platform_data.volt_max_lim = 4300;
	platform_data.restore_config_data = mfld_fg_restore_config_data;
	platform_data.save_config_data = mfld_fg_save_config_data;
#endif
#ifdef CONFIG_BOARD_CTP
	platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
	platform_data.file_sys_storage_enabled = 1;
	platform_data.battery_health = ctp_get_battery_health;
	platform_data.is_volt_shutdown_enabled = ctp_is_volt_shutdown_enabled;
	platform_data.get_vmin_threshold = ctp_get_vsys_min;
#endif
#ifdef CONFIG_CHARGER_SMB347 /* redridge dv10 */
	platform_data.battery_status = smb347_get_charging_status;
#endif
#ifdef CONFIG_CHARGER_BQ24192 /* clovertrail */
	platform_data.battery_status = ctp_query_battery_status;
	platform_data.battery_pack_temp = ctp_get_battery_pack_temp;
#endif

#ifdef CONFIG_X86_MRFLD
	platform_data.enable_current_sense = true;
	platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
	platform_data.battery_health = bc_check_battery_health;
	platform_data.battery_status = bc_check_battery_status;
	platform_data.battery_pack_temp = bc_get_battery_pack_temp;
#endif
	return &platform_data;
}