2 * drivers/media/i2c/smiapp-pll.h
4 * Generic driver for SMIA/SMIA++ compliant camera modules
6 * Copyright (C) 2012 Nokia Corporation
7 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 #include <linux/device.h>
31 #define SMIAPP_PLL_BUS_TYPE_CSI2 0x00
32 #define SMIAPP_PLL_BUS_TYPE_PARALLEL 0x01
34 /* op pix clock is for all lanes in total normally */
35 #define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0)
36 #define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1)
38 struct smiapp_pll_branch {
41 uint32_t sys_clk_freq_hz;
42 uint32_t pix_clk_freq_hz;
57 uint8_t binning_horizontal;
58 uint8_t binning_vertical;
61 uint8_t bits_per_pixel;
63 uint32_t ext_clk_freq_hz;
66 uint16_t pre_pll_clk_div;
67 uint16_t pll_multiplier;
68 uint32_t pll_ip_clk_freq_hz;
69 uint32_t pll_op_clk_freq_hz;
70 struct smiapp_pll_branch vt;
71 struct smiapp_pll_branch op;
73 uint32_t pixel_rate_csi;
74 uint32_t pixel_rate_pixel_array;
77 struct smiapp_pll_branch_limits {
78 uint16_t min_sys_clk_div;
79 uint16_t max_sys_clk_div;
80 uint32_t min_sys_clk_freq_hz;
81 uint32_t max_sys_clk_freq_hz;
82 uint16_t min_pix_clk_div;
83 uint16_t max_pix_clk_div;
84 uint32_t min_pix_clk_freq_hz;
85 uint32_t max_pix_clk_freq_hz;
88 struct smiapp_pll_limits {
89 /* Strict PLL limits */
90 uint32_t min_ext_clk_freq_hz;
91 uint32_t max_ext_clk_freq_hz;
92 uint16_t min_pre_pll_clk_div;
93 uint16_t max_pre_pll_clk_div;
94 uint32_t min_pll_ip_freq_hz;
95 uint32_t max_pll_ip_freq_hz;
96 uint16_t min_pll_multiplier;
97 uint16_t max_pll_multiplier;
98 uint32_t min_pll_op_freq_hz;
99 uint32_t max_pll_op_freq_hz;
101 struct smiapp_pll_branch_limits vt;
102 struct smiapp_pll_branch_limits op;
104 /* Other relevant limits */
105 uint32_t min_line_length_pck_bin;
106 uint32_t min_line_length_pck;
111 int smiapp_pll_calculate(struct device *dev,
112 const struct smiapp_pll_limits *limits,
113 struct smiapp_pll *pll);
115 #endif /* SMIAPP_PLL_H */