]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - drivers/video/tegra/camera/camera_priv_defs.h
video: tegra: remove MCLK gate from vi driver
[linux-3.10.git] / drivers / video / tegra / camera / camera_priv_defs.h
1 /*
2  * drivers/video/tegra/camera/camera_priv_defs.h
3  *
4  * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #ifndef __DRIVERS_VIDEO_TEGRA_CAMERA_CAMERA_PRIV_DEFS_H
18 #define __DRIVERS_VIDEO_TEGRA_CAMERA_CAMERA_PRIV_DEFS_H
19
20 #include <linux/miscdevice.h>
21 #include <linux/platform_device.h>
22 #include <linux/ioctl.h>
23 #include <linux/fs.h>
24 #include <linux/device.h>
25 #include <linux/regulator/consumer.h>
26 #include <linux/clk.h>
27 #include <linux/io.h>
28 #include <linux/uaccess.h>
29 #include <linux/delay.h>
30 #include <linux/export.h>
31 #include <linux/slab.h>
32
33 #include <mach/powergate.h>
34 #include <mach/clk.h>
35 #include <mach/mc.h>
36 #if defined(CONFIG_TEGRA_ISOMGR)
37 #include <mach/isomgr.h>
38 #endif
39
40 #include <video/tegra_camera.h>
41
42
43 /*
44  * CAMERA_*_CLK is only for internal driver use.
45  * TEGRA_CAMERA_*_CLK is enum used between driver and user space.
46  * TEGRA_CAMERA_*_CLK is defined in tegra_camera.h
47  */
48 enum {
49         CAMERA_VI_CLK,
50         CAMERA_EMC_CLK,
51         CAMERA_ISP_CLK,
52         CAMERA_CSI_CLK,
53 #if defined(CONFIG_ARCH_TEGRA_11x_SOC) || defined(CONFIG_ARCH_TEGRA_14x_SOC)
54         CAMERA_CILAB_CLK,
55         CAMERA_CILE_CLK,
56         CAMERA_PLL_D2_CLK,
57 #endif
58
59 #ifdef CONFIG_ARCH_TEGRA_11x_SOC
60         CAMERA_CILCD_CLK,
61 #endif
62         CAMERA_SCLK,
63         CAMERA_CLK_MAX,
64 };
65
66 struct clock {
67         struct clk *clk;
68         bool on;
69 };
70
71 struct vi_stats {
72         atomic_t overflow;
73 };
74
75 struct tegra_camera {
76         struct device *dev;
77         struct miscdevice misc_dev;
78         struct clock clock[CAMERA_CLK_MAX];
79         struct regulator *reg;
80         struct tegra_camera_clk_info info;
81         struct mutex tegra_camera_lock;
82         atomic_t in_use;
83         int power_on;
84         int irq;
85         struct dentry *debugdir;
86         struct vi_stats vi_out0;
87         struct vi_stats vi_out1;
88         struct work_struct stats_work;
89 #if defined(CONFIG_TEGRA_ISOMGR)
90         tegra_isomgr_handle isomgr_handle;
91 #endif
92 };
93
94 /*
95  * index: clock enum value
96  * name:  clock name
97  * init:  default clock state when camera is opened.
98  * freq:  initial clock frequency to set when camera is opened. If it is 0,
99  *        then no need to set clock freq.
100  */
101 struct clock_data {
102         int index;
103         char *name;
104         bool init;
105         unsigned long freq;
106 };
107
108 struct tegra_camera *tegra_camera_register(struct platform_device *ndev);
109 int tegra_camera_unregister(struct tegra_camera *camera);
110 #ifdef CONFIG_PM
111 int tegra_camera_suspend(struct tegra_camera *camera);
112 int tegra_camera_resume(struct tegra_camera *camera);
113 #endif
114
115 #endif