i2caux_interface.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 2012-15 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DAL_I2CAUX_INTERFACE_H__
  26. #define __DAL_I2CAUX_INTERFACE_H__
  27. #include "gpio_service_interface.h"
  28. #define DEFAULT_AUX_MAX_DATA_SIZE 16
  29. #define AUX_MAX_DEFER_WRITE_RETRY 20
  30. struct aux_payload {
  31. /* set following flag to read/write I2C data,
  32. * reset it to read/write DPCD data */
  33. bool i2c_over_aux;
  34. /* set following flag to write data,
  35. * reset it to read data */
  36. bool write;
  37. uint32_t address;
  38. uint8_t length;
  39. uint8_t *data;
  40. };
  41. struct aux_command {
  42. struct aux_payload *payloads;
  43. uint8_t number_of_payloads;
  44. /* expressed in milliseconds
  45. * zero means "use default value" */
  46. uint32_t defer_delay;
  47. /* zero means "use default value" */
  48. uint32_t max_defer_write_retry;
  49. };
  50. union aux_config {
  51. struct {
  52. uint32_t ALLOW_AUX_WHEN_HPD_LOW:1;
  53. } bits;
  54. uint32_t raw;
  55. };
  56. struct i2caux;
  57. struct i2caux *dal_i2caux_create(
  58. struct dc_context *ctx);
  59. bool dal_i2caux_submit_i2c_command(
  60. struct i2caux *i2caux,
  61. struct ddc *ddc,
  62. struct i2c_command *cmd);
  63. bool dal_i2caux_submit_aux_command(
  64. struct i2caux *i2caux,
  65. struct ddc *ddc,
  66. struct aux_command *cmd);
  67. void dal_i2caux_configure_aux(
  68. struct i2caux *i2caux,
  69. struct ddc *ddc,
  70. union aux_config cfg);
  71. void dal_i2caux_destroy(
  72. struct i2caux **ptr);
  73. #endif