blob: 7a4dbeadb182bfacaa411b2ce99b3382785a8687 [file] [log] [blame]
Harsh Shaha1af8822017-05-11 22:06:36 -07001/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _CAM_VFE_SOC_H_
14#define _CAM_VFE_SOC_H_
15
16#include "cam_soc_util.h"
17#include "cam_isp_hw.h"
18
Senthil Kumar Rajagopala8e0c492017-09-05 16:21:49 +053019#define CAM_VFE_DSP_CLK_NAME "ife_dsp_clk"
20
Harsh Shaha1af8822017-05-11 22:06:36 -070021/*
22 * struct cam_vfe_soc_private:
23 *
24 * @Brief: Private SOC data specific to VFE HW Driver
25 *
26 * @cpas_handle: Handle returned on registering with CPAS driver.
27 * This handle is used for all further interface
28 * with CPAS.
29 */
30struct cam_vfe_soc_private {
Senthil Kumar Rajagopala8e0c492017-09-05 16:21:49 +053031 uint32_t cpas_handle;
32 struct clk *dsp_clk;
33 int32_t dsp_clk_index;
34 int32_t dsp_clk_rate;
Harsh Shaha1af8822017-05-11 22:06:36 -070035};
36
37/*
38 * cam_vfe_init_soc_resources()
39 *
40 * @Brief: Initialize SOC resources including private data
41 *
42 * @soc_info: Device soc information
43 * @handler: Irq handler function pointer
44 * @irq_data: Irq handler function Callback data
45 *
46 * @Return: 0: Success
47 * Non-zero: Failure
48 */
49int cam_vfe_init_soc_resources(struct cam_hw_soc_info *soc_info,
50 irq_handler_t vfe_irq_handler, void *irq_data);
51
52/*
Harsh Shah545df9a2017-06-16 16:43:17 -070053 * cam_vfe_deinit_soc_resources()
54 *
55 * @Brief: Deinitialize SOC resources including private data
56 *
57 * @soc_info: Device soc information
58 *
59 * @Return: 0: Success
60 * Non-zero: Failure
61 */
62int cam_vfe_deinit_soc_resources(struct cam_hw_soc_info *soc_info);
63
64/*
Harsh Shaha1af8822017-05-11 22:06:36 -070065 * cam_vfe_enable_soc_resources()
66 *
67 * @brief: Enable regulator, irq resources, start CPAS
68 *
69 * @soc_info: Device soc information
70 *
71 * @Return: 0: Success
72 * Non-zero: Failure
73 */
74int cam_vfe_enable_soc_resources(struct cam_hw_soc_info *soc_info);
75
76/*
77 * cam_vfe_disable_soc_resources()
78 *
79 * @brief: Disable regulator, irq resources, stop CPAS
80 *
81 * @soc_info: Device soc information
82 *
83 * @Return: 0: Success
84 * Non-zero: Failure
85 */
86int cam_vfe_disable_soc_resources(struct cam_hw_soc_info *soc_info);
87
Senthil Kumar Rajagopala8e0c492017-09-05 16:21:49 +053088/*
89 * cam_vfe_soc_enable_clk()
90 *
91 * @brief: Enable clock with given name
92 *
93 * @soc_info: Device soc information
94 * @clk_name: Name of clock to enable
95 *
96 * @Return: 0: Success
97 * Non-zero: Failure
98 */
99int cam_vfe_soc_enable_clk(struct cam_hw_soc_info *soc_info,
100 const char *clk_name);
101
102/*
103 * cam_vfe_soc_disable_dsp_clk()
104 *
105 * @brief: Disable clock with given name
106 *
107 * @soc_info: Device soc information
108 * @clk_name: Name of clock to enable
109 *
110 * @Return: 0: Success
111 * Non-zero: Failure
112 */
113int cam_vfe_soc_disable_clk(struct cam_hw_soc_info *soc_info,
114 const char *clk_name);
115
Harsh Shaha1af8822017-05-11 22:06:36 -0700116#endif /* _CAM_VFE_SOC_H_ */