static void __init msm7x30_init(void)
{
	wake_lock_init(&vbus_wake_lock, WAKE_LOCK_SUSPEND, "board-vbus");
#ifdef CONFIG_DEBUG_LL
	{
		/* HACK: get a fake clock request for uart2 for debug_ll */
		struct clk *uart2_clk;
		uart2_clk = clk_get(&msm_device_uart2.dev, "uart_clk");
		if (IS_ERR(uart2_clk))
			uart2_clk = NULL;
		else
			clk_enable(uart2_clk);
	}
#endif

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_serial_debug_init(MSM_UART2_PHYS, INT_UART2,
			      &msm_device_uart2.dev, 23, MSM_GPIO_TO_INT(51));
#endif

	if (machine_is_msm7x30_fluid())
		msm7x30_pmic_keypad_pdata.keymap = msm7x30_fluid_pmic_keymap;
	else
		msm7x30_pmic_keypad_pdata.keymap = msm7x30_surf_pmic_keymap;

	msm7x30_ssbi_pmic_init();
	msm7x30_i2c_0_init();
	msm7x30_spi_init();

	/* set the gpu power rail to manual mode so clk en/dis will not
	 * turn off gpu power, and hang it on resume */
	msm7x30_kgsl_power_rail_mode(0);
	msm7x30_kgsl_power(true);

	msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
	msm_device_spi.dev.platform_data = &msm7x30_spi_pdata;

	platform_add_devices(devices, ARRAY_SIZE(devices));

	if (machine_is_msm7x30_fluid()) {
		fluid_cyttsp_init();
		i2c_register_board_info(0, fluid_i2c_0_board_info,
					ARRAY_SIZE(fluid_i2c_0_board_info));
	}
	i2c_register_board_info(1, surf_i2c_devices,
				ARRAY_SIZE(surf_i2c_devices));

	if (machine_is_msm7x30_fluid())
		fluid_board_props_init();

	msm7x30_board_audio_init();

	msm_hsusb_set_vbus_state(1);
	msm_hsusb_set_vbus_state(0);
	msm_hsusb_set_vbus_state(1);
}
// called from RPC Callback
void notify_cable_status(int status)
{
	pr_info("%s: %d\n", __func__, status);
	vbus_present = status;
	msm_hsusb_set_vbus_state(vbus_present);
	power_supply_changed(&ac_supply);
	power_supply_changed(&usb_supply);
}
Esempio n. 3
0
void notify_cable_status(int status)
{
	printk("%s, VBUS IRQ triggered, VBUS=%d)\n", __func__,status);
	//activate VBUS for usb driver
	msm_hsusb_set_vbus_state(status);
	//queue work to avoid blocking irq
	queue_work(g_vbus_notifier_work_queue, &g_vbus_notifier_work);	
}
static void msm7x30_vbus_present(bool present)
{
	pr_info("usb_cable_status: %s\n", present ? "inserted" : "removed");
	if (present)
		wake_lock(&vbus_wake_lock);
	msm_hsusb_set_vbus_state(present);
	if (!present)
		wake_unlock(&vbus_wake_lock);
}
Esempio n. 5
0
/* VBUS reporting logically comes from a transceiver */
static int msm72k_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
{
	struct usb_info *ui = container_of(_gadget, struct usb_info, gadget);

	ui->usb_state = is_active ? USB_STATE_POWERED : USB_STATE_NOTATTACHED;

	msm_hsusb_set_vbus_state(is_active);
	return 0;
}
Esempio n. 6
0
static void __init halibut_init(void)
{
	if (socinfo_init() < 0)
		BUG();

	if (machine_is_msm7201a_ffa()) {
		smc91x_resources[0].start = 0x98000300;
		smc91x_resources[0].end = 0x98000400;
		smc91x_resources[1].start = MSM_GPIO_TO_INT(85);
		smc91x_resources[1].end = MSM_GPIO_TO_INT(85);
	}

	/* All 7x01 2.0 based boards are expected to have RAM chips capable
	 * of 160 MHz. */
	if (cpu_is_msm7x01()
	    && SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2)
		halibut_clock_data.max_axi_khz = 160000;

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
			      &msm_device_uart3.dev, 1);
