Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp550184rdb; Fri, 6 Oct 2023 10:58:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGe5al4DWiJ6JExNeVUqv5Ncz4SJQSb88cFVYbz0CyQFCiG2owRLuGcPtiJQlWK6YW9p/6N X-Received: by 2002:a17:902:ee41:b0:1c7:65e3:e610 with SMTP id 1-20020a170902ee4100b001c765e3e610mr8559437plo.49.1696615100937; Fri, 06 Oct 2023 10:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696615100; cv=none; d=google.com; s=arc-20160816; b=baMp5xVUubwlxse2j9XlAW5rSNQ4XBrITJhhCrSaoprBl1Wn7jHf7+Jf2SSjf12kjn ssdrADUIa6h5T9RACiGM/gvAnqFUPwO5uU9xXzwcJeHESNh4qS6AeFs9xruzVXFC4+BO opSQFsnxLl9DE4xWnoFqli0lmo2ep/egVLLk19csJR7TWqLdh2uEjuL83fxkCSrAQnHJ xMBke0d/jNgwajcskA9JVzMoC5456+A0wo1zaN1raBMIMPe/CilUDHQF+Emz0WfGmoKP UUHUlhVCc638jwDyXf20+LXian+NuWvaXXVVJC98+9Fzweb09q+dYKPnQPf0GpxRfBSm 4F9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lLvfcfjTt5FPbCb7jmi7H5VpIo6AQyBiwiFzkClCnXo=; fh=k8rcVvHEim30WRJ/pgo5N//4w/KsFmMmNgKKuu3aMyE=; b=l5EjYdYMZA+ElfNWPLf/zcie2TCTZj6g/VU98Qbz0fQ9E7L+hB7jf7praYLl38cRfa O65giopXIUcVhViQCMLjb4xYlVVdONQBQ/yX41loRxI7DYGrmkEabkQ1K2TO+iITKwpm SWDiXTbs/55zgx66lZwrW799cHRgsjj9fFXDFGaU8eV8rNfiJHAokeMqe4H38Uicvwl2 WMkCifJ6felE9DdfBq6tGLGOdF7SUUURIt+W27xmIavltdeM+6Yr1m0FquaVSBgVdHMu vBXoGZLYJHQWjjKfmM7W+UNBOU9hXacXtYzEUGyNkHMsPE8eASFNHZhkePiDo6lahZlb k49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NuTJnx0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t13-20020a1709027fcd00b001c74d844254si3985738plb.101.2023.10.06.10.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 10:58:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NuTJnx0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F0B05896342C; Fri, 6 Oct 2023 10:58:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233139AbjJFR6E (ORCPT + 99 others); Fri, 6 Oct 2023 13:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbjJFR6D (ORCPT ); Fri, 6 Oct 2023 13:58:03 -0400 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA65AC5; Fri, 6 Oct 2023 10:58:00 -0700 (PDT) Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-77433d61155so150058585a.2; Fri, 06 Oct 2023 10:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696615080; x=1697219880; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lLvfcfjTt5FPbCb7jmi7H5VpIo6AQyBiwiFzkClCnXo=; b=NuTJnx0KUR8WGCoC5tM6KKfeOWNYQDq+YWTv/GJ9ntuw8fyxSfH+3isYbwnLC9xe/6 SnHs7eHZOS46dCAEru3aCMoUAgLzhXGk05h3HaMxeHzZSNr38LwPWvC3EW4ave56p7/c VJ0cgon6vWR+HvgrFOtNKLfRmdFSnUhQRsNfBXnSbg2Q5dnH+h1VowjxvG3dMC/GQpjM LqwZMtIfrR1YRmFhghqm6QGJzOmurRxsRog9YUtfUDw4z4Jhpbs/OK8OdSqOkr1RZiBX B2wV/WhPNgnrd0jKvahge/ie2DmhdRGsJ8poPvsqmGa2XyJr8MzMqavojxfA9SRKxglG BwhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696615080; x=1697219880; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lLvfcfjTt5FPbCb7jmi7H5VpIo6AQyBiwiFzkClCnXo=; b=U3QywjadlqiwiBtK2og6wMmCf+5x+2PqwMR7Nnj09rhDsVlGEbjZKrf0p0JPzB7vvZ 12C311wS7gEQxd594w0L8D6CzSAk64EL3kTUhKEN5KOQS0CmzRNjakkhBm9FL20c/Ec5 +g9FMXhKbdRU9bRo1DkBe4qeNwnvOlBGKmEPXsGWLFAb/JaTzYKdOOHtd8VdygknJGTI 7JOjhKKqIaNba+Ao1fbgJ+ngSupCY71XY/6Oxw2nFrOOxc7NpBfJTTAoVBDElirSyXoY x6XqOhR3voXx/IEptbmR3K80Mvcd7B+0+Si522GcT0ht1TO3oPB8BEAfm1QXJngNTICz cXvA== X-Gm-Message-State: AOJu0YxczYdoA7HQTtAi2Hi9zplpCQibAxP2qUDrUb2GcDCXJ7vL/Djt 8JShWLg2z8Kk464FHlcG8ZRYmGagxD4qUqjgfT2SKJPhFdM= X-Received: by 2002:a05:6214:5585:b0:626:f3d:9e46 with SMTP id mi5-20020a056214558500b006260f3d9e46mr9141180qvb.18.1696615079856; Fri, 06 Oct 2023 10:57:59 -0700 (PDT) MIME-Version: 1.0 References: <20231006160437.15627-1-ddrokosov@salutedevices.com> <20231006160437.15627-4-ddrokosov@salutedevices.com> In-Reply-To: <20231006160437.15627-4-ddrokosov@salutedevices.com> From: Andy Shevchenko Date: Fri, 6 Oct 2023 20:57:23 +0300 Message-ID: Subject: Re: [PATCH v1 03/11] leds: aw200xx: support HWEN hardware control To: Dmitry Rokosov Cc: lee@kernel.org, pavel@ucw.cz, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, kernel@sberdevices.ru, rockosov@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 06 Oct 2023 10:58:18 -0700 (PDT) X-Spam-Level: ** On Fri, Oct 6, 2023 at 7:04=E2=80=AFPM 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 > configured via i2c interface. ... > +#include Definitely not. Use agnostic APIs. ... > @@ -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. > }; ... > + if (!gpio_is_valid(chip->hwen)) Absolutely not. You may not use legacy GPIO APIs. > + return; > + > + gpio_set_value(chip->hwen, 1); Ditto. ... > + usleep_range(400, 500); fsleep() ? ... > +static void aw200xx_disable(const struct aw200xx *const chip) > +{ > + if (gpio_is_valid(chip->hwen)) > + gpio_set_value(chip->hwen, 0); > +} As per above. ... > +static void aw200xx_probe_hwen(struct device *dev, struct aw200xx *chip) > +{ > + chip->hwen =3D 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 inva= lid\n", > + chip->hwen); > + chip->hwen =3D -EINVAL; > + } > +} Please, rewrite this completely using supported APIs and not deprecated or obsolete ones. --=20 With Best Regards, Andy Shevchenko