Message ID | 20171214190835.7672-11-niklas.soderlund+renesas@ragnatech.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Niklas, On 14/12/17 19:08, Niklas Söderlund wrote: > This will be needed to fill out the frame descriptor information > correctly. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > drivers/media/i2c/adv748x/adv748x-csi2.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c > index 2a5dff8c571013bf..a2a6d93077204731 100644 > --- a/drivers/media/i2c/adv748x/adv748x-csi2.c > +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c > @@ -18,6 +18,28 @@ > > #include "adv748x.h" > > +struct adv748x_csi2_format { > + unsigned int code; > + unsigned int datatype; > +}; > + > +static const struct adv748x_csi2_format adv748x_csi2_formats[] = { > + { .code = MEDIA_BUS_FMT_RGB888_1X24, .datatype = 0x24, }, > + { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, }, > + { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, }, > + { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, }, > +}; Is the datatype mapping specific to the ADV748x here? or are these generic/common CSI2 mappings? What do those datatype magic numbers represent? -- Kieran > + > +static unsigned int adv748x_csi2_code_to_datatype(unsigned int code) > +{ > + unsigned int i; > + > + for (i = 0; i < ARRAY_SIZE(adv748x_csi2_formats); i++) > + if (adv748x_csi2_formats[i].code == code) > + return adv748x_csi2_formats[i].datatype; > + return 0; > +} > + > static bool is_txa(struct adv748x_csi2 *tx) > { > return tx == &tx->state->txa; >
Hi Kieran, On Thu, Dec 14, 2017 at 10:25:36PM +0000, Kieran Bingham wrote: > Hi Niklas, > > On 14/12/17 19:08, Niklas Söderlund wrote: > > This will be needed to fill out the frame descriptor information > > correctly. > > > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > > --- > > drivers/media/i2c/adv748x/adv748x-csi2.c | 22 ++++++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > > > diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c > > index 2a5dff8c571013bf..a2a6d93077204731 100644 > > --- a/drivers/media/i2c/adv748x/adv748x-csi2.c > > +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c > > @@ -18,6 +18,28 @@ > > > > #include "adv748x.h" > > > > +struct adv748x_csi2_format { > > + unsigned int code; > > + unsigned int datatype; > > +}; > > + > > +static const struct adv748x_csi2_format adv748x_csi2_formats[] = { > > + { .code = MEDIA_BUS_FMT_RGB888_1X24, .datatype = 0x24, }, > > + { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, }, > > + { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, }, > > + { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, }, YUV 422 10 bit is associated to data type 0x1d in CSI-2 specifications > > +}; > > Is the datatype mapping specific to the ADV748x here? > or are these generic/common CSI2 mappings? > > What do those datatype magic numbers represent? They are fixed mappings defined by CSI-2 specifications and they should probably be generic to all drivers imho > > -- > Kieran > > > + > > +static unsigned int adv748x_csi2_code_to_datatype(unsigned int code) > > +{ > > + unsigned int i; > > + > > + for (i = 0; i < ARRAY_SIZE(adv748x_csi2_formats); i++) > > + if (adv748x_csi2_formats[i].code == code) > > + return adv748x_csi2_formats[i].datatype; > > + return 0; > > +} > > + > > static bool is_txa(struct adv748x_csi2 *tx) > > { > > return tx == &tx->state->txa; > >
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c index 2a5dff8c571013bf..a2a6d93077204731 100644 --- a/drivers/media/i2c/adv748x/adv748x-csi2.c +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c @@ -18,6 +18,28 @@ #include "adv748x.h" +struct adv748x_csi2_format { + unsigned int code; + unsigned int datatype; +}; + +static const struct adv748x_csi2_format adv748x_csi2_formats[] = { + { .code = MEDIA_BUS_FMT_RGB888_1X24, .datatype = 0x24, }, + { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, }, + { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, }, + { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, }, +}; + +static unsigned int adv748x_csi2_code_to_datatype(unsigned int code) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(adv748x_csi2_formats); i++) + if (adv748x_csi2_formats[i].code == code) + return adv748x_csi2_formats[i].datatype; + return 0; +} + static bool is_txa(struct adv748x_csi2 *tx) { return tx == &tx->state->txa;
This will be needed to fill out the frame descriptor information correctly. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> --- drivers/media/i2c/adv748x/adv748x-csi2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)