Commit 57cf33cc authored by Radoslav Tsvetkov's avatar Radoslav Tsvetkov Committed by Hans Verkuil

media: qcom: camss: Attach formats to CSID resources

Following the example of VFE, move all formats of the decoder
to camss-csid.c and attach them to the subdevices resources.
Signed-off-by: default avatarRadoslav Tsvetkov <quic_rtsvetko@quicinc.com>
Signed-off-by: default avatarGjorgji Rosikopulos <quic_grosikop@quicinc.com>
Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp/sm8250/sdm845/apq8016
Acked-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 6c46cb0d
...@@ -45,128 +45,6 @@ ...@@ -45,128 +45,6 @@
#define CAMSS_CSID_TG_DT_n_CGG_1(n) (0x0b0 + 0xc * (n)) #define CAMSS_CSID_TG_DT_n_CGG_1(n) (0x0b0 + 0xc * (n))
#define CAMSS_CSID_TG_DT_n_CGG_2(n) (0x0b4 + 0xc * (n)) #define CAMSS_CSID_TG_DT_n_CGG_2(n) (0x0b4 + 0xc * (n))
static const struct csid_format csid_formats[] = {
{
MEDIA_BUS_FMT_UYVY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_VYUY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YUYV8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YVYU8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_SBGGR8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGBRG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGRBG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SRGGB8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SBGGR10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGBRG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGRBG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SRGGB10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SBGGR12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGBRG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGRBG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SRGGB12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_Y10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
};
static void csid_configure_stream(struct csid_device *csid, u8 enable) static void csid_configure_stream(struct csid_device *csid, u8 enable)
{ {
struct csid_testgen_config *tg = &csid->testgen; struct csid_testgen_config *tg = &csid->testgen;
...@@ -174,7 +52,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -174,7 +52,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
if (enable) { if (enable) {
struct v4l2_mbus_framefmt *input_format; struct v4l2_mbus_framefmt *input_format;
const struct csid_format *format; const struct csid_format_info *format;
u8 vc = 0; /* Virtual Channel 0 */ u8 vc = 0; /* Virtual Channel 0 */
u8 cid = vc * 4; /* id of Virtual Channel and Data Type set */ u8 cid = vc * 4; /* id of Virtual Channel and Data Type set */
u8 dt_shift; u8 dt_shift;
...@@ -184,7 +62,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -184,7 +62,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
u32 num_lines, num_bytes_per_line; u32 num_lines, num_bytes_per_line;
input_format = &csid->fmt[MSM_CSID_PAD_SRC]; input_format = &csid->fmt[MSM_CSID_PAD_SRC];
format = csid_get_fmt_entry(csid->formats, csid->nformats, format = csid_get_fmt_entry(csid->res->formats->formats,
csid->res->formats->nformats,
input_format->code); input_format->code);
num_bytes_per_line = input_format->width * format->bpp * format->spp / 8; num_bytes_per_line = input_format->width * format->bpp * format->spp / 8;
num_lines = input_format->height; num_lines = input_format->height;
...@@ -211,7 +90,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -211,7 +90,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
struct csid_phy_config *phy = &csid->phy; struct csid_phy_config *phy = &csid->phy;
input_format = &csid->fmt[MSM_CSID_PAD_SINK]; input_format = &csid->fmt[MSM_CSID_PAD_SINK];
format = csid_get_fmt_entry(csid->formats, csid->nformats, format = csid_get_fmt_entry(csid->res->formats->formats,
csid->res->formats->nformats,
input_format->code); input_format->code);
val = phy->lane_cnt - 1; val = phy->lane_cnt - 1;
...@@ -311,8 +191,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code, ...@@ -311,8 +191,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code,
static void csid_subdev_init(struct csid_device *csid) static void csid_subdev_init(struct csid_device *csid)
{ {
csid->formats = csid_formats;
csid->nformats = ARRAY_SIZE(csid_formats);
csid->testgen.modes = csid_testgen_modes; csid->testgen.modes = csid_testgen_modes;
csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN1; csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN1;
} }
......
...@@ -44,156 +44,6 @@ ...@@ -44,156 +44,6 @@
#define CAMSS_CSID_TG_DT_n_CGG_1(n) (0x0b8 + 0xc * (n)) #define CAMSS_CSID_TG_DT_n_CGG_1(n) (0x0b8 + 0xc * (n))
#define CAMSS_CSID_TG_DT_n_CGG_2(n) (0x0bc + 0xc * (n)) #define CAMSS_CSID_TG_DT_n_CGG_2(n) (0x0bc + 0xc * (n))
static const struct csid_format csid_formats[] = {
{
MEDIA_BUS_FMT_UYVY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_VYUY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YUYV8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YVYU8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_SBGGR8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGBRG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGRBG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SRGGB8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SBGGR10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGBRG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGRBG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SRGGB10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SBGGR12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGBRG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGRBG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SRGGB12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SBGGR14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SGBRG14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SGRBG14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SRGGB14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_Y10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
};
static void csid_configure_stream(struct csid_device *csid, u8 enable) static void csid_configure_stream(struct csid_device *csid, u8 enable)
{ {
struct csid_testgen_config *tg = &csid->testgen; struct csid_testgen_config *tg = &csid->testgen;
...@@ -203,7 +53,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -203,7 +53,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
if (enable) { if (enable) {
struct v4l2_mbus_framefmt *input_format; struct v4l2_mbus_framefmt *input_format;
const struct csid_format *format; const struct csid_format_info *format;
u8 vc = 0; /* Virtual Channel 0 */ u8 vc = 0; /* Virtual Channel 0 */
u8 cid = vc * 4; /* id of Virtual Channel and Data Type set */ u8 cid = vc * 4; /* id of Virtual Channel and Data Type set */
u8 dt_shift; u8 dt_shift;
...@@ -213,7 +63,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -213,7 +63,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
u32 num_bytes_per_line, num_lines; u32 num_bytes_per_line, num_lines;
input_format = &csid->fmt[MSM_CSID_PAD_SRC]; input_format = &csid->fmt[MSM_CSID_PAD_SRC];
format = csid_get_fmt_entry(csid->formats, csid->nformats, format = csid_get_fmt_entry(csid->res->formats->formats,
csid->res->formats->nformats,
input_format->code); input_format->code);
num_bytes_per_line = input_format->width * format->bpp * format->spp / 8; num_bytes_per_line = input_format->width * format->bpp * format->spp / 8;
num_lines = input_format->height; num_lines = input_format->height;
...@@ -240,7 +91,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) ...@@ -240,7 +91,8 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable)
struct csid_phy_config *phy = &csid->phy; struct csid_phy_config *phy = &csid->phy;
input_format = &csid->fmt[MSM_CSID_PAD_SINK]; input_format = &csid->fmt[MSM_CSID_PAD_SINK];
format = csid_get_fmt_entry(csid->formats, csid->nformats, format = csid_get_fmt_entry(csid->res->formats->formats,
csid->res->formats->nformats,
input_format->code); input_format->code);
val = phy->lane_cnt - 1; val = phy->lane_cnt - 1;
...@@ -387,8 +239,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code, ...@@ -387,8 +239,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code,
static void csid_subdev_init(struct csid_device *csid) static void csid_subdev_init(struct csid_device *csid)
{ {
csid->formats = csid_formats;
csid->nformats = ARRAY_SIZE(csid_formats);
csid->testgen.modes = csid_testgen_modes; csid->testgen.modes = csid_testgen_modes;
csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN1; csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN1;
} }
......
...@@ -176,163 +176,6 @@ ...@@ -176,163 +176,6 @@
#define TPG_COLOR_BOX_CFG_MODE 0 #define TPG_COLOR_BOX_CFG_MODE 0
#define TPG_COLOR_BOX_PATTERN_SEL 2 #define TPG_COLOR_BOX_PATTERN_SEL 2
static const struct csid_format csid_formats[] = {
{
MEDIA_BUS_FMT_UYVY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_VYUY8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YUYV8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_YVYU8_1X16,
DATA_TYPE_YUV422_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
2,
},
{
MEDIA_BUS_FMT_SBGGR8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGBRG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SGRBG8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SRGGB8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_SBGGR10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGBRG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SGRBG10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SRGGB10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_Y8_1X8,
DATA_TYPE_RAW_8BIT,
DECODE_FORMAT_UNCOMPRESSED_8_BIT,
8,
1,
},
{
MEDIA_BUS_FMT_Y10_1X10,
DATA_TYPE_RAW_10BIT,
DECODE_FORMAT_UNCOMPRESSED_10_BIT,
10,
1,
},
{
MEDIA_BUS_FMT_SBGGR12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGBRG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SGRBG12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SRGGB12_1X12,
DATA_TYPE_RAW_12BIT,
DECODE_FORMAT_UNCOMPRESSED_12_BIT,
12,
1,
},
{
MEDIA_BUS_FMT_SBGGR14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SGBRG14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SGRBG14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
{
MEDIA_BUS_FMT_SRGGB14_1X14,
DATA_TYPE_RAW_14BIT,
DECODE_FORMAT_UNCOMPRESSED_14_BIT,
14,
1,
},
};
static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc)
{ {
struct csid_testgen_config *tg = &csid->testgen; struct csid_testgen_config *tg = &csid->testgen;
...@@ -341,8 +184,9 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc) ...@@ -341,8 +184,9 @@ static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc)
u8 lane_cnt = csid->phy.lane_cnt; u8 lane_cnt = csid->phy.lane_cnt;
/* Source pads matching RDI channels on hardware. Pad 1 -> RDI0, Pad 2 -> RDI1, etc. */ /* Source pads matching RDI channels on hardware. Pad 1 -> RDI0, Pad 2 -> RDI1, etc. */
struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + vc]; struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + vc];
const struct csid_format *format = csid_get_fmt_entry(csid->formats, csid->nformats, const struct csid_format_info *format = csid_get_fmt_entry(csid->res->formats->formats,
input_format->code); csid->res->formats->nformats,
input_format->code);
if (!lane_cnt) if (!lane_cnt)
lane_cnt = 4; lane_cnt = 4;
...@@ -612,8 +456,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code, ...@@ -612,8 +456,6 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code,
static void csid_subdev_init(struct csid_device *csid) static void csid_subdev_init(struct csid_device *csid)
{ {
csid->formats = csid_formats;
csid->nformats = ARRAY_SIZE(csid_formats);
csid->testgen.modes = csid_testgen_modes; csid->testgen.modes = csid_testgen_modes;
csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2; csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2;
} }
......
...@@ -67,7 +67,7 @@ enum csid_testgen_mode { ...@@ -67,7 +67,7 @@ enum csid_testgen_mode {
CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2 = 9, /* excluding disabled */ CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2 = 9, /* excluding disabled */
}; };
struct csid_format { struct csid_format_info {
u32 code; u32 code;
u8 data_type; u8 data_type;
u8 decode_format; u8 decode_format;
...@@ -75,6 +75,11 @@ struct csid_format { ...@@ -75,6 +75,11 @@ struct csid_format {
u8 spp; /* bus samples per pixel */ u8 spp; /* bus samples per pixel */
}; };
struct csid_formats {
unsigned int nformats;
const struct csid_format_info *formats;
};
struct csid_testgen_config { struct csid_testgen_config {
enum csid_testgen_mode mode; enum csid_testgen_mode mode;
const char * const*modes; const char * const*modes;
...@@ -152,6 +157,7 @@ struct csid_hw_ops { ...@@ -152,6 +157,7 @@ struct csid_hw_ops {
struct csid_subdev_resources { struct csid_subdev_resources {
bool is_lite; bool is_lite;
const struct csid_hw_ops *hw_ops; const struct csid_hw_ops *hw_ops;
const struct csid_formats *formats;
}; };
struct csid_device { struct csid_device {
...@@ -172,8 +178,6 @@ struct csid_device { ...@@ -172,8 +178,6 @@ struct csid_device {
struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM]; struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM];
struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *testgen_mode; struct v4l2_ctrl *testgen_mode;
const struct csid_format *formats;
unsigned int nformats;
const struct csid_subdev_resources *res; const struct csid_subdev_resources *res;
}; };
...@@ -193,16 +197,16 @@ u32 csid_find_code(u32 *codes, unsigned int ncode, ...@@ -193,16 +197,16 @@ u32 csid_find_code(u32 *codes, unsigned int ncode,
unsigned int match_format_idx, u32 match_code); unsigned int match_format_idx, u32 match_code);
/* /*
* csid_get_fmt_entry - Find csid_format entry with matching format code * csid_get_fmt_entry - Find csid_format_info entry with matching format code
* @formats: Array of format csid_format entries * @formats: Array of format csid_format_info entries
* @nformats: Length of @nformats array * @nformats: Length of @nformats array
* @code: Desired format code * @code: Desired format code
* *
* Return formats[0] on failure to find code * Return formats[0] on failure to find code
*/ */
const struct csid_format *csid_get_fmt_entry(const struct csid_format *formats, const struct csid_format_info *csid_get_fmt_entry(const struct csid_format_info *formats,
unsigned int nformats, unsigned int nformats,
u32 code); u32 code);
int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
const struct camss_subdev_resources *res, u8 id); const struct camss_subdev_resources *res, u8 id);
...@@ -216,6 +220,10 @@ void msm_csid_get_csid_id(struct media_entity *entity, u8 *id); ...@@ -216,6 +220,10 @@ void msm_csid_get_csid_id(struct media_entity *entity, u8 *id);
extern const char * const csid_testgen_modes[]; extern const char * const csid_testgen_modes[];
extern const struct csid_formats csid_formats_4_1;
extern const struct csid_formats csid_formats_4_7;
extern const struct csid_formats csid_formats_gen2;
extern const struct csid_hw_ops csid_ops_4_1; extern const struct csid_hw_ops csid_ops_4_1;
extern const struct csid_hw_ops csid_ops_4_7; extern const struct csid_hw_ops csid_ops_4_7;
extern const struct csid_hw_ops csid_ops_gen2; extern const struct csid_hw_ops csid_ops_gen2;
......
...@@ -81,7 +81,8 @@ static const struct camss_subdev_resources csid_res_8x16[] = { ...@@ -81,7 +81,8 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_1 .hw_ops = &csid_ops_4_1,
.formats = &csid_formats_4_1
} }
}, },
...@@ -101,7 +102,8 @@ static const struct camss_subdev_resources csid_res_8x16[] = { ...@@ -101,7 +102,8 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_1 .hw_ops = &csid_ops_4_1,
.formats = &csid_formats_4_1
} }
}, },
}; };
...@@ -208,7 +210,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = { ...@@ -208,7 +210,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -228,7 +231,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = { ...@@ -228,7 +231,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -248,7 +252,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = { ...@@ -248,7 +252,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.reg = { "csid2" }, .reg = { "csid2" },
.interrupt = { "csid2" }, .interrupt = { "csid2" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -268,7 +273,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = { ...@@ -268,7 +273,8 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
.reg = { "csid3" }, .reg = { "csid3" },
.interrupt = { "csid3" }, .interrupt = { "csid3" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
} }
}; };
...@@ -410,7 +416,8 @@ static const struct camss_subdev_resources csid_res_660[] = { ...@@ -410,7 +416,8 @@ static const struct camss_subdev_resources csid_res_660[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -433,7 +440,8 @@ static const struct camss_subdev_resources csid_res_660[] = { ...@@ -433,7 +440,8 @@ static const struct camss_subdev_resources csid_res_660[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -456,7 +464,8 @@ static const struct camss_subdev_resources csid_res_660[] = { ...@@ -456,7 +464,8 @@ static const struct camss_subdev_resources csid_res_660[] = {
.reg = { "csid2" }, .reg = { "csid2" },
.interrupt = { "csid2" }, .interrupt = { "csid2" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
}, },
...@@ -479,7 +488,8 @@ static const struct camss_subdev_resources csid_res_660[] = { ...@@ -479,7 +488,8 @@ static const struct camss_subdev_resources csid_res_660[] = {
.reg = { "csid3" }, .reg = { "csid3" },
.interrupt = { "csid3" }, .interrupt = { "csid3" },
.csid = { .csid = {
.hw_ops = &csid_ops_4_7 .hw_ops = &csid_ops_4_7,
.formats = &csid_formats_4_7
} }
} }
}; };
...@@ -660,7 +670,8 @@ static const struct camss_subdev_resources csid_res_845[] = { ...@@ -660,7 +670,8 @@ static const struct camss_subdev_resources csid_res_845[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
...@@ -683,7 +694,8 @@ static const struct camss_subdev_resources csid_res_845[] = { ...@@ -683,7 +694,8 @@ static const struct camss_subdev_resources csid_res_845[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
...@@ -707,7 +719,8 @@ static const struct camss_subdev_resources csid_res_845[] = { ...@@ -707,7 +719,8 @@ static const struct camss_subdev_resources csid_res_845[] = {
.interrupt = { "csid2" }, .interrupt = { "csid2" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
} }
}; };
...@@ -882,7 +895,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { ...@@ -882,7 +895,8 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID1 */ /* CSID1 */
...@@ -897,7 +911,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { ...@@ -897,7 +911,8 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID2 */ /* CSID2 */
...@@ -912,7 +927,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { ...@@ -912,7 +927,8 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.interrupt = { "csid2" }, .interrupt = { "csid2" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID3 */ /* CSID3 */
...@@ -927,7 +943,8 @@ static const struct camss_subdev_resources csid_res_8250[] = { ...@@ -927,7 +943,8 @@ static const struct camss_subdev_resources csid_res_8250[] = {
.interrupt = { "csid3" }, .interrupt = { "csid3" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
} }
}; };
...@@ -1121,7 +1138,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1121,7 +1138,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.reg = { "csid0" }, .reg = { "csid0" },
.interrupt = { "csid0" }, .interrupt = { "csid0" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID1 */ /* CSID1 */
...@@ -1135,7 +1153,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1135,7 +1153,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.reg = { "csid1" }, .reg = { "csid1" },
.interrupt = { "csid1" }, .interrupt = { "csid1" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID2 */ /* CSID2 */
...@@ -1149,7 +1168,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1149,7 +1168,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.reg = { "csid2" }, .reg = { "csid2" },
.interrupt = { "csid2" }, .interrupt = { "csid2" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID3 */ /* CSID3 */
...@@ -1163,7 +1183,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1163,7 +1183,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.reg = { "csid3" }, .reg = { "csid3" },
.interrupt = { "csid3" }, .interrupt = { "csid3" },
.csid = { .csid = {
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID_LITE0 */ /* CSID_LITE0 */
...@@ -1177,7 +1198,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1177,7 +1198,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid0_lite" }, .interrupt = { "csid0_lite" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID_LITE1 */ /* CSID_LITE1 */
...@@ -1191,7 +1213,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1191,7 +1213,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid1_lite" }, .interrupt = { "csid1_lite" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID_LITE2 */ /* CSID_LITE2 */
...@@ -1205,7 +1228,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1205,7 +1228,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid2_lite" }, .interrupt = { "csid2_lite" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
}, },
/* CSID_LITE3 */ /* CSID_LITE3 */
...@@ -1219,7 +1243,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = { ...@@ -1219,7 +1243,8 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
.interrupt = { "csid3_lite" }, .interrupt = { "csid3_lite" },
.csid = { .csid = {
.is_lite = true, .is_lite = true,
.hw_ops = &csid_ops_gen2 .hw_ops = &csid_ops_gen2,
.formats = &csid_formats_gen2
} }
} }
}; };
......
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