#endif
	msm_hsusb_pdata.soc_version = socinfo_get_version();
	msm_acpu_clock_init(&halibut_clock_data);
	msm_device_hsusb_peripheral.dev.platform_data = &msm_hsusb_pdata,
	msm_device_hsusb_host.dev.platform_data = &msm_hsusb_pdata,
	platform_add_devices(devices, ARRAY_SIZE(devices));
	msm_camera_add_device();
	msm_device_i2c_init();
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));

#ifdef CONFIG_SURF_FFA_GPIO_KEYPAD
	if (machine_is_msm7201a_ffa())
		platform_device_register(&keypad_device_7k_ffa);
	else
		platform_device_register(&keypad_device_surf);
#endif

	halibut_init_mmc();
#ifdef CONFIG_USB_FUNCTION
	hsusb_gpio_init();
#endif
	msm_fb_add_devices();
	bt_power_init();
#ifdef CONFIG_USB_ANDROID
	msm_hsusb_rpc_connect();
	msm_hsusb_set_vbus_state(1) ;
#endif
	msm_pm_set_platform_data(msm_pm_data);
}
static void __init halibut_init(void)
{
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
			      &msm_device_uart3.dev, 1);
#endif
	msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
	msm_acpu_clock_init(&halibut_clock_data);
#ifdef CONFIG_MSM_CAMERA
	config_camera_off_gpios(); /* might not be necessary */
#endif
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
	platform_add_devices(devices, ARRAY_SIZE(devices));
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
	msm_hsusb_set_vbus_state(1);
}
static void __init swordfish_init(void)
{
	int rc;

	msm_acpu_clock_init(&swordfish_clock_data);
#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
			      &msm_device_uart3.dev, 1);
#endif
	msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
	msm_device_touchscreen.dev.platform_data = &swordfish_ts_pdata;
	platform_add_devices(devices, ARRAY_SIZE(devices));
	msm_hsusb_set_vbus_state(1);
	rc = swordfish_init_mmc();
	if (rc)
		pr_crit("%s: MMC init failure (%d)\n", __func__, rc);
}
Esempio n. 9
0
void __init msm_add_usb_devices(struct msm_hsusb_platform_data* board_pdata)
{
	/* At this point, the msm_device_hsusb.dev.platform_data is already set
	 * with the wrapping msm_hsusb_wrapper_pdata from devices-msm7x00.c.
	 * If board_pdata is given, its hooks are called from the wrapper.
	 */
	if (board_pdata)
		msm_hsusb_board_pdata = board_pdata;

	platform_device_register(&msm_device_hsusb);
#ifdef CONFIG_USB_ANDROID_RNDIS
	platform_device_register(&rndis_device);
#endif
	platform_device_register(&usb_mass_storage_device);
	platform_device_register(&android_usb_device);

	// set vbus state accordingly
	msm_hsusb_set_vbus_state(!!readl(MSM_SHARED_RAM_BASE + 0xfc00c));
}
static int handle_battery_call(struct msm_rpc_server *server,
			       struct rpc_request_hdr *req, unsigned len)
{	
	struct rpc_batt_mtoa_cable_status_update_args *args;

	if (req->procedure != RPC_BATT_MTOA_CABLE_STATUS_UPDATE_PROC)
		return 0;

	args = (struct rpc_batt_mtoa_cable_status_update_args *)(req + 1);
	args->status = be32_to_cpu(args->status);
	pr_info("cable_status_update: status=%d\n",args->status);

	args->status = !!args->status;

