当前位置: 首页>>代码示例>>C++>>正文


C++ register_early_suspend函数代码示例

本文整理汇总了C++中register_early_suspend函数的典型用法代码示例。如果您正苦于以下问题:C++ register_early_suspend函数的具体用法?C++ register_early_suspend怎么用?C++ register_early_suspend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了register_early_suspend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sec_keyboard_probe

static int __devinit sec_keyboard_probe(struct platform_device *pdev)
{
	struct sec_keyboard_platform_data *pdata = pdev->dev.platform_data;
	struct sec_keyboard_drvdata *ddata;
	struct input_dev *input;
	int i, error;

	if (pdata == NULL) {
		printk(KERN_ERR "%s: no pdata\n", __func__);
		return -ENODEV;
	}

	ddata = kzalloc(sizeof(struct sec_keyboard_drvdata), GFP_KERNEL);
	if (NULL == ddata) {
		error = -ENOMEM;
		goto err_free_mem;
	}

	input = input_allocate_device();
	if (NULL == input) {
		printk(KERN_ERR "[Keyboard] failed to allocate input device.\n");
		error = -ENOMEM;
		goto err_free_mem;
	}

	ddata->input_dev = input;
	ddata->acc_power = pdata->acc_power;
	ddata->check_uart_path = pdata->check_uart_path;
	ddata->acc_int_gpio = pdata->accessory_irq_gpio;
	ddata->led_on = false;
	ddata->dockconnected = false;
	ddata->pre_connected = false;
	ddata->remap_key = 0;
	ddata->kl = UNKOWN_KEYLAYOUT;
	ddata->callbacks.check_keyboard_dock = check_keyboard_dock;
	if (pdata->register_cb)
		pdata->register_cb(&ddata->callbacks);
	ddata->noti_univ_kbd_dock = pdata->noti_univ_kbd_dock;

	memcpy(ddata->keycode, sec_keycodes, sizeof(sec_keycodes));

	INIT_DELAYED_WORK(&ddata->remap_dwork, sec_keyboard_remapkey);
	INIT_DELAYED_WORK(&ddata->power_dwork, sec_keyboard_power);
	INIT_DELAYED_WORK(&ddata->ack_dwork, sec_keyboard_ack);

	platform_set_drvdata(pdev, ddata);
	input_set_drvdata(input, ddata);

	input->name = pdev->name;
	input->dev.parent = &pdev->dev;
	input->id.bustype = BUS_RS232;
	input->event = sec_keyboard_event;

	__set_bit(EV_KEY, input->evbit);
	__set_bit(EV_LED, input->evbit);
	__set_bit(LED_CAPSL, input->ledbit);
	/* framework doesn't use repeat event */
	/* __set_bit(EV_REP, input->evbit); */

	for (i = 0; i < KEYBOARD_SIZE; i++) {
		if (KEY_RESERVED != ddata->keycode[i])
			input_set_capability(input, EV_KEY, ddata->keycode[i]);
	}

	/* for the UK keyboard */
	input_set_capability(input, EV_KEY, KEY_NUMERIC_POUND);

	/* for the remaped keys */
	input_set_capability(input, EV_KEY, KEY_NEXTSONG);
	input_set_capability(input, EV_KEY, KEY_PREVIOUSSONG);

	/* for the wakeup key */
	input_set_capability(input, EV_KEY, KEY_WAKEUP);

	error = input_register_device(input);
	if (error < 0) {
		printk(KERN_ERR "[Keyboard] failed to register input device.\n");
		error = -ENOMEM;
		goto err_input_allocate_device;
	}

	ddata->serio_driver.driver.name = pdev->name;
	ddata->serio_driver.id_table = sec_serio_ids;
	ddata->serio_driver.interrupt = sec_keyboard_interrupt,
	ddata->serio_driver.connect = sec_keyboard_connect,
	ddata->serio_driver.disconnect = sec_keyboard_disconnect,

	error = serio_register_driver(&ddata->serio_driver);
	if (error < 0) {
		printk(KERN_ERR "[Keyboard] failed to register serio\n");
		error = -ENOMEM;
		goto err_reg_serio;
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	ddata->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	ddata->early_suspend.suspend = keyboard_early_suspend;
	ddata->early_suspend.resume = keyboard_late_resume;
	register_early_suspend(&ddata->early_suspend);
#endif	/* CONFIG_HAS_EARLYSUSPEND */
//.........这里部分代码省略.........
开发者ID:android-armv7a-belalang-tempur,项目名称:android_kernel_samsung_smdk4210-1,代码行数:101,代码来源:sec_keyboard.c

示例2: dock_keyboard_probe

static int __devinit dock_keyboard_probe(struct platform_device *pdev)
{
	struct dock_keyboard_platform_data *pdata = pdev->dev.platform_data;
	struct dock_keyboard_data *data;
	struct input_dev *input;
	int i;
	int ret;

	pr_debug("kbd: probe\n");

	data = kzalloc(sizeof(struct dock_keyboard_data), GFP_KERNEL);
	if (unlikely(IS_ERR(data))) {
		ret = -ENOMEM;
		goto err_alloc_mem;
	}

	sec_dock_kbd_driver.private_data = data;

	INIT_WORK(&data->work_msg, key_event_work);
	platform_set_drvdata(pdev, data);

	input = input_allocate_device();
	if (unlikely(IS_ERR(input))) {
		pr_err("kbd: failed to allocate input device.\n");
		ret = -ENOMEM;
		goto err_alloc_input_dev;
	}

	data->input_dev = input;
	input_set_drvdata(data->input_dev, data);
	data->kl = UNKNOWN_KEYLAYOUT;

	input->name = pdev->name;
	input->dev.parent = &pdev->dev;
	input->id.bustype = BUS_RS232;
	input->event = dock_keyboard_event;

	set_bit(EV_SYN, input->evbit);
	set_bit(EV_KEY, input->evbit);
	set_bit(EV_LED, input->evbit);
	set_bit(LED_CAPSL, input->ledbit);

	for (i = 0; i < KEYBOARD_SIZE; i++) {
		if (KEY_RESERVED != dock_keycodes[i].keycode) {
			input_set_capability(input, EV_KEY,
					     dock_keycodes[i].keycode);
		}
	}

	/* for the UK keyboard */
	input_set_capability(input, EV_KEY, KEY_NUMERIC_POUND);

	/* for the remaped keys */
	input_set_capability(input, EV_KEY, KEY_NEXTSONG);
	input_set_capability(input, EV_KEY, KEY_PREVIOUSSONG);

	ret = input_register_device(data->input_dev);
	if (unlikely(ret)) {
		pr_err("kbd: failed to register input device.\n");
		goto err_reg_input_dev;
	}

	data->dock_irq_gpio = pdata->dock_irq_gpio;
	data->power = pdata->power;

	if (pdata->register_cb)
		pdata->register_cb(input, dock_keyboard_cb);

#ifdef CONFIG_HAS_EARLYSUSPEND
	data->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	data->early_suspend.suspend = dock_keyboard_early_suspend;
	data->early_suspend.resume = dock_keyboard_late_resume;
	register_early_suspend(&data->early_suspend);
#endif /* CONFIG_HAS_EARLYSUSPEND */

	init_timer(&data->key_timer);
	data->key_timer.data = (unsigned long)data;
	data->key_timer.expires = jiffies + HZ / 3;
	data->key_timer.function = remapkey_timer;

	init_timer(&data->off_timer);
	data->off_timer.data = (unsigned long)data;
	data->off_timer.expires = jiffies + HZ * 2 / 3;
	data->off_timer.function = power_off_timer;

	ret = serio_register_driver(&sec_dock_kbd_driver.serio_drv);
	if (unlikely(ret)) {
		pr_err("kbd: failed to register serio driver!\n");
		goto err_reg_serio_drv;
	}

	return 0;

err_reg_serio_drv:
#ifdef CONFIG_HAS_EARLYSUSPEND
	unregister_early_suspend(&data->early_suspend);
#endif
	if (pdata->register_cb)
		pdata->register_cb(NULL, NULL);
	input_unregister_device(input);
//.........这里部分代码省略.........
开发者ID:nickh186,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:101,代码来源:sec_dock_keyboard.c

示例3: cyttsp4_btn_probe

static int cyttsp4_btn_probe(struct cyttsp4_device *ttsp)
{
	struct cyttsp4_btn_data *bd;
	struct device *dev = &ttsp->dev;
	struct cyttsp4_btn_platform_data *pdata = dev_get_platdata(dev);
	int rc = 0;

	dev_info(dev, "%s\n", __func__);
	dev_dbg(dev, "%s: debug on\n", __func__);
	dev_vdbg(dev, "%s: verbose debug on\n", __func__);

/*Increase the judgment conditions*/
	if (pdata == NULL) {
		dev_err(dev, "%s: Missing platform data\n", __func__);
		rc = -ENODEV;
		goto error_no_pdata;
	}
	bd = kzalloc(sizeof(*bd), GFP_KERNEL);
	if (bd == NULL) {
		dev_err(dev, "%s: Error, kzalloc\n", __func__);
		rc = -ENOMEM;
		goto error_alloc_data_failed;
	}

	mutex_init(&bd->report_lock);
	bd->ttsp = ttsp;
	bd->pdata = pdata;
	dev_set_drvdata(dev, bd);
	/* Create the input device and register it. */
	dev_vdbg(dev, "%s: Create the input device and register it\n",
		__func__);
	bd->input = input_allocate_device();
	if (bd->input == NULL) {
		dev_err(dev, "%s: Error, failed to allocate input device\n",
			__func__);
		rc = -ENOSYS;
		goto error_alloc_failed;
	}

	bd->input->name = ttsp->name;
	scnprintf(bd->phys, sizeof(bd->phys)-1, "%s", dev_name(dev));
	bd->input->phys = bd->phys;
	bd->input->dev.parent = &bd->ttsp->dev;
	bd->input->open = cyttsp4_btn_open;
	bd->input->close = cyttsp4_btn_close;
	input_set_drvdata(bd->input, bd);

	pm_runtime_enable(dev);

	/* get sysinfo */
	bd->si = cyttsp4_request_sysinfo(ttsp);
	if (bd->si) {
		rc = cyttsp4_setup_input_device(ttsp);
		if (rc)
			goto error_init_input;
	} else {
		dev_err(dev, "%s: Fail get sysinfo pointer from core p=%p\n",
			__func__, bd->si);
		cyttsp4_subscribe_attention(ttsp, CY_ATTEN_STARTUP,
			cyttsp4_setup_input_attention, 0);
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	bd->es.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	bd->es.suspend = cyttsp4_btn_early_suspend;
	bd->es.resume = cyttsp4_btn_late_resume;
	register_early_suspend(&bd->es);
#endif

	dev_dbg(dev, "%s: ok\n", __func__);
	return 0;

error_init_input:
	pm_runtime_suspend(dev);
	pm_runtime_disable(dev);
	input_free_device(bd->input);
error_alloc_failed:
	dev_set_drvdata(dev, NULL);
	kfree(bd);
error_alloc_data_failed:
error_no_pdata:
	dev_err(dev, "%s failed.\n", __func__);
	return rc;
}
开发者ID:XePeleato,项目名称:android_kernel_huawei_venus,代码行数:84,代码来源:cyttsp4_btn.c

示例4: adxl34x_i2c_probe

static int __devinit adxl34x_i2c_probe(struct i2c_client *client,
				       const struct i2c_device_id *id)
{
	struct adxl34x *ac;
	int error = -1;
	struct adxl34x_platform_data *devpd = client->dev.platform_data;

	if (!devpd) {
		dev_err(&client->dev, "No platfrom data: Using default initialization\n");
		error = -EINVAL;
		goto get_platdata_error;
	}

	error = i2c_check_functionality(client->adapter,
			I2C_FUNC_SMBUS_BYTE_DATA);
	if (!error) {
		dev_err(&client->dev, "SMBUS Byte Data not Supported %d\n", error);
		goto i2c_detect_error;
	}

	ac = kzalloc(sizeof(struct adxl34x), GFP_KERNEL);
	if (NULL == ac) {
		dev_err(&client->dev, "alloc adxl34x failed\n");
		error = -ENOMEM;
		goto alloc_mem_error;
	}

	i2c_set_clientdata(client, ac);
	ac->bus = client;

	if (i2c_check_functionality(client->adapter,
				    I2C_FUNC_SMBUS_READ_I2C_BLOCK))
		ac->read_block = adxl34x_i2c_smbus_read_block_data;
	else
		ac->read_block = adxl34x_i2c_master_read_block_data;

	ac->read = adxl34x_i2c_smbus_read;
	ac->write = adxl34x_i2c_smbus_write;

	error = adxl34x_initialize(client, ac);
	if (error) {
		dev_err(&client->dev, "initialize failed %d.\n", error);
		goto init_error;
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	ac->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	ac->early_suspend.suspend = adxl34x_early_suspend;
	ac->early_suspend.resume = adxl34x_late_resume;
	register_early_suspend(&ac->early_suspend);
#endif

	return 0;

init_error:
	i2c_set_clientdata(client, NULL);
	kfree(ac);
	ac = NULL;
alloc_mem_error:
i2c_detect_error:
get_platdata_error:

	return error;
}
开发者ID:yanniks,项目名称:android_kernel_huawei_g615,代码行数:64,代码来源:adxl34x.c

示例5: mma8452_probe

static int __devinit mma8452_probe(struct i2c_client *client,
				   const struct i2c_device_id *id)
{
	int result, client_id;
	struct input_dev *idev;
	struct i2c_adapter *adapter;
	struct mma8452_data *mma;

	const struct mma8452_platform_data *pdata = client->dev.platform_data;
	
	if (!pdata) {
		dev_err(&client->dev, "platform data for layout is NULL; exiting\n");
		return -EINVAL;
	}


	/* Allocate memory for driver data */
	mma = kzalloc(sizeof(struct mma8452_data), GFP_KERNEL);
	if (!mma) {
		printk(KERN_ERR "mma8452_probe: memory allocation failed.\n");
		return -ENOMEM;
	}

	mma8452_i2c_client = client;

	printk(SENSOR_TAG "come into %s\n",__FUNCTION__);
	adapter = to_i2c_adapter(client->dev.parent);
	result = i2c_check_functionality(adapter,
					 I2C_FUNC_SMBUS_BYTE |
					 I2C_FUNC_SMBUS_BYTE_DATA);
	if (!result)
		goto err_out;
	else
		printk(SENSOR_TAG "i2c_check_functionality() was called success\n");

	client_id = i2c_smbus_read_byte_data(client, MMA8452_WHO_AM_I);

	if (client_id != MMA8452_ID && client_id != MMA8452_ID) {
		dev_err(&client->dev,
			"read chip ID 0x%x is not equal to 0x%x or 0x%x!\n",
			result, MMA8452_ID, MMA8452_ID);
    	printk(SENSOR_TAG "I2C read error\n");
		result = -EINVAL;
		goto err_out;
	}else{
		printk(SENSOR_TAG "read chip ID is :0x%x\n",client_id);
	}

	/* Initialize the MMA8452 chip */
	result = mma8452_change_mode(client, senstive_mode);
	if (result) {
		dev_err(&client->dev,
			"error when init mma8452 chip:(%d)\n", result);
		goto err_out;
	}

	hwmon_dev = hwmon_device_register(&client->dev);
	if (!hwmon_dev) {
		result = -ENOMEM;
		dev_err(&client->dev,
			"error when register hwmon device\n");
		goto err_out;
	}

	mma8452_idev = input_allocate_polled_device();
	if (!mma8452_idev) {
		result = -ENOMEM;
		dev_err(&client->dev, "alloc poll device failed!\n");
		goto err_alloc_poll_device;
	}
	mma8452_idev->poll = mma8452_dev_poll;
	mma8452_idev->poll_interval = POLL_INTERVAL;
	mma8452_idev->poll_interval_min = POLL_INTERVAL_MIN;
	mma8452_idev->poll_interval_max = POLL_INTERVAL_MAX;
	idev = mma8452_idev->input;
	if (client_id == MMA8452_ID)
		idev->name = "mma8452";
	else
		idev->name = "mma8452";
	idev->id.bustype = BUS_I2C;
	idev->evbit[0] = BIT_MASK(EV_ABS);

	input_set_abs_params(idev, ABS_X, -8192, 8191, INPUT_FUZZ, INPUT_FLAT);
	input_set_abs_params(idev, ABS_Y, -8192, 8191, INPUT_FUZZ, INPUT_FLAT);
	input_set_abs_params(idev, ABS_Z, -8192, 8191, INPUT_FUZZ, INPUT_FLAT);

	result = input_register_polled_device(mma8452_idev);
	if (result) {
		dev_err(&client->dev, "register poll device failed!\n");
		goto err_register_polled_device;
	}

	mma->mma_early_suspend.suspend = mma8452_early_suspend;
	mma->mma_early_suspend.resume = mma8452_early_resume;
	register_early_suspend(&mma->mma_early_suspend);
	
    result = sysfs_create_group(&idev->dev.kobj, &mma8452_attr_group);
	if (result) {
		dev_err(&client->dev, "create device file failed!\n");
		result = -EINVAL;
//.........这里部分代码省略.........
开发者ID:Dm47021,项目名称:Android_kernel_zte_arthur_308,代码行数:101,代码来源:mxc_mma8452.c

示例6: yas_probe

static int yas_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{
    struct yas_state *st;
    struct iio_dev *indio_dev;
    int ret, i;
    s8 *bias;
    struct yas_acc_platform_data *pdata;

    I("%s\n", __func__);

    this_client = i2c;
    indio_dev = iio_device_alloc(sizeof(*st));
    if (!indio_dev) {
        ret = -ENOMEM;
        goto error_ret;
    }
    i2c_set_clientdata(i2c, indio_dev);

    indio_dev->name = id->name;
    indio_dev->dev.parent = &i2c->dev;
    indio_dev->info = &yas_info;
    indio_dev->channels = yas_channels;
    indio_dev->num_channels = ARRAY_SIZE(yas_channels);
    indio_dev->modes = INDIO_DIRECT_MODE;

    st = iio_priv(indio_dev);
    st->client = i2c;
    st->sampling_frequency = 20;
    st->acc.callback.device_open = yas_device_open;
    st->acc.callback.device_close = yas_device_close;
    st->acc.callback.device_read = yas_device_read;
    st->acc.callback.device_write = yas_device_write;
    st->acc.callback.usleep = yas_usleep;
    st->acc.callback.current_time = yas_current_time;
    st->indio_dev = indio_dev;
    INIT_DELAYED_WORK(&st->work, yas_work_func);
    mutex_init(&st->lock);
#ifdef CONFIG_HAS_EARLYSUSPEND
    st->sus.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
    st->sus.suspend = yas_early_suspend;
    st->sus.resume = yas_late_resume;
    register_early_suspend(&st->sus);
#endif
    ret = yas_probe_buffer(indio_dev);
    if (ret)
        goto error_free_dev;
    ret = yas_probe_trigger(indio_dev);
    if (ret)
        goto error_remove_buffer;
    ret = iio_device_register(indio_dev);
    if (ret)
        goto error_remove_trigger;
    ret = yas_acc_driver_init(&st->acc);
    if (ret < 0) {
        ret = -EFAULT;
        goto error_unregister_iio;
    }
    ret = st->acc.init();
    if (ret < 0) {
        ret = -EFAULT;
        goto error_unregister_iio;
    }
    ret = st->acc.set_enable(1);
    if (ret < 0) {
        ret = -EFAULT;
        goto error_driver_term;
    }

    pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
    if (pdata == NULL)
        E("%s: memory allocation for pdata failed.", __func__);
    else
        yas_parse_dt(&i2c->dev , pdata);

    for (i = 0; i < 3; i++) {
        st->accel_data[i] = 0;
        bias = (s8 *)&pdata->gs_kvalue;
        st->calib_bias[i] = -(bias[2-i] *
                              YAS_GRAVITY_EARTH / 256);
        I("%s: calib_bias[%d] = %d\n", __func__, i, st->calib_bias[i]);
    }

    mutex_lock(&st->lock);
    if ((pdata->placement < 8) && (pdata->placement >= 0)) {
        ret = st->acc.set_position(pdata->placement);
        I("%s: set position = %d\n", __func__, pdata->placement);
    } else {
        ret = st->acc.set_position(5);
        D("%s: set default position = 5\n", __func__);
    }
    mutex_unlock(&st->lock);

#ifdef CONFIG_CIR_ALWAYS_READY
    module.IRQ = i2c->irq;
    I("%s: IRQ = %d\n", __func__, module.IRQ);
    ret = request_irq(module.IRQ, kxtj2_irq_handler, IRQF_TRIGGER_RISING,
                      "kxtj2", &module);
    enable_irq_wake(module.IRQ);
    if (ret)
        E("%s: Could not request irq = %d\n", __func__, module.IRQ);
//.........这里部分代码省略.........
开发者ID:qtekfun,项目名称:kernel_htc_msm8939,代码行数:101,代码来源:kxtj2.c

示例7: ofn_input_dev_open

static int ofn_input_dev_open(struct input_dev *dev)
{
	int  rc = 0;
	struct avago_ofn_data  *dd = input_get_drvdata(dev);
	uint8_t            buf[2];
	uint8_t delta_xy_buf[2] = {23, 23}; 
	uint8_t motion = 23;
       static int open_time = 0;

       open_time++;
       if (open_time > 1)
       {
           return 0; // only open one time
       }
       
	if (!dd) {
		rc = -ENOMEM;
		goto dev_open_exit;
	}
    
#if 1
	printk("chenjun: ofn_input_dev_open: SHUTDOWN = %d\n", gpio_get_value(GPIO_OFN_SHUTDOWN));
	printk("chenjun: ofn_input_dev_open: RESET = %d\n", gpio_get_value(GPIO_OFN_RESET));

#if 0	
	gpio_direction_output(GPIO_OFN_SHUTDOWN, 1);
	gpio_direction_output(GPIO_OFN_RESET, 1);
       mdelay(803); // Minimum: 500ms

       gpio_direction_output(GPIO_OFN_RESET, 1);
#endif

	
	
#if 0
	rc = gpio_direction_input(GPIO_OFN_MOTION);
	if (rc) {
		goto dev_open_exit;
	}
	rc = request_irq(GPIO_OFN_MOTION_INT, &ofn_interrupt,
		                   IRQF_TRIGGER_FALLING, "ofn", 0); 
	if (rc) {

		goto dev_open_exit;
	}
#endif
#if 1
	gpio_direction_output(GPIO_OFN_SHUTDOWN, 0);
	gpio_direction_output(GPIO_OFN_RESET, 0);
       udelay(23); // 39 // Minimum: 20us
	gpio_direction_output(GPIO_OFN_RESET, 1);

       mdelay(100); // 203 // Minimum: 100ms
#endif

#if 0
	init_timer(&ofn_next_key_timer);
	ofn_next_key_timer.function = ofn_next_key_timer_callback;
	ofn_next_key_timer.data = 0;
#endif
	rc = ofn_config(dd);
     if (rc!=0)
	 goto	ofn_config_fail;

#if 1
	rc = gpio_direction_input(GPIO_OFN_MOTION);
	if (rc) {
		goto dev_open_exit;
	}
	rc = request_irq(GPIO_OFN_MOTION_INT, &ofn_interrupt,
		                   IRQF_TRIGGER_FALLING, "ofn", 0); 
	if (rc) {
		goto dev_open_exit;
	}
#endif
#if 1
//
        rc = ofn_i2c_read(dd->clientp, 0x02, &motion, 1);
        rc = ofn_i2c_read(dd->clientp, OFN_REG_DELTA_X, &delta_xy_buf[0], 1);
        rc = ofn_i2c_read(dd->clientp, OFN_REG_DELTA_Y, &delta_xy_buf[1], 1);
//

    rc = ofn_i2c_read(dd->clientp, OFN_REG_PRODUCT_ID, buf, 1);
    if (rc)
	goto ofn_config_fail;

#endif

#ifdef CONFIG_HAS_EARLYSUSPEND

	dd->early_suspend.level = 52;
	dd->early_suspend.suspend = ofn_early_suspend;
	dd->early_suspend.resume = ofn_late_resume;
	register_early_suspend(&dd->early_suspend);
#endif

	return 0;


ofn_config_fail:
//.........这里部分代码省略.........
开发者ID:Victor-android,项目名称:kernel_zte_raise_mod,代码行数:101,代码来源:avago_ofn.c

示例8: acer_panel_init

int __init acer_panel_init(void)
{
	int err;
	struct resource *res;

	tegra_get_board_info(&board_info);

	acer_carveouts[1].base = tegra_carveout_start;
	acer_carveouts[1].size = tegra_carveout_size;

	tegra_gpio_enable(LVDS_SHUTDOWN);
	tegra_gpio_enable(LCD_VDD);
	tegra_gpio_enable(LCD_CABC);
	tegra_gpio_enable(BL_ENABLE);
#if defined(CONFIG_TEGRA_HDMI)
	tegra_gpio_enable(HDMI_HPD);
#endif
	gpio_request(LVDS_SHUTDOWN, "lvds_shutdown");
	gpio_request(LCD_VDD, "lcd_vdd");
	gpio_request(LCD_CABC, "lcd_cabc");
	gpio_request(BL_ENABLE, "bl_enable");
#if defined(CONFIG_TEGRA_HDMI)
	gpio_request(HDMI_HPD, "hdmi_hpd");
#endif

	gpio_direction_output(LVDS_SHUTDOWN,1);
	gpio_direction_output(LCD_VDD, 1);
	gpio_direction_output(LCD_CABC,0);
	gpio_direction_output(BL_ENABLE,1);

#if defined(CONFIG_TEGRA_HDMI)
	tegra_gpio_enable(HDMI_5V);
	err = gpio_request(HDMI_5V, "hdmi_5V_enable");
	if (err) {
		pr_err("[HDMI] request 5V_enable failed\n");
	}
#if HDMI_5V_ALWAYS_ON
	err = gpio_direction_output(HDMI_5V, 1);
#else
	err = gpio_direction_output(HDMI_5V, 0);
#endif
	if (err) {
		pr_err("[HDMI] failed to set direction of hdmi_5V_enable\n");
	}
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
	acer_panel_early_suspender.suspend = acer_panel_early_suspend;
	acer_panel_early_suspender.resume = acer_panel_late_resume;
	acer_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&acer_panel_early_suspender);
#endif

	err = platform_add_devices(acer_gfx_devices,
			ARRAY_SIZE(acer_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if ((acer_board_type == BOARD_PICASSO_M) || (acer_board_type == BOARD_PICASSO_E2)) {
		res = nvhost_get_resource_byname(&acer_pm_disp1_device,
				IORESOURCE_MEM, "fbmem");
	}else{
		res = nvhost_get_resource_byname(&acer_p2_disp1_device,
				IORESOURCE_MEM, "fbmem");
	}
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if(!err){
		if ((acer_board_type == BOARD_PICASSO_M) || (acer_board_type == BOARD_PICASSO_E2)) {
			err = nvhost_device_register(&acer_pm_disp1_device);
		}else{
			err = nvhost_device_register(&acer_p2_disp1_device);
		}
	}
#if defined(CONFIG_TEGRA_HDMI)
	res = nvhost_get_resource_byname(&acer_disp2_device,
				IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&acer_disp2_device);
#endif
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif
	return err;
}
开发者ID:St3v3Ha11,项目名称:android_kernel_acer_t30,代码行数:96,代码来源:board-acer-t30-panel.c

示例9: rt9396_probe

static int rt9396_probe(struct i2c_client *i2c_dev, const struct i2c_device_id *i2c_dev_id)
{
	struct lge_backlight_platform_data *pdata;
	struct rt9396_driver_data *drvdata;
	struct backlight_device *bd;
	int err;

	rt9396_powerstate = NORMAL_STATE;
	dprintk("start, client addr=0x%x\n", i2c_dev->addr);

	pdata = i2c_dev->dev.platform_data;
	if(!pdata)
		return -EINVAL;

	drvdata = kzalloc(sizeof(struct rt9396_driver_data), GFP_KERNEL);
	if (!drvdata) {
		dev_err(&i2c_dev->dev, "failed to allocate memory\n");
		return -ENOMEM;
	}

	if (pdata && pdata->platform_init)
		pdata->platform_init();

	drvdata->client = i2c_dev;
	drvdata->gpio = pdata->gpio;
	drvdata->max_intensity = LCD_LED_MAX;
	if (pdata->max_current > 0)
		drvdata->max_intensity = pdata->max_current;
	drvdata->intensity = LCD_LED_MIN;
	drvdata->mode = NORMAL_MODE;
	drvdata->state = UNINIT_STATE;
	drvdata->version = pdata->version;

	if(rt9396_setup_version(drvdata) != 0) {
		eprintk("Error while requesting gpio %d\n", drvdata->gpio);
		kfree(drvdata);
		return -ENODEV;
	}

	if (drvdata->gpio && gpio_request(drvdata->gpio, "rt9396_en") != 0) {
		eprintk("Error while requesting gpio %d\n", drvdata->gpio);
		kfree(drvdata);
		return -ENODEV;
	}
	gpio_tlmm_config(GPIO_CFG(drvdata->gpio, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);

	bd = backlight_device_register("rt9396-bl", &i2c_dev->dev, NULL, &rt9396_ops, NULL);
	if (bd == NULL) {
		eprintk("entering rt9396 probe function error \n");
		kfree(drvdata);
		return -1;
	}
	bd->props.power = FB_BLANK_UNBLANK;
	bd->props.brightness = drvdata->intensity;
	bd->props.max_brightness = drvdata->max_intensity;
	drvdata->bd = bd;

	if (led_classdev_register(&i2c_dev->dev, &rt9396_led_dev) == 0) {
		eprintk("Registering led class dev successfully.\n");
		drvdata->led = &rt9396_led_dev;
		err = device_create_file(drvdata->led->dev, &dev_attr_alc);
		err = device_create_file(drvdata->led->dev, &dev_attr_reg);
		err = device_create_file(drvdata->led->dev, &dev_attr_drvstat);
		err = device_create_file(drvdata->led->dev, &dev_attr_chargerlogo);
	}
// [Caio99BR][[email protected]] Workaround for bug of screen still awake after lock
#ifndef CONFIG_MACH_LGE_2ND_GEN_KK_WORKAROUD
	if (led_classdev_register(&i2c_dev->dev, &rt9396_keyled_dev) == 0) {
		eprintk("Registering led class dev successfully.\n");
		drvdata->led = &rt9396_keyled_dev;
	}
#endif

	i2c_set_clientdata(i2c_dev, drvdata);
	i2c_set_adapdata(i2c_dev->adapter, i2c_dev);

	rt9396_device_init(drvdata);
	rt9396_send_intensity(drvdata, RT9396BL_DEFAULT_BRIGHTNESS);

#ifdef CONFIG_HAS_EARLYSUSPEND
	drvdata->early_suspend.suspend = rt9396_early_suspend;
	drvdata->early_suspend.resume = rt9396_late_resume;
	drvdata->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 40;
	register_early_suspend(&drvdata->early_suspend);
#endif

	rt9396_ref = drvdata;

	eprintk("done\n");
	return 0;
}
开发者ID:RolanDroid,项目名称:lge_MonsterKernel-lproj,代码行数:91,代码来源:rt9396_bl.c

示例10: cm3217_probe

static int cm3217_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
    struct cm3217_data *cm3217;
    struct cm3217_platform_data *pdata = pdata = client->dev.platform_data;
    char com1 = CM3217_COM1_VALUE, com2 = CM3217_COM2_VALUE;
    int err;

    if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
    {
        dev_err(&client->dev, "Must have I2C_FUNC_I2C.\n");
        err = -ENODEV;
        goto alloc_memory_fail;
    }

    cm3217 = kmalloc(sizeof(struct cm3217_data), GFP_KERNEL);
    if(!cm3217) {
        printk("cm3217 alloc memory err !!!\n");
        err = -ENOMEM;
        goto alloc_memory_fail;
    }

    if(pdata->init_platform_hw)
        pdata->init_platform_hw();

    cm3217->client = client;
    i2c_set_clientdata(client, cm3217);
    cm3217->power_pin = pdata->power_pin;
    cm3217->irq_pin = pdata->irq_pin;
    cm3217->status = SENSOR_OFF;
    glight = cm3217;

    //init cm3217
    client->addr = CM3217_ADDR_COM1;
    cm3217_command_set(client, &com1, 1);
    client->addr = CM3217_ADDR_COM2;
    cm3217_command_set(client, &com2, 1);

    cm3217->input = input_allocate_device();
    if (!cm3217->input) {
        err = -ENOMEM;
        printk(KERN_ERR"cm3217: Failed to allocate input device\n");
        goto exit_input_allocate_device_failed;
    }
    set_bit(EV_ABS, cm3217->input->evbit);
    /* light sensor data */
    input_set_abs_params(cm3217->input, ABS_MISC, 0, 10, 0, 0);
    cm3217->input->name = "lightsensor-level";

    err = input_register_device(cm3217->input);
    if (err < 0) {
        printk(KERN_ERR"cm3217: Unable to register input device: %s\n",cm3217->input->name);
        goto exit_input_register_device_failed;
    }
    /*
    	if(cm3217->power_pin != INVALID_GPIO)
    	{
    		gpio_request(cm3217->power_pin, "cm3217_power_pin");
    		gpio_pull_updown(cm3217->power_pin,PullDisable);
    	}
    */
    INIT_WORK(&cm3217->timer_work, adc_timer_work);
    setup_timer(&cm3217->timer, adc_timer, (unsigned long)cm3217);
    err = misc_register(&cm3217_device);
    if (err < 0) {
        printk(KERN_ERR"cm3217_probe: lightsensor_device register failed\n");
        goto exit_misc_register_fail;
    }
    printk("lightsensor cm3217 driver created !\n");
    //cm3217_start(cm3217);
#ifdef CONFIG_HAS_EARLYSUSPEND
    cm3217_early_suspend.suspend = cm3217_suspend;
    cm3217_early_suspend.resume = cm3217_resume;
    cm3217_early_suspend.level = 0x2;
    register_early_suspend(&cm3217_early_suspend);
#endif
    return 0;
exit_misc_register_fail:
    //gpio_free(pdata->power_pin);
    input_unregister_device(cm3217->input);
exit_input_register_device_failed:
    input_free_device(cm3217->input);
exit_input_allocate_device_failed:
    kfree(cm3217);
alloc_memory_fail:
    printk("%s error\n",__FUNCTION__);
    return err;
}
开发者ID:avila-devlogic,项目名称:D33_KK_Kernel,代码行数:87,代码来源:cm3217.c

示例11: ssp_probe


//.........这里部分代码省略.........
		pr_err("[SSP]: %s - could not create irq\n", __func__);
		goto err_setup_irq;
	}

	iRet = initialize_sysfs(data);
	if (iRet < 0) {
		pr_err("[SSP]: %s - could not create sysfs\n", __func__);
		goto err_sysfs_create;
	}

	iRet = initialize_event_symlink(data);
	if (iRet < 0) {
		pr_err("[SSP]: %s - could not create symlink\n", __func__);
		goto err_symlink_create;
	}

	initialize_variable(data);

	ssp_enable(data, true);
	/* check boot loader binary */
	data->fw_dl_state = check_fwbl(data);

	if (data->fw_dl_state == FW_DL_STATE_NONE) {
		iRet = initialize_mcu(data);
		if (iRet == ERROR) {
			data->uResetCnt++;
			toggle_mcu_reset(data);
			msleep(SSP_SW_RESET_TIME);
			initialize_mcu(data);
		} else if (iRet < ERROR) {
			pr_err("[SSP] %s, initialize_mcu failed\n", __func__);
			goto err_read_reg;
		}
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	data->early_suspend.suspend = ssp_early_suspend;
	data->early_suspend.resume = ssp_late_resume;
	register_early_suspend(&data->early_suspend);
#endif

#ifdef CONFIG_SENSORS_SSP_SENSORHUB
	/* init sensorhub device */
	iRet = ssp_sensorhub_initialize(data);
	if (iRet < 0) {
		pr_err("[SSP] %s, ssp_sensorhub_initialize err(%d)", __func__, iRet);
		ssp_sensorhub_remove(data);
	}
#endif

	data->bMcuDumpMode = ssp_check_sec_dump_mode();
	pr_info("[SSP]: %s - setup debuglevel %d!\n", __func__, data->bMcuDumpMode);

	pr_info("[SSP]: %s - probe success!\n", __func__);

	enable_debug_timer(data);

	if (data->fw_dl_state == FW_DL_STATE_NEED_TO_SCHEDULE) {
		pr_info("[SSP] Firmware update is scheduled\n");
		schedule_delayed_work(&data->work_firmware,
				msecs_to_jiffies(1000));
		data->fw_dl_state = FW_DL_STATE_SCHEDULED;
	} else if (data->fw_dl_state == FW_DL_STATE_FAIL) {
		data->bSspShutdown = true;
	}

	data->bProbeIsDone = true;
	iRet = 0;

	goto exit;

err_read_reg:
err_symlink_create:
	remove_sysfs(data);
err_sysfs_create:
	free_irq(data->iIrq, data);
	gpio_free(data->mcu_int1);
err_setup_irq:
	destroy_workqueue(data->debug_wq);
err_create_workqueue:
	remove_input_dev(data);
err_input_register_device:
	wake_lock_destroy(&data->ssp_wake_lock);
err_reset_null:
#ifdef CONFIG_SENSORS_SSP_STM
	mutex_destroy(&data->comm_mutex);
	mutex_destroy(&data->pending_mutex);
#endif
#ifdef CONFIG_SENSORS_SSP_SHTC1
	mutex_destroy(&data->bulk_temp_read_lock);
	mutex_destroy(&data->cp_temp_adc_lock);
#endif

err_setup:
	kfree(data);
	pr_err("[SSP] %s, probe failed!\n", __func__);
exit:
	pr_info("#####################################################\n\n");
	return iRet;
}
开发者ID:lssjbrolli,项目名称:android_kernel_samsung_klimtlte,代码行数:101,代码来源:ssp_dev.c

示例12: hua_ts_device_probe

int hua_ts_device_probe(struct hua_input_device *dev)
{
	int ret;
	struct hua_ts_device *ts = (struct hua_ts_device *) dev;
	struct hua_input_chip *chip = dev->chip;
	struct hua_input_core *core = chip->core;
	struct input_dev *input = dev->input;
	const struct hua_ts_touch_key *key, *key_end;
	const char *name;

	ret = hua_input_add_kobject(&core->prop_kobj, "board_properties");
	if (ret < 0 && ret != -EEXIST)
	{
		pr_red_info("hua_input_add_kobject");
		return ret;
	}

	name = kasprintf(GFP_KERNEL, "virtualkeys.%s", input->name);
	if (name == NULL)
	{
		ret = -ENOMEM;
		pr_red_info("kasprintf");
		goto out_hua_input_remove_kobject;
	}

	hua_ts_board_properties_attr.attr.name = name;

	ret = hua_input_create_sysfs_files(dev, &core->prop_kobj, &hua_ts_board_properties_attr, 1);
	if (ret < 0)
	{
		pr_red_info("hua_input_add_kobject");
		goto out_kfree_name;
	}

	ret = sysfs_create_files(&dev->misc_dev.dev->kobj, hua_ts_device_attributes);
	if (ret < 0)
	{
		pr_red_info("sysfs_create_files");
		goto out_hua_input_remove_sysfs_files;
	}

#ifdef CONFIG_HAS_EARLYSUSPEND
	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
	ts->early_suspend.suspend = hua_ts_suspend;
	ts->early_suspend.resume = hua_ts_resume;
	register_early_suspend(&ts->early_suspend);
#elif defined(CONFIG_FB) && defined(CONFIG_HUAMOBILE_USE_FB_NOTIFILER)
	ts->fb_notifier.notifier_call = hua_ts_fb_notifier_call;
	ret = fb_register_client(&ts->fb_notifier);
	if (ret < 0)
	{
		pr_red_info("fb_register_client");
	}
#else
	ts->pm_notifier.notifier_call = hua_ts_pm_notifier_call;
	ret = register_pm_notifier(&ts->pm_notifier);
	if (ret < 0)
	{
		pr_red_info("register_pm_notifier");
	}
#endif

	set_bit(INPUT_PROP_DIRECT, input->propbit);

	set_bit(EV_KEY, input->evbit);
	set_bit(BTN_TOUCH, input->keybit);

	if (ts->keys && ts->key_count)
	{
		for (key = ts->keys, key_end = key + ts->key_count; key < key_end; key++)
		{
			set_bit(key->code, input->keybit);
		}
	}

	set_bit(EV_ABS, input->evbit);
	input_set_abs_params(input, ABS_MT_POSITION_X, ts->xmin, ts->xmax, dev->fuzz, dev->flat);
	input_set_abs_params(input, ABS_MT_POSITION_Y, ts->ymin, ts->ymax, 0, 0);
	input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, ts->point_count - 1, 0, 0);

	input->open = hua_ts_device_open;
	dev->remove = hua_ts_device_remove;

	ts->touch_count = 0;

	pr_green_info("huamobile touch screen %s probe complete", dev->name);

	return 0;

out_hua_input_remove_sysfs_files:
	hua_input_remove_sysfs_files(&core->prop_kobj, &hua_ts_board_properties_attr, 1);
out_kfree_name:
	kfree(name);
out_hua_input_remove_kobject:
	hua_input_remove_kobject(&core->prop_kobj);
	return ret;
}
开发者ID:redspider110,项目名称:cavan,代码行数:97,代码来源:hua_ts_core.c

示例13: htc_headset_mgr_probe

static int htc_headset_mgr_probe(struct platform_device *pdev)
{
	int ret;

	struct htc_headset_mgr_platform_data *pdata = pdev->dev.platform_data;

	HS_LOG("++++++++++++++++++++");

	hi = kzalloc(sizeof(struct htc_headset_mgr_info), GFP_KERNEL);
	if (!hi)
		return -ENOMEM;

	hi->pdata.driver_flag = pdata->driver_flag;
	hi->pdata.headset_devices_num = pdata->headset_devices_num;
	hi->pdata.headset_devices = pdata->headset_devices;
	hi->pdata.headset_config_num = pdata->headset_config_num;
	hi->pdata.headset_config = pdata->headset_config;

	hi->pdata.hptv_det_hp_gpio = pdata->hptv_det_hp_gpio;
	hi->pdata.hptv_det_tv_gpio = pdata->hptv_det_tv_gpio;
	hi->pdata.hptv_sel_gpio = pdata->hptv_sel_gpio;

	hi->pdata.headset_init = pdata->headset_init;
	hi->pdata.headset_power = pdata->headset_power;

	if (hi->pdata.headset_init)
		hi->pdata.headset_init();

	hi->driver_init_seq = 0;

	hi->early_suspend.suspend = htc_headset_mgr_early_suspend;
	hi->early_suspend.resume = htc_headset_mgr_late_resume;
	register_early_suspend(&hi->early_suspend);

	wake_lock_init(&hi->hs_wake_lock, WAKE_LOCK_SUSPEND, DRIVER_NAME);

	hi->hpin_jiffies = jiffies;
	hi->usb_headset.type = USB_NO_HEADSET;
	hi->usb_headset.status = STATUS_DISCONNECTED;

	hi->hs_35mm_type = HEADSET_UNPLUG;
	hi->h2w_35mm_type = HEADSET_UNPLUG;
	hi->is_ext_insert = 0;
	hi->mic_bias_state = 0;
	hi->mic_detect_counter = 0;
	hi->key_level_flag = -1;
	hi->quick_boot_status = 0;

	atomic_set(&hi->btn_state, 0);

	hi->tty_enable_flag = 0;
	hi->fm_flag = 0;
	hi->debug_flag = 0;

	mutex_init(&hi->mutex_lock);

	hi->sdev_h2w.name = "h2w";
	hi->sdev_h2w.print_name = h2w_print_name;

	ret = switch_dev_register(&hi->sdev_h2w);
	if (ret < 0)
		goto err_h2w_switch_dev_register;

	hi->sdev_usb_audio.name = "usb_audio";
	hi->sdev_usb_audio.print_name = usb_audio_print_name;

	ret = switch_dev_register(&hi->sdev_usb_audio);
	if (ret < 0)
		goto err_usb_audio_switch_dev_register;

	detect_wq = create_workqueue("detect");
	if (detect_wq == NULL) {
		ret = -ENOMEM;
		HS_ERR("Failed to create detect workqueue");
		goto err_create_detect_work_queue;
	}

	button_wq = create_workqueue("button");
	if (button_wq  == NULL) {
		ret = -ENOMEM;
		HS_ERR("Failed to create button workqueue");
		goto err_create_button_work_queue;
	}

	hi->input = input_allocate_device();
	if (!hi->input) {
		ret = -ENOMEM;
		goto err_request_input_dev;
	}

	hi->input->name = "h2w headset";
	set_bit(EV_SYN, hi->input->evbit);
	set_bit(EV_KEY, hi->input->evbit);
	set_bit(KEY_END, hi->input->keybit);
	set_bit(KEY_MUTE, hi->input->keybit);
	set_bit(KEY_VOLUMEDOWN, hi->input->keybit);
	set_bit(KEY_VOLUMEUP, hi->input->keybit);
	set_bit(KEY_NEXTSONG, hi->input->keybit);
	set_bit(KEY_PLAYPAUSE, hi->input->keybit);
	set_bit(KEY_PREVIOUSSONG, hi->input->keybit);
//.........这里部分代码省略.........
开发者ID:DooMLoRD,项目名称:HTC-Flyer-HC-Kernel,代码行数:101,代码来源:htc_headset_mgr.c

示例14: grouper_panel_init

int __init grouper_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;
	struct board_info board_info;

	tegra_get_board_info(&board_info);

#if defined(CONFIG_TEGRA_NVMAP)
	grouper_carveouts[1].base = tegra_carveout_start;
	grouper_carveouts[1].size = tegra_carveout_size;
#endif
/*
	gpio_request(grouper_lvds_avdd_en, "lvds_avdd_en");
	gpio_direction_output(grouper_lvds_avdd_en, 1);
	tegra_gpio_enable(grouper_lvds_avdd_en);

	//gpio_request(grouper_lvds_stdby, "lvds_stdby");
	//gpio_direction_output(grouper_lvds_stdby, 1);
	//tegra_gpio_enable(grouper_lvds_stdby);

	gpio_request(grouper_lvds_rst, "lvds_rst");
	gpio_direction_output(grouper_lvds_rst, 1);
	tegra_gpio_enable(grouper_lvds_rst);

	if (board_info.fab == BOARD_FAB_A00) {
		gpio_request(grouper_lvds_rs_a00, "lvds_rs");
		gpio_direction_output(grouper_lvds_rs_a00, 0);
		tegra_gpio_enable(grouper_lvds_rs_a00);
	} else {
		gpio_request(grouper_lvds_rs, "lvds_rs");
		gpio_direction_output(grouper_lvds_rs, 0);
		tegra_gpio_enable(grouper_lvds_rs);
	}

	gpio_request(grouper_lvds_lr, "lvds_lr");
	gpio_direction_output(grouper_lvds_lr, 1);
	tegra_gpio_enable(grouper_lvds_lr);
*/
/*
	gpio_request(grouper_lvds_shutdown, "lvds_shutdown");
	gpio_direction_output(grouper_lvds_shutdown, 1);
	tegra_gpio_enable(grouper_lvds_shutdown);
*/
	tegra_gpio_enable(grouper_hdmi_hpd);
	gpio_request(grouper_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(grouper_hdmi_hpd);

#ifdef CONFIG_HAS_EARLYSUSPEND
	grouper_panel_early_suspender.suspend = grouper_panel_early_suspend;
	grouper_panel_early_suspender.resume = grouper_panel_late_resume;
	grouper_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&grouper_panel_early_suspender);
#endif

#ifdef CONFIG_TEGRA_GRHOST
	err = nvhost_device_register(&tegra_grhost_device);
	if (err)
		return err;
#endif

	err = platform_add_devices(grouper_gfx_devices,
				ARRAY_SIZE(grouper_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = nvhost_get_resource_byname(&grouper_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
//	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
//				min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if (!err)
		err = nvhost_device_register(&grouper_disp1_device);

	res = nvhost_get_resource_byname(&grouper_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&grouper_disp2_device);
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif
	return err;
}
开发者ID:DirtyDroidX,项目名称:oxydo-grouper,代码行数:93,代码来源:board-grouper-panel.c

示例15: s3cfb_probe


//.........这里部分代码省略.........
			goto err1;
		}
		res = request_mem_region(res->start,
					res->end - res->start + 1, pdev->name);
		if (!res) {
			dev_err(fbdev[i]->dev,
				"failed to request io memory region\n");
			ret = -EINVAL;
			goto err1;
		}
		fbdev[i]->regs = ioremap(res->start, res->end - res->start + 1);
		if (!fbdev[i]->regs) {
			dev_err(fbdev[i]->dev, "failed to remap io region\n");
			ret = -EINVAL;
			goto err1;
		}

		fbdev[i]->wq_count = 0;
		init_waitqueue_head(&fbdev[i]->wq);

		/* irq */
		fbdev[i]->irq = platform_get_irq(pdev, 0);
		if (request_irq(fbdev[i]->irq, s3cfb_irq_frame, IRQF_SHARED,
				pdev->name, fbdev[i])) {
			dev_err(fbdev[i]->dev, "request_irq failed\n");
			ret = -EINVAL;
			goto err2;
		}

#ifdef CONFIG_FB_S3C_TRACE_UNDERRUN
		if (request_irq(platform_get_irq(pdev, 1), s3cfb_irq_fifo,
				IRQF_DISABLED, pdev->name, fbdev[i])) {
			dev_err(fbdev[i]->dev, "request_irq failed\n");
			ret = -EINVAL;
			goto err2;
		}

		s3cfb_set_fifo_interrupt(fbdev[i], 1);
		dev_info(fbdev[i]->dev, "fifo underrun trace\n");
#endif
#ifdef CONFIG_FB_S3C_MDNIE
		/* only FIMD0 is supported */
		if (i == 0)
			s3c_mdnie_setup();
#endif
		/* hw setting */
		s3cfb_init_global(fbdev[i]);

		/* alloc fb_info */
		if (s3cfb_alloc_framebuffer(fbdev[i], i)) {
			dev_err(fbdev[i]->dev, "alloc error fimd[%d]\n", i);
			goto err3;
		}

		/* register fb_info */
		if (s3cfb_register_framebuffer(fbdev[i])) {
			dev_err(fbdev[i]->dev, "register error fimd[%d]\n", i);
			goto err3;
		}

		/* enable display */
		s3cfb_set_clock(fbdev[i]);

		/* Set Alpha value width to 8-bit alpha value
		 * 1 : 8bit mode
		 * 2 : 4bit mode
		 */
		s3cfb_set_alpha_value(fbdev[i], 1);

#ifdef CONFIG_FB_S3C_MDNIE
		/* only FIMD0 is supported */
		if (i == 0) {
			reg = readl(S3C_VA_SYS + 0x0210);
			reg &= ~(1<<13);
			reg &= ~(1<<12);
			reg &= ~(3<<10);
			reg |= (1<<0);
			reg &= ~(1<<1);
			writel(reg, S3C_VA_SYS + 0x0210);
			writel(3, fbdev[i]->regs + 0x27c);

			s3c_mdnie_init_global(fbdev[i]);
			s3c_mdnie_start(fbdev[i]);
		}
#endif
		s3cfb_enable_window(fbdev[0], pdata->default_win);
		s3cfb_update_power_state(fbdev[i], pdata->default_win,
					FB_BLANK_UNBLANK);
		s3cfb_display_on(fbdev[i]);

		fbdev[i]->system_state = POWER_ON;
#ifdef CONFIG_HAS_WAKELOCK
#ifdef CONFIG_HAS_EARLYSUSPEND
		fbdev[i]->early_suspend.suspend = s3cfb_early_suspend;
		fbdev[i]->early_suspend.resume = s3cfb_late_resume;
		fbdev[i]->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
		register_early_suspend(&fbdev[i]->early_suspend);
#endif
#endif
	}
开发者ID:FrozenData,项目名称:SGS2-Kernel-Update2,代码行数:101,代码来源:s3cfb_main.c


注:本文中的register_early_suspend函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。