Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2014 NVIDIA Corporation
0004  */
0005 
0006 #ifndef __SOC_TEGRA_COMMON_H__
0007 #define __SOC_TEGRA_COMMON_H__
0008 
0009 #include <linux/errno.h>
0010 #include <linux/types.h>
0011 
0012 struct device;
0013 
0014 /**
0015  * Tegra SoC core device OPP table configuration
0016  *
0017  * @init_state: pre-initialize OPP state of a device
0018  */
0019 struct tegra_core_opp_params {
0020     bool init_state;
0021 };
0022 
0023 #ifdef CONFIG_ARCH_TEGRA
0024 bool soc_is_tegra(void);
0025 
0026 int devm_tegra_core_dev_init_opp_table(struct device *dev,
0027                        struct tegra_core_opp_params *params);
0028 #else
0029 static inline bool soc_is_tegra(void)
0030 {
0031     return false;
0032 }
0033 
0034 static inline int
0035 devm_tegra_core_dev_init_opp_table(struct device *dev,
0036                    struct tegra_core_opp_params *params)
0037 {
0038     return -ENODEV;
0039 }
0040 #endif
0041 
0042 static inline int
0043 devm_tegra_core_dev_init_opp_table_common(struct device *dev)
0044 {
0045     struct tegra_core_opp_params opp_params = {};
0046     int err;
0047 
0048     opp_params.init_state = true;
0049 
0050     err = devm_tegra_core_dev_init_opp_table(dev, &opp_params);
0051     if (err != -ENODEV)
0052         return err;
0053 
0054     return 0;
0055 }
0056 
0057 #endif /* __SOC_TEGRA_COMMON_H__ */