summaryrefstree
path: root/kernel/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.h
blob: 24e5f915ed3060b6a29c934f6a2c980837e4e50b (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
 * Samsung Exynos5 SoC series FIMC-IS driver
 *
 * exynos5 fimc-is core functions
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd
 *
 * 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/i2c.h>
#include <linux/slab.h>
#include "fimc-is-core.h"

typedef unsigned char BYTE;

#define REG_VSEL0		0x00
#define VSEL0_NSEL0		0x3f
#define VSEL0_BUCK_EN0_SHIFT	7
#define VSEL0_BUCK_EN0		(0x01 << VSEL0_BUCK_EN0_SHIFT)
#define VSEL0_INIT_VAL		VSEL0_BUCK_EN0 | FAN53555_VOUT_1P00

// FAN53555UC08X : Vout = 0.60V + NSELx * 10mV
enum{
    FAN53555_VOUT_0P60 = 0,
	FAN53555_VOUT_0P61,
	FAN53555_VOUT_0P62,
	FAN53555_VOUT_0P63,
	FAN53555_VOUT_0P64,
	FAN53555_VOUT_0P65,
	FAN53555_VOUT_0P66,
	FAN53555_VOUT_0P67,
	FAN53555_VOUT_0P68,
	FAN53555_VOUT_0P69,

	FAN53555_VOUT_0P70 = 10,
	FAN53555_VOUT_0P71,
	FAN53555_VOUT_0P72,
	FAN53555_VOUT_0P73,
	FAN53555_VOUT_0P74,
	FAN53555_VOUT_0P75,
	FAN53555_VOUT_0P76,
	FAN53555_VOUT_0P77,
	FAN53555_VOUT_0P78,
	FAN53555_VOUT_0P79,

	FAN53555_VOUT_0P80 = 20,
	FAN53555_VOUT_0P81,
	FAN53555_VOUT_0P82,
	FAN53555_VOUT_0P83,
	FAN53555_VOUT_0P84,
	FAN53555_VOUT_0P85,
	FAN53555_VOUT_0P86,
	FAN53555_VOUT_0P87,
	FAN53555_VOUT_0P88,
	FAN53555_VOUT_0P89,

	FAN53555_VOUT_0P90 = 30,
	FAN53555_VOUT_0P91,
	FAN53555_VOUT_0P92,
	FAN53555_VOUT_0P93,
	FAN53555_VOUT_0P94,
	FAN53555_VOUT_0P95,
	FAN53555_VOUT_0P96,
	FAN53555_VOUT_0P97,
	FAN53555_VOUT_0P98,
	FAN53555_VOUT_0P99,

	FAN53555_VOUT_1P00 = 40,
	FAN53555_VOUT_1P01,
	FAN53555_VOUT_1P02,  // VSEL0 default, 08X
	FAN53555_VOUT_1P03,
	FAN53555_VOUT_1P04,
	FAN53555_VOUT_1P05,
	FAN53555_VOUT_1P06,
	FAN53555_VOUT_1P07,
	FAN53555_VOUT_1P08,
	FAN53555_VOUT_1P09,

	FAN53555_VOUT_1P10 = 50,
	FAN53555_VOUT_1P11,
	FAN53555_VOUT_1P12,
	FAN53555_VOUT_1P13,
	FAN53555_VOUT_1P14,
	FAN53555_VOUT_1P15,  // VSEL1 default, 08X
	FAN53555_VOUT_1P16,
	FAN53555_VOUT_1P17,
	FAN53555_VOUT_1P18,
	FAN53555_VOUT_1P19,

	FAN53555_VOUT_1P20 = 60,
	FAN53555_VOUT_1P21,
	FAN53555_VOUT_1P22,
	FAN53555_VOUT_1P23,
};

struct fan53555_vout {
	int sel;	/* selector, unique value for vout entry and indepedant to dcdc vendor */
	int val;	/* dcdc-specific value for vout register */
	char vout[7];	/* voltage level string */
};

int fan53555_get_vout_val(int sel);
const char *fan53555_get_vout_str(int sel);
int fan53555_enable_vsel0(struct i2c_client *client, int on_off);
int fan53555_set_vsel0_vout(struct i2c_client *client, int vout);