Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6806246rwd; Tue, 6 Jun 2023 02:06:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56zDBttsbFP7bBIqJetmmrvrxF1nWQcHn5j0zRAZ6gODfzpi2fSRcrcSFRnm6Bb+Fahj4c X-Received: by 2002:a05:6358:baaa:b0:127:f114:2d36 with SMTP id dg42-20020a056358baaa00b00127f1142d36mr2126323rwb.14.1686042363422; Tue, 06 Jun 2023 02:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686042363; cv=none; d=google.com; s=arc-20160816; b=LAWqHInqN9G/DNEz2X5e1S1M+THzrBIxOv5SrHyxTcfnIxzLaKwxDYDa3ubXVmGXa1 SfkWxyf+CkQWgaWLLn49WoQ7/tuIYt7LimnfVtNcn1OmnftB53xCq90+cx4Ts79ivOEi wMBFDABz7PwHx+6Q2eBZrsDf9/tQFFcBmfU7iLpECiutGE0lYW1J9AQhn9mcAgp5PiMr YD2lWSLgurSNHhOrJ5TmFIiq0iv5+vVRrYxDzueXUiZoGsN7b94aniIApr7LsX4awGdw Wxv5EYAi/aTsxA6JT0gmdB1HCa9FO1+qRjpJWl3pQZZVrSdYVr+e39wMwMyG1MbKW8zS Xa5A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na16-20020a17090b4c1000b002503ba697e9si350571pjb.131.2023.06.06.02.05.40; Tue, 06 Jun 2023 02:06:03 -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 S236421AbjFFIWW (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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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 --- 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 = { -- 2.40.1