Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1362864lqm; Thu, 2 May 2024 12:20:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUj7ZMVuZphZI3x2LXFHK4Ja9hokzPEjRG5rvcfT0VWJyO4Lwzk4Mt/yAYYHIzHfIRwlI72yJbuwzRk8y0n7gg4ZiWEGxCXCGcVGi3NbQ== X-Google-Smtp-Source: AGHT+IEFtldRFsnuqkk8hOTPhVrqrc0UmcgZFpOZTa1BMr8JZzo0fBN32pWobBx2iJL2XPvGdLGS X-Received: by 2002:a05:620a:1a94:b0:790:f698:763b with SMTP id bl20-20020a05620a1a9400b00790f698763bmr1487789qkb.37.1714677602684; Thu, 02 May 2024 12:20:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714677602; cv=pass; d=google.com; s=arc-20160816; b=UFiXdBe1tyZC8ol3anitWOaM/zjS2k5hDYjd5YRUmjW2YFG1xd7eL2biDbEu3tZh50 EfoWcDG6l4LT1hLRjJAFFgm/P5QV3MvKOLDzAMBnNNqKUVhDECBCutTkdKwNMZSn2cQx d+q+euDATVNMhp8rhn3yhkC9RqkHyEJA/vExeZyvBgHaKdkQqWGokjz6eTcDiLrJv/nV yAh+njGSr8ZFkRiffMeCnk0Dkl3AXjA8TBIj/QpBVzMy3lRpjof3mYDC2YpzTf0Vo2Q1 9tsJyN9ArttfLrnOx/7Wk0/QfGxh5FdUT134Q7M0SJG3yzUF4jomPvxcRdZnR0KNH25s yv9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=k+oWBJElMqMmdqYAC+nJwL07HfwgZhwCMxFZN6VYpBw=; fh=EcAyfXgtH76JfKosxktYkMymnAX4cJpTaE2e+JB1Xh8=; b=JNfTu64527SnN+jQGFx2w1kNrNwpytdhX28MYkFX+IKJ/avmFmop1GGayknhQXAzdv R8ThVm+JzKpDsyJxZPcoQEjS3BE0+Dsn0InH0a1ZhYunh5ZwMi+3x28eZHe5fbABc6uB 22QBdbG0p1bcTw1vfRiPUfPlUP00YUZlnpxA/hQ1DZCKE4ILJ1zg8b54/kMMUG3CB3SO c6re9zuS9M9x6NobHH4s0HyxuKCDuX2Bl4DDNqvtBnTyKQtyYGI0UbGtSfXbeScbDszp QK6qy04TkTFP+WuFRPiynVX5VSl87SUeCwOebOVXL8xNSXUjh8Te+Jg7bhcPigjxTLl8 S71g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=apitzsch.eu); spf=pass (google.com: domain of linux-kernel+bounces-166861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166861-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id vw22-20020a05620a565600b007926eeb7b8dsi1500488qkn.291.2024.05.02.12.20.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 12:20:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=apitzsch.eu); spf=pass (google.com: domain of linux-kernel+bounces-166861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166861-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6AF9F1C20E00 for ; Thu, 2 May 2024 19:20:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 306B11802AC; Thu, 2 May 2024 19:19:55 +0000 (UTC) Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.31.42]) (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 448341DDE9; Thu, 2 May 2024 19:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.67.31.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714677594; cv=none; b=etXM6TLUux7ekR63Vc8oepAiibgfSjaEDjpBPEhiDPRmyc6/RZuwFSkY6It24hH/W5/BsaXQgifmMd3Szog/J4+jxp4n0nh0kSrdzaNgoAtX/xajnfbESY0M/2GexIL9/lgQmAwS3u6ZfUb3MeanjZXDLSQ6wuoN1Z1wXhXYQN4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714677594; c=relaxed/simple; bh=cMv9nLPugJbMDvj5g8lAQwCGg7iV1EJ33oheAeccbpA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=l4fzcCAdyEoENs2xo7PXsgSLqOFxfrU51/ZM+bOAkiZdsiy4rDN78pttx69bgpqL5sM+/qNcq6hvxlav9glhtld0ODUrIHTShpo+kAQ4oThpBHVDmi8zNbK2PhKB82X6TPBc0F4lwRQb2kvJyF1IEOk39H+ZdRO59rLTl5Tmqv8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=apitzsch.eu; spf=pass smtp.mailfrom=apitzsch.eu; arc=none smtp.client-ip=80.67.31.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=apitzsch.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=apitzsch.eu Received: from [92.206.191.65] (helo=framework.lan) by smtprelay04.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1s2bxV-000000007N8-1Lcs; Thu, 02 May 2024 21:19:09 +0200 Message-ID: <9bb6ef63e19bf079fd881a3b78b71d7a00e4a3bb.camel@apitzsch.eu> Subject: Re: [PATCH v2 2/3] leds: sy7802: Add support for Silergy SY7802 flash LED controller From: =?ISO-8859-1?Q?Andr=E9?= Apitzsch To: Lee Jones 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 Date: Thu, 02 May 2024 21:19:13 +0200 In-Reply-To: <20240502091017.GF5338@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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= Am Donnerstag, dem 02.05.2024 um 10:10 +0100 schrieb Lee Jones: > On Wed, 01 May 2024, Andr=C3=A9 Apitzsch wrote: >=20 > > > > + ret =3D -EBUSY; > > > > + goto unlock; > > > > + } > > > > + > > > > + if (level) > > > > + curr =3D chip->fled_torch_used | BIT(led- > > > > >led_no); > > > > + else > > > > + curr =3D chip->fled_torch_used & ~BIT(led- > > > > >led_no); > > > > + > > > > + if (curr) > > > > + val |=3D SY7802_MODE_TORCH; > > > > + > > > > + /* Torch needs to be disabled first to apply new > > > > brightness */ > > >=20 > > > "Disable touch to apply brightness" > > >=20 > > > > + ret =3D regmap_update_bits(chip->regmap, > > > > SY7802_REG_ENABLE, > > > > SY7802_MODE_MASK, > > > > + SY7802_MODE_OFF); > > > > + if (ret) > > > > + goto unlock; > > > > + > > > > + mask =3D led->led_no =3D=3D SY7802_LED_JOINT ? > > > > SY7802_TORCH_CURRENT_MASK_ALL : > > >=20 > > > Why not just use led->led_no in place of mask? > >=20 > > 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}. >=20 > This doesn't make much sense. >=20 > I guess you mean that led_no is a u8 and mask is a u32. >=20 > 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? >=20 > > > Easier to read if you drop SY7802_TORCH_CURRENT_MASK_ALL to its > > > own > > > line. > > >=20 > > > > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SY7802_TORCH_CURRENT_MASK(le= d->led_no); > > > > + > > > > [..] > > > >=20 >=20