Commit 161cc847 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

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: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 47ff2ff2
# 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
// SPDX-License-Identifier: GPL-2.0-only
/*
* drivers/media/i2c/smiapp/smiapp-quirk.c
* drivers/media/i2c/smiapp/ccs-quirk.c
*
* Generic driver for SMIA/SMIA++ compliant camera modules
*
......@@ -10,12 +10,11 @@
#include <linux/delay.h>
#include "ccs.h"
#include "ccs-limits.h"
#include "smiapp.h"
static int ccs_write_addr_8s(struct smiapp_sensor *sensor,
const struct smiapp_reg_8 *regs, int len)
static int ccs_write_addr_8s(struct ccs_sensor *sensor,
const struct ccs_reg_8 *regs, int len)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
int rval;
......@@ -33,7 +32,7 @@ static int ccs_write_addr_8s(struct smiapp_sensor *sensor,
return 0;
}
static int jt8ew9_limits(struct smiapp_sensor *sensor)
static int jt8ew9_limits(struct ccs_sensor *sensor)
{
if (sensor->minfo.revision_number_major < 0x03)
sensor->frame_skip = 1;
......@@ -46,9 +45,9 @@ static int jt8ew9_limits(struct smiapp_sensor *sensor)
return 0;
}
static int jt8ew9_post_poweron(struct smiapp_sensor *sensor)
static int jt8ew9_post_poweron(struct ccs_sensor *sensor)
{
static const struct smiapp_reg_8 regs[] = {
static const struct ccs_reg_8 regs[] = {
{ 0x30a3, 0xd8 }, /* Output port control : LVDS ports only */
{ 0x30ae, 0x00 }, /* 0x0307 pll_multiplier maximum value on PLL input 9.6MHz ( 19.2MHz is divided on pre_pll_div) */
{ 0x30af, 0xd0 }, /* 0x0307 pll_multiplier maximum value on PLL input 9.6MHz ( 19.2MHz is divided on pre_pll_div) */
......@@ -84,15 +83,15 @@ static int jt8ew9_post_poweron(struct smiapp_sensor *sensor)
return ccs_write_addr_8s(sensor, regs, ARRAY_SIZE(regs));
}
const struct smiapp_quirk smiapp_jt8ew9_quirk = {
const struct ccs_quirk smiapp_jt8ew9_quirk = {
.limits = jt8ew9_limits,
.post_poweron = jt8ew9_post_poweron,
};
static int imx125es_post_poweron(struct smiapp_sensor *sensor)
static int imx125es_post_poweron(struct ccs_sensor *sensor)
{
/* Taken from v02. No idea what the other two are. */
static const struct smiapp_reg_8 regs[] = {
static const struct ccs_reg_8 regs[] = {
/*
* 0x3302: clk during frame blanking:
* 0x00 - HS mode, 0x01 - LP11
......@@ -105,11 +104,11 @@ static int imx125es_post_poweron(struct smiapp_sensor *sensor)
return ccs_write_addr_8s(sensor, regs, ARRAY_SIZE(regs));
}
const struct smiapp_quirk smiapp_imx125es_quirk = {
const struct ccs_quirk smiapp_imx125es_quirk = {
.post_poweron = imx125es_post_poweron,
};
static int jt8ev1_limits(struct smiapp_sensor *sensor)
static int jt8ev1_limits(struct ccs_sensor *sensor)
{
ccs_replace_limit(sensor, CCS_L_X_ADDR_MAX, 0, 4271);
ccs_replace_limit(sensor, CCS_L_MIN_LINE_BLANKING_PCK_BIN, 0, 184);
......@@ -117,11 +116,11 @@ static int jt8ev1_limits(struct smiapp_sensor *sensor)
return 0;
}
static int jt8ev1_post_poweron(struct smiapp_sensor *sensor)
static int jt8ev1_post_poweron(struct ccs_sensor *sensor)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
int rval;
static const struct smiapp_reg_8 regs[] = {
static const struct ccs_reg_8 regs[] = {
{ 0x3031, 0xcd }, /* For digital binning (EQ_MONI) */
{ 0x30a3, 0xd0 }, /* FLASH STROBE enable */
{ 0x3237, 0x00 }, /* For control of pulse timing for ADC */
......@@ -142,7 +141,7 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor)
{ 0x33cf, 0xec }, /* For Black sun */
{ 0x3328, 0x80 }, /* Ugh. No idea what's this. */
};
static const struct smiapp_reg_8 regs_96[] = {
static const struct ccs_reg_8 regs_96[] = {
{ 0x30ae, 0x00 }, /* For control of ADC clock */
{ 0x30af, 0xd0 },
{ 0x30b0, 0x01 },
......@@ -163,12 +162,12 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor)
}
}
static int jt8ev1_pre_streamon(struct smiapp_sensor *sensor)
static int jt8ev1_pre_streamon(struct ccs_sensor *sensor)
{
return ccs_write_addr(sensor, 0x3328, 0x00);
}
static int jt8ev1_post_streamoff(struct smiapp_sensor *sensor)
static int jt8ev1_post_streamoff(struct ccs_sensor *sensor)
{
int rval;
......@@ -188,14 +187,14 @@ static int jt8ev1_post_streamoff(struct smiapp_sensor *sensor)
return ccs_write_addr(sensor, 0x3328, 0x80);
}
static int jt8ev1_init(struct smiapp_sensor *sensor)
static int jt8ev1_init(struct ccs_sensor *sensor)
{
sensor->pll.flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
return 0;
}
const struct smiapp_quirk smiapp_jt8ev1_quirk = {
const struct ccs_quirk smiapp_jt8ev1_quirk = {
.limits = jt8ev1_limits,
.post_poweron = jt8ev1_post_poweron,
.pre_streamon = jt8ev1_pre_streamon,
......@@ -203,13 +202,13 @@ const struct smiapp_quirk smiapp_jt8ev1_quirk = {
.init = jt8ev1_init,
};
static int tcm8500md_limits(struct smiapp_sensor *sensor)
static int tcm8500md_limits(struct ccs_sensor *sensor)
{
ccs_replace_limit(sensor, CCS_L_MIN_PLL_IP_CLK_FREQ_MHZ, 0, 2700000);
return 0;
}
const struct smiapp_quirk smiapp_tcm8500md_quirk = {
const struct ccs_quirk smiapp_tcm8500md_quirk = {
.limits = tcm8500md_limits,
};
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* drivers/media/i2c/smiapp/smiapp-quirk.h
* drivers/media/i2c/smiapp/ccs-quirk.h
*
* Generic driver for SMIA/SMIA++ compliant camera modules
*
......@@ -8,13 +8,13 @@
* Contact: Sakari Ailus <sakari.ailus@iki.fi>
*/
#ifndef __SMIAPP_QUIRK__
#define __SMIAPP_QUIRK__
#ifndef __CCS_QUIRK__
#define __CCS_QUIRK__
struct smiapp_sensor;
struct ccs_sensor;
/**
* struct smiapp_quirk - quirks for sensors that deviate from SMIA++ standard
* struct ccs_quirk - quirks for sensors that deviate from SMIA++ standard
*
* @limits: Replace sensor->limits with values which can't be read from
* sensor registers. Called the first time the sensor is powered up.
......@@ -36,43 +36,43 @@ struct smiapp_sensor;
* access may be done by the caller (default read
* value is zero), else negative error code on error
*/
struct smiapp_quirk {
int (*limits)(struct smiapp_sensor *sensor);
int (*post_poweron)(struct smiapp_sensor *sensor);
int (*pre_streamon)(struct smiapp_sensor *sensor);
int (*post_streamoff)(struct smiapp_sensor *sensor);
unsigned long (*pll_flags)(struct smiapp_sensor *sensor);
int (*init)(struct smiapp_sensor *sensor);
int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg,
struct ccs_quirk {
int (*limits)(struct ccs_sensor *sensor);
int (*post_poweron)(struct ccs_sensor *sensor);
int (*pre_streamon)(struct ccs_sensor *sensor);
int (*post_streamoff)(struct ccs_sensor *sensor);
unsigned long (*pll_flags)(struct ccs_sensor *sensor);
int (*init)(struct ccs_sensor *sensor);
int (*reg_access)(struct ccs_sensor *sensor, bool write, u32 *reg,
u32 *val);
unsigned long flags;
};
#define SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY (1 << 0)
#define CCS_QUIRK_FLAG_8BIT_READ_ONLY (1 << 0)
struct smiapp_reg_8 {
struct ccs_reg_8 {
u16 reg;
u8 val;
};
#define SMIAPP_MK_QUIRK_REG_8(_reg, _val) \
#define CCS_MK_QUIRK_REG_8(_reg, _val) \
{ \
.reg = (u16)_reg, \
.val = _val, \
}
#define smiapp_call_quirk(sensor, _quirk, ...) \
#define ccs_call_quirk(sensor, _quirk, ...) \
((sensor)->minfo.quirk && \
(sensor)->minfo.quirk->_quirk ? \
(sensor)->minfo.quirk->_quirk(sensor, ##__VA_ARGS__) : 0)
#define smiapp_needs_quirk(sensor, _quirk) \
#define ccs_needs_quirk(sensor, _quirk) \
((sensor)->minfo.quirk ? \
(sensor)->minfo.quirk->flags & _quirk : 0)
extern const struct smiapp_quirk smiapp_jt8ev1_quirk;
extern const struct smiapp_quirk smiapp_imx125es_quirk;
extern const struct smiapp_quirk smiapp_jt8ew9_quirk;
extern const struct smiapp_quirk smiapp_tcm8500md_quirk;
extern const struct ccs_quirk smiapp_jt8ev1_quirk;
extern const struct ccs_quirk smiapp_imx125es_quirk;
extern const struct ccs_quirk smiapp_jt8ew9_quirk;
extern const struct ccs_quirk smiapp_tcm8500md_quirk;
#endif /* __SMIAPP_QUIRK__ */
#endif /* __CCS_QUIRK__ */
// SPDX-License-Identifier: GPL-2.0-only
/*
* drivers/media/i2c/smiapp/smiapp-regs.c
* drivers/media/i2c/smiapp/ccs-regs.c
*
* Generic driver for SMIA/SMIA++ compliant camera modules
*
......@@ -13,8 +13,7 @@
#include <linux/delay.h>
#include <linux/i2c.h>
#include "smiapp.h"
#include "smiapp-regs.h"
#include "ccs.h"
static uint32_t float_to_u32_mul_1000000(struct i2c_client *client,
uint32_t phloat)
......@@ -66,7 +65,7 @@ static uint32_t float_to_u32_mul_1000000(struct i2c_client *client,
* Read a 8/16/32-bit i2c register. The value is returned in 'val'.
* Returns zero if successful, or non-zero otherwise.
*/
static int ____ccs_read_addr(struct smiapp_sensor *sensor, u16 reg, u16 len,
static int ____ccs_read_addr(struct ccs_sensor *sensor, u16 reg, u16 len,
u32 *val)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
......@@ -113,7 +112,7 @@ static int ____ccs_read_addr(struct smiapp_sensor *sensor, u16 reg, u16 len,
}
/* Read a register using 8-bit access only. */
static int ____ccs_read_addr_8only(struct smiapp_sensor *sensor, u16 reg,
static int ____ccs_read_addr_8only(struct ccs_sensor *sensor, u16 reg,
u16 len, u32 *val)
{
unsigned int i;
......@@ -147,7 +146,7 @@ unsigned int ccs_reg_width(u32 reg)
* Read a 8/16/32-bit i2c register. The value is returned in 'val'.
* Returns zero if successful, or non-zero otherwise.
*/
static int __ccs_read_addr(struct smiapp_sensor *sensor, u32 reg, u32 *val,
static int __ccs_read_addr(struct ccs_sensor *sensor, u32 reg, u32 *val,
bool only8)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
......@@ -155,11 +154,10 @@ static int __ccs_read_addr(struct smiapp_sensor *sensor, u32 reg, u32 *val,
int rval;
if (!only8)
rval = ____ccs_read_addr(sensor, SMIAPP_REG_ADDR(reg), len,
val);
rval = ____ccs_read_addr(sensor, CCS_REG_ADDR(reg), len, val);
else
rval = ____ccs_read_addr_8only(sensor, SMIAPP_REG_ADDR(reg),
len, val);
rval = ____ccs_read_addr_8only(sensor, CCS_REG_ADDR(reg), len,
val);
if (rval < 0)
return rval;
......@@ -169,21 +167,20 @@ static int __ccs_read_addr(struct smiapp_sensor *sensor, u32 reg, u32 *val,
return 0;
}
int ccs_read_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val)
int ccs_read_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 *val)
{
return __ccs_read_addr(
sensor, reg, val,
smiapp_needs_quirk(sensor,
SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY));
ccs_needs_quirk(sensor, CCS_QUIRK_FLAG_8BIT_READ_ONLY));
}
static int ccs_read_addr_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val,
static int ccs_read_addr_quirk(struct ccs_sensor *sensor, u32 reg, u32 *val,
bool force8)
{
int rval;
*val = 0;
rval = smiapp_call_quirk(sensor, reg_access, false, &reg, val);
rval = ccs_call_quirk(sensor, reg_access, false, &reg, val);
if (rval == -ENOIOCTLCMD)
return 0;
if (rval < 0)
......@@ -195,17 +192,17 @@ static int ccs_read_addr_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val,
return ccs_read_addr_no_quirk(sensor, reg, val);
}
int ccs_read_addr(struct smiapp_sensor *sensor, u32 reg, u32 *val)
int ccs_read_addr(struct ccs_sensor *sensor, u32 reg, u32 *val)
{
return ccs_read_addr_quirk(sensor, reg, val, false);
}
int ccs_read_addr_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
int ccs_read_addr_8only(struct ccs_sensor *sensor, u32 reg, u32 *val)
{
return ccs_read_addr_quirk(sensor, reg, val, true);
}
int ccs_write_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
int ccs_write_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 val)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
struct i2c_msg msg;
......@@ -222,7 +219,7 @@ int ccs_write_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
msg.len = 2 + len;
msg.buf = data;
put_unaligned_be16(SMIAPP_REG_ADDR(reg), data);
put_unaligned_be16(CCS_REG_ADDR(reg), data);
put_unaligned_be32(val << (8 * (sizeof(val) - len)), data + 2);
for (retries = 0; retries < 5; retries++) {
......@@ -245,7 +242,7 @@ int ccs_write_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
dev_err(&client->dev,
"wrote 0x%x to offset 0x%x error %d\n", val,
SMIAPP_REG_ADDR(reg), r);
CCS_REG_ADDR(reg), r);
return r;
}
......@@ -254,11 +251,11 @@ int ccs_write_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
* Write to a 8/16-bit register.
* Returns zero if successful, or non-zero otherwise.
*/
int ccs_write_addr(struct smiapp_sensor *sensor, u32 reg, u32 val)
int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val)
{
int rval;
rval = smiapp_call_quirk(sensor, reg_access, true, &reg, &val);
rval = ccs_call_quirk(sensor, reg_access, true, &reg, &val);
if (rval == -ENOIOCTLCMD)
return 0;
if (rval < 0)
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* include/media/smiapp/smiapp-regs.h
* include/media/smiapp/ccs-regs.h
*
* Generic driver for SMIA/SMIA++ compliant camera modules
*
......@@ -16,15 +16,15 @@
#include "ccs-regs.h"
#define SMIAPP_REG_ADDR(reg) ((u16)reg)
#define CCS_REG_ADDR(reg) ((u16)reg)
struct smiapp_sensor;
struct ccs_sensor;
int ccs_read_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr(struct smiapp_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val);
int ccs_write_addr_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val);
int ccs_write_addr(struct smiapp_sensor *sensor, u32 reg, u32 val);
int ccs_read_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr_8only(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_write_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 val);
int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val);
unsigned int ccs_reg_width(u32 reg);
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* drivers/media/i2c/smiapp/smiapp.h
* drivers/media/i2c/smiapp/ccs.h
*
* Generic driver for SMIA/SMIA++ compliant camera modules
*
......@@ -8,19 +8,18 @@
* Contact: Sakari Ailus <sakari.ailus@iki.fi>
*/
#ifndef __SMIAPP_PRIV_H_
#define __SMIAPP_PRIV_H_
#ifndef __CCS_H__
#define __CCS_H__
#include <linux/mutex.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
#include "ccs-quirk.h"
#include "ccs-regs.h"
#include "smiapp-pll.h"
#include "ccs-reg-access.h"
#include "../smiapp-pll.h"
#include "smiapp-reg-defs.h"
#include "smiapp-regs.h"
#include "smiapp-quirk.h"
/*
* Standard SMIA++ constants
......@@ -41,12 +40,13 @@
(1000 + (SMIAPP_RESET_DELAY_CLOCKS * 1000 \
+ (clk) / 1000 - 1) / ((clk) / 1000))
#define SMIAPP_COLOUR_COMPONENTS 4
#define CCS_COLOUR_COMPONENTS 4
#define SMIAPP_NAME "smiapp"
#define SMIAPP_NAME "smiapp"
#define CCS_NAME "ccs"
#define SMIAPP_DFL_I2C_ADDR (0x20 >> 1) /* Default I2C Address */
#define SMIAPP_ALT_I2C_ADDR (0x6e >> 1) /* Alternate I2C Address */
#define CCS_DFL_I2C_ADDR (0x20 >> 1) /* Default I2C Address */
#define CCS_ALT_I2C_ADDR (0x6e >> 1) /* Alternate I2C Address */
/*
* Sometimes due to board layout considerations the camera module can be
......@@ -54,12 +54,12 @@
* corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
* FIXME: rotation also changes the bayer pattern.
*/
enum smiapp_module_board_orient {
SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
SMIAPP_MODULE_BOARD_ORIENT_180,
enum ccs_module_board_orient {
CCS_MODULE_BOARD_ORIENT_0 = 0,
CCS_MODULE_BOARD_ORIENT_180,
};
struct smiapp_flash_strobe_parms {
struct ccs_flash_strobe_parms {
u8 mode;
u32 strobe_width_high_us;
u16 strobe_delay;
......@@ -67,7 +67,7 @@ struct smiapp_flash_strobe_parms {
u8 trigger;
};
struct smiapp_hwconfig {
struct ccs_hwconfig {
/*
* Change the cci address if i2c_addr_alt is set.
* Both default and alternate cci addr need to be present
......@@ -78,19 +78,19 @@ struct smiapp_hwconfig {
uint32_t ext_clk; /* sensor external clk */
unsigned int lanes; /* Number of CSI-2 lanes */
uint32_t csi_signalling_mode; /* SMIAPP_CSI_SIGNALLING_MODE_* */
uint32_t csi_signalling_mode; /* CCS_CSI_SIGNALLING_MODE_* */
uint64_t *op_sys_clock;
enum smiapp_module_board_orient module_board_orient;
enum ccs_module_board_orient module_board_orient;
struct smiapp_flash_strobe_parms *strobe_setup;
struct ccs_flash_strobe_parms *strobe_setup;
};
struct smiapp_quirk;
struct ccs_quirk;
#define SMIAPP_MODULE_IDENT_FLAG_REV_LE (1 << 0)
#define CCS_MODULE_IDENT_FLAG_REV_LE (1 << 0)
struct smiapp_module_ident {
struct ccs_module_ident {
u16 mipi_manufacturer_id;
u16 model_id;
u8 smia_manufacturer_id;
......@@ -99,10 +99,10 @@ struct smiapp_module_ident {
u8 flags;
char *name;
const struct smiapp_quirk *quirk;
const struct ccs_quirk *quirk;
};
struct smiapp_module_info {
struct ccs_module_info {
u32 smia_manufacturer_id;
u32 mipi_manufacturer_id;
u32 model_id;
......@@ -126,10 +126,10 @@ struct smiapp_module_info {
u32 smiapp_profile;
char *name;
const struct smiapp_quirk *quirk;
const struct ccs_quirk *quirk;
};
#define SMIAPP_IDENT_FQ(manufacturer, model, rev, fl, _name, _quirk) \
#define CCS_IDENT_FQ(manufacturer, model, rev, fl, _name, _quirk) \
{ .smia_manufacturer_id = manufacturer, \
.model_id = model, \
.revision_number_major = rev, \
......@@ -137,22 +137,22 @@ struct smiapp_module_info {
.name = _name, \
.quirk = _quirk, }
#define SMIAPP_IDENT_LQ(manufacturer, model, rev, _name, _quirk) \
#define CCS_IDENT_LQ(manufacturer, model, rev, _name, _quirk) \
{ .smia_manufacturer_id = manufacturer, \
.model_id = model, \
.revision_number_major = rev, \
.flags = SMIAPP_MODULE_IDENT_FLAG_REV_LE, \
.flags = CCS_MODULE_IDENT_FLAG_REV_LE, \
.name = _name, \
.quirk = _quirk, }
#define SMIAPP_IDENT_L(manufacturer, model, rev, _name) \
#define CCS_IDENT_L(manufacturer, model, rev, _name) \
{ .smia_manufacturer_id = manufacturer, \
.model_id = model, \
.revision_number_major = rev, \
.flags = SMIAPP_MODULE_IDENT_FLAG_REV_LE, \
.flags = CCS_MODULE_IDENT_FLAG_REV_LE, \
.name = _name, }
#define SMIAPP_IDENT_Q(manufacturer, model, rev, _name, _quirk) \
#define CCS_IDENT_Q(manufacturer, model, rev, _name, _quirk) \
{ .smia_manufacturer_id = manufacturer, \
.model_id = model, \
.revision_number_major = rev, \
......@@ -160,49 +160,49 @@ struct smiapp_module_info {
.name = _name, \
.quirk = _quirk, }
#define SMIAPP_IDENT(manufacturer, model, rev, _name) \
#define CCS_IDENT(manufacturer, model, rev, _name) \
{ .smia_manufacturer_id = manufacturer, \
.model_id = model, \
.revision_number_major = rev, \
.flags = 0, \
.name = _name, }
struct smiapp_csi_data_format {
struct ccs_csi_data_format {
u32 code;
u8 width;
u8 compressed;
u8 pixel_order;
};
#define SMIAPP_SUBDEVS 3
#define CCS_SUBDEVS 3
#define SMIAPP_PA_PAD_SRC 0
#define SMIAPP_PAD_SINK 0
#define SMIAPP_PAD_SRC 1
#define SMIAPP_PADS 2
#define CCS_PA_PAD_SRC 0
#define CCS_PAD_SINK 0
#define CCS_PAD_SRC 1
#define CCS_PADS 2
struct smiapp_binning_subtype {
struct ccs_binning_subtype {
u8 horizontal:4;
u8 vertical:4;
} __packed;
struct smiapp_subdev {
struct ccs_subdev {
struct v4l2_subdev sd;
struct media_pad pads[SMIAPP_PADS];
struct media_pad pads[CCS_PADS];
struct v4l2_rect sink_fmt;
struct v4l2_rect crop[SMIAPP_PADS];
struct v4l2_rect crop[CCS_PADS];
struct v4l2_rect compose; /* compose on sink */
unsigned short sink_pad;
unsigned short source_pad;
int npads;
struct smiapp_sensor *sensor;
struct ccs_sensor *sensor;
struct v4l2_ctrl_handler ctrl_handler;
};
/*
* struct smiapp_sensor - Main device structure
* struct ccs_sensor - Main device structure
*/
struct smiapp_sensor {
struct ccs_sensor {
/*
* "mutex" is used to serialise access to all fields here
* except v4l2_ctrls at the end of the struct. "mutex" is also
......@@ -210,22 +210,22 @@ struct smiapp_sensor {
* information.
*/
struct mutex mutex;
struct smiapp_subdev ssds[SMIAPP_SUBDEVS];
struct ccs_subdev ssds[CCS_SUBDEVS];
u32 ssds_used;
struct smiapp_subdev *src;
struct smiapp_subdev *binner;
struct smiapp_subdev *scaler;
struct smiapp_subdev *pixel_array;
struct smiapp_hwconfig *hwcfg;
struct ccs_subdev *src;
struct ccs_subdev *binner;
struct ccs_subdev *scaler;
struct ccs_subdev *pixel_array;
struct ccs_hwconfig *hwcfg;
struct regulator *vana;
struct clk *ext_clk;
struct gpio_desc *xshutdown;
void *ccs_limits;
u8 nbinning_subtypes;
struct smiapp_binning_subtype binning_subtypes[CCS_LIM_BINNING_SUB_TYPE_MAX_N + 1];
struct ccs_binning_subtype binning_subtypes[CCS_LIM_BINNING_SUB_TYPE_MAX_N + 1];
u32 mbus_frame_fmts;
const struct smiapp_csi_data_format *csi_format;
const struct smiapp_csi_data_format *internal_csi_format;
const struct ccs_csi_data_format *csi_format;
const struct ccs_csi_data_format *internal_csi_format;
u32 default_mbus_frame_fmts;
int default_pixel_order;
......@@ -246,7 +246,7 @@ struct smiapp_sensor {
bool dev_init_done;
u8 compressed_min_bpp;
struct smiapp_module_info minfo;
struct ccs_module_info minfo;
struct smiapp_pll pll;
......@@ -265,16 +265,16 @@ struct smiapp_sensor {
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate_csi;
/* test pattern colour components */
struct v4l2_ctrl *test_data[SMIAPP_COLOUR_COMPONENTS];
struct v4l2_ctrl *test_data[CCS_COLOUR_COMPONENTS];
};
#define to_smiapp_subdev(_sd) \
container_of(_sd, struct smiapp_subdev, sd)
#define to_ccs_subdev(_sd) \
container_of(_sd, struct ccs_subdev, sd)
#define to_smiapp_sensor(_sd) \
(to_smiapp_subdev(_sd)->sensor)
#define to_ccs_sensor(_sd) \
(to_ccs_subdev(_sd)->sensor)
void ccs_replace_limit(struct smiapp_sensor *sensor,
void ccs_replace_limit(struct ccs_sensor *sensor,
unsigned int limit, unsigned int offset, u32 val);
#endif /* __SMIAPP_PRIV_H_ */
#endif /* __CCS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment