aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/s6e8ab0_mipi_lcd.c
blob: ef5c41fbca30a1b633f30f47400ffd53ac6a907e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* linux/drivers/video/backlight/s6e8ab0_mipi_lcd.c
 *
 *
 * Copyright (c) 2011 Samsung Electronics
 *
 * 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.
 *
 *
*/

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/wait.h>
#include <linux/ctype.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/workqueue.h>
#include <linux/backlight.h>
#include <linux/lcd.h>

#include <video/mipi_display.h>

#include <plat/gpio-cfg.h>
#include <plat/regs-dsim.h>

#include <plat/dsim.h>
#include <plat/mipi_dsi.h>

void init_lcd(struct mipi_dsim_device *dsim)
{
	s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_DCS_SHORT_WRITE,
		0, 0);
	msleep(60);
	/* Exit sleep */
	s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_DCS_SHORT_WRITE,
		0x11, 0);
	msleep(600);
	s5p_mipi_dsi_wr_data(dsim, MIPI_DSI_TURN_ON_PERIPHERAL,
		0, 0);
}

void s6e8ab0_mipi_lcd_off(struct mipi_dsim_device *dsim)
{
	usleep_range(1000, 1200);
}

static int s6e8ab0_mipi_lcd_suspend(struct mipi_dsim_device *dsim)
{
	s6e8ab0_mipi_lcd_off(dsim);
	return 0;
}

static int s6e8ab0_mipi_lcd_displayon(struct mipi_dsim_device *dsim)
{
	init_lcd(dsim);

	return 0;
}

static int s6e8ab0_mipi_lcd_resume(struct mipi_dsim_device *dsim)
{
	init_lcd(dsim);
	return 0;
}

struct mipi_dsim_lcd_driver s6e8ab0_mipi_lcd_driver = {
	.suspend =  s6e8ab0_mipi_lcd_suspend,
	.displayon = s6e8ab0_mipi_lcd_displayon,
	.resume = s6e8ab0_mipi_lcd_resume,
};