Re: [PATCH v4 04/12] scsi: ufs: core: Add support for TX Equalization
From: Can Guo
Date: Tue Mar 24 2026 - 06:20:35 EST
Hi Peter,
On 3/24/2026 3:46 PM, Peter Wang (王信友) wrote:
OK.
On Fri, 2026-03-20 at 20:10 -0700, Can Guo wrote:
> +static int ufshcd_tx_eqtr(struct ufs_hba *hba,
> + struct ufshcd_tx_eq_params *params,
> + struct ufs_pa_layer_attr *pwr_mode)
> +{
> + struct ufs_pa_layer_attr old_pwr_info;
> + u32 gear = pwr_mode->gear_tx;
> + int ret;
> +
> + if (gear < UFS_HS_G4 || gear > UFS_HS_G6) {
> + dev_err(hba->dev, "TX EQTR is not implemented for HS-
> G%u\n",
> + gear);
> + return -EINVAL;
> + }
>
Hi Can,
This check can be removed since ufshcd_config_tx_eq_settings
has already checked it.
I don't understand this comment.
> + params = &hba->tx_eq_params[gear - 1];
> +
> + if (gear < UFS_HS_G1 || gear > UFS_HS_GEAR_MAX) {
> + dev_err(hba->dev, "Invalid HS-Gear (%u) for TX
> Equalization\n",
> + gear);
> + return -EINVAL;
> + } else if (gear < adaptive_txeq_gear) {
> + return 0;
> + }
>
"gear" should be checked before use?
Sounds good.
> + /* TX EQTR is supported for HS-G4 and higher Gears */
> + if (gear < UFS_HS_G4)
> + goto apply_tx_eq_settings;
> +
Could we return 0 directly?
and move this to the previous check, like this:
} else if (gear < max_t(u32, adaptive_txeq_gear, UFS_HS_G4) {
return 0;
}
Thanks,
Can Guo.
Thanks
Peter
************* MEDIATEK Confidentiality Notice
********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!