From patchwork Tue May 9 09:30:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 91481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2749677vqo; Tue, 9 May 2023 02:52:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UrH+T2iUmJY4T6i1GFmxzFlrSTx50Gw85gV+m3IADicEP0a7oczCBoUVdRn3Fajn1aQIl X-Received: by 2002:a17:903:1247:b0:1a6:a6e7:8846 with SMTP id u7-20020a170903124700b001a6a6e78846mr17165915plh.40.1683625922255; Tue, 09 May 2023 02:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683625922; cv=none; d=google.com; s=arc-20160816; b=wJ4J6UlPMHBoDQ3CzbVvMLrHd6KMj/M86w+jgiSAZNr64sBLogbNg4jQk6adrsfaVT WQWFXAERVIqqt1DNRwtNbhg/z/bh/KnaCthKNWE12OEpHq8Rr3728l/MkVdJg0pDOrY1 5R3Yefzx+OMYKlXY7p/Dl8qJ3keh6BQuOnnxRpPB1RxXmcnRIRmapxrTrJVEX6tuhgpO qN6guq/IZ4BWI8XD2zAHsgL9oHCCVXH+T10pNI4bmuARK3ry9LzYNg6r+5yj8JtN9xlM H6Bu6U/hYX4U2MYTUfrGdrMQMMJDWNU75lAHmjibGirnFdrxlfHkPj8B7b59Fw166DMe h5MA== 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=MUAqpjxDeFf+pV2Ertpwdw1zhAaxf1hBkl86Kqxd1SI=; b=XBGyMZy+eLTSum1GaGweR1glngx/fsAoeU6076OqRXN5RqL22wf3wxm1Orhoi3dNkc NPIklvhtV1HX9jALJCO0QJJ3l6SaEt87sAD6EWwVlVDtqBYxSh6WinZKGnnHOOx6umDQ juWqqyNNHEcL2xiUkYfrxY1BiuEwTrIAfzygE+0mSFRiiaBTnGuuuiREk5nABlyc1YdR 6SMsjvnZQsBoM2sVg3n4Ug6u0uKtzFSPEoFaEzQvOdCSq4Ti5mCO6pHzre0DoNPgwySF tQTUYgrUNBkUTGUhyhFFADsqe9Ik4trKoW4gRL9jXQS9Hb/1fu1N/Fqj+NiO3qbPhLcL uKFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wnONW0nJ; 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 m9-20020a170902768900b001a6b6085041si1074950pll.512.2023.05.09.02.51.45; Tue, 09 May 2023 02:52:02 -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=wnONW0nJ; 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 S233970AbjEIJbS (ORCPT + 99 others); Tue, 9 May 2023 05:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234927AbjEIJbN (ORCPT ); Tue, 9 May 2023 05:31:13 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F38DDBB for ; Tue, 9 May 2023 02:31:11 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3499UdFx071916; Tue, 9 May 2023 04:30:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1683624639; bh=MUAqpjxDeFf+pV2Ertpwdw1zhAaxf1hBkl86Kqxd1SI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wnONW0nJOEUbw28vRdlSmmt+iWGGBeYWMUZn9mTM1XqdJskApo9cMf3qK7JFnxHT6 kPUWEtElEO3Qf1j/Q0+cj50K2WhcySNfA57GIS5UgQGn+/J6eexVtBrPeRxx/SD/NL 3MLxyU2/EOhM35AVku1ewVFW48PRVbXSvuRYOt48= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3499UdZ9032337 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 May 2023 04:30:39 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 9 May 2023 04:30:38 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE104.ent.ti.com (10.64.6.25) 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, 9 May 2023 04:30:38 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3499Ucwg084916; Tue, 9 May 2023 04:30:38 -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 , Rahul T R , Swapnil Jakhade , Boris Brezillon , Francesco Dolcini CC: DRI Development List , Linux Kernel List , Nishanth Menon , Vignesh Raghavendra , Devarsh Thakkar , Jayesh Choudhary , Aradhya Bhatia Subject: [PATCH v6 1/8] drm/bridge: tfp410: Support format negotiation hooks Date: Tue, 9 May 2023 15:00:29 +0530 Message-ID: <20230509093036.3303-2-a-bhatia1@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230509093036.3303-1-a-bhatia1@ti.com> References: <20230509093036.3303-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?1765409735061211765?= X-GMAIL-MSGID: =?utf-8?q?1765409735061211765?= 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: * Dropped the output format check condition because the output format for HDMI bridges should be RGB888_1X24 and not FIXED. Hence, also dropped 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 = {