Exemplo n.º 1
0
void max77693_muic_deskdock_cb(bool attached)
{
	MUIC_PRINT_LOG();
	pr_info("MUIC deskdock attached=%d\n", attached);
	if (attached)
		switch_set_state(&switch_dock, 1);
	else
		switch_set_state(&switch_dock, 0);
}
Exemplo n.º 2
0
void max77693_muic_cardock_cb(bool attached)
{
	MUIC_PRINT_LOG();
	pr_info("MUIC cardock attached=%d\n", attached);
	pr_info("##MUIC [ %s ]- func : %s !!\n", __FILE__, __func__);
	if (attached)
		switch_set_state(&switch_dock, 2);
	else
		switch_set_state(&switch_dock, 0);
}
Exemplo n.º 3
0
bool max77693_muic_is_mhl_attached(void)
{
	int val;
	MUIC_PRINT_LOG();
	gpio_request(GPIO_MHL_SEL, "MHL_SEL");
	val = gpio_get_value(GPIO_MHL_SEL);
	pr_info("MUIC val:%d\n", val);
	gpio_free(GPIO_MHL_SEL);

	return !!val;
}
Exemplo n.º 4
0
void max77693_muic_init_cb(void)
{
	int ret;

	/* for CarDock, DeskDock */
	ret = switch_dev_register(&switch_dock);

	MUIC_PRINT_LOG();
	pr_info("MUIC ret=%d\n", ret);

	if (ret < 0)
		pr_err("Failed to register dock switch. %d\n", ret);
}
Exemplo n.º 5
0
/*extern void MHL_On(bool on);*/
void max77693_muic_mhl_cb(int attached)
{
	MUIC_PRINT_LOG();
	pr_info("MUIC attached:%d\n", attached);
	if (attached == MAX77693_MUIC_ATTACHED) {
		/*MHL_On(1);*/ /* GPIO_LEVEL_HIGH */
		pr_info("MHL Attached !!\n");
#ifdef	CONFIG_SAMSUNG_MHL
		sii9234_mhl_detection_sched();
#endif
	} else {
		/*MHL_On(0);*/ /* GPIO_LEVEL_LOW */
		pr_info("MHL Detached !!\n");
	}
}
Exemplo n.º 6
0
static ssize_t u1_switch_store_vbus(struct device *dev,
				       struct device_attribute *attr,
				       const char *buf, size_t count)
{
	int disable, ret, usb_mode;
	struct regulator *regulator;
	/* struct s3c_udc *udc = platform_get_drvdata(&s3c_device_usbgadget); */

	MUIC_PRINT_LOG();
	if (!strncmp(buf, "0", 1))
		disable = 0;
	else if (!strncmp(buf, "1", 1))
		disable = 1;
	else {
		pr_warn("%s: Wrong command\n", __func__);
		return count;
	}

	pr_info("%s: disable=%d\n", __func__, disable);
	usb_mode =
	    disable ? USB_CABLE_DETACHED_WITHOUT_NOTI : USB_CABLE_ATTACHED;
	/* ret = udc->change_usb_mode(usb_mode); */
	ret = -1;
	if (ret < 0)
		pr_err("%s: fail to change mode!!!\n", __func__);

	regulator = regulator_get(NULL, "safeout1");
	if (IS_ERR(regulator)) {
		pr_warn("%s: fail to get regulator\n", __func__);
		return count;
	}

	if (disable) {
		if (regulator_is_enabled(regulator))
			regulator_force_disable(regulator);
		if (!regulator_is_enabled(regulator))
			regulator_enable(regulator);
	} else {
		if (!regulator_is_enabled(regulator))
			regulator_enable(regulator);
	}
	regulator_put(regulator);

	return count;
}
Exemplo n.º 7
0
static ssize_t u1_switch_show_vbus(struct device *dev,
				      struct device_attribute *attr, char *buf)
{
	int i;
	struct regulator *regulator;

