i_qal_devnode.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2021 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: qal_devnode
  20. * QCA abstraction layer (QAL) device config APIs
  21. */
  22. #if !defined(__I_QAL_DEVNODE_H)
  23. #define __I_QAL_DEVNODE_H
  24. /* Include Files */
  25. #include <linux/of_pci.h>
  26. #include <linux/of.h>
  27. #include "qdf_types.h"
  28. #define PCI_DOMAIN_ID_MIN 0x0000
  29. #define PCI_DOMAIN_ID_MAX 0xFFFF
  30. typedef struct device_node *__qdf_devnode_t;
  31. /**
  32. * __qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
  33. * from a property.
  34. * @devnode: device node from which the property value is to be read.
  35. * @pname: name of the property to be searched.
  36. * @u32_val: pointer to return value, modified only if return value is 0.
  37. * @elem: number of array elements to read
  38. *
  39. * Return: QDF_STATUS_SUCCESS if valid value can be decoded,
  40. * error code otherwise
  41. */
  42. static inline QDF_STATUS
  43. __qal_devnode_read_u32_array(const __qdf_devnode_t devnode,
  44. const char *pname, u32 *u32_val, size_t elem)
  45. {
  46. int ret;
  47. ret = of_property_read_u32_array(devnode, pname, u32_val, elem);
  48. return qdf_status_from_os_return(ret);
  49. }
  50. /**
  51. * __qal_devnode_read_u32() - Find and read 32 bit integer from a property.
  52. * @devnode: device node from which the property value is to be read.
  53. * @pname: name of the property to be searched.
  54. * @u32_val: pointer to return value, modified only if return value is 0.
  55. *
  56. * Return: QDF_STATUS_SUCCESS if valid value can be decoded,
  57. * error code otherwise
  58. */
  59. static inline QDF_STATUS
  60. __qal_devnode_read_u32(const __qdf_devnode_t devnode,
  61. const char *pname, u32 *u32_val)
  62. {
  63. int ret;
  64. ret = of_property_read_u32(devnode, pname, u32_val);
  65. return qdf_status_from_os_return(ret);
  66. }
  67. #endif /* __I_QAL_DEVNODE_H */