From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA478C432BE for ; Sun, 29 Aug 2021 18:01:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 76F5E60E97 for ; Sun, 29 Aug 2021 18:01:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 76F5E60E97 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EB8CKK+CPJ2kEQCmJaPi3AMAKhKql8HsvxAsnG3tub0=; b=rL3DTMC81DN3D4wUWbXzMuSyJe Q0HWtWSynUA+NTmqOHIQIx73mJNPAx1yZH6ZJUx3datevYfku3jVmjlsuxmnpgiWLqndTLVImoGxr bfGMmKP+X0l+yncNYuDXYzrfG5+QZ9c5kA8cGhAH5gpr4Sj2DFg6M8iYbA54NijnMcpW8xcRT7VDI 17R7C5Jy8UlQSiKhbGBH9gPMFBB35ia2uIOrPjV93948jErhA6hz8DA6Jc2xZs41U4sBpqODYaBpY Gki72xX3r+pJkzp1e4+FKI8UX+5P1gCmtUwERCunqCGX1gRq2roVjXwR5EmNeWvFkMrtsb0ufx7g4 UWYniLDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKP5Q-00FqmE-9J; Sun, 29 Aug 2021 17:59:16 +0000 Received: from jabberwock.ucw.cz ([46.255.230.98]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKP5M-00FqlB-6d for linux-arm-kernel@lists.infradead.org; Sun, 29 Aug 2021 17:59:14 +0000 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 06DA41C0B76; Sun, 29 Aug 2021 19:59:07 +0200 (CEST) Date: Sun, 29 Aug 2021 19:59:07 +0200 From: Pavel Machek To: Jacek Anaszewski Cc: =?iso-8859-1?Q?N=EDcolas_F=2E_R=2E_A=2E?= Prado , Dan Murphy , Bjorn Andersson , Andy Gross , Rob Herring , linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Brian Masney , Luca Weiss , Russell King , Georgi Djakov , linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, ~lkcamp/patches@lists.sr.ht, =?iso-8859-1?Q?Andr=E9?= Almeida , kernel@collabora.com Subject: Re: [PATCH v3 2/5] leds: Add driver for QCOM SPMI Flash LEDs Message-ID: <20210829175906.GA663@amd> References: <20210803162641.1525980-1-nfraprado@collabora.com> <20210803162641.1525980-3-nfraprado@collabora.com> <20210824214515.ekjpvaymkgxltlzp@notapiano> <278ea1e8-8b21-457d-78d7-fbb32544fe0a@gmail.com> MIME-Version: 1.0 In-Reply-To: <278ea1e8-8b21-457d-78d7-fbb32544fe0a@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210829_105912_430980_796279D6 X-CRM114-Status: GOOD ( 31.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6569846129898372596==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6569846129898372596== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi both! Please trim your replies (removing code you are not commenting on). Scolling 600 lines to find where discussion is is not fun. Best regards, Pavel > >>>+static int qcom_flash_torch_on(struct qcom_flash_led *led) > >>>+{ > >>>+ int rc, error; > >>>+ struct qcom_flash_device *leds_dev =3D led_to_leds_dev(led); > >>>+ struct device *dev =3D leds_dev->dev; > >>>+ > >>>+ if (leds_dev->peripheral_subtype =3D=3D QCOM_FLASH_SUBTYPE_DUAL) { > >>>+ rc =3D qcom_flash_torch_regulator_on(leds_dev); > >>>+ if (rc) > >>>+ goto error_reg_write; > >>>+ } else if (leds_dev->peripheral_subtype =3D=3D QCOM_FLASH_SUBTYPE_SI= NGLE) { > >>>+ rc =3D qcom_flash_fled_regulator_on(leds_dev); > >> > >>Why for torch mode you need to enable fled regulator? > > > >Based on [1], apparently the hardware present in the Single variant of t= he PMIC > >has some limitation that requires the use of the flash regulator and the= value > >QCOM_FLASH_ENABLE_ALL to enable the LEDs for the torch mode. The Dual va= riant on > >the other hand can just use the torch regulator and enables the LEDs with > >QCOM_FLASH_ENABLE_MODULE. > > > >[1] https://github.com/AICP/kernel_lge_hammerhead/commit/0f47c747c074993= 655d0bfebd045e8ddd228fe4c > > > >I'm honestly not sure what the impact is on using the different regulato= rs and > >enable values. I have tested enabling the Dual PMIC with different enabl= e values > >and all seemed to work the same, so must be some hardware detail. > > > >I left that Single codepath in the hope that it is useful for devices th= at have > >that variant of the hardware, but I have only actually tested the Dual P= MIC, > >which is the one present on the Nexus 5. >=20 > Thanks for the explanation. Just wanted to confirm that it was not > a mistake. >=20 > >> > >>>+ if (rc) > >>>+ goto error_flash_set; > >>>+ > >>>+ /* > >>>+ * Write 0x80 to MODULE_ENABLE before writing > >>>+ * 0xE0 in order to avoid a hardware bug caused > >>>+ * by register value going from 0x00 to 0xE0. > >>>+ */ > >>>+ rc =3D qcom_flash_masked_write(leds_dev, > >>>+ QCOM_FLASH_ADDR_ENABLE_CONTROL, > >>>+ QCOM_FLASH_ENABLE_MODULE_MASK, > >>>+ QCOM_FLASH_ENABLE_MODULE); > >>>+ if (rc) { > >>>+ dev_err(dev, "Enable reg write failed(%d)\n", rc); > >>>+ goto error_flash_set; > >>>+ } > >>>+ } > >>>+ > >>>+ rc =3D qcom_flash_torch_reg_enable(leds_dev, true); > >>>+ if (rc) > >>>+ goto error_reg_write; > >>>+ > >>>+ rc =3D qcom_flash_masked_write(leds_dev, QCOM_FLASH_ADDR_ENABLE_CONT= ROL, > >>>+ QCOM_FLASH_ENABLE_MASK, > >>>+ leds_dev->torch_enable_cmd); > >>>+ if (rc) { > >>>+ dev_err(dev, "Enable reg write failed(%d)\n", rc); > >>>+ goto error_reg_write; > >>>+ } > >>>+ > >>>+ rc =3D qcom_flash_masked_write(leds_dev, QCOM_FLASH_ADDR_LED_STROBE_= CTRL, > >>>+ led->flash_strobe_cmd, > >>>+ led->flash_strobe_cmd); > >> > >>Just to make sure - the hardware requires strobe cmd to enable torch? > > > >Yes. The strobe value is the one that actually turns each of the LEDs on, > >doesn't matter if it's on flash or torch mode. The difference in torch m= ode is > >actually just that the timeout on the LEDs is disabled (done by writing = 0x00 > >into the TORCH, 0xE4, register). > >So for both modes, the LEDs are turned on by writing to the STROBE_CTRL,= 0x47, > >register. If torch is on they'll stay on indefinitely, while on flash mo= de > >they'll turn off after the timeout. > > > >Perhaps it's just a naming issue? >=20 > I propose to add these comments next to the calls in question. --=20 http://www.livejournal.com/~pavelmachek --/9DWx/yDrRhgMJTb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmEryuoACgkQMOfwapXb+vITYACfTzmB/yQMp8pEyspMSXKVmTXc 00kAoIV7dtVg8PxzAHH9lUhUZiImRPmJ =8kYL -----END PGP SIGNATURE----- --/9DWx/yDrRhgMJTb-- --===============6569846129898372596== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6569846129898372596==--