Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1616117lqm; Fri, 3 May 2024 00:29:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWG2TT4/YIFkjhZUiElpDn5iYeDJr4YWzi28JVVik37irT/ph5s7HZfWrEnPxHi6OVnXGj6W0xWr29LNQ9XinwDSTMHSUSg25fOelNAIA== X-Google-Smtp-Source: AGHT+IGMHyiWXvBwbpxZkeNgccP7N/mfaDS7eSkAeJ7pvKMn28C4EcQGa7+AancSsgOaUpNwzzDs X-Received: by 2002:a05:6870:c151:b0:23c:904e:a24f with SMTP id g17-20020a056870c15100b0023c904ea24fmr2325769oad.31.1714721366503; Fri, 03 May 2024 00:29:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714721366; cv=pass; d=google.com; s=arc-20160816; b=KHKx0eiAjN68O80KCCXeDU0PlGRHksEyIkMfmXhnEl6S6sj1NtV4oRXOpbD1JrWdUn r5fL864imNk8ML2pIV5rvuzDU2InZeIqQ/Q6HWHnjLzFBXnrzoXQIeh0Ig+bcyPQ6lBS b9W6uelsnURfvjYcwQF7ZOF2G3kOQW3yIyRwgenpnU8Sa7visrYrlPM3umpJi06upR3I LLPOB+k9Tp/bAcateGQgznIHMAyMC2og6KfQviND/PrDc6xk9glv7U6Sb5yTGV0024Xw +RBY2PXh4uWlud3iCCf3Y4LQ7NWw2pftRg99e8pgOjZMIdpfhLtiPRNnPX2tF598Sj8C I2HA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JMXki/1Q5LqFk4wDJf/xyGUSFEivLrfkvpNLHg/jVkM=; fh=p5qEDRbY6YwxxwlM9x8fDoNBFYaD8hcuuQFqNLFF+IQ=; b=lCrA4P0A7Liqv10gVqry5janRt643dhnUfknJHNSa/6SnH+ASluavykvdKHh+9nH0x 0CZ7+yoAb/ii7SjkcOinRkmbBesAouNBkcE3Uzy79byWmen8yzz60kDNwkjChTk4dgns KYxo11nIAWQSAFo9SFTNdhd0WJI0f1nWfS51ZwfBYFCug/19zkICij1fzXrPxjYOf37d VD2isGoyV1VoLH9ZWZ1Fbkm0Hu/XALPP3HyJ+YNA4zo355dVHBGCF6BqCp+a5gvf9vSk 94OsPhStn9xv0+CRyCWPhcfrKd9EAuvsnZGyaFolAH+RMMfhcZKgLcm3D1SFNtEil/dm gumg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WvkKNcli; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-167311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c19-20020aa78c13000000b006ee1508edb3si2451856pfd.123.2024.05.03.00.29.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 00:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WvkKNcli; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-167311-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167311-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 89354284967 for ; Fri, 3 May 2024 07:20:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B18E3146D5B; Fri, 3 May 2024 07:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WvkKNcli" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C65C3146A75; Fri, 3 May 2024 07:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720835; cv=none; b=M4Te7n16GX8PBayLJK9vT/A9U9g/VfSLeC9iNh7wNYtp691fKHYdkoMMhg6zLwDi3dzPGE36buJKFCj9qmHeaiVAcOK69cWEeVmLhX2WJNfBEgLvTtVBvxCDN7KrfkSGJNErqIMvdGneWbP9oIE0/gnDuwWuoLyKP6gw0ghXy8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720835; c=relaxed/simple; bh=VkrDitXNDbDsw/xs7zAS2Pp+s+d1L4Fx/47JCMT3yB0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sJO3pU/hx/P+oIBAXqzXb4eyCaGnAJgByctxNhv9Zbeqo2fhkOTbdOIBUhKQa7aOIHYhBRpUDB20ox6YFxcCqSYBZcXXEkUg8aqNpea0Qm+J9b+/O0yA7AaZ3NzJhEcMUZtowcorCzu3dGt1jILbBuJVTTysUcjFGKtAGLBYsUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WvkKNcli; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED49EC116B1; Fri, 3 May 2024 07:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714720835; bh=VkrDitXNDbDsw/xs7zAS2Pp+s+d1L4Fx/47JCMT3yB0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WvkKNcliEjYuU4LXhmSwZwR3iuV5RTxhcMEMoO0JvQiVHxFWyt2vWld4+KNhln3ty uOQ4icLZZuFlmveAhP4Xg1ssN+W5j48rwyOOrG5pO7IGMg2+INJ61ZA4/AVIpaPO31 wNv9gwWAksnFrAo66L4F3QVmLJn+Oe0SQJ1lc2WLXsILhZ4dZVGYh8bmbV2GJsq0Jd 8sCD7xBbc6j979qAPX2MVkMhL5PC4gRmKv/YQkkp+IcBgfI/omjtqBSQJJCHI3sMVf eGrsUpAXaw8BlzOVgEkkYgxDJS+U1igZtyxE3mTG8mkE3qh3x+/El3xuoPNcF1Dt/O Q7jVPhcHImPfg== Date: Fri, 3 May 2024 08:20:29 +0100 From: Lee Jones To: =?iso-8859-1?Q?Andr=E9?= Apitzsch Cc: Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kees Cook , "Gustavo A. R. Silva" , Bjorn Andersson , Konrad Dybcio , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-arm-msm@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org Subject: Re: [PATCH v2 2/3] leds: sy7802: Add support for Silergy SY7802 flash LED controller Message-ID: <20240503072029.GE1227636@google.com> References: <20240401-sy7802-v2-0-1138190a7448@apitzsch.eu> <20240401-sy7802-v2-2-1138190a7448@apitzsch.eu> <20240411124855.GJ1980182@google.com> <20240502091017.GF5338@google.com> <9bb6ef63e19bf079fd881a3b78b71d7a00e4a3bb.camel@apitzsch.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9bb6ef63e19bf079fd881a3b78b71d7a00e4a3bb.camel@apitzsch.eu> On Thu, 02 May 2024, André Apitzsch wrote: > Am Donnerstag, dem 02.05.2024 um 10:10 +0100 schrieb Lee Jones: > > On Wed, 01 May 2024, André Apitzsch wrote: > > > > > > > + ret = -EBUSY; > > > > > + goto unlock; > > > > > + } > > > > > + > > > > > + if (level) > > > > > + curr = chip->fled_torch_used | BIT(led- > > > > > >led_no); > > > > > + else > > > > > + curr = chip->fled_torch_used & ~BIT(led- > > > > > >led_no); > > > > > + > > > > > + if (curr) > > > > > + val |= SY7802_MODE_TORCH; > > > > > + > > > > > + /* Torch needs to be disabled first to apply new > > > > > brightness */ > > > > > > > > "Disable touch to apply brightness" > > > > > > > > > + ret = regmap_update_bits(chip->regmap, > > > > > SY7802_REG_ENABLE, > > > > > SY7802_MODE_MASK, > > > > > + SY7802_MODE_OFF); > > > > > + if (ret) > > > > > + goto unlock; > > > > > + > > > > > + mask = led->led_no == SY7802_LED_JOINT ? > > > > > SY7802_TORCH_CURRENT_MASK_ALL : > > > > > > > > Why not just use led->led_no in place of mask? > > > > > > I might be missing something, but I don't know how to use led- > > > >led_no > > > in place of mask, when > > > led->led_no is in {0,1,2} and > > > mask is in {0x07, 0x38, 0x3f}. > > > > This doesn't make much sense. > > > > I guess you mean that led_no is a u8 and mask is a u32. > > > > What happens if you cast led_no to u32 in the call to > > regmap_update_bits()? > > Sorry, I'm still confused. Could you elaborate your original question? Replied where there is still context. -- Lee Jones [李琼斯]