soc_mediabus.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * SoC-camera Media Bus API extensions
  3. *
  4. * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef SOC_MEDIABUS_H
  11. #define SOC_MEDIABUS_H
  12. #include <linux/videodev2.h>
  13. #include <media/v4l2-mediabus.h>
  14. /**
  15. * enum soc_mbus_packing - data packing types on the media-bus
  16. * @SOC_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM
  17. * @SOC_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the
  18. * possibly incomplete byte high bits are padding
  19. * @SOC_MBUS_PACKING_2X8_PADLO: as above, but low bits are padding
  20. * @SOC_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended
  21. * to 16 bits
  22. */
  23. enum soc_mbus_packing {
  24. SOC_MBUS_PACKING_NONE,
  25. SOC_MBUS_PACKING_2X8_PADHI,
  26. SOC_MBUS_PACKING_2X8_PADLO,
  27. SOC_MBUS_PACKING_EXTEND16,
  28. };
  29. /**
  30. * enum soc_mbus_order - sample order on the media bus
  31. * @SOC_MBUS_ORDER_LE: least significant sample first
  32. * @SOC_MBUS_ORDER_BE: most significant sample first
  33. */
  34. enum soc_mbus_order {
  35. SOC_MBUS_ORDER_LE,
  36. SOC_MBUS_ORDER_BE,
  37. };
  38. /**
  39. * struct soc_mbus_pixelfmt - Data format on the media bus
  40. * @name: Name of the format
  41. * @fourcc: Fourcc code, that will be obtained if the data is
  42. * stored in memory in the following way:
  43. * @packing: Type of sample-packing, that has to be used
  44. * @order: Sample order when storing in memory
  45. * @bits_per_sample: How many bits the bridge has to sample
  46. */
  47. struct soc_mbus_pixelfmt {
  48. const char *name;
  49. u32 fourcc;
  50. enum soc_mbus_packing packing;
  51. enum soc_mbus_order order;
  52. u8 bits_per_sample;
  53. };
  54. const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
  55. enum v4l2_mbus_pixelcode code);
  56. s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
  57. #endif