]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
[media] soc_camera: Add RGB666 & RGB888 formats
authorPhil Edworthy <phil.edworthy@renesas.com>
Mon, 18 Mar 2013 11:47:59 +0000 (08:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 4 Apr 2013 22:40:08 +0000 (19:40 -0300)
Based on work done by Katsuya Matsubara.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Documentation/DocBook/media/v4l/subdev-formats.xml
Documentation/DocBook/media_api.tmpl
drivers/media/platform/soc_camera/soc_mediabus.c
include/media/soc_camera.h
include/media/soc_mediabus.h
include/uapi/linux/v4l2-mediabus.h

index cc51372ed5e0c07fd277f8f67a303e5a3324599e..adc61982df7b239ebd0f0db20e35185171e2c6d3 100644 (file)
 
       <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-rgb">
        <title>RGB formats</title>
-       <tgroup cols="11">
+       <tgroup cols="27">
          <colspec colname="id" align="left" />
          <colspec colname="code" align="center"/>
          <colspec colname="bit" />
-         <colspec colnum="4" colname="b07" align="center" />
-         <colspec colnum="5" colname="b06" align="center" />
-         <colspec colnum="6" colname="b05" align="center" />
-         <colspec colnum="7" colname="b04" align="center" />
-         <colspec colnum="8" colname="b03" align="center" />
-         <colspec colnum="9" colname="b02" align="center" />
-         <colspec colnum="10" colname="b01" align="center" />
-         <colspec colnum="11" colname="b00" align="center" />
-         <spanspec namest="b07" nameend="b00" spanname="b0" />
+         <colspec colnum="4" colname="b23" align="center" />
+         <colspec colnum="5" colname="b22" align="center" />
+         <colspec colnum="6" colname="b21" align="center" />
+         <colspec colnum="7" colname="b20" align="center" />
+         <colspec colnum="8" colname="b19" align="center" />
+         <colspec colnum="9" colname="b18" align="center" />
+         <colspec colnum="10" colname="b17" align="center" />
+         <colspec colnum="11" colname="b16" align="center" />
+         <colspec colnum="12" colname="b15" align="center" />
+         <colspec colnum="13" colname="b14" align="center" />
+         <colspec colnum="14" colname="b13" align="center" />
+         <colspec colnum="15" colname="b12" align="center" />
+         <colspec colnum="16" colname="b11" align="center" />
+         <colspec colnum="17" colname="b10" align="center" />
+         <colspec colnum="18" colname="b09" align="center" />
+         <colspec colnum="19" colname="b08" align="center" />
+         <colspec colnum="20" colname="b07" align="center" />
+         <colspec colnum="21" colname="b06" align="center" />
+         <colspec colnum="22" colname="b05" align="center" />
+         <colspec colnum="23" colname="b04" align="center" />
+         <colspec colnum="24" colname="b03" align="center" />
+         <colspec colnum="25" colname="b02" align="center" />
+         <colspec colnum="26" colname="b01" align="center" />
+         <colspec colnum="27" colname="b00" align="center" />
+         <spanspec namest="b23" nameend="b00" spanname="b0" />
          <thead>
            <row>
              <entry>Identifier</entry>
              <entry></entry>
              <entry></entry>
              <entry>Bit</entry>
+             <entry>23</entry>
+             <entry>22</entry>
+             <entry>21</entry>
+             <entry>20</entry>
+             <entry>19</entry>
+             <entry>18</entry>
+             <entry>17</entry>
+             <entry>16</entry>
+             <entry>15</entry>
+             <entry>14</entry>
+             <entry>13</entry>
+             <entry>12</entry>
+             <entry>11</entry>
+             <entry>10</entry>
+             <entry>9</entry>
+             <entry>8</entry>
              <entry>7</entry>
              <entry>6</entry>
              <entry>5</entry>
              <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE</entry>
              <entry>0x1001</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>0</entry>
              <entry>0</entry>
              <entry>0</entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>3</subscript></entry>
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE</entry>
              <entry>0x1002</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>3</subscript></entry>
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>0</entry>
              <entry>0</entry>
              <entry>0</entry>
              <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE</entry>
              <entry>0x1003</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>0</entry>
              <entry>r<subscript>4</subscript></entry>
              <entry>r<subscript>3</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry>V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE</entry>
              <entry>0x1004</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>0</entry>
              <entry>r<subscript>4</subscript></entry>
              <entry>r<subscript>3</subscript></entry>
              <entry>V4L2_MBUS_FMT_BGR565_2X8_BE</entry>
              <entry>0x1005</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>b<subscript>4</subscript></entry>
              <entry>b<subscript>3</subscript></entry>
              <entry>b<subscript>2</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry>V4L2_MBUS_FMT_BGR565_2X8_LE</entry>
              <entry>0x1006</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>b<subscript>4</subscript></entry>
              <entry>b<subscript>3</subscript></entry>
              <entry>b<subscript>2</subscript></entry>
              <entry>V4L2_MBUS_FMT_RGB565_2X8_BE</entry>
              <entry>0x1007</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>r<subscript>4</subscript></entry>
              <entry>r<subscript>3</subscript></entry>
              <entry>r<subscript>2</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry>V4L2_MBUS_FMT_RGB565_2X8_LE</entry>
              <entry>0x1008</entry>
              <entry></entry>
+             &dash-ent-16;
              <entry>g<subscript>2</subscript></entry>
              <entry>g<subscript>1</subscript></entry>
              <entry>g<subscript>0</subscript></entry>
              <entry></entry>
              <entry></entry>
              <entry></entry>
+             &dash-ent-16;
+             <entry>r<subscript>4</subscript></entry>
+             <entry>r<subscript>3</subscript></entry>
+             <entry>r<subscript>2</subscript></entry>
+             <entry>r<subscript>1</subscript></entry>
+             <entry>r<subscript>0</subscript></entry>
+             <entry>g<subscript>5</subscript></entry>
+             <entry>g<subscript>4</subscript></entry>
+             <entry>g<subscript>3</subscript></entry>
+           </row>
+           <row id="V4L2-MBUS-FMT-RGB666-1X18">
+             <entry>V4L2_MBUS_FMT_RGB666_1X18</entry>
+             <entry>0x1009</entry>
+             <entry></entry>
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>r<subscript>5</subscript></entry>
              <entry>r<subscript>4</subscript></entry>
              <entry>r<subscript>3</subscript></entry>
              <entry>r<subscript>2</subscript></entry>
              <entry>g<subscript>5</subscript></entry>
              <entry>g<subscript>4</subscript></entry>
              <entry>g<subscript>3</subscript></entry>
+             <entry>g<subscript>2</subscript></entry>
+             <entry>g<subscript>1</subscript></entry>
+             <entry>g<subscript>0</subscript></entry>
+             <entry>b<subscript>5</subscript></entry>
+             <entry>b<subscript>4</subscript></entry>
+             <entry>b<subscript>3</subscript></entry>
+             <entry>b<subscript>2</subscript></entry>
+             <entry>b<subscript>1</subscript></entry>
+             <entry>b<subscript>0</subscript></entry>
+           </row>
+           <row id="V4L2-MBUS-FMT-RGB888-1X24">
+             <entry>V4L2_MBUS_FMT_RGB888_1X24</entry>
+             <entry>0x100a</entry>
+             <entry></entry>
+             <entry>r<subscript>7</subscript></entry>
+             <entry>r<subscript>6</subscript></entry>
+             <entry>r<subscript>5</subscript></entry>
+             <entry>r<subscript>4</subscript></entry>
+             <entry>r<subscript>3</subscript></entry>
+             <entry>r<subscript>2</subscript></entry>
+             <entry>r<subscript>1</subscript></entry>
+             <entry>r<subscript>0</subscript></entry>
+             <entry>g<subscript>7</subscript></entry>
+             <entry>g<subscript>6</subscript></entry>
+             <entry>g<subscript>5</subscript></entry>
+             <entry>g<subscript>4</subscript></entry>
+             <entry>g<subscript>3</subscript></entry>
+             <entry>g<subscript>2</subscript></entry>
+             <entry>g<subscript>1</subscript></entry>
+             <entry>g<subscript>0</subscript></entry>
+             <entry>b<subscript>7</subscript></entry>
+             <entry>b<subscript>6</subscript></entry>
+             <entry>b<subscript>5</subscript></entry>
+             <entry>b<subscript>4</subscript></entry>
+             <entry>b<subscript>3</subscript></entry>
+             <entry>b<subscript>2</subscript></entry>
+             <entry>b<subscript>1</subscript></entry>
+             <entry>b<subscript>0</subscript></entry>
+           </row>
+           <row id="V4L2-MBUS-FMT-RGB888-2X12-BE">
+             <entry>V4L2_MBUS_FMT_RGB888_2X12_BE</entry>
+             <entry>0x100b</entry>
+             <entry></entry>
+             &dash-ent-10;
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>r<subscript>7</subscript></entry>
+             <entry>r<subscript>6</subscript></entry>
+             <entry>r<subscript>5</subscript></entry>
+             <entry>r<subscript>4</subscript></entry>
+             <entry>r<subscript>3</subscript></entry>
+             <entry>r<subscript>2</subscript></entry>
+             <entry>r<subscript>1</subscript></entry>
+             <entry>r<subscript>0</subscript></entry>
+             <entry>g<subscript>7</subscript></entry>
+             <entry>g<subscript>6</subscript></entry>
+             <entry>g<subscript>5</subscript></entry>
+             <entry>g<subscript>4</subscript></entry>
+           </row>
+           <row>
+             <entry></entry>
+             <entry></entry>
+             <entry></entry>
+             &dash-ent-10;
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>g<subscript>3</subscript></entry>
+             <entry>g<subscript>2</subscript></entry>
+             <entry>g<subscript>1</subscript></entry>
+             <entry>g<subscript>0</subscript></entry>
+             <entry>b<subscript>7</subscript></entry>
+             <entry>b<subscript>6</subscript></entry>
+             <entry>b<subscript>5</subscript></entry>
+             <entry>b<subscript>4</subscript></entry>
+             <entry>b<subscript>3</subscript></entry>
+             <entry>b<subscript>2</subscript></entry>
+             <entry>b<subscript>1</subscript></entry>
+             <entry>b<subscript>0</subscript></entry>
+           </row>
+           <row id="V4L2-MBUS-FMT-RGB888-2X12-LE">
+             <entry>V4L2_MBUS_FMT_RGB888_2X12_LE</entry>
+             <entry>0x100c</entry>
+             <entry></entry>
+             &dash-ent-10;
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>g<subscript>3</subscript></entry>
+             <entry>g<subscript>2</subscript></entry>
+             <entry>g<subscript>1</subscript></entry>
+             <entry>g<subscript>0</subscript></entry>
+             <entry>b<subscript>7</subscript></entry>
+             <entry>b<subscript>6</subscript></entry>
+             <entry>b<subscript>5</subscript></entry>
+             <entry>b<subscript>4</subscript></entry>
+             <entry>b<subscript>3</subscript></entry>
+             <entry>b<subscript>2</subscript></entry>
+             <entry>b<subscript>1</subscript></entry>
+             <entry>b<subscript>0</subscript></entry>
+           </row>
+           <row>
+             <entry></entry>
+             <entry></entry>
+             <entry></entry>
+             &dash-ent-10;
+             <entry>-</entry>
+             <entry>-</entry>
+             <entry>r<subscript>7</subscript></entry>
+             <entry>r<subscript>6</subscript></entry>
+             <entry>r<subscript>5</subscript></entry>
+             <entry>r<subscript>4</subscript></entry>
+             <entry>r<subscript>3</subscript></entry>
+             <entry>r<subscript>2</subscript></entry>
+             <entry>r<subscript>1</subscript></entry>
+             <entry>r<subscript>0</subscript></entry>
+             <entry>g<subscript>7</subscript></entry>
+             <entry>g<subscript>6</subscript></entry>
+             <entry>g<subscript>5</subscript></entry>
+             <entry>g<subscript>4</subscript></entry>
            </row>
          </tbody>
        </tgroup>
index 1f6593deb9955ad494edef4b182bd16bf01b8ce4..6a8b7158697f9ae58b33e82d2f7becd772a6c4aa 100644 (file)
@@ -23,6 +23,7 @@
 <!-- LinuxTV v4l-dvb repository. -->
 <!ENTITY v4l-dvb               "<ulink url='http://linuxtv.org/repo/'>http://linuxtv.org/repo/</ulink>">
 <!ENTITY dash-ent-10            "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>">
+<!ENTITY dash-ent-16            "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>">
 ]>
 
 <book id="media_api">