	regulator = regulator_get(NULL, "safeout1");
	if (IS_ERR(regulator)) {
		pr_warn("%s: fail to get regulator\n", __func__);
		return sprintf(buf, "UNKNOWN\n");
	}
	if (regulator_is_enabled(regulator))
		i = sprintf(buf, "VBUS is enabled\n");
	else
		i = sprintf(buf, "VBUS is disabled\n");
	MUIC_PRINT_LOG();
	regulator_put(regulator);

	return i;
}
Exemplo n.º 8
0
int max77693_muic_set_safeout(int path)
{
	struct regulator *regulator;

	MUIC_PRINT_LOG();
	pr_info("MUIC safeout path=%d\n", path);

	if (path == CP_USB_MODE) {
		regulator = regulator_get(NULL, "safeout1");
		if (IS_ERR(regulator))
			return -ENODEV;
		if (regulator_is_enabled(regulator))
			regulator_force_disable(regulator);
		regulator_put(regulator);

		regulator = regulator_get(NULL, "safeout2");
		if (IS_ERR(regulator))
			return -ENODEV;
		if (!regulator_is_enabled(regulator))
			regulator_enable(regulator);
		regulator_put(regulator);
	} else {
		/* AP_USB_MODE || AUDIO_MODE */
		regulator = regulator_get(NULL, "safeout1");
		if (IS_ERR(regulator))
			return -ENODEV;
		if (!regulator_is_enabled(regulator))
			regulator_enable(regulator);
		regulator_put(regulator);

		regulator = regulator_get(NULL, "safeout2");
		if (IS_ERR(regulator))
			return -ENODEV;
		if (regulator_is_enabled(regulator))
			regulator_force_disable(regulator);
		regulator_put(regulator);
	}

	return 0;
}
Exemplo n.º 9
0
static int uart_switch_init(void)
{
	int ret, val;
	MUIC_PRINT_LOG();

	ret = gpio_request(GPIO_UART_SEL, "UART_SEL");
	if (ret < 0) {
		pr_err("Failed to request GPIO_UART_SEL!\n");
		return -ENODEV;
	}
	s3c_gpio_setpull(GPIO_UART_SEL, S3C_GPIO_PULL_NONE);
	val = gpio_get_value(GPIO_UART_SEL);
	pr_info("##MUIC [ %s ]- func : %s !! val:-%d-\n", __FILE__, __func__,
		val);
	gpio_direction_output(GPIO_UART_SEL, val);

	gpio_export(GPIO_UART_SEL, 1);

	gpio_export_link(switch_dev, "uart_sel", GPIO_UART_SEL);

	return 0;
}
Exemplo n.º 10
0
/*extern void MHL_On(bool on);*/
void max77693_muic_mhl_cb(int attached)
{
	MUIC_PRINT_LOG();
	pr_info("MUIC attached:%d\n", attached);
	if (attached == MAX77693_MUIC_ATTACHED) {
		/*MHL_On(1);*/ /* GPIO_LEVEL_HIGH */
		pr_info("MHL Attached !!\n");
#ifdef CONFIG_SAMSUNG_MHL
#ifdef CONFIG_MACH_MIDAS
		sii9234_wake_lock();
#endif
		sii9234_mhl_detection_sched();
#endif
	} else {
		/*MHL_On(0);*/ /* GPIO_LEVEL_LOW */
		pr_info("MHL Detached !!\n");
#ifdef CONFIG_SAMSUNG_MHL
		exturn_mhl_onoff_ex(false);
#ifdef CONFIG_MACH_MIDAS
		sii9234_wake_unlock();
#endif
#endif
	}
}
Exemplo n.º 11
0
int max77693_muic_host_notify_cb(int enable)
{
	MUIC_PRINT_LOG();
	pr_info("MUIC host_noti enable=%d\n", enable);
	return 0;
}
Exemplo n.º 12
0
int max77693_muic_charger_cb(enum cable_type_muic cable_type)
{
	MUIC_PRINT_LOG();
	return 0;
}