From patchwork Tue Jul 18 09:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fenglin Wu X-Patchwork-Id: 121921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1623763vqt; Tue, 18 Jul 2023 02:53:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlE87aCBXqzZzlvr2arGFoN3+O2Smnh4JhwkMuSqxA3pW/haaXGm8bbkiwq4toXjKzFaVCyk X-Received: by 2002:a05:6a00:190c:b0:682:4c1c:a0f6 with SMTP id y12-20020a056a00190c00b006824c1ca0f6mr20690831pfi.3.1689674027298; Tue, 18 Jul 2023 02:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689674027; cv=none; d=google.com; s=arc-20160816; b=MJjIeWiq20RdbqHJXOxTBKfYXOWza6HhZa26k2Gcf3wxW/Rz9TLAA7hRBaXIPzT7c0 I5ih4PVkJKtBx2Kdo7zV/PiEU380UUbzT9CmGHAgYmG9vw2tVU5zBrMXgwbGnYNRAwvD 0CbpCIrx/ZzF9ZdhJP8EqusxVXVlqmKbpzPS0orpbGNMtRp9TzKiiOLJMzk63e+Ft0FY 7mFGlKItdmrFecBbGybjhAvih6X9mjQRJsZsaX/GnKDUPniAz2ZFDa0JchmrrEJYR4Io T3cA2JpYXsKn2lpxN6LY5afnuBBx2lQeLagRDj2blTwkOn8MuT027wQcztoL+GzeWHj8 gP1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2JI/ceV/+gBheTQl8ppCWHbt7J8E80oqaoct7rSb0T0=; fh=zjDCuupMACeSb7mx+U3frxvtPxdq/kwwykIdT4uIPPI=; b=x6kKWGiY1uvjhVbBtdwYNc0EQHfL2u9RgPEM5fDkeLv0HzIGlOixWDiASliaGrOfIx E/UNudPQA1J9z/wtozoqiVDMtPWbjHqup44YmYYnfvFEBw7Nvytszbp1b6kL5d4RazdT mmZlO4/R5J8M+GIAY6+v5gaPlwCgCK3fyx8sfC61wub8sf+Oi1cle580BOx6SY1h5M1P RaavMKPy8j1/QYGl8YbVkhPn2Z4k8IW5y/AQxv8L08QjW8MTPsidR2cERyXmC2FYEZcH IhYHUTkpxIXiMzGbudW0Wk121GXb9ca9DtUOwb49NxHUVIvWWi9D9SxEXmw/s7tbn1p3 lQ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CIpMAmCK; 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 fd10-20020a056a002e8a00b0067b2f265d2asi1377797pfb.262.2023.07.18.02.53.34; Tue, 18 Jul 2023 02:53:47 -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=CIpMAmCK; 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 S232112AbjGRJZl (ORCPT + 99 others); Tue, 18 Jul 2023 05:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbjGRJZf (ORCPT ); Tue, 18 Jul 2023 05:25:35 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 953A310DF; Tue, 18 Jul 2023 02:25:30 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36I6ki2W011157; Tue, 18 Jul 2023 09:25:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=2JI/ceV/+gBheTQl8ppCWHbt7J8E80oqaoct7rSb0T0=; b=CIpMAmCKOzZ2t930Wl0YI1FPoTn6hN7x3YfCKFzR4ESiJZ2lyMunB5Tj7wktfTL18QN7 7TGqdAI4kgI6jBgN64/HHcM9HGq4eOcSXSyDiGsyANQKn6Gjhg7C22rFoaggpAeOpYIG KKss4iEsvLxevDFi+JtL5EhHUYiGgFi3ExVNImLxHALz42rp4t82kIh/gYbK7gRpqU5U e+ZWJDPArQ1bliTbNbhuwlQvvhqhgVEhsnnWGWUz8tNHS0Qj7MXzABYiln+5p/MJFJsX IgJWnkwXqtThuLrv9ue3SBhHLKdmLbV/BCd05VUKmtWrLcb5lriDpb7BL74opowzdSki MQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rwnrrgb63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 09:25:02 +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 36I9P1am025820 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 09:25:01 GMT Received: from fenglinw2-gv.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, 18 Jul 2023 02:24:58 -0700 From: Fenglin Wu To: , , , , , "Fenglin Wu" , ChiaEn Wu , Alice Chen , ChiYuan Huang , "Dylan Van Assche" , Jiapeng Chong , Tom Rix , CC: , Subject: [PATCH v1] led: flash: various minor fixes for leds-qcom-flash driver Date: Tue, 18 Jul 2023 17:24:28 +0800 Message-ID: <20230718092439.2482320-1-quic_fenglinw@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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-GUID: 2E2T8EoQIN0PnmIJGpKIZYC5febABgEr X-Proofpoint-ORIG-GUID: 2E2T8EoQIN0PnmIJGpKIZYC5febABgEr 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-17_15,2023-07-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 phishscore=0 malwarescore=0 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=772 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180085 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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: 1771751632890466797 X-GMAIL-MSGID: 1771751632890466797 Update the driver to address following minor issues: - Add a sentence in Kconfig to explain the driver can be compiled as a module - strobe off the LED channel before setting flash current to prevent the flash LED being lit with an incorrect brightness if it was already active in torch mode - put the child node if register any flash LED device failed. Signed-off-by: Fenglin Wu --- drivers/leds/flash/Kconfig | 2 ++ drivers/leds/flash/leds-qcom-flash.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig index 4ed2efc65434..4e08dbc05709 100644 --- a/drivers/leds/flash/Kconfig +++ b/drivers/leds/flash/Kconfig @@ -89,6 +89,8 @@ config LEDS_QCOM_FLASH the total LED current will be split symmetrically on each channel and they will be enabled/disabled at the same time. + This driver can be built as a module, it will be called "leds-qcom-flash". + config LEDS_RT4505 tristate "LED support for RT4505 flashlight controller" depends on I2C && OF diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c index b089ca1a1901..a73d3ea5c97a 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; @@ -745,6 +749,7 @@ static int qcom_flash_led_probe(struct platform_device *pdev) return 0; release: + fwnode_handle_put(child); while (flash_data->v4l2_flash[flash_data->leds_count] && flash_data->leds_count) v4l2_flash_release(flash_data->v4l2_flash[flash_data->leds_count--]); return rc;