index 89dce097a827a57d918702b0a4cd415b48ee409e..7569e7746c92b8a80bc124a975c7e55c4baa8b9c 100644 (file)
@@ -96,6 +96,42 @@ static const struct soc_mbus_lookup mbus_fmt[] = {
                .order                  = SOC_MBUS_ORDER_LE,
                .layout                 = SOC_MBUS_LAYOUT_PACKED,
        },
+}, {
+       .code = V4L2_MBUS_FMT_RGB666_1X18,
+       .fmt = {
+               .fourcc                 = V4L2_PIX_FMT_RGB32,
+               .name                   = "RGB666/32bpp",
+               .bits_per_sample        = 18,
+               .packing                = SOC_MBUS_PACKING_EXTEND32,
+               .order                  = SOC_MBUS_ORDER_LE,
+       },
+}, {
+       .code = V4L2_MBUS_FMT_RGB888_1X24,
+       .fmt = {
+               .fourcc                 = V4L2_PIX_FMT_RGB32,
+               .name                   = "RGB888/32bpp",
+               .bits_per_sample        = 24,
+               .packing                = SOC_MBUS_PACKING_EXTEND32,
+               .order                  = SOC_MBUS_ORDER_LE,
+       },
+}, {
+       .code = V4L2_MBUS_FMT_RGB888_2X12_BE,
+       .fmt = {
+               .fourcc                 = V4L2_PIX_FMT_RGB32,
+               .name                   = "RGB888/32bpp",
+               .bits_per_sample        = 12,
+               .packing                = SOC_MBUS_PACKING_EXTEND32,
+               .order                  = SOC_MBUS_ORDER_BE,
+       },
+}, {
+       .code = V4L2_MBUS_FMT_RGB888_2X12_LE,
+       .fmt = {
+               .fourcc                 = V4L2_PIX_FMT_RGB32,
+               .name                   = "RGB888/32bpp",
+               .bits_per_sample        = 12,
+               .packing                = SOC_MBUS_PACKING_EXTEND32,
+               .order                  = SOC_MBUS_ORDER_LE,
+       },
 }, {
        .code = V4L2_MBUS_FMT_SBGGR8_1X8,
        .fmt = {
@@ -358,6 +394,10 @@ int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
                *numerator = 1;
                *denominator = 1;
                return 0;
+       case SOC_MBUS_PACKING_EXTEND32:
+               *numerator = 1;
+               *denominator = 1;
+               return 0;
        case SOC_MBUS_PACKING_2X8_PADHI:
        case SOC_MBUS_PACKING_2X8_PADLO:
                *numerator = 2;
@@ -392,6 +432,8 @@ s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf)
                return width * 3 / 2;
        case SOC_MBUS_PACKING_VARIABLE:
                return 0;
+       case SOC_MBUS_PACKING_EXTEND32:
+               return width * 4;
        }
        return -EINVAL;
 }