	if (vbus_present != args->status) {
		vbus_present = args->status;
		msm_hsusb_set_vbus_state(vbus_present);
		power_supply_changed(&ac_supply);
		power_supply_changed(&usb_supply);
	}
	return 0;
}
Esempio n. 11
0
/* VBUS reporting logically comes from a transceiver */
static int msm72k_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
{
	msm_hsusb_set_vbus_state(is_active);
	return 0;
}
Esempio n. 12
0
static void __init bahamas_init(void)
{
	int rc;
	printk("bahamas_init() revision=%d\n", system_rev);

	/*
	 * Setup common MSM GPIOS
	 */
	sdc1_boot_reset();
//        printk("\n\nboard-mega.c: sdc1 boot reset\n\n");

	config_gpios();
//        printk("\n\nboard-mega.c: config gpios\n\n");

	msm_hw_reset_hook = bahamas_reset;
//        printk("\n\nboard-mega.c: msm hw reset hook\n\n");

	msm_acpu_clock_init(&bahamas_clock_data);
//        printk("\n\nmsm acpu clock init\n\n");
	perflock_init(&bahamas_perflock_data);
//        printk("\n\nperflock init\n\n");
	/* adjust GPIOs based on bootloader request */
	/* XXX: on Memphis,
	 *      GPIO#86 is H2W DAT / UART RX for HTC 11-Pin
	 *      GPIO#87 is H2W CLK / UART TX for HTC 11-Pin
	 *      We would need to use UART3 as debug port
	 *
	 * TODO: switch UART3 and H2W (for headset detect)
	 *       based on bootloader request.
	 */

/*#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	if (!opt_disable_uart3)
		msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
				      &msm_device_uart3.dev, 1);
#endif*/


	/* touchscreen must be powered before we enable i2c pullup */
#if 0 /* TODO: do some equivalent operations here */
	udelay(50);
	trout_gpio_write(NULL, TROUT_GPIO_I2C_PULL, 1);
#endif

	/* put the AF VCM in powerdown mode to avoid noise */
#if 0
	trout_gpio_write(NULL, TROUT_GPIO_VCM_PWDN, 1);
	mdelay(100);
	trout_i2c_sysdev_resume(NULL);
#endif

#if 0 /* TODO: do some equivalent operations here */
	if(sysdev_class_register(&trout_i2c_sysdev_class) == 0)
		sysdev_register(&trout_i2c_sys_device);
#endif

	#ifdef CONFIG_SERIAL_MSM_HS
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
	msm_add_serial_devices(3);
	#else
	msm_add_serial_devices(0);
	#endif

	msm_add_serial_devices(2);

	msm_add_usb_devices(NULL,NULL);

	//msm_change_usb_id(0x0bb4, 0x0c06);
	if (board_mcp_monodie())
		msm_add_mem_devices(&pmem_setting_monodie);
	else
		msm_add_mem_devices(&pmem_setting_dualdie);
	msm_init_pmic_vibrator();
//        printk("\n\nboard-mega.c: msm init pmic vibrator\n\n");

	bahamas_init_h2w_power_gpio();
//        printk("\n\nboard-mega.c: bahamas init h2w power gpio\n\n");
//#if 1
	rc = bahamas_init_mmc(system_rev);
//        printk("\n\nboard-mega.c: init mmc\n\n");
	if (rc)
		printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);
//#endif
	if(!system_rev)
		bahamas_reset_keys_device.dev.platform_data = &bahamas_reset_keys_pdata0;
	/*CC090319*/
/*	if  (bahamas_is_3M_camera())   {
		msm_camera_device_data.sinfo = &msm_camera_sensor_mt9t013;
		}
	else  {
		msm_camera_device_data.sinfo = &msm_camera_sensor_s5k4b2fx;
	}*/

	if(system_rev < 3) {
		if (panel_detect() == PANEL_WINTEK) {
			microp_data.num_pins   = ARRAY_SIZE(microp_pins_0_wint);
			microp_data.pin_config = microp_pins_0_wint;
		} else {
			microp_data.num_pins   = ARRAY_SIZE(microp_pins_0);
			microp_data.pin_config = microp_pins_0;
		}
		i2c_microp_devices.irq = 0;
	} else if (panel_detect() == PANEL_WINTEK) {
		microp_data.num_pins   = ARRAY_SIZE(microp_pins_1_wint);
		microp_data.pin_config = microp_pins_1_wint;
	}

