Ejemplo n.º 1
0
static int nevada_panel_enable(struct omap_display *display)
{
	int r;
	struct nevada_device *md =
		(struct nevada_device *)display->panel->priv;

	DBG("nevada_panel_enable\n");

	mutex_lock(&md->mutex);

	if (display->hw_config.panel_enable)
		display->hw_config.panel_enable(display);

	r = panel_detect(md);
	if (r) {
		mutex_unlock(&md->mutex);
		return r;
	}

	md->enabled = panel_enabled(md);

	if (md->enabled) {
		DBG("panel already enabled\n");
		; /*nevada_esd_start_check(md);*/
	} else {
		; /*md->saved_bklight_level = nevada_get_bklight_level(panel);*/
	}


	if (md->enabled) {
		mutex_unlock(&md->mutex);
		return 0;
	}

	/*nevada_cmd(md, 0x1);*/ /* SW reset */
	/*msleep(120);*/

	/*send_init_string(md);*/

	set_sleep_mode(md, 0);
	md->enabled = 1;

	/*panel_test_dump(md);*/

	/*for(r = 0; r < 500; r++)*/
	/*send_init_string(md);*/

	set_display_state(md, 1);
	/*nevada_set_bklight_level(panel, md->saved_bklight_level);*/

	panel_test_dump(md);
	nevada_cmd(md, 0x13); /* normal mode XXX */

	/*msleep(500);*/
	panel_test_dump(md);

	mutex_unlock(&md->mutex);
	return 0;
}
Ejemplo n.º 2
0
static int acx_panel_probe(struct omap_dss_device *dssdev)
{
	int r;
	struct acx565akm_device *md = &acx_dev;
	struct backlight_device *bldev;
	int max_brightness, brightness;
	struct backlight_properties props;

	dev_dbg(&dssdev->dev, "%s\n", __func__);
	dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
					OMAP_DSS_LCD_IHS;
	/* FIXME AC bias ? */
	dssdev->panel.timings = acx_panel_timings;

	if (dssdev->platform_enable)
		dssdev->platform_enable(dssdev);
	/*
	 * After reset we have to wait 5 msec before the first
	 * command can be sent.
	 */
	msleep(5);

	md->enabled = panel_enabled(md);

	r = panel_detect(md);
	if (r) {
		dev_err(&dssdev->dev, "%s panel detect error\n", __func__);
		if (!md->enabled && dssdev->platform_disable)
			dssdev->platform_disable(dssdev);
		return r;
	}

	mutex_lock(&acx_dev.mutex);
	acx_dev.dssdev = dssdev;
	mutex_unlock(&acx_dev.mutex);

	if (!md->enabled) {
		if (dssdev->platform_disable)
			dssdev->platform_disable(dssdev);
	}

	/*------- Backlight control --------*/

	props.fb_blank = FB_BLANK_UNBLANK;
	props.power = FB_BLANK_UNBLANK;

	bldev = backlight_device_register("acx565akm", &md->spi->dev,
			md, &acx565akm_bl_ops, &props);
	md->bl_dev = bldev;
	if (md->has_cabc) {
		r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
		if (r) {
			dev_err(&bldev->dev,
				"%s failed to create sysfs files\n", __func__);
			backlight_device_unregister(bldev);
			return r;
		}
		md->cabc_mode = get_hw_cabc_mode(md);
	}

	if (md->has_bc)
		max_brightness = 255;
	else
		max_brightness = dssdev->max_backlight_level;

	if (md->has_bc)
		brightness = acx565akm_get_actual_brightness(md);
	else if (dssdev->get_backlight)
		brightness = dssdev->get_backlight(dssdev);
	else
		brightness = 0;

	bldev->props.max_brightness = max_brightness;
	bldev->props.brightness = brightness;

	acx565akm_bl_update_status(bldev);
	return 0;
}
Ejemplo n.º 3
0
static int acx565akm_probe(struct spi_device *spi)
{
	struct panel_drv_data *ddata;
	struct omap_dss_device *dssdev;
	struct backlight_device *bldev;
	int max_brightness, brightness;
	struct backlight_properties props;
	int r;

	dev_dbg(&spi->dev, "%s\n", __func__);

	spi->mode = SPI_MODE_3;

	ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL);
	if (ddata == NULL)
		return -ENOMEM;

	dev_set_drvdata(&spi->dev, ddata);

	ddata->spi = spi;

	mutex_init(&ddata->mutex);

	if (dev_get_platdata(&spi->dev)) {
		r = acx565akm_probe_pdata(spi);
		if (r)
			return r;
	} else if (spi->dev.of_node) {
		r = acx565akm_probe_of(spi);
		if (r)
			return r;
	} else {
		dev_err(&spi->dev, "platform data missing!\n");
		return -ENODEV;
	}

	if (gpio_is_valid(ddata->reset_gpio)) {
		r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio,
				GPIOF_OUT_INIT_LOW, "lcd reset");
		if (r)
			goto err_gpio;
	}

	if (gpio_is_valid(ddata->reset_gpio))
		gpio_set_value(ddata->reset_gpio, 1);

	/*
	 * After reset we have to wait 5 msec before the first
	 * command can be sent.
	 */
	usleep_range(5000, 10000);

	ddata->enabled = panel_enabled(ddata);

	r = panel_detect(ddata);

	if (!ddata->enabled && gpio_is_valid(ddata->reset_gpio))
		gpio_set_value(ddata->reset_gpio, 0);

	if (r) {
		dev_err(&spi->dev, "%s panel detect error\n", __func__);
		goto err_detect;
	}

	memset(&props, 0, sizeof(props));
	props.fb_blank = FB_BLANK_UNBLANK;
	props.power = FB_BLANK_UNBLANK;
	props.type = BACKLIGHT_RAW;

	bldev = backlight_device_register("acx565akm", &ddata->spi->dev,
			ddata, &acx565akm_bl_ops, &props);
	ddata->bl_dev = bldev;
	if (ddata->has_cabc) {
		r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
		if (r) {
			dev_err(&bldev->dev,
				"%s failed to create sysfs files\n", __func__);
			goto err_sysfs;
		}
		ddata->cabc_mode = get_hw_cabc_mode(ddata);
	}

	max_brightness = 255;

	if (ddata->has_bc)
		brightness = acx565akm_get_actual_brightness(ddata);
	else
		brightness = 0;

	bldev->props.max_brightness = max_brightness;
	bldev->props.brightness = brightness;

	acx565akm_bl_update_status(bldev);


	ddata->videomode = acx565akm_panel_timings;

	dssdev = &ddata->dssdev;
	dssdev->dev = &spi->dev;
	dssdev->driver = &acx565akm_ops;
	dssdev->type = OMAP_DISPLAY_TYPE_SDI;
	dssdev->owner = THIS_MODULE;
	dssdev->panel.timings = ddata->videomode;

	r = omapdss_register_display(dssdev);
	if (r) {
		dev_err(&spi->dev, "Failed to register panel\n");
		goto err_reg;
	}

	return 0;

