int headset_notifier_register(struct headset_notifier *notifier)
{
	if (!notifier->func) {
		HS_LOG("NULL register function");
		return 0;
	}

	switch (notifier->id) {
	case HEADSET_REG_HPIN_GPIO:
		HS_LOG("Register HPIN_GPIO notifier");
		hs_mgr_notifier.hpin_gpio = notifier->func;
		break;
	case HEADSET_REG_REMOTE_ADC:
		HS_LOG("Register REMOTE_ADC notifier");
		hs_mgr_notifier.remote_adc = notifier->func;
		break;
	case HEADSET_REG_REMOTE_KEYCODE:
		HS_LOG("Register REMOTE_KEYCODE notifier");
		hs_mgr_notifier.remote_keycode = notifier->func;
		break;
	case HEADSET_REG_RPC_KEY:
		HS_LOG("Register RPC_KEY notifier");
		hs_mgr_notifier.rpc_key = notifier->func;
		break;
	case HEADSET_REG_MIC_STATUS:
		HS_LOG("Register MIC_STATUS notifier");
		hs_mgr_notifier.mic_status = notifier->func;
		break;
	case HEADSET_REG_MIC_BIAS:
		HS_LOG("Register MIC_BIAS notifier");
		hs_mgr_notifier.mic_bias_enable = notifier->func;
		break;
	case HEADSET_REG_MIC_SELECT:
		HS_LOG("Register MIC_SELECT notifier");
		hs_mgr_notifier.mic_select = notifier->func;
		break;
	case HEADSET_REG_KEY_INT_ENABLE:
		HS_LOG("Register KEY_INT_ENABLE notifier");
		hs_mgr_notifier.key_int_enable = notifier->func;
		break;
	case HEADSET_REG_KEY_ENABLE:
		HS_LOG("Register KEY_ENABLE notifier");
		hs_mgr_notifier.key_enable = notifier->func;
		break;
	case HEADSET_REG_INDICATOR_ENABLE:
		HS_LOG("Register INDICATOR_ENABLE notifier");
		hs_mgr_notifier.indicator_enable = notifier->func;
		break;
	default:
		HS_LOG("Unknown register ID");
		return 0;
	}

	headset_notifier_update(notifier->id);

	return 1;
}
Ejemplo n.º 2
0
int headset_notifier_register(struct headset_notifier *notifier)
{
	if (!notifier->func) {
		HS_LOG("NULL register function");
		return 0;
	}

	switch (notifier->id) {
	case HEADSET_REG_HPIN_GPIO:
		HS_LOG("Register HPIN_GPIO notifier");
		hs_mgr_notifier.hpin_gpio = notifier->func;
		break;
	case HEADSET_REG_REMOTE_ADC:
		HS_LOG("Register REMOTE_ADC notifier");
		hs_mgr_notifier.remote_adc = notifier->func;
		break;
	case HEADSET_REG_REMOTE_KEYCODE:
		HS_LOG("Register REMOTE_KEYCODE notifier");
		hs_mgr_notifier.remote_keycode = notifier->func;
		break;
	case HEADSET_REG_RPC_KEY:
		HS_LOG("Register RPC_KEY notifier");
		hs_mgr_notifier.rpc_key = notifier->func;
		break;
	case HEADSET_REG_MIC_STATUS:
		HS_LOG("Register MIC_STATUS notifier");
		hs_mgr_notifier.mic_status = notifier->func;
		break;
	case HEADSET_REG_MIC_BIAS:
		HS_LOG("Register MIC_BIAS notifier");
		hs_mgr_notifier.mic_bias_enable = notifier->func;
		break;
	case HEADSET_REG_MIC_SELECT:
		HS_LOG("Register MIC_SELECT notifier");
		hs_mgr_notifier.mic_select = notifier->func;
		break;
	case HEADSET_REG_KEY_INT_ENABLE:
		HS_LOG("Register KEY_INT_ENABLE notifier");
		hs_mgr_notifier.key_int_enable = notifier->func;
		break;
	case HEADSET_REG_KEY_ENABLE:
		HS_LOG("Register KEY_ENABLE notifier");
		hs_mgr_notifier.key_enable = notifier->func;
		break;
	case HEADSET_REG_INDICATOR_ENABLE:
		HS_LOG("Register INDICATOR_ENABLE notifier");
		hs_mgr_notifier.indicator_enable = notifier->func;
		break;
	case HEADSET_REG_1WIRE_INIT:
		HS_LOG("Register 1WIRE_INIT notifier");
		hs_mgr_notifier.hs_1wire_init = notifier->func;
		hi->driver_one_wire_exist = 1;
		break;
	case HEADSET_REG_1WIRE_QUERY:
		HS_LOG("Register 1WIRE_QUERY notifier");
		hs_mgr_notifier.hs_1wire_query = notifier->func;
		break;
	case HEADSET_REG_1WIRE_READ_KEY:
		HS_LOG("Register 1WIRE_READ_KEY notifier");
		hs_mgr_notifier.hs_1wire_read_key = notifier->func;
		break;
	case HEADSET_REG_1WIRE_DEINIT:
		HS_LOG("Register 1WIRE_DEINIT notifier");
		hs_mgr_notifier.hs_1wire_deinit = notifier->func;
		break;
	case HEADSET_REG_1WIRE_REPORT_TYPE:
		HS_LOG("Register 1WIRE_REPORT_TYPE notifier");
		hs_mgr_notifier.hs_1wire_report_type = notifier->func;
		break;
	default:
		HS_LOG("Unknown register ID");
		return 0;
	}

	headset_notifier_update(notifier->id);

	return 1;
}