/* * Generic DSI Command Mode panel driver * * Copyright (C) 2013 Texas Instruments * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. *//* #define DEBUG */#include<linux/backlight.h>#include<linux/delay.h>#include<linux/fb.h>#include<linux/gpio.h>#include<linux/interrupt.h>#include<linux/jiffies.h>#include<linux/module.h>#include<linux/platform_device.h>#include<linux/sched.h>#include<linux/slab.h>#include<linux/workqueue.h>#include<video/omapdss.h>#include<video/omap-panel-data.h>#include<video/mipi_display.h>/* DSI Virtual channel. Hardcoded for now. */#define TCH 0#define DCS_READ_NUM_ERRORS 0x05#define DCS_BRIGHTNESS 0x51#define DCS_CTRL_DISPLAY 0x53#define DCS_GET_ID1 0xda#define DCS_GET_ID2 0xdb#define DCS_GET_ID3 0xdcstructpanel_drv_data{structomap_dss_devicedssdev;structomap_dss_device*in;structomap_video_timingstimings;structplatform_device*pdev;structmutexlock;structbacklight_device*bldev;unsignedlonghw_guard_end;/* next value of jiffies when we can * issue the next sleep in/out command */unsignedlonghw_guard_wait;/* max guard time in jiffies *//* panel HW configuration from DT or platform data */intreset_gpio;intext_te_gpio;booluse_dsi_backlight;structomap_dsi_pin_configpin_config;/* runtime variables */boolenabled;boolte_enabled;atomic_tdo_update;intchannel;structdelayed_workte_timeout_work;boolintro_printed;structworkqueue_struct*workqueue;boolulps_enabled;unsignedulps_timeout;structdelayed_workulps_work;};#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)staticirqreturn_tdsicm_te_isr(intirq,void*data);staticvoiddsicm_te_timeout_work_callback(structwork_struct*work);staticint_dsicm_enable_te(structpanel_drv_data*ddata,boolenable);staticintdsicm_panel_reset(structpanel_drv_data*ddata);staticvoiddsicm_ulps_work(structwork_struct*work);staticvoidhw_guard_start(structpanel_drv_data*ddata,intguard_msec){ddata->hw_guard_wait=msecs_to_jiffies(guard_msec);ddata->hw_guard_end=jiffies+ddata->hw_guard_wait;}staticvoidhw_guard_wait(struct