media-device.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Media device
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. *
  6. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  7. * Sakari Ailus <sakari.ailus@iki.fi>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #ifndef _MEDIA_DEVICE_H
  23. #define _MEDIA_DEVICE_H
  24. #include <linux/device.h>
  25. #include <linux/list.h>
  26. #include <media/media-devnode.h>
  27. /**
  28. * struct media_device - Media device
  29. * @dev: Parent device
  30. * @devnode: Media device node
  31. * @model: Device model name
  32. * @serial: Device serial number (optional)
  33. * @bus_info: Unique and stable device location identifier
  34. * @hw_revision: Hardware device revision
  35. * @driver_version: Device driver version
  36. *
  37. * This structure represents an abstract high-level media device. It allows easy
  38. * access to entities and provides basic media device-level support. The
  39. * structure can be allocated directly or embedded in a larger structure.
  40. *
  41. * The parent @dev is a physical device. It must be set before registering the
  42. * media device.
  43. *
  44. * @model is a descriptive model name exported through sysfs. It doesn't have to
  45. * be unique.
  46. */
  47. struct media_device {
  48. /* dev->driver_data points to this struct. */
  49. struct device *dev;
  50. struct media_devnode devnode;
  51. char model[32];
  52. char serial[40];
  53. char bus_info[32];
  54. u32 hw_revision;
  55. u32 driver_version;
  56. };
  57. /* media_devnode to media_device */
  58. #define to_media_device(node) container_of(node, struct media_device, devnode)
  59. int __must_check media_device_register(struct media_device *mdev);
  60. void media_device_unregister(struct media_device *mdev);
  61. #endif