/*~CC090319*/
	//platform_add_devices(devices, ARRAY_SIZE(devices));

	/* Read Config 8 200 (Full Speed USB Mode) */
	/*if (readl(MSM_SHARED_RAM_BASE + 0xFC054) & 0x200)
		bahamas_h2w_data.flags |= FULL_SPEED_USB;

	if (system_rev >= 3)
		bahamas_h2w_data.flags |= _35MM_MIC_DET_L2H;

/*	if (system_rev >= 5)
		i2c_register_board_info(0, i2c_sensor, ARRAY_SIZE(i2c_sensor));

	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
	i2c_register_board_info(0 ,&i2c_microp_devices, 1);

	/* SD card door should wake the device */
	//trout_gpio_irq_set_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SD_DOOR_N), 1);
	msm_hsusb_set_vbus_state(1);
}
Esempio n. 13
0
int htc_cable_status_update(const char *sfrom)
{
	int rc = 0;
	unsigned source;
	int status;
	unsigned last_source;
	unsigned vbus_status;

	vbus_status = get_vbus_state();

	//printk("%s called from %s\n",__func__,sfrom);
	
	if (!is_battery_initialized)
		return 0;
	
	if (vbus_status && (!g_usb_online) && (htc_batt_info.rep.charging_source !=CHARGER_AC))
	{
		//usually, it takes less than 1sec for usb gadget to detect usb cable
		//we give time to usb notifier to modify g_usb_online status
		printk("%s: detected USB cable insertion (AC charger). Wait 1sec to see if it's USB charger or AC charger\n",__func__);
		msleep(1000);
	}
	
	mutex_lock(&htc_batt_info.lock);
	if(vbus_status && g_usb_online) {
		status=CHARGER_USB;	/* vbus present, usb connection online = USB CHARGER */
		printk("%s vbus present, usb connection=%d => USB CHARGER\n",__func__,g_usb_online);
	} else if (vbus_status && !g_usb_online) {
		status=CHARGER_AC;	/* vbus present, no usb = AC CHARGER */
		printk("%s vbus present, usb connection=%d =>AC CHARGER\n",__func__,g_usb_online);
	} else {
		printk("%s no vbus, no usb, usb connection=%d => ON BATTERY\n",__func__,g_usb_online);
		g_usb_online = 0;
		status=CHARGER_BATTERY;
	}
	last_source = htc_batt_info.rep.charging_source;

	switch(status) {
	case CHARGER_BATTERY:
		htc_batt_info.rep.charging_source = CHARGER_BATTERY;
		htc_batt_info.rep.charging_enabled = 0;
		break;
	case CHARGER_USB:
		htc_batt_info.rep.charging_source = CHARGER_USB;
		htc_batt_info.rep.charging_enabled = 1;
		break;
	case CHARGER_AC:
		htc_batt_info.rep.charging_source = CHARGER_AC;
		htc_batt_info.rep.charging_enabled = 1;
		break;
	default:
		BATT_ERR("%s - Not supported cable status received!\n", __FUNCTION__);
		rc = -EINVAL;
	}
	source = htc_batt_info.rep.charging_source;
	
	//maf reset if we change source
	if(source != last_source)
	{
		maf_clear();
		//JH //this is for packet filter (notify port list while USB in/out)
		update_port_list_charging_state(!(htc_batt_info.rep.charging_source == CHARGER_BATTERY));
	}
	
	mutex_unlock(&htc_batt_info.lock);
	
    htc_battery_set_charging(status);
	//r0bin: fix battery drain issue & keep usb connection stable!
	if(!((source==CHARGER_USB) || (source==CHARGER_AC)))
		msm_hsusb_set_vbus_state(0);
	
	if (  source == CHARGER_USB || source==CHARGER_AC ) {
		wake_lock(&vbus_wake_lock);
	} else if(last_source != source) {
		/* give userspace some time to see the uevent and update
		 * LED state or whatnot...
		 */
		wake_lock_timeout(&vbus_wake_lock, HZ);
	} else {
		wake_unlock(&vbus_wake_lock);
	}

	/* make sure that we only change the powersupply state if we really have to */
	if (source == CHARGER_BATTERY || last_source == CHARGER_BATTERY)
		power_supply_changed(&htc_power_supplies[CHARGER_BATTERY]);
	if (source == CHARGER_USB || last_source == CHARGER_USB)
		power_supply_changed(&htc_power_supplies[CHARGER_USB]);
	if (source == CHARGER_AC || last_source == CHARGER_AC)
		power_supply_changed(&htc_power_supplies[CHARGER_AC]);

	return rc;
}
Esempio n. 14
0
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key, temp_key_code;
     
	printk(KERN_ERR " ^^^^^^ key_code %d, key_parm %d \n",key_code, key_parm);

