Exemplo n.º 1
0
static int set_h2w_path(const char *val, struct kernel_param *kp)
{
	int ret = -EINVAL;
	int enable;
	int current_h2w_path = bahamas_h2w_path;

	ret = param_set_int(val, kp);
	if (ret)
		return ret;
	
	if (bahamas_h2w_path == current_h2w_path) {
		printk(KERN_INFO "%s: H2W path has been set to %s\n", __func__,
			(bahamas_h2w_path == H2W_UART3) ? "UART3" : "GPIO");
		return ret;
	}

	switch (bahamas_h2w_path) {
	case H2W_GPIO:
		enable = 1;
		cnf_driver_event("H2W_enable_irq", &enable);
		break;
	case H2W_UART3:
		enable = 0;
		cnf_driver_event("H2W_enable_irq", &enable);
		break;
	default:
		bahamas_h2w_path = -1;
		return -EINVAL;
	}
	
	h2w_configure(bahamas_h2w_path);
	return ret;
}
Exemplo n.º 2
0
static int set_h2w_path(const char *val, struct kernel_param *kp)
{
	int ret = -EINVAL;
	int enable;

	ret = param_set_int(val, kp);
	if (ret)
		return ret;

	switch (hero_h2w_path) {
	case H2W_GPIO:
		enable = 1;
		cnf_driver_event("H2W_enable_irq", &enable);
		break;
	case H2W_UART3:
		enable = 0;
		cnf_driver_event("H2W_enable_irq", &enable);
		break;
	default:
		hero_h2w_path = -1;
		return -EINVAL;
	}

	h2w_configure(hero_h2w_path);
	return ret;
}
// Stolen from GSM Hero, good candidate for snippage.
static void heroc_microp_intr_function(uint8_t *pin_status)
{
	static int last_insert = 0;
	int insert;
	/*
	printk(KERN_INFO "heroc_microp_intr_function : %02X %02X %02X\n",
		pin_status[0], pin_status[1], pin_status[2]);
	*/
	if (pin_status[1] & 0x01) {
		insert = 0;
	} else {
		insert = 1;
	}

	if (last_insert != insert) {
		printk(KERN_INFO "heroc_microp_intr_function : %s\n", insert ? "inserted" : "not inserted");
		microp_i2c_set_pin_mode(4, insert, microp_data.dev_id);
		cnf_driver_event("H2W_extend_headset", &insert);
		last_insert = insert;
	}
}