2019-05-27 14:55:21 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2011-12-08 00:45:25 +08:00
|
|
|
/*
|
2012-08-15 03:23:43 +08:00
|
|
|
* drivers/media/i2c/smiapp-pll.h
|
2011-12-08 00:45:25 +08:00
|
|
|
*
|
|
|
|
* Generic driver for SMIA/SMIA++ compliant camera modules
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Nokia Corporation
|
2012-10-28 17:44:17 +08:00
|
|
|
* Contact: Sakari Ailus <sakari.ailus@iki.fi>
|
2011-12-08 00:45:25 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SMIAPP_PLL_H
|
|
|
|
#define SMIAPP_PLL_H
|
|
|
|
|
2012-10-20 21:35:25 +08:00
|
|
|
/* CSI-2 or CCP-2 */
|
|
|
|
#define SMIAPP_PLL_BUS_TYPE_CSI2 0x00
|
|
|
|
#define SMIAPP_PLL_BUS_TYPE_PARALLEL 0x01
|
|
|
|
|
|
|
|
/* op pix clock is for all lanes in total normally */
|
|
|
|
#define SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0)
|
|
|
|
#define SMIAPP_PLL_FLAG_NO_OP_CLOCKS (1 << 1)
|
|
|
|
|
2014-09-16 20:07:11 +08:00
|
|
|
struct smiapp_pll_branch {
|
|
|
|
uint16_t sys_clk_div;
|
|
|
|
uint16_t pix_clk_div;
|
|
|
|
uint32_t sys_clk_freq_hz;
|
|
|
|
uint32_t pix_clk_freq_hz;
|
|
|
|
};
|
|
|
|
|
2011-12-08 00:45:25 +08:00
|
|
|
struct smiapp_pll {
|
2012-10-20 21:35:25 +08:00
|
|
|
/* input values */
|
|
|
|
uint8_t bus_type;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint8_t lanes;
|
|
|
|
} csi2;
|
|
|
|
struct {
|
|
|
|
uint8_t bus_width;
|
|
|
|
} parallel;
|
|
|
|
};
|
2014-04-09 05:14:42 +08:00
|
|
|
unsigned long flags;
|
2011-12-08 00:45:25 +08:00
|
|
|
uint8_t binning_horizontal;
|
|
|
|
uint8_t binning_vertical;
|
|
|
|
uint8_t scale_m;
|
|
|
|
uint8_t scale_n;
|
|
|
|
uint8_t bits_per_pixel;
|
|
|
|
uint32_t link_freq;
|
2014-09-16 20:04:35 +08:00
|
|
|
uint32_t ext_clk_freq_hz;
|
2011-12-08 00:45:25 +08:00
|
|
|
|
2012-10-20 21:35:25 +08:00
|
|
|
/* output values */
|
2011-12-08 00:45:25 +08:00
|
|
|
uint16_t pre_pll_clk_div;
|
|
|
|
uint16_t pll_multiplier;
|
|
|
|
uint32_t pll_ip_clk_freq_hz;
|
|
|
|
uint32_t pll_op_clk_freq_hz;
|
2014-09-16 20:07:11 +08:00
|
|
|
struct smiapp_pll_branch vt;
|
|
|
|
struct smiapp_pll_branch op;
|
2011-12-08 00:45:25 +08:00
|
|
|
|
|
|
|
uint32_t pixel_rate_csi;
|
2014-04-02 06:18:09 +08:00
|
|
|
uint32_t pixel_rate_pixel_array;
|
2011-12-08 00:45:25 +08:00
|
|
|
};
|
|
|
|
|
2012-10-22 22:40:56 +08:00
|
|
|
struct smiapp_pll_branch_limits {
|
|
|
|
uint16_t min_sys_clk_div;
|
|
|
|
uint16_t max_sys_clk_div;
|
|
|
|
uint32_t min_sys_clk_freq_hz;
|
|
|
|
uint32_t max_sys_clk_freq_hz;
|
|
|
|
uint16_t min_pix_clk_div;
|
|
|
|
uint16_t max_pix_clk_div;
|
|
|
|
uint32_t min_pix_clk_freq_hz;
|
|
|
|
uint32_t max_pix_clk_freq_hz;
|
|
|
|
};
|
|
|
|
|
2011-12-08 00:45:25 +08:00
|
|
|
struct smiapp_pll_limits {
|
|
|
|
/* Strict PLL limits */
|
|
|
|
uint32_t min_ext_clk_freq_hz;
|
|
|
|
uint32_t max_ext_clk_freq_hz;
|
|
|
|
uint16_t min_pre_pll_clk_div;
|
|
|
|
uint16_t max_pre_pll_clk_div;
|
|
|
|
uint32_t min_pll_ip_freq_hz;
|
|
|
|
uint32_t max_pll_ip_freq_hz;
|
|
|
|
uint16_t min_pll_multiplier;
|
|
|
|
uint16_t max_pll_multiplier;
|
|
|
|
uint32_t min_pll_op_freq_hz;
|
|
|
|
uint32_t max_pll_op_freq_hz;
|
|
|
|
|
2012-10-22 22:40:56 +08:00
|
|
|
struct smiapp_pll_branch_limits vt;
|
|
|
|
struct smiapp_pll_branch_limits op;
|
2011-12-08 00:45:25 +08:00
|
|
|
|
|
|
|
/* Other relevant limits */
|
|
|
|
uint32_t min_line_length_pck_bin;
|
|
|
|
uint32_t min_line_length_pck;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct device;
|
|
|
|
|
2012-10-22 22:40:57 +08:00
|
|
|
int smiapp_pll_calculate(struct device *dev,
|
|
|
|
const struct smiapp_pll_limits *limits,
|
2011-12-08 00:45:25 +08:00
|
|
|
struct smiapp_pll *pll);
|
|
|
|
|
|
|
|
#endif /* SMIAPP_PLL_H */
|