#ifdef CONFIG_MACH_MSM8X55_J_MASAI_E
    if(key_code == 0xfe && (key_parm == 0 || key_parm == 1))
    {
        msm_hsusb_set_vbus_state(key_parm);
    }
#endif


#ifdef CONFIG_MACH_MSM8X55_J_MASAI_E
	if(key_code == 130 && key_parm == 0){
		is_earjack_connected = 1;
	}
	if(key_code == 255 && key_parm == 130){
		is_earjack_connected = 0;
	}
	
	if(key_code == 132 && key_parm == 0){
		if(is_earjack_connected == 0){
			return;
		}
	}
#endif	
	
	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
	case KEY_MEDIA:
    #ifndef CONFIG_MACH_MSM8X55_MINI    
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
    #endif    
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
	case SW_HEADPHONE_INSERT_W_MIC:
		hs->mic_on = hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, SW_HEADPHONE_INSERT,
							hs->hs_on);
		input_report_switch(hs->ipdev, SW_MICROPHONE_INSERT,
							hs->mic_on);
		update_state();
		break;

	case SW_HEADPHONE_INSERT:      
		hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->hs_on);
        printk(KERN_ERR "SW_HEADPHONE_INSERT, key_code: %x key_parm: on off : %d\n",key, hs->hs_on);
		update_state();
		break;
	case SW_MICROPHONE_INSERT:
		hs->mic_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->mic_on);
		update_state();
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
/*
 * tuple format: (key_code, key_param)
 *
 * old-architecture:
 * key-press = (key_code, 0)
 * key-release = (0xff, key_code)
 *
 * new-architecutre:
 * key-press = (key_code, 0)
 * key-release = (key_code, 0xff)
 */
