From patchwork Tue Jul 25 09:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fenglin Wu X-Patchwork-Id: 125508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2381904vqg; Tue, 25 Jul 2023 03:51:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCV09YXaViWpabP7TGHDHTnt2+Nlfoo+wA3lJ31XdpkQ53JcmFmHuC4s6ovzObRTJAfhT4 X-Received: by 2002:aca:210b:0:b0:3a4:a8c:a9cf with SMTP id 11-20020aca210b000000b003a40a8ca9cfmr11593697oiz.22.1690282317611; Tue, 25 Jul 2023 03:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690282317; cv=none; d=google.com; s=arc-20160816; b=n0Rx1hdMdDN2gjpEO+eg7qBD/YZj/cP1WiXMxyyKBPCP24zQDxkSHul0Uex/eKS0Q8 Rx3rn2zrVI3ZU01U6KmmR6fm56PwXLxca4M2iLoIeFiydm9OVlIMrv2V93eYClGwPNTU 8tykmH/QGXzRC6F4rH25Qg1NwP1PWLGa2k1LuKpt/qne9ZDSf4bw+nlUfh5bGmRcZ3He EY2UFXR15PO3ZeYjS5GJ2oDEywaQjDKe4k5NVm90nzIxJ3OPHEvs6dGzNzd0j41vF70I 2Kym20yEPXVZw03QSH4Qn6M8JdzDaAoGRaQkZdiGhT8P3iPl1k3CIeOwQNzWPW1xlccB erHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=4bYZn8KsNVyvtvAHPDcH9lOPhrvBpowcdWikiFWiqms=; fh=kVf/vnVrQEBXVxwphWeUaDPXkVz3+NkcXi6FO02aQ78=; b=LmxWS+z5i8piwGpa2QWu1mBgUO4l7Zkg1a2QiTrfdTqlHIwcNr8LaCMHvuYE2VSMXf uCIafRsng1gSITm0chEW0SEfs/xnuRklhf7GIF5oeucB0BDpglgw9ILnj+X7pj3gHnjH AzC56pbEn8aVmU8msy0dERbOfLmbnvQFHrk8mbQAWR6HzX8pj/kkSv9pb2RWGiWmrYD5 9meNU89MmEF9IBUWdG05ycZO8Hbgmk/7ewpQcj1GyTxkOsRXxKhpG/jCWykf84hVIW0M 8A2RVr05GT32vg8Ns+GvzHWAcVILEW6dD1M9EKcErd6xSj0MhHMsFi+mbvG0wi2g0LtP kFCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=leABWcaE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx12-20020a17090afd8c00b002509d96227esi13258295pjb.173.2023.07.25.03.51.44; Tue, 25 Jul 2023 03:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=leABWcaE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233540AbjGYJ55 (ORCPT + 99 others); Tue, 25 Jul 2023 05:57:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233509AbjGYJ5r (ORCPT ); Tue, 25 Jul 2023 05:57:47 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A92F11999; Tue, 25 Jul 2023 02:57:45 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36P9lCi4003593; Tue, 25 Jul 2023 09:57:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=qcppdkim1; bh=4bYZn8KsNVyvtvAHPDcH9lOPhrvBpowcdWikiFWiqms=; b=leABWcaEBnoyDtYSzOy4I5P/LClKtB63xyGZ0SLhff6Fm7TyTOBDCLuK3CNupe4UZjjk WsuVQeSlZFAEvzYOFJqWZfHSUT5Ut6hI/73rUP7Hr9VH4GJcb+geGPkIXk5ngqK4x1Vi 89koT/QvIZIOx3OF0yS+eTk1myuWQkGmtMvseYFZAjcs6DOwTcPZi0LUbpQ0BPNTqzC/ Q+njeH5gb76lvU6V4Uf03+ohATM0LHkPe3i8i1qrHtIBnmsPXt/WTqQCfd0FJHRY8ZHW I2gmctnbgPARtpTq6dotFATck5/Yezm+fuKpxUQ2t0/V4M5Absj9Swugw/qZHiBd/RW7 CQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s1qa3tjhr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jul 2023 09:57:41 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36P9vebl021614 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Jul 2023 09:57:40 GMT Received: from fenglinw2-gv.ap.qualcomm.com (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.30; Tue, 25 Jul 2023 02:57:38 -0700 From: Fenglin Wu Date: Tue, 25 Jul 2023 17:57:20 +0800 Subject: [PATCH v2 2/3] leds: flash: leds-qcom-flash: turn off LED before setting flash current MIME-Version: 1.0 Message-ID: <20230725-leds-qcom-flash-driver-tiny-fixes-v2-2-0f5cbce5fed0@quicinc.com> References: <20230725-leds-qcom-flash-driver-tiny-fixes-v2-0-0f5cbce5fed0@quicinc.com> In-Reply-To: <20230725-leds-qcom-flash-driver-tiny-fixes-v2-0-0f5cbce5fed0@quicinc.com> To: Fenglin Wu , , Pavel Machek , Lee Jones CC: , X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1690279054; l=875; i=quic_fenglinw@quicinc.com; s=20230725; h=from:subject:message-id; bh=W/dfqC+/sx2xdVFtlxcBI6JBsWRBJdEzU7xvhTBhVQk=; b=mhyIsm06MIsDejy0g0TzWf+U5u/3kNjoenYLow6u3aRJqU29uOCcNmzPH8fh8IwsCVrsOiCGk snYrWxGXkwoCubvEpupxkY6z6h1swrqWwdsKZ8OWJ4QDxwa/vdHDbnv X-Developer-Key: i=quic_fenglinw@quicinc.com; a=ed25519; pk=hleIDz3Unk1zeiwwOnZUjoQVMMelRancDFXg927lNjI= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: XNC7vZ8WRUeCst9iGFroJwehMG0B9RRz X-Proofpoint-GUID: XNC7vZ8WRUeCst9iGFroJwehMG0B9RRz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-25_05,2023-07-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 clxscore=1015 mlxlogscore=545 priorityscore=1501 mlxscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307250086 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772389471200345923 X-GMAIL-MSGID: 1772389471200345923 Strobe off the LED before setting flash current to avoid it's being enabled with an incorrect current if it has been working in torch mode. Signed-off-by: Fenglin Wu --- drivers/leds/flash/leds-qcom-flash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index b089ca1a1901..29cf09479422 100644 --- a/drivers/leds/flash/leds-qcom-flash.c +++ b/drivers/leds/flash/leds-qcom-flash.c @@ -309,6 +309,10 @@ static int qcom_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool stat struct qcom_flash_led *led = flcdev_to_qcom_fled(fled_cdev); int rc; + rc = set_flash_strobe(led, SW_STROBE, false); + if (rc) + return rc; + rc = set_flash_current(led, led->flash_current_ma, FLASH_MODE); if (rc) return rc;