common.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2014 NVIDIA Corporation
  4. */
  5. #ifndef __SOC_TEGRA_COMMON_H__
  6. #define __SOC_TEGRA_COMMON_H__
  7. #include <linux/errno.h>
  8. #include <linux/types.h>
  9. struct device;
  10. /**
  11. * Tegra SoC core device OPP table configuration
  12. *
  13. * @init_state: pre-initialize OPP state of a device
  14. */
  15. struct tegra_core_opp_params {
  16. bool init_state;
  17. };
  18. #ifdef CONFIG_ARCH_TEGRA
  19. bool soc_is_tegra(void);
  20. int devm_tegra_core_dev_init_opp_table(struct device *dev,
  21. struct tegra_core_opp_params *params);
  22. #else
  23. static inline bool soc_is_tegra(void)
  24. {
  25. return false;
  26. }
  27. static inline int
  28. devm_tegra_core_dev_init_opp_table(struct device *dev,
  29. struct tegra_core_opp_params *params)
  30. {
  31. return -ENODEV;
  32. }
  33. #endif
  34. static inline int
  35. devm_tegra_core_dev_init_opp_table_common(struct device *dev)
  36. {
  37. struct tegra_core_opp_params opp_params = {};
  38. int err;
  39. opp_params.init_state = true;
  40. err = devm_tegra_core_dev_init_opp_table(dev, &opp_params);
  41. if (err != -ENODEV)
  42. return err;
  43. return 0;
  44. }
  45. #endif /* __SOC_TEGRA_COMMON_H__ */