From patchwork Tue May 9 09:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 91474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2744372vqo; Tue, 9 May 2023 02:38:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6IDagWwW80xC+ALogL81Z6cGOEMWVb6HAF89G4mro5uGdHZDZ86hNnlem7cjcA0z/xFA1Z X-Received: by 2002:a17:90b:97:b0:24d:fccf:7ba6 with SMTP id bb23-20020a17090b009700b0024dfccf7ba6mr13465506pjb.43.1683625133565; Tue, 09 May 2023 02:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683625133; cv=none; d=google.com; s=arc-20160816; b=iKXI53V+Zadfs3X9mwSt+GdsdaflmR+qLU06hAyUAkBQiktbxUppzOkAYB+PhrRl+n j9qbDWa6H2+PGJgsUzbcoefR5Q/u0H7iY6jaCl94kJt7wY9JOyVaeFvyBvZ6/5dIJZCL ID/b0UZNK6r01t5Q9N+OwYg1P1Uyy2vBLibzpi56gLuL/mZhFjLv6oyJWS9ONZew5S2m x2vLuORc1BLfeP49YBxsxFP6oggDH7SIL+L2+WMuLrbvDFgkdVNO8ChPS+ZmIrcNc1UC i4xwTeNF+beg83KK3q7jku32Z6BBl7dT3nbhwt7xvQkV0SHe/pGjddAInneiAIpmF5lL EkKA== 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=dLF7J3jFLUCNIXG4GKr7cBET1aDmrLyN47iJx0ezMmM=; b=YVozzl6gfctxTaQ0Q0yKYrO4Q/74Qcp05ko+9RnF1dK6Y+IEEQB5med8YEh7e88tF4 ljTNoELQmTt1tZTiSn2dzMhj1NwOQueU65fsUXVEhafsMLfC/9fqA/yZFRwlcp4fYAaX XVLM+7vcPyRP9dTGIN/JLD5YXWUL2XJk6shNqeJ3xULcEjdlt7uTh+V0wOTFPehpjU3n bdwkposInzCJv1ITPxnOgDzfVkvCJN95Tn5NsL7cp5NMLpKTpgEzgoIiw52rrxTpzCgd tCp367rbME5Nhv72EIdjzCvjmVlfMzCEjluniWtYaPbxmYRy122xAeb8DZf1s3WMKdTP Wdgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="r/F4WuCH"; 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 p19-20020a637f53000000b0051a8a22a42dsi1141262pgn.268.2023.05.09.02.38.41; Tue, 09 May 2023 02:38: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="r/F4WuCH"; 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 S234981AbjEIJbP (ORCPT + 99 others); Tue, 9 May 2023 05:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjEIJbL (ORCPT ); Tue, 9 May 2023 05:31:11 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED68A1FEF for ; Tue, 9 May 2023 02:31:09 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3499UiCs071933; Tue, 9 May 2023 04:30:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1683624644; bh=dLF7J3jFLUCNIXG4GKr7cBET1aDmrLyN47iJx0ezMmM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=r/F4WuCH92Kz7fOX6SquKxwQiYcBb8lRAic5l1CzlhG0rRtCICbdW65VpsxQYkDn4 xco3iGbkxwLcjKrMDg6PdR5/k1UpBAi4eY+RxFCDURcSyG+fVOdpR7NaAiYN52aZIm aJ2XSiOTFwYE6xCSK4m8CGCaKzf+I7zTu2zLltnk= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3499Uifc107317 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 9 May 2023 04:30:44 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE113.ent.ti.com (10.64.6.34) 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:44 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE112.ent.ti.com (10.64.6.33) 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:44 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3499UheI017893; Tue, 9 May 2023 04:30: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 , 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 5/8] drm/bridge: sii902x: Support format negotiation hooks Date: Tue, 9 May 2023 15:00:33 +0530 Message-ID: <20230509093036.3303-6-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?1765408907713389435?= X-GMAIL-MSGID: =?utf-8?q?1765408907713389435?= With new connector model, sii902x will not create the connector, when DRM_BRIDGE_ATTACH_NO_CONNECTOR is set 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 selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is the case with older model. Signed-off-by: Aradhya Bhatia Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/sii902x.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index ef66461e7f7c..662b6cb4aa62 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -473,6 +473,28 @@ static struct edid *sii902x_bridge_get_edid(struct drm_bridge *bridge, return sii902x_get_edid(sii902x, connector); } +static u32 *sii902x_bridge_atomic_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) +{ + u32 *input_fmts; + u32 default_bus_format = MEDIA_BUS_FMT_RGB888_1X24; + + *num_input_fmts = 0; + + input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + input_fmts[0] = default_bus_format; + *num_input_fmts = 1; + + return input_fmts; +} + static const struct drm_bridge_funcs sii902x_bridge_funcs = { .attach = sii902x_bridge_attach, .mode_set = sii902x_bridge_mode_set, @@ -480,6 +502,10 @@ static const struct drm_bridge_funcs sii902x_bridge_funcs = { .enable = sii902x_bridge_enable, .detect = sii902x_bridge_detect, .get_edid = sii902x_bridge_get_edid, + .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 = sii902x_bridge_atomic_get_input_bus_fmts, }; static int sii902x_mute(struct sii902x *sii902x, bool mute)