Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1883034rdb; Mon, 9 Oct 2023 06:09:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkR8N/QbCoA5stVwTN4wrmmTyiXNPhWtUNQ8ZgcOeXN3QfQk8jSXMNarZjbdEUM9M7kdta X-Received: by 2002:a17:902:724a:b0:1bb:3979:d467 with SMTP id c10-20020a170902724a00b001bb3979d467mr11705222pll.63.1696856981515; Mon, 09 Oct 2023 06:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696856981; cv=none; d=google.com; s=arc-20160816; b=hrT31rcfsGBrQTkSnsoF+CILgh9K0p0Nenw88f4fQdrE5DfGyrIkwCoJ6sGWe7zMo3 l1kSf+rXcTv6wkzatA8Rk7Jio4tVLmVjtJJsvZNcHrzp/5MkBB7t/onJtGHqWf0PMjbH 5ea3dZvpfCanTgKacGkDpq+8JMaOnt1A5p6uCsGBz2LKh6tbyc4WOOSV+tzCzE5MOI6N YdoYLXQJMn64BD9segQPPcZQ6TcBS0VWpOPjHhPtYSJCOsIDxAry6X9bszLa6JMwn+ME RD+oGazPVmL5mxeIsYGfBh4ttJov1dYm+XtbbMu/L0ZRWfU953pw5fD8xT7yzOia79KG 3eVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=fJueb/I454tOqgUy+mqOFFsn6IdMT0sYitu6ljAKTBs=; fh=4lb18ii2wz2onRPwfu/X4MigCaE+ZvPH28o8gOxOO0I=; b=jS8PYNm6F3KaIWwlx6H/gbrE+Sht7oV3jBiLRfDvAizn6NHfcxOt0YNgRK0RvjHoGN zvozupc5DmHmxFrB/uwIbOmVuUNkkI/yDsS1WCxUGVTJix8bJTWkCsjuFr/WncFBDkzE UMpbCw3xWR95D1UGYCS0y+GnRY607cRn7iRmGBZtseTEqMszMYBjEoDs7JWs3g41CBrR 72kePOYOaEWTlGlnQ6YOp6A911LFc1XJHwSFWepFLk2ySjrQrBO7pyxKpNImR5FQFnq8 UNQi+lY/Ci2t5er2zZPWqsnjJGgvxnIJSTWhR978IN8xN8tPdDd0n+G7JNfNqbCYwDIk RkUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=j2PsSXaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m17-20020a170902c45100b001c3f6dbe2bdsi5789513plm.105.2023.10.09.06.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 06:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=j2PsSXaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 10C3280ADC64; Mon, 9 Oct 2023 06:09:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376759AbjJINJ3 (ORCPT + 99 others); Mon, 9 Oct 2023 09:09:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376748AbjJINJ1 (ORCPT ); Mon, 9 Oct 2023 09:09:27 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E90119E; Mon, 9 Oct 2023 06:09:24 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 1CBC8120005; Mon, 9 Oct 2023 16:09:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 1CBC8120005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1696856961; bh=fJueb/I454tOqgUy+mqOFFsn6IdMT0sYitu6ljAKTBs=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:From; b=j2PsSXaTU7/xQBImFRZFRkiXL3U8tXLfP5hSgTxZd0R6ipksW6SlwiwzRSuoQ8BF9 qrtUdcnmkM64evnkHYhePoALkJ5OSUqf5su/rofLnQwhXs219ik+ccJ4T9abwx+FjU 7Xwp+05EVFFf+X6bETJdckU5eowrz7xvLh3ffVMtSNTymvEHBfCNWPMCnVZ7XXW3fH HwsEgr4Fn53D7N5OKNXOzEidDtb626+tRyNvLS67wDKgBn76AvMVOU76BOmeRS51V6 0q0HQYU3fmD7nuibkgOhakq2SmHoeatQBNDY14pPeLyaxuODq2dfKimJZ4NNWCfUN3 zY0b5m8fT5dfQ== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Mon, 9 Oct 2023 16:09:20 +0300 (MSK) Received: from localhost (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Mon, 9 Oct 2023 16:09:19 +0300 Date: Mon, 9 Oct 2023 16:09:19 +0300 From: Dmitry Rokosov To: Andy Shevchenko CC: , , , , , , , , , Subject: Re: [PATCH v1 03/11] leds: aw200xx: support HWEN hardware control Message-ID: <20231009130919.bezr4wvk4pwmc4p3@CAB-WSD-L081021> References: <20231006160437.15627-1-ddrokosov@salutedevices.com> <20231006160437.15627-4-ddrokosov@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20220415 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 180473 [Oct 09 2023] X-KSMG-AntiSpam-Version: 6.0.0.2 X-KSMG-AntiSpam-Envelope-From: ddrokosov@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 536 536 1ae19c7800f69da91432b5e67ed4a00b9ade0d03, {Track_E25351}, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;127.0.0.199:7.1.2;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/10/08 23:24:00 #22096719 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 06:09:39 -0700 (PDT) X-Spam-Level: ** Hello Andy, Thanks a lot for such a quick review! Please find my comments below. On Fri, Oct 06, 2023 at 08:57:23PM +0300, Andy Shevchenko wrote: > On Fri, Oct 6, 2023 at 7:04 PM Dmitry Rokosov > wrote: > > > > HWEN is hardware control, which is used for enable/disable aw200xx chip. > > It's high active, internally pulled down to GND. > > > > After HWEN pin set high the chip begins to load the OTP information, > > which takes 200us to complete. About 200us wait time is needed for > > internal oscillator startup and display SRAM initialization. After > > display SRAM initialization, the registers in page1 to page5 can be > > pages 1 to 5 > > Sure, you are totally right. > > configured via i2c interface. > > ... > > > +#include > > Definitely not. > > Use agnostic APIs. Sure > > @@ -116,6 +117,7 @@ struct aw200xx { > > struct mutex mutex; > > > u32 num_leds; > > u32 display_rows; > > + int hwen; > > struct aw200xx_led leds[]; > > Side note: add a patch to use __counted_by() here. Okay, now I see the patch with __counted_by() some days ago. I will rebase on it. > > + if (!gpio_is_valid(chip->hwen)) > > Absolutely not. You may not use legacy GPIO APIs. Exactly > > + return; > > + > > + gpio_set_value(chip->hwen, 1); > > Ditto. Ok > > + usleep_range(400, 500); > > fsleep() ? Agreed. In this situation fsleep() automatic behaviour is acceptable. > > ... > > > +static void aw200xx_disable(const struct aw200xx *const chip) > > +{ > > + if (gpio_is_valid(chip->hwen)) > > + gpio_set_value(chip->hwen, 0); > > +} > > As per above. Ok > > +static void aw200xx_probe_hwen(struct device *dev, struct aw200xx *chip) > > +{ > > + chip->hwen = of_get_named_gpio(dev->of_node, "awinic,hwen-gpio", 0); > > + if (gpio_is_valid(chip->hwen)) > > + if (devm_gpio_request_one(dev, chip->hwen, GPIOF_OUT_INIT_HIGH, > > + "AW200XX HWEN")) { > > + dev_warn(dev, "Can't request gpio %d, tag it invalid\n", > > + chip->hwen); > > + chip->hwen = -EINVAL; > > + } > > +} > > Please, rewrite this completely using supported APIs and not > deprecated or obsolete ones. Yep, I see. I will use devm_gpiod_* API. -- Thank you, Dmitry