From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0C3A3DDDCD for ; Tue, 24 Mar 2026 10:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774346971; cv=none; b=iUqTW/u69Jo8dTCaNwsgvuBFhu9GCbnkzgoItgsSMFTxP4ru+TfyLq87awBzvbnWaYIRVJWcBI+XA/7CyGa6VPhjTUdcBQYVNG2oqH1tv6Knkj5hr+JHiV/g7Y8cNUhfPo0DSXSNp9wSLiV1CrKCYKb1XimkVoKSU0Fz5qYlOt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774346971; c=relaxed/simple; bh=Y6l6P3mRcGumqcg7EpV61TZl1gP6VXw05dJB9IDwwgU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MULCA1XVVVzSd80ECh04FC20ae+DDLzYSvT98P3U4Bp1OiHrCfU7qbf6PYS3wi9O4sIbEe9o64muHhj5BLm/7pbLXSFB7Va85f0GA3v9dtctLtUR0/O9QC3UlxQbv/tnmUP2V1KZz4czDBEJibEZ4+KKPUTKkzsQ2brZFjLeTso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ILcYQGHw; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IkzRDKl/; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ILcYQGHw"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IkzRDKl/" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62O9Vvct890467 for ; Tue, 24 Mar 2026 10:09:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= UrpwhYpqVWH5PEq+bY3QVD0NRdHOyCw4udik0ap+snM=; b=ILcYQGHwjEsynasu pCmW7R5GVvcL12qoX5W5fmhLrJQCl7HXhY8WHq1YSjtpYsRSknf7GMLkuv+rMZHH RML1o0LVxf1qOy1dDxZ7soZHc9xBIHuGcgnLbOu+l0tFVdaCxq42utFv+Ip3Ytrj 9OvDhDW1GZuJXhR0IgNKxKYgbHEOcUuv/r8e9giHbte3BrWBKMhnjz5Dt3XgX/Qm q/Y5ITR0rtr1O7Lkq84Th0HDVDT7/dQT7V3q28n9xR9Rf9abrPbtE3TbnHjadRGK kb7F16kEHanmfxgvnHIN6wSoOT4DHOwaxi2VU/teZWO/bY7CBLNSlnsSUPI3kna7 xBBQ/Q== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d3k1x9akd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 24 Mar 2026 10:09:26 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-35b8f351debso1374803a91.1 for ; Tue, 24 Mar 2026 03:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774346965; x=1774951765; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=UrpwhYpqVWH5PEq+bY3QVD0NRdHOyCw4udik0ap+snM=; b=IkzRDKl/2Vj0QzM2nqiwrIjm/7/0gIY36hwN3mZAlumvfn68r+eSM1QaokHcCBngis PK5iKi9QKLjvcaxLyYa4Iv3tq8cKZOkbvhYB4B/Tm+BRv4D9CS+ijxAZEEHMK/hDWUIf oA/wBLifCqR+7l0JZE9Zt5xmqRpMlzTc68rMLNzUrJ98l+X3wjPqiCFYCBv7yDGQdsTO QDeoto+g1MclyK0hqzCCJ6+Xx3/qCYj8KVP+kq7YxtmCCSCpAHJiyrBYLuIeKkOjG7o6 7zIT7md0iAqMeQajpcuFxgYUnB7quC9VeBj1f+JwHzLDsXuPBYI9IJQ4jVv42LQr1Gp0 Ud7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774346965; x=1774951765; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UrpwhYpqVWH5PEq+bY3QVD0NRdHOyCw4udik0ap+snM=; b=RNf7BlIhZY9QHzvzDMFN5fQmGNsNZSkRaOHHLaAWCOMUI2cmv0hubfD1/5LO9BCogO 3GFDEKFqadeybXpAXVUJTGK+aTwQh0rxNTHKhOud7fbr2mGRHFKOUsphCxoHoXpCep9F u7xkspEWYfwTP2HcMYxn9TL4GOwDK+OfiN1Nx2W15uy/rmbgaFITvV8DGNZvK6PxGqDy B/7V9xx2sITcEbAv7Ghnulj8kkNtrBWpOoKK94M3ebd2F5mjyQpMECKwk2+rqGYKtfiJ bg4D4JXqLakyUI4ZJ0FJ9Ci8z1j0mGlrAFjTAxt66FigNMQNebZ7dOAqE8NE/RRrP1Oc 2X4A== X-Forwarded-Encrypted: i=1; AJvYcCWMSYk/6vKRrY/Rrbz4CXticR3PFPnVfP2Yh88fw0YmMapnWYxewZqyeytVkfHSUgrCYkhEMqtevtAz2KI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5swFxIcdoLB5ONAYoTDgVtUTsmfHwRyTVuaZ0/xHzE7ASXceL bf3Iz3+xJimx8c5NBRwIScI2I7XjZgXOAl5ZKzyDgM06MjXw/4xHU/9+FEIBvrtefP8l18LjraB 7eh5YulzmUuEHbh/+SXBkyLSsPsguAPpt0YHItetm6aScxsL4LaN9u58SsJ+y1utAxU4= X-Gm-Gg: ATEYQzzu0xDKvWt6mS/NorWVPMKaQdRZcBYPi0ycWMiG0LkUKv+HI0Zl3CazP9Fzx/s XhqYmPdq6TU2qhu8Ug9cmDKxT1k2xaB7wgpqaJftQdtcE4hZ0o2d3foi9+uDFWeQSiB5TwR53/9 ypfeRNFNFXQJqHdWfERSZ/3hZpiYbB7JzVoP0FQZJQAvhA/BFH7feO+sGU2v0LR70ZUT6BPKWu1 sJ2kNCGe/Q05uNgAt2WqWzISr+7S+acJHTorgchBY26iOPl1hTF6RRU4bGFrIT6b/DmsqKkEMeQ xtteyzJgekKOlMBMUVP8d+gZO20Ff50mU8dzpXt+PQ4iataHfDzp6wsEqpZ74DPeC9CPnZa9f9Z ncc3oCIuluVDZsV/4N23uYOhs5BEx3SjTv11iFLNTKUdR10tuu4fs304eS/1CgSuFgo8fctTHb3 y72kmrP+VtrGo= X-Received: by 2002:a17:90b:2242:b0:35b:a7be:ae62 with SMTP id 98e67ed59e1d1-35bd2d2c8e1mr13176927a91.30.1774346965152; Tue, 24 Mar 2026 03:09:25 -0700 (PDT) X-Received: by 2002:a17:90b:2242:b0:35b:a7be:ae62 with SMTP id 98e67ed59e1d1-35bd2d2c8e1mr13176904a91.30.1774346964614; Tue, 24 Mar 2026 03:09:24 -0700 (PDT) Received: from [10.133.33.145] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c0318f2ddsm2563054a91.17.2026.03.24.03.09.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2026 03:09:24 -0700 (PDT) Message-ID: <1a038159-c847-4e58-a60c-cd5ecabeeed9@oss.qualcomm.com> Date: Tue, 24 Mar 2026 18:09:17 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 04/12] scsi: ufs: core: Add support for TX Equalization To: =?UTF-8?B?UGV0ZXIgV2FuZyAo546L5L+h5Y+LKQ==?= , "beanhuo@micron.com" , "mani@kernel.org" , "avri.altman@wdc.com" , "bvanassche@acm.org" , "martin.petersen@oracle.com" Cc: "linux-scsi@vger.kernel.org" , "adrian.hunter@intel.com" , "alim.akhtar@samsung.com" , "James.Bottomley@HansenPartnership.com" , "quic_nguyenb@quicinc.com" , "linux-kernel@vger.kernel.org" References: <20260321031021.1722459-1-can.guo@oss.qualcomm.com> <20260321031021.1722459-5-can.guo@oss.qualcomm.com> Content-Language: en-US From: Can Guo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI0MDA4MSBTYWx0ZWRfX1NyA9WQEWmHb mbT1n0LNSYhj5rTSfrUFZDQI/2R9+WvU5KDoMx94nT4A5whi/BLYgygoZigsaurpRhlM2fu/kXi r+2sQkwR1CnyKUfEYeIWKe7ts3rIZS0s2WkXXYuQHjsIbtU4k4qBnm5E0gWO8rTjX7lCHxcOgjI 7P0+FA0JKmFx9lGddZH6z/NlE9zsfDz9ktcoslilLWLM/DCnxv86/37vfLhpmhjN+j+EUbdl90q NGIHfR8MZUm4+plUx8Mbh9ujhU2qN8Al2QSV3+yN/o0wEnm1UocNAoD4Ucoo/o2O+MDwfXdMyC3 3UMdMV4LNKqxL+IbGbDrOnK4zM6nQ35VLLP7Lzl6SFUWiAKs37e4P6jlPEJrrfuodLUpfH2SQqe r6+Yg6+93O+u0tzvhgIoSn62j6bpUH1hGLHmK/JIZYjWZptt6XqQQ4eG3OQ0KUvnkXErQroVvMY 6RNvNldAixqKr9UM0FA== X-Proofpoint-ORIG-GUID: ICiADwWQ8a0Wf7e2KiZLXOPmEGDj3f85 X-Authority-Analysis: v=2.4 cv=O880fR9W c=1 sm=1 tr=0 ts=69c262d6 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=JjZgfduHwEyX-iJ7t1EA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-GUID: ICiADwWQ8a0Wf7e2KiZLXOPmEGDj3f85 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-24_02,2026-03-23_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603240081 Hi Peter, On 3/24/2026 3:46 PM, Peter Wang (王信友) wrote: > > 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. OK. > > > > +       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? I don't understand this comment. > > > +       /* 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; > } Sounds good. 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!