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 7B0FCECAAD5 for ; Mon, 5 Sep 2022 11:43:15 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rk4zGmyN5O4pIZjBPRsZ20nkyBnmpXEdbOT1hvJXP98=; b=rGkiMfAcAHytyN +kAHmItF4TA1Ke27yc+lE4dTGNBfCF1F7xSaVb4V1EUW9tWouXrF/iZFnRhg8AHuu7jkakEkQu5wb m24xD3Mp/jsmADylHbEeOOeOBLDeuZqU4qz3VQu8nhDaQxicvWk8HphoDshN5c2jxO6V3/xtJLRwV PkcFC3Wh286QCW4lWnvD/51L9DcNPudPh3HomyAQtJ7FaIyVn9+PB76CFHXPfTo5XCwf/gslZD/GJ YV8G6guh6f4bqJzrIxddJR4QY0LkyVEKxPzzMNIKLkY8MnCncGKPyKt9Sz0hjuZIkz0AqHRFrCRMX MJ4Npt3OVfaa13kw69HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVAT1-001SuV-Em; Mon, 05 Sep 2022 11:40:41 +0000 Received: from smtp.domeneshop.no ([2a01:5b40:0:3005::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oV9Bd-0003D8-EU for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 10:18:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org ; s=ds202112; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nGjgsqGfJ0L+5KqUZMoJ4DGF2/kaGZuM3mOBrnObORY=; b=GuFH49lIq7dXPIMGs2vx4oc3BR e4YS/7YXDJgB9v/zgketZQx9j+ssn++8p5j5K3bgQHeAgYXYvDb4xMsOlhPfqz7vlqzPscXDqPiDp TuZk6qPEaf9gEEvSTnRfIOwWc95dRQfj//0k4w1VdwEkrGqBd9ai/8uZRyhuSxUeSOOObjAaIyW6B 2x5vmyH3jI24qzuKuKEcC/2jq+sAieA5uyVJr0iVO0oz10Maa9WzNwr34UsF7CYZqJWlbCMUkDiex HCn3YQ35Mqkh6eFmO3/78uayPkQngfVpngj7+TknlebgMGDtZ5dq9zlx9rs99wN7jTx7Ln6187TRI kHjBOxRA==; Received: from [2a01:799:961:d200:cca0:57ac:c55d:a485] (port=59939) by smtp.domeneshop.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oV9BW-00065d-5J; Mon, 05 Sep 2022 12:18:30 +0200 Message-ID: Date: Mon, 5 Sep 2022 12:18:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v2 09/41] drm/connector: Add TV standard property To: Maxime Ripard , Maxime Ripard , Ben Skeggs , David Airlie , Chen-Yu Tsai , Thomas Zimmermann , Jani Nikula , Lyude Paul , Philipp Zabel , Maarten Lankhorst , Rodrigo Vivi , Tvrtko Ursulin , Jernej Skrabec , Samuel Holland , Karol Herbst , Emma Anholt , Daniel Vetter , Joonas Lahtinen Cc: Hans de Goede , linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Dave Stevenson , dri-devel@lists.freedesktop.org, Dom Cobley , linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Mateusz Kwiatkowski , Geert Uytterhoeven , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= References: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> <20220728-rpi-analog-tv-properties-v2-9-459522d653a7@cerno.tech> From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= In-Reply-To: <20220728-rpi-analog-tv-properties-v2-9-459522d653a7@cerno.tech> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_031837_595695_BA3CFA84 X-CRM114-Status: GOOD ( 23.98 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Den 29.08.2022 15.11, skrev Maxime Ripard: > The TV mode property has been around for a while now to select and get the > > current TV mode output on an analog TV connector. > > > > Despite that property name being generic, its content isn't and has been > > driver-specific which makes it hard to build any generic behaviour on top > > of it, both in kernel and user-space. > > > > Let's create a new bitmask tv norm property, that can contain any of the > > analog TV standards currently supported by kernel drivers. Each driver can > > then pass in a bitmask of the modes it supports. > > > > We'll then be able to phase out the older tv mode property. > > > > Signed-off-by: Maxime Ripard > > > > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c > +/** > > + * drm_mode_create_tv_properties - create TV specific connector properties > > + * @dev: DRM device > > + * @supported_tv_modes: Bitmask of TV modes supported (See DRM_MODE_TV_MODE_*) > > + > > + * Called by a driver's TV initialization routine, this function creates > > + * the TV specific connector properties for a given device. Caller is > > + * responsible for allocating a list of format names and passing them to > > + * this routine. > > + * > > + * Returns: > > + * 0 on success or a negative error code on failure. > > + */ > > +int drm_mode_create_tv_properties(struct drm_device *dev, > > + unsigned int supported_tv_modes) > > +{ > > + struct drm_prop_enum_list tv_mode_list[DRM_MODE_TV_MODE_MAX]; > > + struct drm_property *tv_mode; > > + unsigned int i, len = 0; > > + > Can you add a check here like in the legacy version: if (dev->mode_config.tv_mode_property) return 0; This way it's possible to call this multiple times. Like in drm/gud during connector init if there are multiple TV connectors or if a device with multiple IP blocks should show up. Noralf. > + for (i = 0; i < DRM_MODE_TV_MODE_MAX; i++) { > > + if (!(supported_tv_modes & BIT(i))) > > + continue; > > + > > + tv_mode_list[len].type = i; > > + tv_mode_list[len].name = drm_get_tv_mode_name(i); > > + len++; > > + } > > + > > + tv_mode = drm_property_create_enum(dev, 0, "TV mode", > > + tv_mode_list, len); > > + if (!tv_mode) > > + return -ENOMEM; > > + > > + dev->mode_config.tv_mode_property = tv_mode; > > + > > + return drm_mode_create_tv_properties_legacy(dev, 0, NULL); > > +} > > +EXPORT_SYMBOL(drm_mode_create_tv_properties); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel