diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2020-02-11 14:19:13 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-12-02 15:39:44 +0100 |
commit | 161cc847370a92f2d39f79edc640b599a497c862 (patch) | |
tree | a104e41c5647c337629f465432581681264e97ca | |
parent | 47ff2ff267ee4f259154ddd578b25224393d306b (diff) |
media: smiapp: Internal rename to CCS
Rename internal names to reflect the driver's new reference. The module
name remains the same.
Also fix trivial coding style issues on the way related to e.g. alignment
changes due to the rename.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | drivers/media/i2c/smiapp/Makefile | 4 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs-core.c (renamed from drivers/media/i2c/smiapp/smiapp-core.c) | 888 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs-quirk.c (renamed from drivers/media/i2c/smiapp/smiapp-quirk.c) | 43 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs-quirk.h (renamed from drivers/media/i2c/smiapp/smiapp-quirk.h) | 46 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs-reg-access.c (renamed from drivers/media/i2c/smiapp/smiapp-regs.c) | 41 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs-reg-access.h (renamed from drivers/media/i2c/smiapp/smiapp-regs.h) | 16 | ||||
-rw-r--r-- | drivers/media/i2c/smiapp/ccs.h (renamed from drivers/media/i2c/smiapp/smiapp.h) | 124 |
7 files changed, 576 insertions, 586 deletions
diff --git a/drivers/media/i2c/smiapp/Makefile b/drivers/media/i2c/smiapp/Makefile index a7bf53dd4a63..c9d300b5d2bc 100644 --- a/drivers/media/i2c/smiapp/Makefile +++ b/drivers/media/i2c/smiapp/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only -smiapp-objs += smiapp-core.o smiapp-regs.o \ - smiapp-quirk.o ccs-limits.o +smiapp-objs += ccs-core.o ccs-reg-access.o \ + ccs-quirk.o ccs-limits.o obj-$(CONFIG_VIDEO_SMIAPP) += smiapp.o ccflags-y += -I $(srctree)/drivers/media/i2c diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/ccs-core.c index b12e41a6a410..f9dbf1407a33 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/ccs-core.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * drivers/media/i2c/smiapp/smiapp-core.c + * drivers/media/i2c/smiapp/ccs-core.c * * Generic driver for SMIA/SMIA++ compliant camera modules * @@ -27,10 +27,10 @@ #include <media/v4l2-fwnode.h> #include <media/v4l2-device.h> +#include "ccs.h" #include "ccs-limits.h" -#include "smiapp.h" -#define SMIAPP_ALIGN_DIM(dim, flags) \ +#define CCS_ALIGN_DIM(dim, flags) \ ((flags) & V4L2_SEL_FLAG_GE \ ? ALIGN((dim), 2) \ : (dim) & ~1) @@ -41,20 +41,20 @@ static struct ccs_limit_offset { } ccs_limit_offsets[CCS_L_LAST + 1]; /* - * smiapp_module_idents - supported camera modules + * ccs_module_idents - supported camera modules */ -static const struct smiapp_module_ident smiapp_module_idents[] = { - SMIAPP_IDENT_L(0x01, 0x022b, -1, "vs6555"), - SMIAPP_IDENT_L(0x01, 0x022e, -1, "vw6558"), - SMIAPP_IDENT_L(0x07, 0x7698, -1, "ovm7698"), - SMIAPP_IDENT_L(0x0b, 0x4242, -1, "smiapp-003"), - SMIAPP_IDENT_L(0x0c, 0x208a, -1, "tcm8330md"), - SMIAPP_IDENT_LQ(0x0c, 0x2134, -1, "tcm8500md", &smiapp_tcm8500md_quirk), - SMIAPP_IDENT_L(0x0c, 0x213e, -1, "et8en2"), - SMIAPP_IDENT_L(0x0c, 0x2184, -1, "tcm8580md"), - SMIAPP_IDENT_LQ(0x0c, 0x560f, -1, "jt8ew9", &smiapp_jt8ew9_quirk), - SMIAPP_IDENT_LQ(0x10, 0x4141, -1, "jt8ev1", &smiapp_jt8ev1_quirk), - SMIAPP_IDENT_LQ(0x10, 0x4241, -1, "imx125es", &smiapp_imx125es_quirk), +static const struct ccs_module_ident ccs_module_idents[] = { + CCS_IDENT_L(0x01, 0x022b, -1, "vs6555"), + CCS_IDENT_L(0x01, 0x022e, -1, "vw6558"), + CCS_IDENT_L(0x07, 0x7698, -1, "ovm7698"), + CCS_IDENT_L(0x0b, 0x4242, -1, "smiapp-003"), + CCS_IDENT_L(0x0c, 0x208a, -1, "tcm8330md"), + CCS_IDENT_LQ(0x0c, 0x2134, -1, "tcm8500md", &smiapp_tcm8500md_quirk), + CCS_IDENT_L(0x0c, 0x213e, -1, "et8en2"), + CCS_IDENT_L(0x0c, 0x2184, -1, "tcm8580md"), + CCS_IDENT_LQ(0x0c, 0x560f, -1, "jt8ew9", &smiapp_jt8ew9_quirk), + CCS_IDENT_LQ(0x10, 0x4141, -1, "jt8ev1", &smiapp_jt8ev1_quirk), + CCS_IDENT_LQ(0x10, 0x4241, -1, "imx125es", &smiapp_imx125es_quirk), }; /* @@ -78,7 +78,7 @@ static void ccs_assign_limit(void *ptr, unsigned int width, u32 val) } } -static int ccs_limit_ptr(struct smiapp_sensor *sensor, unsigned int limit, +static int ccs_limit_ptr(struct ccs_sensor *sensor, unsigned int limit, unsigned int offset, void **__ptr) { const struct ccs_limit *linfo; @@ -98,7 +98,7 @@ static int ccs_limit_ptr(struct smiapp_sensor *sensor, unsigned int limit, return 0; } -void ccs_replace_limit(struct smiapp_sensor *sensor, +void ccs_replace_limit(struct ccs_sensor *sensor, unsigned int limit, unsigned int offset, u32 val) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); @@ -118,7 +118,7 @@ void ccs_replace_limit(struct smiapp_sensor *sensor, ccs_assign_limit(ptr, ccs_reg_width(linfo->reg), val); } -static u32 ccs_get_limit(struct smiapp_sensor *sensor, +static u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit, unsigned int offset) { void *ptr; @@ -148,7 +148,7 @@ static u32 ccs_get_limit(struct smiapp_sensor *sensor, #define CCS_LIM_AT(sensor, limit, offset) \ ccs_get_limit(sensor, CCS_L_##limit, CCS_L_##limit##_OFFSET(offset)) -static int ccs_read_all_limits(struct smiapp_sensor *sensor) +static int ccs_read_all_limits(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); void *ptr, *alloc, *end; @@ -224,7 +224,7 @@ out_err: return ret; } -static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor) +static int ccs_read_frame_fmt(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); u8 fmt_model_type, fmt_model_subtype, ncol_desc, nrow_desc; @@ -351,7 +351,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor *sensor) return 0; } -static int smiapp_pll_configure(struct smiapp_sensor *sensor) +static int ccs_pll_configure(struct ccs_sensor *sensor) { struct smiapp_pll *pll = &sensor->pll; int rval; @@ -386,8 +386,7 @@ static int smiapp_pll_configure(struct smiapp_sensor *sensor) return ccs_write(sensor, OP_SYS_CLK_DIV, pll->op.sys_clk_div); } -static int smiapp_pll_try(struct smiapp_sensor *sensor, - struct smiapp_pll *pll) +static int ccs_pll_try(struct ccs_sensor *sensor, struct smiapp_pll *pll) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); struct smiapp_pll_limits lim = { @@ -425,7 +424,7 @@ static int smiapp_pll_try(struct smiapp_sensor *sensor, return smiapp_pll_calculate(&client->dev, &lim, pll); } -static int smiapp_pll_update(struct smiapp_sensor *sensor) +static int ccs_pll_update(struct ccs_sensor *sensor) { struct smiapp_pll *pll = &sensor->pll; int rval; @@ -437,7 +436,7 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor) pll->scale_m = sensor->scale_m; pll->bits_per_pixel = sensor->csi_format->compressed; - rval = smiapp_pll_try(sensor, pll); + rval = ccs_pll_try(sensor, pll); if (rval < 0) return rval; @@ -455,12 +454,12 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor) * */ -static void __smiapp_update_exposure_limits(struct smiapp_sensor *sensor) +static void __ccs_update_exposure_limits(struct ccs_sensor *sensor) { struct v4l2_ctrl *ctrl = sensor->exposure; int max; - max = sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height + max = sensor->pixel_array->crop[CCS_PA_PAD_SRC].height + sensor->vblank->val - CCS_LIM(sensor, COARSE_INTEGRATION_TIME_MAX_MARGIN); @@ -475,40 +474,40 @@ static void __smiapp_update_exposure_limits(struct smiapp_sensor *sensor) * 3. Pixel order, same as in pixel_order_str. Formats for all four pixel * orders must be defined. */ -static const struct smiapp_csi_data_format smiapp_csi_data_formats[] = { - { MEDIA_BUS_FMT_SGRBG16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_GBRG, }, - { MEDIA_BUS_FMT_SGRBG14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_GBRG, }, - { MEDIA_BUS_FMT_SGRBG12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_GBRG, }, - { MEDIA_BUS_FMT_SGRBG10_1X10, 10, 10, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB10_1X10, 10, 10, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR10_1X10, 10, 10, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG10_1X10, 10, 10, SMIAPP_PIXEL_ORDER_GBRG, }, - { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_GBRG, }, - { MEDIA_BUS_FMT_SGRBG8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_GRBG, }, - { MEDIA_BUS_FMT_SRGGB8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_RGGB, }, - { MEDIA_BUS_FMT_SBGGR8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_BGGR, }, - { MEDIA_BUS_FMT_SGBRG8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_GBRG, }, +static const struct ccs_csi_data_format ccs_csi_data_formats[] = { + { MEDIA_BUS_FMT_SGRBG16_1X16, 16, 16, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB16_1X16, 16, 16, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR16_1X16, 16, 16, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG16_1X16, 16, 16, CCS_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG14_1X14, 14, 14, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB14_1X14, 14, 14, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR14_1X14, 14, 14, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG14_1X14, 14, 14, CCS_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG12_1X12, 12, 12, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB12_1X12, 12, 12, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR12_1X12, 12, 12, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG12_1X12, 12, 12, CCS_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG10_1X10, 10, 10, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB10_1X10, 10, 10, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR10_1X10, 10, 10, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG10_1X10, 10, 10, CCS_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, 10, 8, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, 10, 8, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, 10, 8, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, 10, 8, CCS_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG8_1X8, 8, 8, CCS_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB8_1X8, 8, 8, CCS_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR8_1X8, 8, 8, CCS_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG8_1X8, 8, 8, CCS_PIXEL_ORDER_GBRG, }, }; static const char *pixel_order_str[] = { "GRBG", "RGGB", "BGGR", "GBRG" }; #define to_csi_format_idx(fmt) (((unsigned long)(fmt) \ - - (unsigned long)smiapp_csi_data_formats) \ - / sizeof(*smiapp_csi_data_formats)) + - (unsigned long)ccs_csi_data_formats) \ + / sizeof(*ccs_csi_data_formats)) -static u32 smiapp_pixel_order(struct smiapp_sensor *sensor) +static u32 ccs_pixel_order(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int flip = 0; @@ -527,31 +526,31 @@ static u32 smiapp_pixel_order(struct smiapp_sensor *sensor) return sensor->default_pixel_order ^ flip; } -static void smiapp_update_mbus_formats(struct smiapp_sensor *sensor) +static void ccs_update_mbus_formats(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); unsigned int csi_format_idx = to_csi_format_idx(sensor->csi_format) & ~3; unsigned int internal_csi_format_idx = to_csi_format_idx(sensor->internal_csi_format) & ~3; - unsigned int pixel_order = smiapp_pixel_order(sensor); + unsigned int pixel_order = ccs_pixel_order(sensor); sensor->mbus_frame_fmts = sensor->default_mbus_frame_fmts << pixel_order; sensor->csi_format = - &smiapp_csi_data_formats[csi_format_idx + pixel_order]; + &ccs_csi_data_formats[csi_format_idx + pixel_order]; sensor->internal_csi_format = - &smiapp_csi_data_formats[internal_csi_format_idx + &ccs_csi_data_formats[internal_csi_format_idx + pixel_order]; BUG_ON(max(internal_csi_format_idx, csi_format_idx) + pixel_order - >= ARRAY_SIZE(smiapp_csi_data_formats)); + >= ARRAY_SIZE(ccs_csi_data_formats)); dev_dbg(&client->dev, "new pixel order %s\n", pixel_order_str[pixel_order]); } -static const char * const smiapp_test_patterns[] = { +static const char * const ccs_test_patterns[] = { "Disabled", "Solid Colour", "Eight Vertical Colour Bars", @@ -559,10 +558,10 @@ static const char * const smiapp_test_patterns[] = { "Pseudorandom Sequence (PN9)", }; -static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) +static int ccs_set_ctrl(struct v4l2_ctrl *ctrl) { - struct smiapp_sensor *sensor = - container_of(ctrl->handler, struct smiapp_subdev, ctrl_handler) + struct ccs_sensor *sensor = + container_of(ctrl->handler, struct ccs_subdev, ctrl_handler) ->sensor; struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int pm_status; @@ -585,17 +584,17 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) orient ^= sensor->hvflip_inv_mask; - smiapp_update_mbus_formats(sensor); + ccs_update_mbus_formats(sensor); break; case V4L2_CID_VBLANK: exposure = sensor->exposure->val; - __smiapp_update_exposure_limits(sensor); + __ccs_update_exposure_limits(sensor); if (exposure > sensor->exposure->maximum) { sensor->exposure->val = sensor->exposure->maximum; - rval = smiapp_set_ctrl(sensor->exposure); + rval = ccs_set_ctrl(sensor->exposure); if (rval < 0) return rval; } @@ -605,7 +604,7 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) if (sensor->streaming) return -EBUSY; - rval = smiapp_pll_update(sensor); + rval = ccs_pll_update(sensor); if (rval) return rval; @@ -641,14 +640,14 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_VBLANK: rval = ccs_write(sensor, FRAME_LENGTH_LINES, sensor->pixel_array->crop[ - SMIAPP_PA_PAD_SRC].height + CCS_PA_PAD_SRC].height + ctrl->val); break; case V4L2_CID_HBLANK: rval = ccs_write(sensor, LINE_LENGTH_PCK, sensor->pixel_array->crop[ - SMIAPP_PA_PAD_SRC].width + CCS_PA_PAD_SRC].width + ctrl->val); break; @@ -689,11 +688,11 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl) return rval; } -static const struct v4l2_ctrl_ops smiapp_ctrl_ops = { - .s_ctrl = smiapp_set_ctrl, +static const struct v4l2_ctrl_ops ccs_ctrl_ops = { + .s_ctrl = ccs_set_ctrl, }; -static int smiapp_init_controls(struct smiapp_sensor *sensor) +static int ccs_init_controls(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -705,7 +704,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) sensor->pixel_array->ctrl_handler.lock = &sensor->mutex; sensor->analog_gain = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, CCS_LIM(sensor, ANALOG_GAIN_CODE_MIN), CCS_LIM(sensor, ANALOG_GAIN_CODE_MAX), @@ -714,38 +713,38 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) /* Exposure limits will be updated soon, use just something here. */ sensor->exposure = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_EXPOSURE, 0, 0, 1, 0); sensor->hflip = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); sensor->vflip = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); sensor->vblank = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_VBLANK, 0, 1, 1, 0); if (sensor->vblank) sensor->vblank->flags |= V4L2_CTRL_FLAG_UPDATE; sensor->hblank = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_HBLANK, 0, 1, 1, 0); if (sensor->hblank) sensor->hblank->flags |= V4L2_CTRL_FLAG_UPDATE; sensor->pixel_rate_parray = v4l2_ctrl_new_std( - &sensor->pixel_array->ctrl_handler, &smiapp_ctrl_ops, + &sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1); v4l2_ctrl_new_std_menu_items(&sensor->pixel_array->ctrl_handler, - &smiapp_ctrl_ops, V4L2_CID_TEST_PATTERN, - ARRAY_SIZE(smiapp_test_patterns) - 1, - 0, 0, smiapp_test_patterns); + &ccs_ctrl_ops, V4L2_CID_TEST_PATTERN, + ARRAY_SIZE(ccs_test_patterns) - 1, + 0, 0, ccs_test_patterns); if (sensor->pixel_array->ctrl_handler.error) { dev_err(&client->dev, @@ -766,7 +765,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) sensor->src->ctrl_handler.lock = &sensor->mutex; sensor->pixel_rate_csi = v4l2_ctrl_new_std( - &sensor->src->ctrl_handler, &smiapp_ctrl_ops, + &sensor->src->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1); if (sensor->src->ctrl_handler.error) { @@ -785,7 +784,7 @@ static int smiapp_init_controls(struct smiapp_sensor *sensor) * For controls that require information on available media bus codes * and linke frequencies. */ -static int smiapp_init_late_controls(struct smiapp_sensor *sensor) +static int ccs_init_late_controls(struct ccs_sensor *sensor) { unsigned long *valid_link_freqs = &sensor->valid_link_freqs[ sensor->csi_format->compressed - sensor->compressed_min_bpp]; @@ -796,19 +795,19 @@ static int smiapp_init_late_controls(struct smiapp_sensor *sensor) sensor->test_data[i] = v4l2_ctrl_new_std( &sensor->pixel_array->ctrl_handler, - &smiapp_ctrl_ops, V4L2_CID_TEST_PATTERN_RED + i, + &ccs_ctrl_ops, V4L2_CID_TEST_PATTERN_RED + i, 0, max_value, 1, max_value); } sensor->link_freq = v4l2_ctrl_new_int_menu( - &sensor->src->ctrl_handler, &smiapp_ctrl_ops, + &sensor->src->ctrl_handler, &ccs_ctrl_ops, V4L2_CID_LINK_FREQ, __fls(*valid_link_freqs), __ffs(*valid_link_freqs), sensor->hwcfg->op_sys_clock); return sensor->src->ctrl_handler.error; } -static void smiapp_free_controls(struct smiapp_sensor *sensor) +static void ccs_free_controls(struct ccs_sensor *sensor) { unsigned int i; @@ -816,7 +815,7 @@ static void smiapp_free_controls(struct smiapp_sensor *sensor) v4l2_ctrl_handler_free(&sensor->ssds[i].ctrl_handler); } -static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) +static int ccs_get_mbus_formats(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); struct smiapp_pll *pll = &sensor->pll; @@ -863,11 +862,11 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) dev_dbg(&client->dev, "%u: bpp %u, compressed %u\n", i, fmt >> 8, (u8)fmt); - for (j = 0; j < ARRAY_SIZE(smiapp_csi_data_formats); j++) { - const struct smiapp_csi_data_format *f = - &smiapp_csi_data_formats[j]; + for (j = 0; j < ARRAY_SIZE(ccs_csi_data_formats); j++) { + const struct ccs_csi_data_format *f = + &ccs_csi_data_formats[j]; - if (f->pixel_order != SMIAPP_PIXEL_ORDER_GRBG) + if (f->pixel_order != CCS_PIXEL_ORDER_GRBG) continue; if (f->width != fmt >> @@ -887,12 +886,12 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) pll->binning_vertical = 1; pll->scale_m = sensor->scale_m; - for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) { + for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) { sensor->compressed_min_bpp = - min(smiapp_csi_data_formats[i].compressed, + min(ccs_csi_data_formats[i].compressed, sensor->compressed_min_bpp); compressed_max_bpp = - max(smiapp_csi_data_formats[i].compressed, + max(ccs_csi_data_formats[i].compressed, compressed_max_bpp); } @@ -903,9 +902,9 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) if (!sensor->valid_link_freqs) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) { - const struct smiapp_csi_data_format *f = - &smiapp_csi_data_formats[i]; + for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) { + const struct ccs_csi_data_format *f = + &ccs_csi_data_formats[i]; unsigned long *valid_link_freqs = &sensor->valid_link_freqs[ f->compressed - sensor->compressed_min_bpp]; @@ -919,7 +918,7 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) for (j = 0; sensor->hwcfg->op_sys_clock[j]; j++) { pll->link_freq = sensor->hwcfg->op_sys_clock[j]; - rval = smiapp_pll_try(sensor, pll); + rval = ccs_pll_try(sensor, pll); dev_dbg(&client->dev, "link freq %u Hz, bpp %u %s\n", pll->link_freq, pll->bits_per_pixel, rval ? "not ok" : "ok"); @@ -951,12 +950,12 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) return -EINVAL; } - smiapp_update_mbus_formats(sensor); + ccs_update_mbus_formats(sensor); return 0; } -static void smiapp_update_blanking(struct smiapp_sensor *sensor) +static void ccs_update_blanking(struct ccs_sensor *sensor) { struct v4l2_ctrl *vblank = sensor->vblank; struct v4l2_ctrl *hblank = sensor->hblank; @@ -980,42 +979,42 @@ static void smiapp_update_blanking(struct smiapp_sensor *sensor) min = max_t(int, CCS_LIM(sensor, MIN_FRAME_BLANKING_LINES), min_fll - - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height); - max = max_fll - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height; + sensor->pixel_array->crop[CCS_PA_PAD_SRC].height); + max = max_fll - sensor->pixel_array->crop[CCS_PA_PAD_SRC].height; __v4l2_ctrl_modify_range(vblank, min, max, vblank->step, min); min = max_t(int, min_llp - - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width, + sensor->pixel_array->crop[CCS_PA_PAD_SRC].width, min_lbp); - max = max_llp - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width; + max = max_llp - sensor->pixel_array->crop[CCS_PA_PAD_SRC].width; __v4l2_ctrl_modify_range(hblank, min, max, hblank->step, min); - __smiapp_update_exposure_limits(sensor); + __ccs_update_exposure_limits(sensor); } -static int smiapp_pll_blanking_update(struct smiapp_sensor *sensor) +static int ccs_pll_blanking_update(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; - rval = smiapp_pll_update(sensor); + rval = ccs_pll_update(sensor); if (rval < 0) return rval; /* Output from pixel array, including blanking */ - smiapp_update_blanking(sensor); + ccs_update_blanking(sensor); dev_dbg(&client->dev, "vblank\t\t%d\n", sensor->vblank->val); dev_dbg(&client->dev, "hblank\t\t%d\n", sensor->hblank->val); dev_dbg(&client->dev, "real timeperframe\t100/%d\n", sensor->pll.pixel_rate_pixel_array / - ((sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width + ((sensor->pixel_array->crop[CCS_PA_PAD_SRC].width + sensor->hblank->val) * - (sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height + (sensor->pixel_array->crop[CCS_PA_PAD_SRC].height + sensor->vblank->val) / 100)); return 0; @@ -1027,8 +1026,8 @@ static int smiapp_pll_blanking_update(struct smiapp_sensor *sensor) * */ -static int smiapp_read_nvm_page(struct smiapp_sensor *sensor, u32 p, u8 *nvm, - u8 *status) +static int ccs_read_nvm_page(struct ccs_sensor *sensor, u32 p, u8 *nvm, + u8 *status) { unsigned int i; int rval; @@ -1082,8 +1081,8 @@ static int smiapp_read_nvm_page(struct smiapp_sensor *sensor, u32 p, u8 *nvm, return 0; } -static int smiapp_read_nvm(struct smiapp_sensor *sensor, unsigned char *nvm, - size_t nvm_size) +static int ccs_read_nvm(struct ccs_sensor *sensor, unsigned char *nvm, + size_t nvm_size) { u8 status = 0; u32 p; @@ -1091,7 +1090,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, unsigned char *nvm, for (p = 0; p < nvm_size / (CCS_LIM_DATA_TRANSFER_IF_1_DATA_MAX_P + 1) && !rval; p++) { - rval = smiapp_read_nvm_page(sensor, p, nvm, &status); + rval = ccs_read_nvm_page(sensor, p, nvm, &status); nvm += CCS_LIM_DATA_TRANSFER_IF_1_DATA_MAX_P + 1; } @@ -1111,7 +1110,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, unsigned char *nvm, * SMIA++ CCI address control * */ -static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) +static int ccs_change_cci_addr(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -1142,9 +1141,9 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) * SMIA++ Mode Control * */ -static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) +static int ccs_setup_flash_strobe(struct ccs_sensor *sensor) { - struct smiapp_flash_strobe_parms *strobe_setup; + struct ccs_flash_strobe_parms *strobe_setup; unsigned int ext_freq = sensor->hwcfg->ext_clk; u32 tmp; u32 strobe_adjustment; @@ -1268,16 +1267,16 @@ out: * Power management */ -static int smiapp_power_on(struct device *dev) +static int ccs_power_on(struct device *dev) { struct v4l2_subdev *subdev = dev_get_drvdata(dev); - struct smiapp_subdev *ssd = to_smiapp_subdev(subdev); + struct ccs_subdev *ssd = to_ccs_subdev(subdev); /* * The sub-device related to the I2C device is always the * source one, i.e. ssds[0]. */ - struct smiapp_sensor *sensor = - container_of(ssd, struct smiapp_sensor, ssds[0]); + struct ccs_sensor *sensor = + container_of(ssd, struct ccs_sensor, ssds[0]); unsigned int sleep; int rval; @@ -1312,7 +1311,7 @@ static int smiapp_power_on(struct device *dev) */ if (sensor->hwcfg->i2c_addr_alt) { - rval = smiapp_change_cci_addr(sensor); + rval = ccs_change_cci_addr(sensor); if (rval) { dev_err(dev, "cci address change error\n"); goto out_cci_addr_fail; @@ -1326,7 +1325,7 @@ static int smiapp_power_on(struct device *dev) } if (sensor->hwcfg->i2c_addr_alt) { - rval = smiapp_change_cci_addr(sensor); + rval = ccs_change_cci_addr(sensor); if (rval) { dev_err(dev, "cci address change error\n"); goto out_cci_addr_fail; @@ -1372,7 +1371,7 @@ static int smiapp_power_on(struct device *dev) if (rval < 0) goto out_cci_addr_fail; - rval = smiapp_call_quirk(sensor, post_poweron); + rval = ccs_call_quirk(sensor, post_poweron); if (rval) { dev_err(dev, "post_poweron quirks failed\n"); goto out_cci_addr_fail; @@ -1390,12 +1389,12 @@ out_xclk_fail: return rval; } -static int smiapp_power_off(struct device *dev) +static int ccs_power_off(struct device *dev) { struct v4l2_subdev *subdev = dev_get_drvdata(dev); - struct smiapp_subdev *ssd = to_smiapp_subdev(subdev); - struct smiapp_sensor *sensor = - container_of(ssd, struct smiapp_sensor, ssds[0]); + struct ccs_subdev *ssd = to_ccs_subdev(subdev); + struct ccs_sensor *sensor = + container_of(ssd, struct ccs_sensor, ssds[0]); /* * Currently power/clock to lens are enable/disabled separately @@ -1420,7 +1419,7 @@ static int smiapp_power_off(struct device *dev) * Video stream management */ -static int smiapp_start_streaming(struct smiapp_sensor *sensor) +static int ccs_start_streaming(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); unsigned int binning_mode; @@ -1454,33 +1453,33 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) goto out; /* Set up PLL */ - rval = smiapp_pll_configure(sensor); + rval = ccs_pll_configure(sensor); if (rval) goto out; /* Analog crop start coordinates */ rval = ccs_write(sensor, X_ADDR_START, - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left); + sensor->pixel_array->crop[CCS_PA_PAD_SRC].left); if (rval < 0) goto out; rval = ccs_write(sensor, Y_ADDR_START, - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top); + sensor->pixel_array->crop[CCS_PA_PAD_SRC].top); if (rval < 0) goto out; /* Analog crop end coordinates */ rval = ccs_write( sensor, X_ADDR_END, - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].left - + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width - 1); + sensor->pixel_array->crop[CCS_PA_PAD_SRC].left + + sensor->pixel_array->crop[CCS_PA_PAD_SRC].width - 1); if (rval < 0) goto out; rval = ccs_write( sensor, Y_ADDR_END, - sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].top - + sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height - 1); + sensor->pixel_array->crop[CCS_PA_PAD_SRC].top + + sensor->pixel_array->crop[CCS_PA_PAD_SRC].height - 1); if (rval < 0) goto out; @@ -1494,25 +1493,25 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) == CCS_DIGITAL_CROP_CAPABILITY_INPUT_CROP) { rval = ccs_write( sensor, DIGITAL_CROP_X_OFFSET, - sensor->scaler->crop[SMIAPP_PAD_SINK].left); + sensor->scaler->crop[CCS_PAD_SINK].left); if (rval < 0) goto out; rval = ccs_write( sensor, DIGITAL_CROP_Y_OFFSET, - sensor->scaler->crop[SMIAPP_PAD_SINK].top); + sensor->scaler->crop[CCS_PAD_SINK].top); if (rval < 0) goto out; rval = ccs_write( sensor, DIGITAL_CROP_IMAGE_WIDTH, - sensor->scaler->crop[SMIAPP_PAD_SINK].width); + sensor->scaler->crop[CCS_PAD_SINK].width); if (rval < 0) goto out; rval = ccs_write( sensor, DIGITAL_CROP_IMAGE_HEIGHT, - sensor->scaler->crop[SMIAPP_PAD_SINK].height); + sensor->scaler->crop[CCS_PAD_SINK].height); if (rval < 0) goto out; } @@ -1531,11 +1530,11 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) /* Output size from sensor */ rval = ccs_write(sensor, X_OUTPUT_SIZE, - sensor->src->crop[SMIAPP_PAD_SRC].width); + sensor->src->crop[CCS_PAD_SRC].width); if (rval < 0) goto out; rval = ccs_write(sensor, Y_OUTPUT_SIZE, - sensor->src->crop[SMIAPP_PAD_SRC].height); + sensor->src->crop[CCS_PAD_SRC].height); if (rval < 0) goto out; @@ -1544,12 +1543,12 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE) && sensor->hwcfg->strobe_setup != NULL && sensor->hwcfg->strobe_setup->trigger != 0) { - rval = smiapp_setup_flash_strobe(sensor); + rval = ccs_setup_flash_strobe(sensor); if (rval) goto out; } - rval = smiapp_call_quirk(sensor, pre_streamon); + rval = ccs_call_quirk(sensor, pre_streamon); if (rval) { dev_err(&client->dev, "pre_streamon quirks failed\n"); goto out; @@ -1563,7 +1562,7 @@ out: return rval; } -static int smiapp_stop_streaming(struct smiapp_sensor *sensor) +static int ccs_stop_streaming(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -1573,7 +1572,7 @@ static int smiapp_stop_streaming(struct smiapp_sensor *sensor) if (rval) goto out; - rval = smiapp_call_quirk(sensor, post_streamoff); + rval = ccs_call_quirk(sensor, post_streamoff); if (rval) dev_err(&client->dev, "post_streamoff quirks failed\n"); @@ -1586,7 +1585,7 @@ out: * V4L2 subdev video operations */ -static int smiapp_pm_get_init(struct smiapp_sensor *sensor) +static int ccs_pm_get_init(struct ccs_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -1610,9 +1609,9 @@ static int smiapp_pm_get_init(struct smiapp_sensor *sensor) return 0; } -static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable) +static int ccs_set_stream(struct v4l2_subdev *subdev, int enable) { - struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); + struct ccs_sensor *sensor = to_ccs_sensor(subdev); struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -1620,7 +1619,7 @@ static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable) return 0; if (!enable) { - smiapp_stop_streaming(sensor); + ccs_stop_streaming(sensor); sensor->streaming = false; pm_runtime_mark_last_busy(&client->dev); pm_runtime_put_autosuspend(&client->dev); @@ -1628,13 +1627,13 @@ static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable) return 0; } - rval = smiapp_pm_get_init(sensor); + rval = ccs_pm_get_init(sensor); if (rval) return rval; sensor->streaming = true; - rval = smiapp_start_streaming(sensor); + rval = ccs_start_streaming(sensor); if (rval < 0) { sensor->streaming = false; pm_runtime_mark_last_busy(&client->dev); @@ -1644,12 +1643,12 @@ static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable) return rval; } -static int smiapp_enum_mbus_code(struct v4l2_subdev *subdev, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_mbus_code_enum *code) +static int ccs_enum_mbus_code(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_mbus_code_enum *code) { struct i2c_client *client = v4l2_get_subdevdata(subdev); - struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); + struct ccs_sensor *sensor = to_ccs_sensor(subdev); unsigned int i; int idx = -1; int rval = -EINVAL; @@ -1659,7 +1658,7 @@ static int smiapp_enum_mbus_code(struct v4l2_subdev *subdev, dev_err(&client->dev, "subdev %s, pad %d, index %d\n", subdev->name, code->pad, code->index); - if (subdev != &sensor->src->sd || code->pad != SMIAPP_PAD_SRC) { + if (subdev != &sensor->src->sd || code->pad != CCS_PAD_SRC) { if (code->index) goto out; @@ -1668,12 +1667,12 @@ static int smiapp_enum_mbus_code(struct v4l2_subdev *subdev, goto out; } - for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) { + for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) { if (sensor->mbus_frame_fmts & (1 << i)) idx++; if (idx == code->index) { - code->code = smiapp_csi_data_formats[i].code; + code->code = ccs_csi_data_formats[i].code; dev_err(&client->dev, "found index %d, i %d, code %x\n", code->index, i, code->code); rval = 0; @@ -1687,22 +1686,21 @@ out: return rval; } -static u32 __smiapp_get_mbus_code(struct v4l2_subdev *subdev, - unsigned int pad) +static u32 __ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad) { - struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); + struct ccs_sensor *sensor = to_ccs_sensor(subdev); - if (subdev == &sensor->src->sd && pad == SMIAPP_PAD_SRC) + if (subdev == &sensor->src->sd && pad == CCS_PAD_SRC) return sensor->csi_format->code; else return sensor->internal_csi_format->code; } -static int __smiapp_get_format(struct v4l2_subdev *subdev, - struct v4l2_subdev_pad_config *cfg, |