Thomas Gleixner | 97fb5e8 | 2019-05-29 07:17:58 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Yaniv Gardi | 47555a5 | 2015-10-28 13:15:49 +0200 | [diff] [blame] | 2 | /* Copyright (c) 2015, The Linux Foundation. All rights reserved. |
Yaniv Gardi | 47555a5 | 2015-10-28 13:15:49 +0200 | [diff] [blame] | 3 | */ |
| 4 | |
| 5 | #ifndef UFSHCD_PLTFRM_H_ |
| 6 | #define UFSHCD_PLTFRM_H_ |
| 7 | |
| 8 | #include "ufshcd.h" |
| 9 | |
Stanley Chu | 58b60a9 | 2019-03-16 13:04:41 +0800 | [diff] [blame] | 10 | #define UFS_PWM_MODE 1 |
| 11 | #define UFS_HS_MODE 2 |
| 12 | |
| 13 | struct ufs_dev_params { |
| 14 | u32 pwm_rx_gear; /* pwm rx gear to work in */ |
| 15 | u32 pwm_tx_gear; /* pwm tx gear to work in */ |
| 16 | u32 hs_rx_gear; /* hs rx gear to work in */ |
| 17 | u32 hs_tx_gear; /* hs tx gear to work in */ |
| 18 | u32 rx_lanes; /* number of rx lanes */ |
| 19 | u32 tx_lanes; /* number of tx lanes */ |
| 20 | u32 rx_pwr_pwm; /* rx pwm working pwr */ |
| 21 | u32 tx_pwr_pwm; /* tx pwm working pwr */ |
| 22 | u32 rx_pwr_hs; /* rx hs working pwr */ |
| 23 | u32 tx_pwr_hs; /* tx hs working pwr */ |
| 24 | u32 hs_rate; /* rate A/B to work in HS */ |
| 25 | u32 desired_working_mode; |
| 26 | }; |
| 27 | |
| 28 | int ufshcd_get_pwr_dev_param(struct ufs_dev_params *dev_param, |
| 29 | struct ufs_pa_layer_attr *dev_max, |
| 30 | struct ufs_pa_layer_attr *agreed_pwr); |
Stanley Chu | 6585801 | 2020-11-16 14:50:47 +0800 | [diff] [blame] | 31 | void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param); |
Yaniv Gardi | 47555a5 | 2015-10-28 13:15:49 +0200 | [diff] [blame] | 32 | int ufshcd_pltfrm_init(struct platform_device *pdev, |
Arnd Bergmann | 176eb92 | 2019-03-04 20:39:11 +0100 | [diff] [blame] | 33 | const struct ufs_hba_variant_ops *vops); |
Yaniv Gardi | 47555a5 | 2015-10-28 13:15:49 +0200 | [diff] [blame] | 34 | void ufshcd_pltfrm_shutdown(struct platform_device *pdev); |
| 35 | |
| 36 | #ifdef CONFIG_PM |
| 37 | |
| 38 | int ufshcd_pltfrm_suspend(struct device *dev); |
| 39 | int ufshcd_pltfrm_resume(struct device *dev); |
| 40 | int ufshcd_pltfrm_runtime_suspend(struct device *dev); |
| 41 | int ufshcd_pltfrm_runtime_resume(struct device *dev); |
| 42 | int ufshcd_pltfrm_runtime_idle(struct device *dev); |
| 43 | |
| 44 | #else /* !CONFIG_PM */ |
| 45 | |
| 46 | #define ufshcd_pltfrm_suspend NULL |
| 47 | #define ufshcd_pltfrm_resume NULL |
| 48 | #define ufshcd_pltfrm_runtime_suspend NULL |
| 49 | #define ufshcd_pltfrm_runtime_resume NULL |
| 50 | #define ufshcd_pltfrm_runtime_idle NULL |
| 51 | |
| 52 | #endif /* CONFIG_PM */ |
| 53 | |
| 54 | #endif /* UFSHCD_PLTFRM_H_ */ |