static void max14577_muic_force_detach(struct max14577_muic_data *muic_data)
{
	muic_lookup_vps_table(muic_data->attached_dev);

	max14577_muic_detach_callback_jig(muic_data);

	switch (muic_data->attached_dev) {
	case ATTACHED_DEV_JIG_UART_OFF_VB_MUIC:
	case ATTACHED_DEV_TA_MUIC:
#if defined(CONFIG_MUIC_SUPPORT_POGO_TA)
	case ATTACHED_DEV_POGO_TA_MUIC:
#endif /* CONFIG_MUIC_SUPPORT_POGO_TA */
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
		max14577_muic_detach_callback_chg(muic_data);
		break;
	case ATTACHED_DEV_JIG_USB_ON_MUIC:
	case ATTACHED_DEV_USB_MUIC:
	case ATTACHED_DEV_CDP_MUIC:
#if defined(CONFIG_MUIC_SUPPORT_POGO_USB)
	case ATTACHED_DEV_POGO_USB_MUIC:
#endif /* CONFIG_MUIC_SUPPORT_POGO_USB */
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
		max14577_muic_detach_callback_chg(muic_data);
		max14577_muic_detach_callback_usb(muic_data);
		break;
	case ATTACHED_DEV_DESKDOCK_MUIC:
#if defined(CONFIG_SEC_FACTORY_MODE)
	case ATTACHED_DEV_JIG_UART_ON_MUIC:
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
		max14577_muic_detach_callback_dock(muic_data);
		break;
#endif /* CONFIG_SEC_FACTORY_MODE */
#if defined(CONFIG_MUIC_SUPPORT_FACTORY_BUTTON)
	case ATTACHED_DEV_FACTORY_BUTTON:
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
		max14577_muic_detach_callback_dock(muic_data);
		break;
#endif /* CONFIG_MUIC_SUPPORT_FACTORY_BUTTON */
	case ATTACHED_DEV_JIG_UART_OFF_MUIC:
	case ATTACHED_DEV_UNKNOWN_MUIC:
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
	case ATTACHED_DEV_NONE_MUIC:
		break;
	default:
		pr_info("%s:%s invalid device type(%d)\n", MUIC_DEV_NAME,
				__func__, muic_data->attached_dev);
		muic_data->attached_dev = ATTACHED_DEV_NONE_MUIC;
		break;
	}

	return;
}
Esempio n. 2
0
static ssize_t max14577_muic_show_attached_dev(struct device *dev,
				   struct device_attribute *attr,
				   char *buf)
{
	struct max14577_muic_data *muic_data = dev_get_drvdata(dev);
	const struct max14577_muic_vps_data *tmp_vps;
	int vps_index;

	vps_index = muic_lookup_vps_table(muic_data->attached_dev);
	if (vps_index == -1)
		return sprintf(buf, "Error No Device\n");

	tmp_vps = &(muic_vps_table[vps_index]);

	return sprintf(buf, "%s\n", tmp_vps->vps_name);
}
Esempio n. 3
0
static int write_vps_regs(struct max14577_muic_data *muic_data,
			muic_attached_dev_t new_dev)
{
	const struct max14577_muic_vps_data *tmp_vps;
	int vps_index;
	int ret = 0;

	vps_index = muic_lookup_vps_table(new_dev);
	if (vps_index == -1)
		return -ENODEV;

	tmp_vps = &(muic_vps_table[vps_index]);

	/* write control1 register */
	ret = write_muic_ctrl_reg(muic_data, MAX14577_MUIC_REG_CONTROL1,
			tmp_vps->control1);

	return ret;
}