Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5531524rwr; Tue, 9 May 2023 02:52:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UUDZc2JtgF/oapDUjYM0xv5ITjMgiQx9vixXJvE0ZV3zPjbi3blnYFoauN8rbAnV1t4xW X-Received: by 2002:a05:6a20:6a04:b0:f0:cef6:9d2e with SMTP id p4-20020a056a206a0400b000f0cef69d2emr17029276pzk.28.1683625967277; Tue, 09 May 2023 02:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683625967; cv=none; d=google.com; s=arc-20160816; b=yY5SesqNIqa30rKphb1E0BGFLcxXbksIrY5ar0ZpbSDcNI5frKd8gFgWSXWLApKzlW LBM3ADG+UeLMAtNJ/d12lcc3x1WUVOzzxo8ewQWixaEDq1ivyiumeZOfxBgr03NEBtnF aFUIZjLNduxszhquWTmy0seac4llIcIwEDTh5M4jYovyXvPGgSkMAMPQsZcU0QgBgVBz RsmZzjLZ2ZL85pmH987HLHB+YSHlfvOQS5kO16cCQrtSnq0SIUl8/vXlOXZ86Bz7Gk/3 lB2Tnxx/qQPM4lnijyVKTQrDMFPSB7D5CatuMNCN5Z8KPdzPhCfzLp4IQwZU2H84BJmR pt3Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a637f53000000b0052c575f1d8dsi1099152pgn.260.2023.05.09.02.52.32; Tue, 09 May 2023 02:52:47 -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 S234985AbjEIJbP (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 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 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 --- 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) -- 2.40.1