Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3665094rwb; Tue, 16 Aug 2022 07:00:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR4aqr6W/Dx1O6+dj/N4eBqZOYXdRsIStAf9yJqHi1fNAXP9oc3Xc/7nJglDF9jN5t0YPAok X-Received: by 2002:a05:6402:350a:b0:43e:9d8:b75 with SMTP id b10-20020a056402350a00b0043e09d80b75mr19533946edd.23.1660658439495; Tue, 16 Aug 2022 07:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660658439; cv=none; d=google.com; s=arc-20160816; b=aZIvBRI7LaAeCLXZ0ILtnAjXxERCJBeEYLdslfA+il/6iBjcpwhg6XLPADi0o4BbXo CQDlxoGhZMBeURMJ91BdgGrOaP4niaPT88B/sq8NxfGb//n53EVXDT+XPYsYNqXcPuXa K3Q5CUu+kh4vyXOTFa7xJrj9CcCDxbbWxahFH+55lMC/YDKrcmmZqitlopYF8xkc8YjV EO946sqeuJPd3wCh9FrefJ9SZZeVdPpS3IOF8cqUPqoKxUzNj47XlDdsS95Y+5RYK9+w AZGujw1QMDhZlIeKhP0dsbkO4hpq6PW+soYDOzhCeWX/71ckK/VGW9miTNZXEE2jM89X xGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=yuVLbrrN+N1iK12i7DUjM6pGqTkdcihboprTmt6Byjw=; b=O71OxdUW9IR6JdUFW5tzQoMo5NVo2nY/n27c/kKdUlc1+5VarX+G239GfIxGDQlz1+ HNsiXQvZX3YzPo5SxlsCe2iGxBJcdJIzRvJrX5/rmqhtNMYjdlVXMWFzBbHbGQ4coaGT 1/Ff7ecoJf3s5Eglaeh4wlSQwJAfovlbnxn5CwvuSZmzDmQ4f99jMGcfm91EHfwvrygt hSuRAn5AJqYihgQPC3jTQ8CaOUbDnfT/pF1uSfJmIl2espc3+r1FbMpN8nffAibGgrPB oz6Bq0qaOGrXeDGmEeS+3foRPfkQ/b0gwpc1JuqAMpW+wdcIOiurOT1N4yABxGBB7MUv ahUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=odX2548X; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=A1Si8qi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md12-20020a170906ae8c00b00730a3c9aeeasi8236902ejb.549.2022.08.16.07.00.13; Tue, 16 Aug 2022 07:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=odX2548X; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=A1Si8qi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235516AbiHPNvO (ORCPT + 99 others); Tue, 16 Aug 2022 09:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiHPNvK (ORCPT ); Tue, 16 Aug 2022 09:51:10 -0400 Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC39098CB6 for ; Tue, 16 Aug 2022 06:51:08 -0700 (PDT) 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 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oapqvc3fwa7skyps" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --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--