From patchwork Tue Jun 6 08:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3251124vqr; Tue, 6 Jun 2023 02:05:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MYttadDVIWJuTS9p1j0uwxBkoOOsdFcwmL8tLiUi6wp8hAhLiY9Mn5IyPJ5/PrHOPehu8 X-Received: by 2002:a05:620a:2947:b0:75d:abfe:36eb with SMTP id n7-20020a05620a294700b0075dabfe36ebmr1571871qkp.36.1686042353662; Tue, 06 Jun 2023 02:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686042353; cv=none; d=google.com; s=arc-20160816; b=a3LE/+ZKVklnpwVpGHIApirMpf97dbc0z64rbTlhinN4i0itlK1ZFImXYK5qMMQPzN YRrShuXDt+nfqIusriU2QHS+iQpBXgCWGjjOfjLEfTZiuCGwzXuNVw1W4iKYusVy03Kv nnqaC66YJTLtnUAcx0ICNtp4r1vwp9MR27zvFLbOrGP1hR+1RSKyzj3GAfkXvDOZZmDF grwgVL37tT8So8j0Q5sjZPqxg8ONCWrtMlofyN3HScFfDkk8n0nGNTUusZJ5bPM83V26 CU734meh4wJt4qOPsvyyAmwTlKlaEpRNbn20nj8bSAg2u//qBd5KX97lj7L7okseXpGf n10A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kl7IYcWHDhOXEbtjKsmUMDfDTwInFa3veP2B2cudDHM=; b=NSh3Zue+6uvGkcztF5yQfirUoNMWkZs7oUz/u7bk4UaKR7DVC+55wEV5oZrpivnolA g+lDNG5ZSpb/G2jI2xRWtDB3664potHiHmFG+gTGYqHIHR1iS7bzvjc07TfWgRVkFbxU fkkPC9TfierzfigGy1QWOzJnln4neHMmGveUm7Cov8N/e/jQyw8XZ3W0Q93esXPnJhEF YnzuEuJCZcCK7kLkmwjJ/+3ah37gdxSmO8qbka+1P2BJk3hzydYixvkqdzMEnFlieCrO N1zJ6HHkTLppKQbGnna6+Phl8z7QPz/1VHFhvd5WtFgLEn8S0nhUJts4F6ttBckiD86p 2F/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zi0niMUG; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a05620a11b200b0075938f5f300si5806449qkk.287.2023.06.06.02.05.39; Tue, 06 Jun 2023 02:05:53 -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=@ti.com header.s=ti-com-17Q1 header.b=Zi0niMUG; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236334AbjFFIWW (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236403AbjFFIWS (ORCPT ); Tue, 6 Jun 2023 04:22:18 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6474E62 for ; Tue, 6 Jun 2023 01:22:13 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lj5h013059; Tue, 6 Jun 2023 03:21:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039705; bh=Kl7IYcWHDhOXEbtjKsmUMDfDTwInFa3veP2B2cudDHM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Zi0niMUGGsiLmMrMcGKT0SJj9txsJItgUXsRIQyMH6rFwtQX6GgplPu4q6y3o0ECo vM12K3ZsMySVT7MJaBfc2zuqFoX18C/bmEjeFoLLK4MbFlld7U93bJYjaL9yXfchtA iasEn1nuqtsh6b57jM7jKzQ3N7oMGAvaEwljALKM= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568Ljr3012375 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:45 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 6 Jun 2023 03:21:44 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 6 Jun 2023 03:21:44 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568LiFS019490; Tue, 6 Jun 2023 03:21:44 -0500 From: Aradhya Bhatia To: Tomi Valkeinen , Jyri Sarha , David Airlie , Daniel Vetter , Laurent Pinchart , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Swapnil Jakhade , Boris Brezillon , Francesco Dolcini CC: DRI Development List , Linux Kernel List , Nishanth Menon , Vignesh Raghavendra , Rahul T R , Devarsh Thakkar , Jayesh Choudhary , Aradhya Bhatia Subject: [PATCH v7 1/8] drm/bridge: tfp410: Support format negotiation hooks Date: Tue, 6 Jun 2023 13:51:35 +0530 Message-ID: <20230606082142.23760-2-a-bhatia1@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606082142.23760-1-a-bhatia1@ti.com> References: <20230606082142.23760-1-a-bhatia1@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767943546631951158?= X-GMAIL-MSGID: =?utf-8?q?1767943546631951158?= From: Nikhil Devshatwar With new connector model, tfp410 will not create the connector and SoC driver will rely on format negotiation to setup the encoder format. Support format negotiations hooks in the drm_bridge_funcs. Use helper functions for state management. Input format is the one selected by the bridge from DT properties. Signed-off-by: Nikhil Devshatwar [a-bhatia1: Removed output fmt condition check] Signed-off-by: Aradhya Bhatia Reviewed-by: Neil Armstrong --- Notes: changes from v1: * Use only MEDIA_BUS_FMT_FIXED for output changes from V5: * Drop the output format check condition because the output format for HDMI bridges should be RGB888_1X24 and not FIXED. Hence, also drop Tomi Valkeinen's and Laurent Pinchart's R-b tags. drivers/gpu/drm/bridge/ti-tfp410.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index ab63225cd635..7dacc7e03eee 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -206,12 +206,38 @@ static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge, return MODE_OK; } +static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + struct tfp410 *dvi = drm_bridge_to_tfp410(bridge); + u32 *input_fmts; + + *num_input_fmts = 0; + + input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + *num_input_fmts = 1; + input_fmts[0] = dvi->bus_format; + + return input_fmts; +} + static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach, .enable = tfp410_enable, .disable = tfp410_disable, .mode_valid = tfp410_mode_valid, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts, }; static const struct drm_bridge_timings tfp410_default_timings = {