From 695e85590b0ea486abe28c2033387acd7a2254d6 Mon Sep 17 00:00:00 2001 From: Gilad Broner Date: Sun, 26 Oct 2014 22:18:43 +0200 Subject: scsi: ufs: add cpu-dma latency PM QOS request Add PM QOS cpu-dma latency request to the driver. Latency parameter value is taken from the device tree node using an optional parameter 'qcom,cpu-dma-latency-us'. Unless specified, a default of 200us is used. Change-Id: I3e10da9e65fc7324897c866b0c2a40cc5e6ca070 Signed-off-by: Gilad Broner [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani [venkatg@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Venkat Gopalakrishnan --- include/linux/scsi/ufs/ufshcd.h | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'include/linux') diff --git a/include/linux/scsi/ufs/ufshcd.h b/include/linux/scsi/ufs/ufshcd.h index d6c130e38e43..18a4ec1509d9 100644 --- a/include/linux/scsi/ufs/ufshcd.h +++ b/include/linux/scsi/ufs/ufshcd.h @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -448,6 +449,38 @@ enum ts_types { }; #endif +/* PM QoS voting state */ +enum ufshcd_pm_qos_state { + PM_QOS_UNVOTED, + PM_QOS_VOTED, + PM_QOS_REQ_VOTE, + PM_QOS_REQ_UNVOTE, +}; + +/* Default latency for PM QOS */ +#define UFS_DEFAULT_CPU_DMA_LATENCY_US 200 /* microseconds */ + +/** + * struct ufshcd_pm_qos - data related to PM QoS voting logic + * @vote_work: work object for voting procedure + * @unvote_work: work object for un-voting procedure + * @req: request object for PM QoS + * @cpu_dma_latency_us: requested latency value used for voting in microseconds + * @state: voting state machine current state + * @active_reqs: number of active requests requiring PM QoS voting + * @is_suspended: flag specifying whether voting logic is suspended. + * When set, voting will not occur for pending requests. + */ +struct ufshcd_pm_qos { + struct work_struct vote_work; + struct work_struct unvote_work; + struct pm_qos_request req; + u32 cpu_dma_latency_us; + enum ufshcd_pm_qos_state state; + int active_reqs; + bool is_suspended; +}; + /** * struct ufs_hba - per adapter private structure * @mmio_base: UFSHCI base register address @@ -637,6 +670,9 @@ struct ufs_hba { bool wlun_dev_clr_ua; + /* PM Quality-of-Service (QoS) data */ + struct ufshcd_pm_qos pm_qos; + struct ufs_pa_layer_attr pwr_info; struct ufs_pwr_mode_info max_pwr_info; @@ -834,6 +870,41 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { }; #endif +#ifndef CONFIG_SMP +static inline int ufshcd_pm_qos_init(struct ufs_hba *hba) +{ + return 0; +} + +static inline int ufshcd_pm_qos_hold(struct ufs_hba *hba, bool async) +{ + return 0; +} + +static inline int __ufshcd_pm_qos_hold(struct ufs_hba *hba, bool async) +{ + return 0; +} + +static inline int ufshcd_pm_qos_release(struct ufs_hba *hba) +{ + return 0; +} + +static inline int __ufshcd_pm_qos_release(struct ufs_hba *hba) +{ + return 0; +} + +static inline void ufshcd_pm_qos_remove(struct ufs_hba *hba) +{ +} + +static inline void ufshcd_parse_pm_qos(struct ufs_hba *hba) +{ +} +#endif /* CONFIG_SMP */ + /* Expose Query-Request API */ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, enum flag_idn idn, bool *flag_res); -- cgit v1.2.3