static void report_hs_key(uint32_t key_code, uint32_t key_parm)
{
	int key = 0, temp_key_code;

/* FUJITSU:2011-06-15 mod ChargeError start */
   	if (key_code == CHG_ST_NTFY_CODE)
   	{
        printk("got CHG_ST_NTFY_CODE notification\n");
        switch(key_parm)
        {
            case K_CHG_ST_NONE:
                key = KEY_CHG_ST_NONE;
                break;
            case K_CHG_ST_OVP:
                key = KEY_CHG_ST_OVP;
                break;
            case K_CHG_ST_OVC:
                key = KEY_CHG_ST_OVC;
                break;
            case K_CHG_ST_OVD:
                key = KEY_CHG_ST_OVD;
                break;
            case K_CHG_ST_EXP:
                key = KEY_CHG_ST_EXP;
                break;
        }
        printk(" key_code = %d, key_parm = %d\n", key_code, key_parm);
        input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
	input_sync(hs->ipdev);
	return;
	}
/* FUJITSU:2011-06-15 mod ChargeError end */

/* FUJITSU:2011-07-05 USB start */
	if (key_code == USB_CABLE_DET) {
		switch(key_parm) {
		case K_CABLE_WAKEUP:
			printk(KERN_DEBUG "%s: cable_det debug. call wakeup (%d)\n", __func__, key_parm);
			/* call wakeup function */
			break;
		case K_CABLE_USB_OTG_INIT_PHY:
		case K_CABLE_USB_CONNECT_CLIENT:
		case K_CABLE_USB_CONNECT_HOST:
			printk(KERN_DEBUG "%s: cable_det debug. USB utilization demand (%d)\n", __func__, key_parm);
			msm_otg_enable_irq();
/* FUJITSU:2011-07-05 USB start */
			printk(KERN_DEBUG "%s: cable_det debug. USB enable (%d)\n", __func__,key_parm);
			msm_hsusb_set_vbus_state(1);
/* FUJITSU:2011-07-05 USB end */
			printk(KERN_DEBUG "%s: cable_det debug. USB connect client (%d) \n",__func__,key_parm);
			break;
		case K_CABLE_USB_DISCONNECT:
			printk(KERN_DEBUG "%s: cable_det debug. USB cable cutting (%d) \n",__func__,key_parm);
/* FUJITSU:2011-07-05 USB start */
			msm_otg_disable_irq();
/* FUJITSU:2011-07-05 USB end */
			printk(KERN_DEBUG "%s: cable_det debug. USB disable (%d) \n",__func__,key_parm);
			break;
/* FUJITSU:2011-07-07 USB start */
		case K_CABLE_CRADLE_CONNECT:
			g_cradle_stat = 1;
			printk(KERN_DEBUG "%s: cable_det debug. CABLE CRADLE enable (%d)stat(%d) \n",__func__,key_parm,g_cradle_stat);
			break;
		case K_CABLE_CRADLE_DISCONNECT:
			g_cradle_otg_charge_type = -1;
			g_cradle_stat = 0;
			printk(KERN_DEBUG "%s: cable_det debug. CABLE CRADLE disable (%d)stat(%d) \n",__func__,key_parm,g_cradle_stat);
			break;
/* FUJITSU:2011-07-07 USB end */
		default:
			/* error !! */
			break;
		}
		return;
    	}
/* FUJITSU:2011-07-05 USB end */

	if (key_code == HS_REL_K)
		key = hs_find_key(key_parm);
	else
		key = hs_find_key(key_code);

	temp_key_code = key_code;

	if (key_parm == HS_REL_K)
		key_code = key_parm;

	switch (key) {
	case KEY_POWER:
	case KEY_END:
/*	case KEY_MEDIA: FUJITSU:2011-04-08 DEL */
	case KEY_VOLUMEUP:
	case KEY_VOLUMEDOWN:
		input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		break;
/* FUJITSU:2011-04-08 for media key start */
	case KEY_MEDIA:
/* FUJITSU:2011-06-08 for media key start */
		if(mediakeyloop){
			if(key_code != HS_REL_K) mediakeyflg = true;
			else mediakeyflg = false;
			break;
		}
		if(mediakeyflg){
			if(key_code == HS_REL_K) mediakeyflg = false;
			break;
		}
/* FUJITSU:2011-06-08 for media key end */
//		if(ena_media_key)input_report_key(hs->ipdev, key, (key_code != HS_REL_K));
		if(ena_media_key && key_code == HS_REL_K){
			input_report_key(hs->ipdev, key, true);
			input_report_key(hs->ipdev, key, false);
		}
		break;
/* FUJITSU:2011-04-08 for media key end */
	case SW_HEADPHONE_INSERT_W_MIC:
		hs->mic_on = hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, SW_HEADPHONE_INSERT,
							hs->hs_on);
		input_report_switch(hs->ipdev, SW_MICROPHONE_INSERT,
							hs->mic_on);
		update_state();
		break;

	case SW_HEADPHONE_INSERT:
		hs->hs_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->hs_on);
		update_state();
		break;
	case SW_MICROPHONE_INSERT:
		hs->mic_on = (key_code != HS_REL_K) ? 1 : 0;
		input_report_switch(hs->ipdev, key, hs->mic_on);
		update_state();
		break;
	case -1:
		printk(KERN_ERR "%s: No mapping for remote handset event %d\n",
				 __func__, temp_key_code);
		return;
	}
	input_sync(hs->ipdev);
}
static void __init photon_init(void)
{
	int rc;
	char *cid = NULL;
	struct kobject *properties_kobj;

#ifndef CONFIG_PHOTON_IS_NAND_BOOT
	kgsl_boot_reset();
	printk("PHOTON BOOT TYPE: SD-CARD\n");
#else
	printk("PHOTON BOOT TYPE: NAND\n");
#endif

	printk("photon_init() revision = 0x%X\n", system_rev);
	board_get_cid_tag(&cid);

	/* for bcm */
	bt_export_bd_address();

	/*
	 * Setup common MSM GPIOS
	 */
	config_gpios();

	/* We need to set this pin to 0 only once on power-up; we will
	 * not actually enable the chip until we apply power to it via
	 * vreg.
	 */
	gpio_request(PHOTON_GPIO_LS_EN, "ls_en");
	gpio_direction_output(PHOTON_GPIO_LS_EN, 0);
	/* disable power for cm3602 chip */
	/* __capella_cm3602_power(0); */

	msm_hw_reset_hook = photon_reset;

	msm_acpu_clock_init(&photon_clock_data);
	perflock_init(&photon_perflock_data);
	
	/* Battery for Photon */
	msm_proc_comm_wince_init();
	msm_device_htc_battery_wince.dev.platform_data = &htcphoton_htc_battery_wince_pdata;

#if defined(CONFIG_MSM_SERIAL_DEBUGGER)
	if (!opt_disable_uart3)
		msm_serial_debug_init(MSM_UART3_PHYS, INT_UART3,
			&msm_device_uart3.dev, 1,
				MSM_GPIO_TO_INT(PHOTON_GPIO_UART3_RX));
#endif

	htc_acoustic_wce_board_data = &htcphoton_acoustic_data;
	msm_add_devices();

#ifdef CONFIG_SERIAL_MSM_HS
	msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
#ifndef CONFIG_SERIAL_MSM_HS_PURE_ANDROID
	msm_device_uart_dm1.name = "msm_serial_hs_bcm";	/* for bcm */
#endif
	msm_add_serial_devices(3);
#else
	msm_add_serial_devices(0);
#endif

	msm_add_serial_devices(2);
	/*
	msm_change_usb_id(0x0bb4, 0x0c10);
	*/
#ifdef CONFIG_USB_FUNCTION
	msm_add_usb_id_pin_gpio(PHOTON_GPIO_USB_ID_PIN);
	msm_add_usb_devices(photon_phy_reset, NULL);
#endif

#ifdef CONFIG_USB_ANDROID
	android_usb_pdata.products[0].product_id =
		android_usb_pdata.product_id;
	android_usb_pdata.serial_number = board_serialno();
	msm_hsusb_pdata.serial_number = board_serialno();
	msm_device_hsusb.dev.platform_data = &msm_hsusb_pdata;
	platform_device_register(&msm_device_hsusb);
#ifdef CONFIG_USB_ANDROID_RNDIS
	platform_device_register(&rndis_device);
#endif
	platform_device_register(&usb_mass_storage_device);
	platform_device_register(&android_usb_device);
#endif
	msm_add_mem_devices(&pmem_setting);

#ifdef CONFIG_MICROP_COMMON
	photon_microp_init();
#endif

	rc = photon_init_mmc(system_rev);
	if (rc)
		printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);

	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		rc = sysfs_create_group(properties_kobj,
						&photon_properties_attr_group);
	if (!properties_kobj || rc)
		pr_err("failed to create board_properties\n");

	/* probe camera driver */
	i2c_register_board_info(0, i2c_camera_devices, ARRAY_SIZE(i2c_camera_devices));

	msm_device_i2c_init();
	platform_add_devices(devices, ARRAY_SIZE(devices));
	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));

	photon_init_panel();

	photon_init_keypad();
	
	msm_hsusb_set_vbus_state(1);
}