From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF23FC433EF for ; Wed, 1 Dec 2021 16:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351594AbhLAQ4w (ORCPT ); Wed, 1 Dec 2021 11:56:52 -0500 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:17416 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244011AbhLAQ4n (ORCPT ); Wed, 1 Dec 2021 11:56:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1638377585; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date: From:Subject:Sender; bh=IrLqeXQ7cnKmOP13b28CuGf9NhUY4ybFFkNm3lBDdyo=; b=cwvV9r0cfsuiCVIDsFf+gsOiOZF2MIZ+8JrpB08rAyftCZMzf/t0j5XO31u//9JMy/ eQirRIPZN9oUQ9ADd0gC//++YlflpmOR2jfpz8QcOq4KBXlH+YlUGp/+8sxlIaFcE5Tt jLD/beSSzkw3Sg1zcDQAVWe05xCpYpL/uwGXCqGwtI/gW6K+1uL7yYmQGG8dsWECdI7o eHPbCT9oWVV38jrE0+V/Nb7Pd92TY7PXUSnbliI/91bOA4TqKGCtTQmW54ftNnGmgHWC foV60zyyOZlUaQ9p08IY+JYhyrYK6ybWduR+rtkFlOFFILCP49f283jnGR3YRbLhB8gM FhUg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj4Qpw9iZeHWElw43u22M=" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 47.34.10 SBL|AUTH) with ESMTPSA id e05ed8xB1Gr4YRR (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Wed, 1 Dec 2021 17:53:04 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: [PATCH v10 4/8] drm/ingenic: Add dw-hdmi driver for jz4780 From: "H. Nikolaus Schaller" In-Reply-To: Date: Wed, 1 Dec 2021 17:53:03 +0100 Cc: Paul Cercueil , Rob Herring , Mark Rutland , Thomas Bogendoerfer , Geert Uytterhoeven , Kees Cook , "Eric W. Biederman" , Miquel Raynal , David Airlie , Daniel Vetter , Neil Armstrong , Robert Foss , Laurent Pinchart , Jernej Skrabec , Harry Wentland , Sam Ravnborg , Maxime Ripard , Hans Verkuil , Liam Girdwood , Paul Boddie , devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, Jonas Karlman , dri-devel@lists.freedesktop.org, Ezequiel Garcia Content-Transfer-Encoding: quoted-printable Message-Id: <3174DA41-EB38-4C30-8752-0D9C894C74A7@goldelico.com> References: <4daf0c5dbed2c47c97003ab8de0a7dbd2a335dc3.1638307601.git.hns@goldelico.com> <46070A95-0FA9-43F9-A9A9-52A7B58B88F5@goldelico.com> <58C550A4-A21E-47BA-8BAE-00B927DC7A2E@goldelico.com> To: Mark Brown X-Mailer: Apple Mail (2.3445.104.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, > Am 01.12.2021 um 16:10 schrieb Mark Brown : >=20 > On Wed, Dec 01, 2021 at 03:33:24PM +0100, H. Nikolaus Schaller wrote: >>> Am 01.12.2021 um 15:03 schrieb Paul Cercueil : >=20 >>> Please make it mandatory in DTS then, and use devm_regulator_get() = in the driver. >=20 >> Well, I just wonder why the elegant devm_regulator_get_optional() = exists at all >> and seems to be used in ca. 80 places. >=20 > Frankly because half of them are broken usages like this since people > seem determined to have the most fragile error handling they can :/ I see. I had made the mistake myself to not check for NULL pointer on regulator_disable here... > There are valid use cases for it, with things like SD cards where some > supplies are genuinely optional and simply constrain what features are > available if they're omitted from the design. You also see some = devices > with the ability to replace internal regulators with external ones. >=20 >> And if it is not allowed, why some DTS should be forced to add not = physically existing dummy-regulators. >=20 > Again, if the supply can be physically absent that is a sensible use > case but that means completely absent, not just not software > controllable. We can represent fixed voltage regulators just fine. The question may be how we can know for a more generic driver that there = is always a regulator. In the present case we know the schematics but it is just one example. >=20 >> AFAIR drivers should implement functionality defined by DTS but not = the other way round: enforce DTS style. >> BTW: there is no +5 mains dummy regulator defined in ci20.dts. >=20 > It wouldn't be the first time a DTS were incomplete, and I'm sure it > won't be the last. >=20 >> What I fear is that if we always have to define the mains +5V (which = is for example not >> defined in ci20.dts), which rules stops us from asking to add a = dummy-regulator from 110/230V to +5V as well. >=20 > It is good practice to specify the full tree of supplies all the way = to > the main supply rail of the board, this ensures that if we need the > information for something we've got it (even if that thing is just = that > we've got to the root of the tree). There's potential applications in > battery supplied devices for managing very low power situations. Indeed. So let's modify it as you have suggested. BR and thanks, Nikolaus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 116C7C433F5 for ; Wed, 1 Dec 2021 16:53:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B5DE6E523; Wed, 1 Dec 2021 16:53:12 +0000 (UTC) Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [81.169.146.168]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57E996E523 for ; Wed, 1 Dec 2021 16:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1638377585; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject:Cc:Date: From:Subject:Sender; bh=IrLqeXQ7cnKmOP13b28CuGf9NhUY4ybFFkNm3lBDdyo=; b=cwvV9r0cfsuiCVIDsFf+gsOiOZF2MIZ+8JrpB08rAyftCZMzf/t0j5XO31u//9JMy/ eQirRIPZN9oUQ9ADd0gC//++YlflpmOR2jfpz8QcOq4KBXlH+YlUGp/+8sxlIaFcE5Tt jLD/beSSzkw3Sg1zcDQAVWe05xCpYpL/uwGXCqGwtI/gW6K+1uL7yYmQGG8dsWECdI7o eHPbCT9oWVV38jrE0+V/Nb7Pd92TY7PXUSnbliI/91bOA4TqKGCtTQmW54ftNnGmgHWC foV60zyyOZlUaQ9p08IY+JYhyrYK6ybWduR+rtkFlOFFILCP49f283jnGR3YRbLhB8gM FhUg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj4Qpw9iZeHWElw43u22M=" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 47.34.10 SBL|AUTH) with ESMTPSA id e05ed8xB1Gr4YRR (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Wed, 1 Dec 2021 17:53:04 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: [PATCH v10 4/8] drm/ingenic: Add dw-hdmi driver for jz4780 From: "H. Nikolaus Schaller" In-Reply-To: Date: Wed, 1 Dec 2021 17:53:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <3174DA41-EB38-4C30-8752-0D9C894C74A7@goldelico.com> References: <4daf0c5dbed2c47c97003ab8de0a7dbd2a335dc3.1638307601.git.hns@goldelico.com> <46070A95-0FA9-43F9-A9A9-52A7B58B88F5@goldelico.com> <58C550A4-A21E-47BA-8BAE-00B927DC7A2E@goldelico.com> To: Mark Brown X-Mailer: Apple Mail (2.3445.104.21) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Paul Boddie , Geert Uytterhoeven , Neil Armstrong , David Airlie , dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Paul Cercueil , Laurent Pinchart , Miquel Raynal , Sam Ravnborg , Jernej Skrabec , devicetree@vger.kernel.org, Kees Cook , Jonas Karlman , Rob Herring , Maxime Ripard , letux-kernel@openphoenux.org, Ezequiel Garcia , Thomas Bogendoerfer , Liam Girdwood , Robert Foss , linux-kernel@vger.kernel.org, "Eric W. Biederman" , Hans Verkuil Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Mark, > Am 01.12.2021 um 16:10 schrieb Mark Brown : >=20 > On Wed, Dec 01, 2021 at 03:33:24PM +0100, H. Nikolaus Schaller wrote: >>> Am 01.12.2021 um 15:03 schrieb Paul Cercueil : >=20 >>> Please make it mandatory in DTS then, and use devm_regulator_get() = in the driver. >=20 >> Well, I just wonder why the elegant devm_regulator_get_optional() = exists at all >> and seems to be used in ca. 80 places. >=20 > Frankly because half of them are broken usages like this since people > seem determined to have the most fragile error handling they can :/ I see. I had made the mistake myself to not check for NULL pointer on regulator_disable here... > There are valid use cases for it, with things like SD cards where some > supplies are genuinely optional and simply constrain what features are > available if they're omitted from the design. You also see some = devices > with the ability to replace internal regulators with external ones. >=20 >> And if it is not allowed, why some DTS should be forced to add not = physically existing dummy-regulators. >=20 > Again, if the supply can be physically absent that is a sensible use > case but that means completely absent, not just not software > controllable. We can represent fixed voltage regulators just fine. The question may be how we can know for a more generic driver that there = is always a regulator. In the present case we know the schematics but it is just one example. >=20 >> AFAIR drivers should implement functionality defined by DTS but not = the other way round: enforce DTS style. >> BTW: there is no +5 mains dummy regulator defined in ci20.dts. >=20 > It wouldn't be the first time a DTS were incomplete, and I'm sure it > won't be the last. >=20 >> What I fear is that if we always have to define the mains +5V (which = is for example not >> defined in ci20.dts), which rules stops us from asking to add a = dummy-regulator from 110/230V to +5V as well. >=20 > It is good practice to specify the full tree of supplies all the way = to > the main supply rail of the board, this ensures that if we need the > information for something we've got it (even if that thing is just = that > we've got to the root of the tree). There's potential applications in > battery supplied devices for managing very low power situations. Indeed. So let's modify it as you have suggested. BR and thanks, Nikolaus