• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * for modules (sensor/actuator/flash) power supply helper.
3  *
4  * Copyright (c) 2017 by Allwinnertech Co., Ltd.  http://www.allwinnertech.com
5  *
6  * Authors:  Zhao Wei <zhaowei@allwinnertech.com>
7  *	Yang Feng <yangfeng@allwinnertech.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13 
14 #ifndef __VIN__SUBDEV__H__
15 #define __VIN__SUBDEV__H__
16 
17 #define MCLK_POWER_VOLTAGE_3300 0
18 #define MCLK_POWER_VOLTAGE_1800 1
19 
20 enum pmic_channel {
21 	IOVDD = 0,
22 	AVDD,
23 	DVDD,
24 	AFVDD,
25 	FLVDD,
26 	CAMERAVDD,
27 	MAX_POW_NUM,
28 };
29 
30 enum gpio_type {
31 	POWER_EN = 0,
32 	PWDN,
33 	RESET,
34 	SM_HS,
35 	SM_VS,
36 	AF_PWDN,
37 	FLASH_EN,
38 	FLASH_MODE,
39 	MAX_GPIO_NUM,
40 };
41 
42 enum gpio_fun {
43 	GPIO_INPUT = 0,
44 	GPIO_OUTPUT = 1,
45 	GPIO_DISABLE = 7,
46 };
47 
48 enum on_off {
49 	OFF,
50 	ON,
51 };
52 
53 enum power_seq_cmd {
54 	PWR_OFF = 0,
55 	PWR_ON = 1,
56 	STBY_OFF = 2,
57 	STBY_ON = 3,
58 };
59 
60 extern struct modules_config *sd_to_modules(struct v4l2_subdev *sd);
61 extern int vin_set_pmu_channel(struct v4l2_subdev *sd,
62 			enum pmic_channel pmic_ch, enum on_off on_off);
63 extern int vin_set_mclk(struct v4l2_subdev *sd, enum on_off on_off);
64 extern int vin_set_mclk_freq(struct v4l2_subdev *sd, unsigned long freq);
65 extern int vin_set_sync_mclk(struct v4l2_subdev *sd, int id, unsigned long freq, enum on_off on_off);
66 
67 extern int vin_gpio_write(struct v4l2_subdev *sd,
68 			enum gpio_type gpio_id, unsigned int status);
69 extern int vin_gpio_set_status(struct v4l2_subdev *sd,
70 			enum gpio_type gpio_id, unsigned int out_value);
71 extern int sunxi_sel_pio_mode(struct pinctrl *pinctrl, u32 pm_sel);
72 
73 #endif	/*__VIN__SUBDEV__H__*/
74