#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/smiapp.h>
#include <linux/v4l2-mediabus.h>
#include <media/v4l2-cci.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <uapi/linux/ccs.h>
#include "ccs.h"
#define CCS_ALIGN_DIM(dim, flags) …
static struct ccs_limit_offset { … } ccs_limit_offsets[CCS_L_LAST + 1];
static const struct ccs_module_ident ccs_module_idents[] = …;
#define CCS_DEVICE_FLAG_IS_SMIA …
struct ccs_device { … };
static const char * const ccs_regulators[] = …;
static void ccs_assign_limit(void *ptr, unsigned int width, u32 val)
{ … }
static int ccs_limit_ptr(struct ccs_sensor *sensor, unsigned int limit,
unsigned int offset, void **__ptr)
{ … }
void ccs_replace_limit(struct ccs_sensor *sensor,
unsigned int limit, unsigned int offset, u32 val)
{ … }
u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
unsigned int offset)
{ … }
static int ccs_read_all_limits(struct ccs_sensor *sensor)
{ … }
static int ccs_read_frame_fmt(struct ccs_sensor *sensor)
{ … }
static int ccs_pll_configure(struct ccs_sensor *sensor)
{ … }
static int ccs_pll_try(struct ccs_sensor *sensor, struct ccs_pll *pll)
{ … }
static int ccs_pll_update(struct ccs_sensor *sensor)
{ … }
static void __ccs_update_exposure_limits(struct ccs_sensor *sensor)
{ … }
static const struct ccs_csi_data_format ccs_csi_data_formats[] = …;
static const char *pixel_order_str[] = …;
#define to_csi_format_idx(fmt) …
static u32 ccs_pixel_order(struct ccs_sensor *sensor)
{ … }
static void ccs_update_mbus_formats(struct ccs_sensor *sensor)
{ … }
static const char * const ccs_test_patterns[] = …;
static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops ccs_ctrl_ops = …;
static int ccs_init_controls(struct ccs_sensor *sensor)
{ … }
static int ccs_init_late_controls(struct ccs_sensor *sensor)
{ … }
static void ccs_free_controls(struct ccs_sensor *sensor)
{ … }
static int ccs_get_mbus_formats(struct ccs_sensor *sensor)
{ … }
static void ccs_update_blanking(struct ccs_sensor *sensor)
{ … }
static int ccs_pll_blanking_update(struct ccs_sensor *sensor)
{ … }
static int ccs_read_nvm_page(struct ccs_sensor *sensor, u32 p, u8 *nvm,
u8 *status)
{ … }
static int ccs_read_nvm(struct ccs_sensor *sensor, unsigned char *nvm,
size_t nvm_size)
{ … }
static int ccs_change_cci_addr(struct ccs_sensor *sensor)
{ … }
static int ccs_setup_flash_strobe(struct ccs_sensor *sensor)
{ … }
static int ccs_write_msr_regs(struct ccs_sensor *sensor)
{ … }
static int ccs_update_phy_ctrl(struct ccs_sensor *sensor)
{ … }
static int ccs_power_on(struct device *dev)
{ … }
static int ccs_power_off(struct device *dev)
{ … }
static int ccs_start_streaming(struct ccs_sensor *sensor)
{ … }
static int ccs_stop_streaming(struct ccs_sensor *sensor)
{ … }
static int ccs_pm_get_init(struct ccs_sensor *sensor)
{ … }
static int ccs_set_stream(struct v4l2_subdev *subdev, int enable)
{ … }
static int ccs_pre_streamon(struct v4l2_subdev *subdev, u32 flags)
{ … }
static int ccs_post_streamoff(struct v4l2_subdev *subdev)
{ … }
static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{ … }
static u32 __ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad)
{ … }
static int __ccs_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int ccs_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static void ccs_get_crop_compose(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_rect **crops,
struct v4l2_rect **comps)
{ … }
static void ccs_propagate(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state, int which,
int target)
{ … }
static const struct ccs_csi_data_format
*ccs_validate_csi_data_format(struct ccs_sensor *sensor, u32 code)
{ … }
static int ccs_set_format_source(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
static int ccs_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{ … }
#define SCALING_GOODNESS …
#define SCALING_GOODNESS_EXTREME …
static int scaling_goodness(struct v4l2_subdev *subdev, int w, int ask_w,
int h, int ask_h, u32 flags)
{ … }
static void ccs_set_compose_binner(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel,
struct v4l2_rect **crops,
struct v4l2_rect *comp)
{ … }
static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel,
struct v4l2_rect **crops,
struct v4l2_rect *comp)
{ … }
static int ccs_set_compose(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int ccs_sel_supported(struct v4l2_subdev *subdev,
struct v4l2_subdev_selection *sel)
{ … }
static int ccs_set_crop(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static void ccs_get_native_size(struct ccs_subdev *ssd, struct v4l2_rect *r)
{ … }
static int ccs_get_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int ccs_set_selection(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{ … }
static int ccs_get_skip_frames(struct v4l2_subdev *subdev, u32 *frames)
{ … }
static int ccs_get_skip_top_lines(struct v4l2_subdev *subdev, u32 *lines)
{ … }
static ssize_t
nvm_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(nvm);
static ssize_t
ident_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(ident);
static int ccs_identify_module(struct ccs_sensor *sensor)
{ … }
static const struct v4l2_subdev_ops ccs_ops;
static const struct media_entity_operations ccs_entity_ops;
static int ccs_register_subdev(struct ccs_sensor *sensor,
struct ccs_subdev *ssd,
struct ccs_subdev *sink_ssd,
u16 source_pad, u16 sink_pad, u32 link_flags)
{ … }
static void ccs_unregistered(struct v4l2_subdev *subdev)
{ … }
static int ccs_registered(struct v4l2_subdev *subdev)
{ … }
static void ccs_cleanup(struct ccs_sensor *sensor)
{ … }
static int ccs_init_subdev(struct ccs_sensor *sensor,
struct ccs_subdev *ssd, const char *name,
unsigned short num_pads, u32 function,
const char *lock_name,
struct lock_class_key *lock_key)
{ … }
static int ccs_init_state(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
{ … }
static const struct v4l2_subdev_video_ops ccs_video_ops = …;
static const struct v4l2_subdev_pad_ops ccs_pad_ops = …;
static const struct v4l2_subdev_sensor_ops ccs_sensor_ops = …;
static const struct v4l2_subdev_ops ccs_ops = …;
static const struct media_entity_operations ccs_entity_ops = …;
static const struct v4l2_subdev_internal_ops ccs_internal_src_ops = …;
static int ccs_get_hwconfig(struct ccs_sensor *sensor, struct device *dev)
{ … }
static int ccs_firmware_name(struct i2c_client *client,
struct ccs_sensor *sensor, char *filename,
size_t filename_size, bool is_module)
{ … }
static int ccs_probe(struct i2c_client *client)
{ … }
static void ccs_remove(struct i2c_client *client)
{ … }
static const struct ccs_device smia_device = …;
static const struct ccs_device ccs_device = …;
static const struct acpi_device_id ccs_acpi_table[] = …;
MODULE_DEVICE_TABLE(acpi, ccs_acpi_table);
static const struct of_device_id ccs_of_table[] = …;
MODULE_DEVICE_TABLE(of, ccs_of_table);
static const struct dev_pm_ops ccs_pm_ops = …;
static struct i2c_driver ccs_i2c_driver = …;
static int ccs_module_init(void)
{ … }
static void ccs_module_cleanup(void)
{ … }
module_init(…) …;
module_exit(ccs_module_cleanup);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;