訊為全能板7寸屏驅動分析

2021-08-09 22:57:17 字數 4813 閱讀 3258

static int __init ft5x0x_ts_init(void)

gpio_direction_output(exynos4_gpl0(2), 1);

s3c_gpio_cfgpin(exynos4_gpl0(2), s3c_gpio_output);

gpio_free(exynos4_gpl0(2));

mdelay(5);

#endif

#if1

printk("==%s: reset==\n", __function__);//啟動的時候復位觸控晶元

ret = gpio_request(exynos4_gpx0(3), "gpx0_3");

if (ret)

}gpio_direction_output(exynos4_gpx0(3), 0);//復位引腳拉低再拉高

mdelay(200);

gpio_direction_output(exynos4_gpx0(3), 1);

s3c_gpio_cfgpin(exynos4_gpx0(3), s3c_gpio_output);

gpio_free(exynos4_gpx0(3));

msleep(300);

......

......

......

......

....

return i2c_add_driver(&ft5x0x_ts_driver);

}

(2)觸控晶元註冊

static int ft5x0x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)

if (!i2c_check_functionality(client->adapter, i2c_func_i2c))

ts = kzalloc(sizeof(*ts), gfp_kernel);

if (!ts)

pdata = client->dev.platform_data;

if (!pdata)

ts->screen_max_x = pdata->screen_max_x;

ts->screen_max_y = pdata->screen_max_y;

ts->pressure_max = pdata->pressure_max;

ts->gpio_irq = pdata->gpio_irq;

if (ts->gpio_irq !=

-einval) else

if (pdata->irq_cfg)

ts->gpio_wakeup = pdata->gpio_wakeup;

ts->gpio_reset = pdata->gpio_reset;

init_work(&ts->work, ft5x0x_ts_pen_irq_work);//註冊中斷處理佇列程式,用於中斷後段處理:ft5x0x_ts_pen_irq_work

this_client = client;

i2c_set_clientdata(client, ts);

/*建立工作佇列執行緒,用於檢測觸控訊號*/

ts->

queue

= create_singlethread_workqueue(dev_name(&client->dev));

if (!ts->

queue)

/*分配輸入裝置*/

input_dev = input_allocate_device();

if (!input_dev)

ts->input_dev = input_dev;

/*設定輸入裝置模式*/

set_bit(ev_syn, input_dev->evbit);

set_bit(ev_abs, input_dev->evbit);

set_bit(ev_key, input_dev->evbit);

#ifdef config_ft5x0x_multitouch

set_bit(abs_mt_tracking_id, input_dev->absbit);

set_bit(abs_mt_touch_major, input_dev->absbit);

set_bit(abs_mt_width_major, input_dev->absbit);

set_bit(abs_mt_position_x, input_dev->absbit);

set_bit(abs_mt_position_y, input_dev->absbit);

/*繫結輸入裝置引數*/

input_set_abs_params(input_dev, abs_mt_position_x, 0, ts->screen_max_x, 0, 0);

input_set_abs_params(input_dev, abs_mt_position_y, 0, ts->screen_max_y, 0, 0);

input_set_abs_params(input_dev, abs_mt_touch_major, 0, ts->pressure_max, 0, 0);

input_set_abs_params(input_dev, abs_mt_width_major, 0, 200, 0, 0);

input_set_abs_params(input_dev, abs_mt_tracking_id, 0, ft5x0x_pt_max, 0, 0);

#else

set_bit(abs_x, input_dev->absbit);

set_bit(abs_y, input_dev->absbit);

set_bit(abs_pressure, input_dev->absbit);

set_bit(btn_touch, input_dev->keybit);

input_set_abs_params(input_dev, abs_x, 0, ts->screen_max_x, 0, 0);

input_set_abs_params(input_dev, abs_y, 0, ts->screen_max_y, 0, 0);

input_set_abs_params(input_dev, abs_pressure, 0, ts->pressure_max, 0 , 0);

#endif

input_dev->name = ft5x0x_name;

input_dev->id.bustype = bus_i2c;

input_dev->id.vendor =

0x12fa;

input_dev->id.product =

0x2143;

input_dev->id.version =

0x0100;

/*註冊輸入裝置*/

err = input_register_device(input_dev);

if (err)

msleep(3);

err = ft5x0x_read_fw_ver(&val);

if (err <

0) /*申請i2c的中斷資源*/

err = request_irq(client->irq, ft5x0x_ts_interrupt,

irq_type_edge_falling /*irqf_trigger_falling*/, "ft5x0x_ts", ts);

if (err <

0) disable_irq(client->irq);

dev_info(&client->dev, "firmware version 0x%02x\n", val);//讀取觸控晶元的韌體版本號

#ifdef config_has_earlysuspend

ts->early_suspend.level = early_suspend_level_blank_screen;//early_suspend_level_disable_fb + 1;

ts->early_suspend.suspend = ft5x0x_ts_suspend;

ts->early_suspend.resume = ft5x0x_ts_resume;

register_early_suspend(&ts->early_suspend);

#endif

enable_irq(client->irq);

//cym 4412_set_ctp(ctp_ft5x06);

dev_info(&client->dev, "focaltech ft5x0x touchscreen initialized\n");

return

0;exit_irq_request_failed:

input_unregister_device(input_dev);

exit_input_dev_alloc_failed:

cancel_work_sync(&ts->work);

destroy_workqueue(ts->

queue);

exit_create_singlethread:

i2c_set_clientdata(client, null);

exit_no_pdata:

kfree(ts);

exit_alloc_data_failed:

exit_check_functionality_failed:

dev_err(&client->dev, "probe ft5x0x touchscreen failed, %d\n", err);

return err;

}

訊為開發板 TFTP和NFS搭建

scp k4b4g,則記憶體 大小是 k4b4gx4 2g 搭建tftp伺服器 在ubnutu cd var tftpboot 有乙個可執行檔案test 開發板ping不通ubnutu怎麼辦?1 關掉無線網絡卡,開啟有線網絡卡 2 在同乙個網段 開發板的securecrt,退出 ctrl c shi...

訊為4412 arm9開發板學習日誌 裝環境

配置清單 在筆者裝環境之前,先將筆者的開發板配置總結一下 scp 1g封裝 4.3寸電阻屏 rgb lcd 沒有wifi模組 不打算用這個 win10環境,顯寸8g 玩arm絕對夠用 pc環境安裝 參考配套教程,windows下安裝如下工具 目前不用tf卡 筆者也沒有買 編譯工具安裝 筆者是c 程式...