index 2cc70cf318bf25938212eb305e571d660fb1a451..ff77d08c30fda6062bdcc45ccdf8327e1560b506 100644 (file)
@@ -292,12 +292,17 @@ struct soc_camera_sense {
 #define SOCAM_DATAWIDTH_8      SOCAM_DATAWIDTH(8)
 #define SOCAM_DATAWIDTH_9      SOCAM_DATAWIDTH(9)
 #define SOCAM_DATAWIDTH_10     SOCAM_DATAWIDTH(10)
+#define SOCAM_DATAWIDTH_12     SOCAM_DATAWIDTH(12)
 #define SOCAM_DATAWIDTH_15     SOCAM_DATAWIDTH(15)
 #define SOCAM_DATAWIDTH_16     SOCAM_DATAWIDTH(16)
+#define SOCAM_DATAWIDTH_18     SOCAM_DATAWIDTH(18)
+#define SOCAM_DATAWIDTH_24     SOCAM_DATAWIDTH(24)
 
 #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
                              SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
-                             SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16)
+                             SOCAM_DATAWIDTH_12 | SOCAM_DATAWIDTH_15 | \
+                             SOCAM_DATAWIDTH_16 | SOCAM_DATAWIDTH_18 | \
+                             SOCAM_DATAWIDTH_24)
 
 static inline void soc_camera_limit_side(int *start, int *length,
                unsigned int start_min,
index 0dc6f4625b920021fa573bfe06918d58c120296c..d33f6d05969297bdc33b02c757dcb169d0a46b91 100644 (file)
@@ -26,6 +26,8 @@
  * @SOC_MBUS_PACKING_VARIABLE: compressed formats with variable packing
  * @SOC_MBUS_PACKING_1_5X8:    used for packed YUV 4:2:0 formats, where 4
  *                             pixels occupy 6 bytes in RAM
+ * @SOC_MBUS_PACKING_EXTEND32: sample width (e.g., 24 bits) has to be extended
+ *                             to 32 bits
  */
 enum soc_mbus_packing {
        SOC_MBUS_PACKING_NONE,
@@ -34,6 +36,7 @@ enum soc_mbus_packing {
        SOC_MBUS_PACKING_EXTEND16,
        SOC_MBUS_PACKING_VARIABLE,
        SOC_MBUS_PACKING_1_5X8,
+       SOC_MBUS_PACKING_EXTEND32,
 };
 
 /**
index b9b7bea04537c59c7adb344217238575e74be2c6..6ee63d09b32d01b36d8d4b38efccfc73cd625677 100644 (file)
@@ -37,7 +37,7 @@
 enum v4l2_mbus_pixelcode {
        V4L2_MBUS_FMT_FIXED = 0x0001,
 
-       /* RGB - next is 0x1009 */
+       /* RGB - next is 0x100d */
        V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
        V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
        V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
@@ -46,6 +46,10 @@ enum v4l2_mbus_pixelcode {
        V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
        V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
        V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
+       V4L2_MBUS_FMT_RGB666_1X18 = 0x1009,
+       V4L2_MBUS_FMT_RGB888_1X24 = 0x100a,
+       V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b,
+       V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
 
        /* YUV (including grey) - next is 0x2017 */
        V4L2_MBUS_FMT_Y8_1X8 = 0x2001,