err_reg:
	sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group);
err_sysfs:
	backlight_device_unregister(bldev);
err_detect:
err_gpio:
	omap_dss_put_device(ddata->in);
	return r;
}
Ejemplo n.º 4
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);
}
static int acx565akm_panel_init(struct omap_display *display)
{
	struct omap_panel *panel = display->panel;
	struct acx565akm_panel_data *panel_data = display->hw_config.panel_data;
	struct acx565akm_device *md = (struct acx565akm_device*)panel->priv;

	struct backlight_device *bldev;
	int brightness;
	int max_brightness;
	int r;

	dev_dbg(&md->spi->dev, "%s\n", __func__);

	if (!panel_data) {
		dev_err(&md->spi->dev, "no panel data\n");
		return -ENODEV;
	}

	mutex_init(&md->mutex);
	md->display = display;

	if (display->hw_config.panel_enable != NULL)
		display->hw_config.panel_enable(display);
	/*
	 * After reset we have to wait 5 msec before the first
	 * command can be sent.
	 */
	msleep(5);

	md->enabled = panel_enabled(md);	//TianMa display not enabled if no code change

	r = panel_detect(md);
	if (r) {	//TianMa display will come here if no code change
		if (!md->enabled && display->hw_config.panel_disable != NULL)	//panel_disable is a func, means that if it exists
			display->hw_config.panel_disable(display);	//TianMa display will be disable if no code change
		mutex_unlock(&md->mutex);
		return r;
	}

	if (!panel_data->bc_connected) {
		md->has_bc = 0;
		md->has_cabc = 0;
	}

#if 0
	acx565akm_set_mode(display, panel->timings.x_res, panel->timings.y_res,
			  panel->bpp);
#endif

	if (!md->enabled)
		display->hw_config.panel_disable(display);

	bldev = backlight_device_register("acx565akm", &md->spi->dev,
			md, &acx565akm_bl_ops);
	md->bl_dev = bldev;

	if (md->has_cabc) {
		r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
		if (r) {
			dev_err(&bldev->dev, "failed to create sysfs files\n");
			backlight_device_unregister(bldev);
			return r;
		}
		md->cabc_mode = get_hw_cabc_mode(md);
	}

	bldev->props.fb_blank = FB_BLANK_UNBLANK;
	bldev->props.power = FB_BLANK_UNBLANK;

	if (md->has_bc)
		max_brightness = 255;
	else
		max_brightness = display->hw_config.max_backlight_level;

	if (md->has_bc)
		brightness = acx565akm_get_actual_brightness(md);
	else if (display->hw_config.get_backlight != NULL)
		brightness = display->hw_config.get_backlight(display);
	else
		brightness = 0;

	bldev->props.max_brightness = max_brightness;
	bldev->props.brightness = brightness;
	acx565akm_bl_update_status(bldev);

	return 0;
}
static void __init bahamas_init(void)
{
	int rc;
	char *cid = NULL;

	printk("bahamas_init() revision = 0x%X\n", system_rev);
	printk(KERN_INFO "mfg_mode=%d\n", board_mfg_mode());
	msm_clock_init();
	board_get_cid_tag(&cid);

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

	gpio_request(BAHAMAS_GPIO_CABLE_IN2, "gpio_cable_in2");
	gpio_request(BAHAMAS_GPIO_AUD_EXTMIC_SEL, "gpio_aud_extmic_sel");
	gpio_request(BAHAMAS_GPIO_WFM_ANT_SW, "gpio_wfm_ant_sw");

	msm_hw_reset_hook = bahamas_reset;

	msm_acpu_clock_init(&bahamas_clock_data);
#if defined(CONFIG_PERFLOCK)
	perflock_init(&bahamas_perflock_data);
#endif

#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(BAHAMAS_GPIO_UART3_RX));
#endif

	msm_add_devices();

#if defined(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);
#if defined(CONFIG_USB_FUNCTION)
	msm_register_usb_phy_init_seq(bahamas_phy_init_seq);
	msm_add_usb_devices(bahamas_phy_reset, NULL);
#endif

#if defined(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);
#if defined(CONFIG_USB_ANDROID_RNDIS)
	platform_device_register(&rndis_device);
#endif
	platform_device_register(&usb_mass_storage_device);
	platform_device_register(&android_usb_device);
#endif
	if (board_mcp_monodie())
		msm_add_mem_devices(&pmem_setting_monodie);
	else
		msm_add_mem_devices(&pmem_setting_dualdie);

	bahamas_init_h2w_power_gpio();

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

	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;
	}

	msm_device_i2c_init();
	platform_add_devices(devices, ARRAY_SIZE(devices));

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

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

	bahamas_init_keypad();
	bahamas_init_panel();

	msm_init_pmic_vibrator(3000);
}