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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CA245C25B0E for ; Tue, 16 Aug 2022 13:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/ZFWi3hUOTel5ZajElegLBi9pwFX5MT6ldbolmuJVNI=; b=AnIcof0pcD5XoukwgVR0EQJ67z oqa9Cq1ZRkhpRi19uShzRYwCbMZm0mVfvm8sIMt77oS3sb1wqBtoWrZFxAofERsGZxmG0F5ttCTI2 7b++CfgiFpZ22vnrRuWl/rUt/AbDBdYlBRMP/9VF0VsDIhyg+dt+UmtiCnZOCFwbzepQ8nZVj/6+6 EoG5YX5jYUXF6YD7UGsIQVXNY28lnovwmWvHutxRBsP1UlZ1JtrSesW2UG3wvxSPo8hESCyWkaPbe 97ssKP4b1uWFmnGgGYXmEXH9k01cUyAU2tl4qYwJj+vuW7QWDN0rpVWM6qcM2+OjnjeVvSJ4P6FCL ihMUO7Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNwyW-0033gk-Nd; Tue, 16 Aug 2022 13:51:20 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNwyK-0033bd-Vi; Tue, 16 Aug 2022 13:51:10 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 419555801CF; Tue, 16 Aug 2022 09:51:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 16 Aug 2022 09:51:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1660657868; x=1660665068; bh=yuVLbrrN+N 1iK12i7DUjM6pGqTkdcihboprTmt6Byjw=; b=odX2548XwGXoGeKNs0MbkWaSSx lfpsoLA8A8tZ3+XRhAbG1K21dnqkAYavMxd5ydxZzSSazv9h7PvZWs3oaJqIVzdA RfmZLhQ6h0EfZpOr1x+wr6wcBilxBz5VUTfO6oIvSod3iW4DRW9iZAY5JWrBRVWy 8RbA1h9nm3vFyOx+F+XZ3Oi0Ew0Vp7PsnmwPJmo+2pX+i+6ZJpekDYbdmpGtfVCo 3VAKjkXEUHf0bOEZYobFiUnvijuSsqOZ7WAeqXo3nvUpCPV8fn3snx0SW0lCtRGR 3K7tv7ETwiQEhEEeQLinpzolbgJNH5qkXFL+wVcSjhd7ht2J/SWD6yDSAvuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660657868; x=1660665068; bh=yuVLbrrN+N1iK12i7DUjM6pGqTkd cihboprTmt6Byjw=; b=A1Si8qi+Laz5mf39bB95eWK9Z9k4Uwq/ARX10hcF5KoC rsCZ4h4myKe7lFZDNiG31Mst8v4bkATp+OYda5/B48kbYWQ2u0KmB9codo9djrHe yTOUZjbJZyB8E2j3I25Q+pbwyeqoVuqgfw6Eb/Ta82kHO4XwYxUPaMPA+8XxwcC+ bTV1VisVVgUolSf0+JPD6hqwLHiiFwPXAG/3ChEFsyvxGYNAfSU1zvmJVn9fuQJm kxGz4+rdbVp3wtvdqh8E4B2HCDmNbzxD8l1XRhP9sDDFyjJPZjCwbnP9t0tfssr5 yfc8ortuZ8OiMn3m0oboGq9/2l0bSlAJDth5K7vXyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehgedgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeetfefffefgkedtfefgledugfdtjeefjedvtddtkeetieffjedvgfehheff hfevudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Aug 2022 09:51:06 -0400 (EDT) Date: Tue, 16 Aug 2022 15:51:05 +0200 From: Maxime Ripard To: Geert Uytterhoeven Cc: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , linux-sunxi@lists.linux.dev, Linux Kernel Mailing List , Phil Elwell , Mateusz Kwiatkowski , Linux ARM , Dave Stevenson , "open list:ARM/Amlogic Meson..." , DRI Development , Dom Cobley Subject: Re: [PATCH v1 34/35] drm/modes: Introduce the tv_mode property as a command-line option Message-ID: <20220816135105.goztqjzqqhhigytd@houat> References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> <20220728-rpi-analog-tv-properties-v1-34-3d53ae722097@cerno.tech> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220816_065109_322034_F89F8DD9 X-CRM114-Status: GOOD ( 25.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============7404120201781616477==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7404120201781616477== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oapqvc3fwa7skyps" Content-Disposition: inline --oapqvc3fwa7skyps Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 12, 2022 at 03:31:19PM +0200, Geert Uytterhoeven wrote: > Hi Maxime, >=20 > On Fri, Jul 29, 2022 at 6:37 PM Maxime Ripard wrote: > > Our new tv mode option allows to specify the TV mode from a property. > > However, it can still be useful, for example to avoid any boot time > > artifact, to set that property directly from the kernel command line. > > > > Let's add some code to allow it, and some unit tests to exercise that c= ode. > > > > Signed-off-by: Maxime Ripard >=20 > Thanks for your patch! >=20 > > --- a/drivers/gpu/drm/drm_modes.c > > +++ b/drivers/gpu/drm/drm_modes.c > > @@ -1677,6 +1677,80 @@ static int drm_mode_parse_panel_orientation(cons= t char *delim, > > return 0; > > } > > > > +#define TV_OPTION_EQUAL(value, len, option) \ > > + ((strlen(option) =3D=3D len) && !strncmp(value, option, len)) > > + > > +static int drm_mode_parse_tv_mode(const char *delim, > > + struct drm_cmdline_mode *mode) > > +{ > > + const char *value; > > + unsigned int len; > > + > > + if (*delim !=3D '=3D') > > + return -EINVAL; > > + > > + value =3D delim + 1; > > + delim =3D strchr(value, ','); > > + if (!delim) > > + delim =3D value + strlen(value); > > + > > + len =3D delim - value; > > + if (TV_OPTION_EQUAL(value, len, "NTSC-443")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_NTSC_443; > > + else if (TV_OPTION_EQUAL(value, len, "NTSC-J")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_NTSC_J; > > + else if (TV_OPTION_EQUAL(value, len, "NTSC-M")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_NTSC_M; >=20 > [...] >=20 > You already have the array tv_norm_values[] from "[PATCH v1 05/35] > drm/connector: Add TV standard property". Can't you export that, and > loop over that array instead? I'm not sure, the command line doesn't follow the same conventions than the property names for a number of conventions, but at the same time we should try to keep it as consistent as possible... Then again, Jani and Thomas didn't seem too fond about exposing data as part of the API, so I'm not sure how we could expose that properly. > > + else if (TV_OPTION_EQUAL(value, len, "HD480I")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD480I; > > + else if (TV_OPTION_EQUAL(value, len, "HD480P")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD480P; > > + else if (TV_OPTION_EQUAL(value, len, "HD576I")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD576I; > > + else if (TV_OPTION_EQUAL(value, len, "HD576P")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD576P; > > + else if (TV_OPTION_EQUAL(value, len, "HD720P")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD720P; > > + else if (TV_OPTION_EQUAL(value, len, "HD1080I")) > > + mode->tv_mode =3D DRM_MODE_TV_NORM_HD1080I; >=20 > The names in tv_norm_values[] use lower-case, while you use upper-case > here. Indeed, I'll fix it, thanks! Maxime --oapqvc3fwa7skyps Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYvugyAAKCRDj7w1vZxhR xYVoAQDFAMNuU1dbZgCiVBYUf+Y13tqfHCtlOuPYmSb6Gmh3xgEAgXYxzEcBWNLK j9bSNzYbE9lp+H3MaLuAPoiaBAXIRQE= =szbm -----END PGP SIGNATURE----- --oapqvc3fwa7skyps-- --===============7404120201781616477== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7404120201781616477==--