Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6811826rwd; Tue, 6 Jun 2023 02:11:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5cZzBR+tTffUOnmk81mXTnVIXUrAeaUxqrpoRv9NTreNzBrVjrVx2+jWPt7oykaS7yo2rT X-Received: by 2002:a37:7d6:0:b0:75c:b919:b4e0 with SMTP id 205-20020a3707d6000000b0075cb919b4e0mr1161967qkh.25.1686042689168; Tue, 06 Jun 2023 02:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686042689; cv=none; d=google.com; s=arc-20160816; b=IxCAai+0Ng5d4lHnueoia4awX+6X9HR1ZaPLOy0BTmEX7HcLGK2elGrXks2khp8id5 Tz0KB84QLZlzU8LtNUWG4Nj4zommubePjsPO2DsHDtXuQfKaj8q9svW4H0VCHuYwZRK3 H8Jy0GvlJ9IUEOPzUCIEE9Kdfm+5bpC8v4uHCb9oDli995yzj6oG+4ej1REQlZ/ch/ai wjFOcQ2tVBPYqnbjsyhLaeAccMJ1HTCp6MtnVGYOOPLzh+Yv80d0glcOGUfjIcjXpAQ2 z/HOAw7dS/ZjnNUI0M2JwPYEGEO+2Daqxopd0QllX9OlpsNSIZtf8OsQb3bN8nN2hTad 1gRA== 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=tSOarY1oK5P3WdLn8Hnq0D9v4f4KHxiCVqh5EM0vuxw=; b=ic7Cdpsl44gPPMS6PyjcQ5KC30slfeGM90kwvnUCWkIgzm1kgEuWg11VpsHtJlm/XG 0321WNCtasIfVXrVSXUxXFuFM2c4aXG+KBJ0kx0dzid5PT9wD6jojUcRhW4Q5Itq7kLg EHfORnDybX/4RcrTPFuTET2GXupepkuRMDzsYDJIRW88dfDraXh9ZumR94DuPmB1AtJX /dRappn/mjHQjcXz/l76ubv4Bk4qLOxk9yYmArbpDdS+vdInHcowtS/aAgWN7r8ASZso +RGNG6X6mTMAyOIuti1JMHTOfE2PhuUhO0/t0szjWpegY2yv0S7cV7SaOkXgJMAVJsg3 24fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="r/Ghi5Qn"; 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 o12-20020a05620a15cc00b0074de91d7505si5592344qkm.207.2023.06.06.02.11.15; Tue, 06 Jun 2023 02:11:29 -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/Ghi5Qn"; 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 S236509AbjFFIW2 (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236407AbjFFIWS (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 80C59E5A for ; Tue, 6 Jun 2023 01:22:13 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568LpmQ013072; Tue, 6 Jun 2023 03:21:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039711; bh=tSOarY1oK5P3WdLn8Hnq0D9v4f4KHxiCVqh5EM0vuxw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=r/Ghi5QnqgTvobF8E7GvNafN5zmANSdORTc/eRZYkzlBF/G+5tIbmQjRK7TTC2bkS Z1Ob48mwPLFg2WAz2FtuxyJOBGn1Zlwst5/e4Y4RgxvJMrDEHoWbKCU0hRCn+sKBzB XZJt/NMY6HI9t6YUXdHk98CVNi7yduuDB4jMGPJw= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568Lpvc012358 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:51 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE101.ent.ti.com (10.64.6.22) 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:51 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE107.ent.ti.com (10.64.6.28) 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:50 -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 3568LolY019592; Tue, 6 Jun 2023 03:21:50 -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 5/8] drm/bridge: sii902x: Support format negotiation hooks Date: Tue, 6 Jun 2023 13:51:39 +0530 Message-ID: <20230606082142.23760-6-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 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 --- Notes: changes from v6: * Add Neil Armstrong's R-b tag. drivers/gpu/drm/bridge/sii902x.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index ef66461e7f7c..70aeb04b7f77 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -473,6 +473,27 @@ 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; + + *num_input_fmts = 0; + + input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + *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 +501,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