Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1957217rdb; Mon, 9 Oct 2023 08:09:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgX+aR0b9GmIKE/5dhUfN9dlOEqBlBbwAvuDq+Zo60xXL0euIdZoDFS070ecwE6bftbuoM X-Received: by 2002:a05:6808:14c3:b0:3af:cc6f:c691 with SMTP id f3-20020a05680814c300b003afcc6fc691mr11766993oiw.58.1696864157228; Mon, 09 Oct 2023 08:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696864157; cv=none; d=google.com; s=arc-20160816; b=rYsAOwqHcEXltYh9fZqWkl3dia8CrhULylB7O9iXBXoR6HZGTGp8YdG7bAvfUJ5gIZ le0OYIF5N6SG19YiPdvAiOVtlf/l85djzKN3S3mQkHspKfBJWyMHj0GkKl18kjR0FPYm uCtLNUffrJWgLWFUtMTAron38/5ylpNbZEcyvHWp+4sL0JgZyjnt3ZCNLl6kl2XJQxGN Uv6XeWiyc66BsB5k4XB2Ulj3DLglFW4lj6YFMzYReSPk/h8h9KZDZ7LUHnyLbKYnuysj 9mzAsgTFfSJLRKc70FSSW2B4LxdAAlVqXL6IXpnXjuoFpHqksV53TmmIZXwzBq6F8Mra Y4bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:autocrypt:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CPukJVpAM34W/WdUPPtUehJa95MxQZSJwW5kHt6f2Jc=; fh=0z5IJp4OV2ZcxcwWIL8EaJSpb0VMYfX04t7xMLEQJk0=; b=pZH1L555SAUW+zwHL37MhKf5Hv/5/RI//eeqUf1oZwj8joMLR9B35hMpHn4ncAG7xM dY3kF4d9uFYhAZPNWsMJFRIxg8Fb+QgMmM1Axb077Sg2X6+OPL1CRdkP+K3M5QzING1v TtF9NXVeg/qD4T4BA9yVU61xlRO35s6mmcdWnSQ95+51cf9JQsUfulselhHecAs+TjT5 Lkl2KR6qRwQeG70qlvlIHW91s9qlzjFMb5owAxRNC9P6ewwTr0u9roLgA0v5HeBDEnO2 o1QDg05RnyfBuI63WzPJ+xhGbft9hht2pKJDeyWDWHOZibpzBO9wG0lMqClgZRXfk9/J WmdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bs5-20020a632805000000b0057745535158si9485717pgb.181.2023.10.09.08.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5222A802FD34; Mon, 9 Oct 2023 08:09:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376373AbjJIPJO convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Oct 2023 11:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346469AbjJIPJN (ORCPT ); Mon, 9 Oct 2023 11:09:13 -0400 Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D6DE9E; Mon, 9 Oct 2023 08:09:11 -0700 (PDT) Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id AE0E984EA2; Mon, 9 Oct 2023 17:09:08 +0200 (CEST) From: Duje =?utf-8?B?TWloYW5vdmnEhw==?= To: Daniel Thompson Cc: Lee Jones , Jingoo Han , Pavel Machek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Helge Deller , Karel Balej , dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: Re: [PATCH 2/2] backlight: Add Kinetic KTD2801 driver Date: Mon, 09 Oct 2023 17:08:59 +0200 Message-ID: <2914963.e9J7NaK4W3@radijator> In-Reply-To: <20231009092103.GB96854@aspen.lan> References: <20231005-ktd2801-v1-0-43cd85b0629a@skole.hr> <20231005-ktd2801-v1-2-43cd85b0629a@skole.hr> <20231009092103.GB96854@aspen.lan> MIME-Version: 1.0 Autocrypt: addr=duje.mihanovic@skole.hr; keydata= mQINBGBhuA8BEACtpIbYNfUtQkpVqgHMPlcQR/vZhB7VUh5S32uSyerG28gUxFs2be//GOhSHv+ DilYp3N3pnTdu1NPGD/D1bzxpSuCz6lylansMzpP21Idn3ydqFydDTduQlvY6nqR2p5hndQg6II pmVvNZXLyP2B3EE1ypdLIm6dJJIZzLm6uJywAePCyncRDJY0J7mn7q8Nwzd6LG74D8+6+fKptFS QYI8Ira7rLtGZHsbfO9MLQI/dSL6xe8ZTnEMjQMAmFvsd2M2rAm8YIV57h/B8oP5V0U4/CkHVho m+a2p0nGRmyDeluQ3rQmX1/m6M5W0yBnEcz5yWgVV63zoZp9EJu3NcZWs22LD6SQjTV1X8Eo999 LtviIj2rIeCliozdsHwv3lN0BzTg9ST9klnDgY0eYeSY1lstwCXrApZCSBKnz98nX9CuuZeGx0b PHelxzHW/+VtWu1IH5679wcZ7J/kQYUxhhk+cIpadRiR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ijVD54V0yWkE8wAqQNf9hag5zlFMfKjmKphzJRbstqlIf0B0oY3NgLZ4ExWa8wJxs+p4pUZd9m+ 6fDfimjuLtlBphjsHfwrgs69g8RqJlEsgsDrWu7zsWraK/jTyuPK6GuNe4AWemRUaZZmhMYnCxU p8AXRgtzZw2vsqERylx1Ug35G/xRIVrjf9bU2fersVWLR3JZ/rJwdjev4cJqzqJ9nBzblHky3K1 cqiNEM/CU+JLBsZMc4jti/3tDv8VKfZiwLMIsVrfPgTM/97CCW3QDwVcreUGx81kemiAweXENWk MGQfJ+8rfAdLHf7iECLWLtrqyfYFQCZGhA5rPPr27TjOLaLV5ObMMBsUY= Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 08:09:16 -0700 (PDT) On Monday, October 9, 2023 11:21:03 AM CEST Daniel Thompson wrote: > On Thu, Oct 05, 2023 at 08:49:09PM +0200, Duje Mihanović wrote: > > +#define EW_DELAY 150 > > +#define EW_DET 270 > > +#define LOW_BIT_HIGH 5 > > +#define LOW_BIT_LOW (4 * HIGH_BIT_LOW) > > +#define HIGH_BIT_LOW 5 > > +#define HIGH_BIT_HIGH (4 * HIGH_BIT_LOW) > > These names are pretty cryptic (they don't even mention that they > are time values and that the unit is microseconds). They also look > like they were derived by tuning so comments would be nice explaining > where they come from (or, failing that, why they are correct). These values are taken from Samsung's driver, which themselves are datasheet values with a couple of us added for I presume safety. The datasheet is publicly available [1] and I can add a link to it to the binding patch in v2. > > + if (!ktd2801->was_on) { > > + gpiod_set_value(ktd2801->desc, 0); > > + udelay(EW_DELAY); > > + gpiod_set_value(ktd2801->desc, 1); > > + udelay(EW_DET); > > + gpiod_set_value(ktd2801->desc, 0); > > + ktd2801->was_on = true; > > + } > > Isn't this implementing the same single GPIO line protocol used by > drivers/leds/flash/leds-ktd2692.c? > > If so, it would be good to pull the expresswire handling into a library > so it can be shared between drivers. leds-ktd2692.c does a pretty > good job of decomposing the expresswire management into functions (e.g. > separating data framing from setting of control values). Expresswire is > a data framing protocol rather than a bus so I think just implementing > it as library code is probably sufficient. KTD2801 and 2692 indeed seem to share the protocol and I can write a library just for this. I believe such a library could go in drivers/leds/leds- expresswire.c and include/linux/leds-expresswire.h (or perhaps even just in a header), do you have any better ideas? > Also, can the expresswire code have protocol-violation watchdogs that > trigger a re-transmit of the message if we get pre-empted in the middle > of sending a message to the backlight (see calls to ktime_get_ns() in > ktd253-backlight.c ). The Samsung driver does not have such watchdogs, but if you think they are needed I can add them. [1] https://www.mouser.com/datasheet/2/936/KTD2801-04b-1391831.pdf Regards, Duje