1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * drivers/media/i2c/smiapp-pll.h
5 * Generic driver for SMIA/SMIA++ compliant camera modules
7 * Copyright (C) 2012 Nokia Corporation
8 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
15 #define SMIAPP_PLL_BUS_TYPE_CSI2 0x00
16 #define SMIAPP_PLL_BUS_TYPE_PARALLEL 0x01
18 /* op pix clock is for all lanes in total normally */
19 #define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0)
20 #define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1)
22 struct smiapp_pll_branch
{
25 uint32_t sys_clk_freq_hz
;
26 uint32_t pix_clk_freq_hz
;
41 uint8_t binning_horizontal
;
42 uint8_t binning_vertical
;
45 uint8_t bits_per_pixel
;
47 uint32_t ext_clk_freq_hz
;
50 uint16_t pre_pll_clk_div
;
51 uint16_t pll_multiplier
;
52 uint32_t pll_ip_clk_freq_hz
;
53 uint32_t pll_op_clk_freq_hz
;
54 struct smiapp_pll_branch vt
;
55 struct smiapp_pll_branch op
;
57 uint32_t pixel_rate_csi
;
58 uint32_t pixel_rate_pixel_array
;
61 struct smiapp_pll_branch_limits
{
62 uint16_t min_sys_clk_div
;
63 uint16_t max_sys_clk_div
;
64 uint32_t min_sys_clk_freq_hz
;
65 uint32_t max_sys_clk_freq_hz
;
66 uint16_t min_pix_clk_div
;
67 uint16_t max_pix_clk_div
;
68 uint32_t min_pix_clk_freq_hz
;
69 uint32_t max_pix_clk_freq_hz
;
72 struct smiapp_pll_limits
{
73 /* Strict PLL limits */
74 uint32_t min_ext_clk_freq_hz
;
75 uint32_t max_ext_clk_freq_hz
;
76 uint16_t min_pre_pll_clk_div
;
77 uint16_t max_pre_pll_clk_div
;
78 uint32_t min_pll_ip_freq_hz
;
79 uint32_t max_pll_ip_freq_hz
;
80 uint16_t min_pll_multiplier
;
81 uint16_t max_pll_multiplier
;
82 uint32_t min_pll_op_freq_hz
;
83 uint32_t max_pll_op_freq_hz
;
85 struct smiapp_pll_branch_limits vt
;
86 struct smiapp_pll_branch_limits op
;
88 /* Other relevant limits */
89 uint32_t min_line_length_pck_bin
;
90 uint32_t min_line_length_pck
;
95 int smiapp_pll_calculate(struct device
*dev
,
96 const struct smiapp_pll_limits
*limits
,
97 struct smiapp_pll
*pll
);
99 #endif /* SMIAPP_PLL_H */