Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2441430rda; Wed, 25 Oct 2023 02:55:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpQn7fX/9AYBEgcGHI9DtZXQ0QRurV0uQBAk9LMskVLyteOhXmUsMMLL8G10Ex0ONozlFK X-Received: by 2002:a05:6902:1343:b0:d9a:4f29:866d with SMTP id g3-20020a056902134300b00d9a4f29866dmr16777119ybu.60.1698227704354; Wed, 25 Oct 2023 02:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698227704; cv=none; d=google.com; s=arc-20160816; b=ST9BLgWFatTWuBl2azohKMsp6bQTaJoLL547T+vTCuHfokzPHUeD5xe1amaj6Fmt7T Kv9FHeDctl5iO/rA9kUadc6/n/YGXUhRdOZ7J97n3MYNZ6KO7L/O8Ed1Tp81lHRbZvly y1CMz/vw6GPH5wIWb5+Uoo4T4KEj/L9wnoPyYWUP5I5XzM+JzoRsir/xyZiNJmxKCade 7zx71rkbkLfNLMzyflP9e3iRsk8Kco0zWjrvNm6iidbVg0hXHIimPtCHryIh+roCeaFp vwiYbfWlCPHE5GrprLTPGmR2MJ1CUTKbZow5MdO+4xe7slgp/n61VpAOC8uWFoCSj5FB TtSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:from:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=7wMO74w/KQMo+4s9Z0A2HrX+bIjpx9iGlyOA0PG/ad4=; fh=5DVxAaLRsZuxvPbSNYKiDWpHisPJK9obY8Qdc59jrcI=; b=PoMOIZfZN/C++m65eAm24w4qHrkXJFT8tId8q8+ahpU+RkFFD6yyWLVXqKSg4JZ/Gw BykPgeJNeZCWgxH3BShW6nMFkk/EZ5fMGWM2kPeVYp7N6Ip6brp58AgDepcG+ONX5I+U y378KByNekAHVQ+orvAbgjI4qrZpyid2yq5kt/wmOgsB14dJmGLQaF3GDIpid1PH5iJq 1EjsrwyC8M7CtNf+YtVXtT/RmOXHxIGSww7MtZf1B2Pui9XVlkrfvcqgYcVcrIsuikNr Z33ZzJs+Ol/eo1oL+lFaDm4FTj5CZEhmmdPKBOOtntnIoB6l6v4hwJhk5AhK8B2WNYDK y5HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fDalulYI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m192-20020a2526c9000000b00da05bef4335si2680254ybm.114.2023.10.25.02.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 02:55:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fDalulYI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D60738036EB0; Wed, 25 Oct 2023 02:55:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbjJYJy1 (ORCPT + 99 others); Wed, 25 Oct 2023 05:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233736AbjJYJyY (ORCPT ); Wed, 25 Oct 2023 05:54:24 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5369128; Wed, 25 Oct 2023 02:54:21 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39P8s1gt005815; Wed, 25 Oct 2023 09:54:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : from : to : cc : references : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=7wMO74w/KQMo+4s9Z0A2HrX+bIjpx9iGlyOA0PG/ad4=; b=fDalulYI2WuDlOyjB/RfQhy53FS3TMA6/rGNwiUHXMmV2ZeSdnzVb57XHSDLBioB1ixx SFYaywyg3BGuYEctknE3SWmjKk8gNAVER/SfyW7wvu0KvfHMzFNv9/RtmeDGZX4li9np mwzO9FbzM3rbzCHslVRLD2VOenErwtLWIyjVGb4/ts2ow6tB6MIqVVIgKgcFN8njtGif SQUZz5kWt2lb95TOaA2Apsm821JxRFIs87+ZBU1GKS/o0LxP0EWB+a0scaH7iYcJGfJP zF+GxaPP25tRSdCKZ70+qNMOHt2HI+RUlHndwahzd6H0woVFipMz6M5xA1fxh+dJY3vw +w== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3txuj7gkrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Oct 2023 09:54:16 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39P9sFC7019754 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Oct 2023 09:54:15 GMT Received: from [10.233.19.96] (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Wed, 25 Oct 2023 02:54:12 -0700 Message-ID: <060e80b9-e403-45b7-8627-e7b33b223688@quicinc.com> Date: Wed, 25 Oct 2023 17:54:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH v6 3/3] input: pm8xxx-vibrator: add new SPMI vibrator support From: Fenglin Wu To: Dmitry Torokhov CC: Dmitry Baryshkov , , , , , , , Konrad Dybcio , , , , , , Luca Weiss References: <20230922083801.3056724-1-quic_fenglinw@quicinc.com> <20230922083801.3056724-4-quic_fenglinw@quicinc.com> <12887370-0ada-359b-8a4f-18a28495c69a@quicinc.com> <8697d115-9aa7-2a1c-4d96-25b15adb5cca@quicinc.com> Content-Language: en-US In-Reply-To: <8697d115-9aa7-2a1c-4d96-25b15adb5cca@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 1q0bmqWI62j_b-3zaFjdSuN-lMjk9_TQ X-Proofpoint-GUID: 1q0bmqWI62j_b-3zaFjdSuN-lMjk9_TQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-25_01,2023-10-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1011 suspectscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 adultscore=0 mlxlogscore=714 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310250084 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 02:55:01 -0700 (PDT) On 10/9/2023 12:01 PM, Fenglin Wu wrote: > > > On 10/1/2023 12:17 AM, Dmitry Torokhov wrote: >> On Mon, Sep 25, 2023 at 10:54:45AM +0800, Fenglin Wu wrote: >>> >>> >>> On 9/24/2023 3:07 AM, Dmitry Baryshkov wrote: >>>>> + >>>>> +       switch (vib->data->hw_type) { >>>>> +       case SSBI_VIB: >>>>>                   mask = SSBI_VIB_DRV_LEVEL_MASK; >>>>>                   shift = SSBI_VIB_DRV_SHIFT; >>>>> +               break; >>>>> +       case SPMI_VIB: >>>>> +               mask = SPMI_VIB_DRV_LEVEL_MASK; >>>>> +               shift = SPMI_VIB_DRV_SHIFT; >>>>> +               break; >>>>> +       case SPMI_VIB_GEN2: >>>>> +               mask = SPMI_VIB_GEN2_DRV_MASK; >>>>> +               shift = SPMI_VIB_GEN2_DRV_SHIFT; >>>>> +               break; >>>>> +       default: >>>>> +               return -EINVAL; >>>> Could you please move the switch to the previous patch? Then it would >>>> be more obvious that you are just adding the SPMI_VIB_GEN2 here. >>>> >>>> Other than that LGTM. >>> >>> Sure, I can move the switch to the previous refactoring patch. >> >> Actually, the idea of having a const "reg" or "chip", etc. structure is >> to avoid this kind of runtime checks based on hardware type and instead >> use common computation. I believe you need to move mask and shift into >> the chip-specific structure and avoid defining hw_type. >> > > Actually, the main motivation for adding 'hw_type' is to avoid reading > 'reg_base' from DT for SSBI_VIB. It can also help to simplify the > 'pm8xxx_vib_data' structure and make following code logic more > straightforward and easier to understand(check hw_type instead of > checking specific constant reg/mask value), it has been used in > following places: > >   1) Avoid reading 'reg_base' from DT for SSBI_VIB. >   2) Only do manual-mode-mask-write for SSBI_VIB. Previously, it was > achieved by giving a valid 'drv_en_manual_mask' value only for SSBI_VIB, > having hw_type make it more straightforward. >   3) Not writing VIB_EN register for SSBI_VIB. A similar strategy was > used previously, only write VIB_EN register when 'enable_mask' is valid, >  checking hw_type make it more straightforward. >   4) To achieve different drive step size for SPMI_VIB (100mV per > step) and SPMI_VIB_GEN2 (1mV per step). >   5) Do different VIB_DRV mask and shift assignment for SPMI_VIB and > SPMI_VIB_GEN2 >   6) Only write VIB_DRV2 for SPMI_VIB_GEN2. > Hi Dmitry, Can you please help to comment if this looks good for you? I actually have pushed a V7 to address your last comment before you made this one. V7 change: https://lore.kernel.org/linux-arm-msm/20230927-pm8xxx-vibrator-v7-1-b5d8c92ce818@quicinc.com/, just want to know how to move forward. Thanks Fenglin > >> Thanks. >>