From patchwork Tue Jun 6 08:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3251124vqr; Tue, 6 Jun 2023 02:05:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MYttadDVIWJuTS9p1j0uwxBkoOOsdFcwmL8tLiUi6wp8hAhLiY9Mn5IyPJ5/PrHOPehu8 X-Received: by 2002:a05:620a:2947:b0:75d:abfe:36eb with SMTP id n7-20020a05620a294700b0075dabfe36ebmr1571871qkp.36.1686042353662; Tue, 06 Jun 2023 02:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686042353; cv=none; d=google.com; s=arc-20160816; b=a3LE/+ZKVklnpwVpGHIApirMpf97dbc0z64rbTlhinN4i0itlK1ZFImXYK5qMMQPzN YRrShuXDt+nfqIusriU2QHS+iQpBXgCWGjjOfjLEfTZiuCGwzXuNVw1W4iKYusVy03Kv nnqaC66YJTLtnUAcx0ICNtp4r1vwp9MR27zvFLbOrGP1hR+1RSKyzj3GAfkXvDOZZmDF grwgVL37tT8So8j0Q5sjZPqxg8ONCWrtMlofyN3HScFfDkk8n0nGNTUusZJ5bPM83V26 CU734meh4wJt4qOPsvyyAmwTlKlaEpRNbn20nj8bSAg2u//qBd5KX97lj7L7okseXpGf n10A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a05620a11b200b0075938f5f300si5806449qkk.287.2023.06.06.02.05.39; Tue, 06 Jun 2023 02:05: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=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 S236334AbjFFIWW (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 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?1767943546631951158?= X-GMAIL-MSGID: =?utf-8?q?1767943546631951158?= 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 Reviewed-by: Neil Armstrong --- 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 = { From patchwork Tue Jun 6 08:21:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3242008vqr; Tue, 6 Jun 2023 01:46:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JLwEJXG24zhe1TNBuxF8useklqOB1I0f4rTfpBo/FeFl/uikOT9ElMDlRVhM6xkMWlqJZ X-Received: by 2002:a9d:6649:0:b0:6b2:420:672e with SMTP id q9-20020a9d6649000000b006b20420672emr1467115otm.8.1686041165427; Tue, 06 Jun 2023 01:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686041165; cv=none; d=google.com; s=arc-20160816; b=cRLzlcJA1Ig64riVhrGZo9KejaMfUmU3ToXLOcN4+s/8V2rRGPvaMFo22Uz9m05Nvp /EStdAbo5r/j+x4Jr2n2EEUNgQxOJm0dL/eh+FUJJZfQZaqYGL5t5nabAoq7TQ/OBpQv UzC/49v0eEJAv4OCFhLVyFCRxglE9kL9eW/1+WYL+SNPPta5KUIClnMFSnFrM7arPwbd n3zUROqJLF0BWOEDQTYh2znzi7OIrSNQ11/hi4Ycu+72HwcRtD348mUrzpBRnCKdk953 kRuMt6JYxzbSJci4V+X7yeC5QVisXrwTyvKK+uLiX6nU2tLteKGIwnzaIPJOGkPmqCZn aLrw== 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=VS8pLGzavRPRDee8Dc/PrcNO4RR5LuY8WkKTJA8aedc=; b=Z0D7lWRDH7YWkFhXOAh401/u9kyf4gWomK5tC/5QToUDz4I0Fjum6VHVu/P6CMO1y8 0nUELDbaLYEnYVmqjxSmGpLa/UhPmPZ7ml+34klbtH+JeVpNO5QJAvXRGCZvzUuv1Ubd gv1ejDc5w68zDrS5bf5jzOr0GMf6TufYjPJ1XFUOKlqEm4i9rbuOl2bljAdV52SLJ/+F 4bjTi19bND7YdgxqSGuVHDRwBX7S35ML5hhcoLYwSqYUJ4pjsHaCq1W9huVzV2Pmryfn m0qSI9B51+LSfumRXWRgxwrVYfMK4JK6/3Sw2I05hffxBKgKVMBRNQxnZ7kYiySi0gDq Y2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XeTz71y5; 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 l198-20020a633ecf000000b0054294720d55si7138923pga.262.2023.06.06.01.45.52; Tue, 06 Jun 2023 01:46:05 -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=XeTz71y5; 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 S236327AbjFFIWY (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236405AbjFFIWS (ORCPT ); Tue, 6 Jun 2023 04:22:18 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB4CE53 for ; Tue, 6 Jun 2023 01:22:13 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lkvb038628; Tue, 6 Jun 2023 03:21:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039706; bh=VS8pLGzavRPRDee8Dc/PrcNO4RR5LuY8WkKTJA8aedc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XeTz71y5kP0VQhFCE1iLlXoiAy5vHj9j3ttBTiMzN8IWqOLl+OWKPpqAvFsVPrXKY /IDtDHTdlCJ5Xp3uTMirgEjOjMSEBhbdONH9/t+2trOZlrO9L41Z8zbLZg+moZrRXD 6Hb+qqzyLJQEJkf/y8uPHVtPjWS28fpd//HWGtIw= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568LkLq012391 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:46 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) 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; Tue, 6 Jun 2023 03:21:46 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com (10.64.6.30) 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:46 -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 3568LjUa090167; Tue, 6 Jun 2023 03:21:45 -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 2/8] drm/bridge: tfp410: Set input_bus_flags in atomic_check Date: Tue, 6 Jun 2023 13:51:36 +0530 Message-ID: <20230606082142.23760-3-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 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?1767942301386750330?= X-GMAIL-MSGID: =?utf-8?q?1767942301386750330?= From: Nikhil Devshatwar input_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check. Implement atomic_check hook for the same. Signed-off-by: Nikhil Devshatwar Signed-off-by: Aradhya Bhatia Reviewed-by: Neil Armstrong --- Notes: changes from v4: * fix a warning Reported-by: kernel test robot changes from v5: * Move the return statement here from patch 4 (where it was added by mistake). changes from v6: * Add new line before return statement. * Add Neil Armstrong's R-b tag. drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 7dacc7e03eee..edf4d30f4f2a 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -228,6 +228,22 @@ static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge, return input_fmts; } +static int tfp410_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct tfp410 *dvi = drm_bridge_to_tfp410(bridge); + + /* + * There might be flags negotiation supported in future. + * Set the bus flags in atomic_check statically for now. + */ + bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; + + return 0; +} + static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach, @@ -238,6 +254,7 @@ static const struct drm_bridge_funcs tfp410_bridge_funcs = { .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, + .atomic_check = tfp410_atomic_check, }; static const struct drm_bridge_timings tfp410_default_timings = { From patchwork Tue Jun 6 08:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3239307vqr; Tue, 6 Jun 2023 01:39:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6i887Ewah+Oq9sQS/jv260erG9c64FTfTKv/pETKpx/vDEIli9konntq5NK6lwYnOvCwxG X-Received: by 2002:a9d:6387:0:b0:6b2:9bdb:a84a with SMTP id w7-20020a9d6387000000b006b29bdba84amr600549otk.32.1686040750872; Tue, 06 Jun 2023 01:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040750; cv=none; d=google.com; s=arc-20160816; b=esR2KcfqmfCJxedJJOd+4udjtXER90reLFrg79p8lWHiGlECym389zapHjcQSY3eCu vSaLZi3r7EvGY7gfumQfIpii4vMQsqrInbrv8LHdrk0YJz35hRU2h6lK+ZHPvb0XJe1M ZdggKCl/gY/2vh8exWPLdtEwi813lxnMGYdaYGqJBs+gLYAc0pzCatw3v4zfX7QfaxzR 0lnERPXAjKlUaoAGGO1ifD+T93CjVFIpg9WKa3N1yJ59E2byzyazscadkTvznHFfFBKW 6+6TCXyuPPB2a3eCZs1nOnAAVSkerskUBIi1jiR5RJL2VUEXAxHHsuFQ/FnWUOvoBcHz gWmQ== 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=rlcycElYspBBCBwIoOXKjxDNDpCcwf8wJnBjzKivxps=; b=sHJylA0YdFrcDoRqRblKnlJUCOm2GC5fTcPGoHy3VKbLBrSoQ/Z2VOjQ/d3vnmCG2S GG8DUk5SgKWH5iUrZ7V2wbi7Gx7SOsFCwKmBKsXrIInWZ1B6tQkctHd5AeFlnhs7UZCb HUflfKHWYHu3C9S1/9mcJPrbZy+xsTG1kah//O9fIytKzxUt0QwCvSXOaHmRrGTQLJ4D 71zXn3iBYRJAhNYmT5DDty7NgxfJrc585WAxefDt6LiJP4zz4Bm0Zmm5nuuvp7zYo0fw Fue8RUqd5+iEHfNte0p6fqOavdeaY1MQvvK9wY2iUPDJNL2L51/AqrLjVw2uQrVwog61 M8qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=e6Ba3L3x; 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 a18-20020aa78e92000000b0064d2d6b6b87si6900943pfr.268.2023.06.06.01.38.58; Tue, 06 Jun 2023 01:39:10 -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=e6Ba3L3x; 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 S236597AbjFFIWe (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236361AbjFFIWT (ORCPT ); Tue, 6 Jun 2023 04:22:19 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C80E6A for ; Tue, 6 Jun 2023 01:22:14 -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 3568LmD8038638; Tue, 6 Jun 2023 03:21:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039708; bh=rlcycElYspBBCBwIoOXKjxDNDpCcwf8wJnBjzKivxps=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=e6Ba3L3xN8aTgby39c2YceFYEp/JCiiN7ZCgYAnc+lPbjYwgCOqCo5eFiVSSpKEJk 3JtsJ/fRBgxfKiinqfWqk4Uf2MDIP4lRYqX0PtWhyL0Rl/eEz3OZB90kiZv2LGDijw R0IIlx/GMYR8PYeRIu/AH1h9uDUY0VI3EIn2+eGo= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568LmF5012332 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:48 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) 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; Tue, 6 Jun 2023 03:21:48 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE109.ent.ti.com (10.64.6.30) 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:48 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568LkxE019588; Tue, 6 Jun 2023 03:21:47 -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 3/8] drm/bridge: mhdp8546: Add minimal format negotiation Date: Tue, 6 Jun 2023 13:51:37 +0530 Message-ID: <20230606082142.23760-4-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 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?1767941866316869975?= X-GMAIL-MSGID: =?utf-8?q?1767941866316869975?= From: Nikhil Devshatwar With new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format. Support minimal format negotiations hooks in the drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model. Signed-off-by: Nikhil Devshatwar [a-bhatia1: Drop the output_fmt check condition] Signed-off-by: Aradhya Bhatia Reviewed-by: Neil Armstrong --- Notes: changes from v1: * cosmetic fixes, commit message update. changes from v5: * drop the default_bus_format variable and directly assigned MEDIA_BUS_FMT_RGB121212_1X36 to input_fmts. changes from v6: * Drop the output_fmt check condition and hence drop Tomi Valkeinen's R-b tag. .../drm/bridge/cadence/cdns-mhdp8546-core.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index f6822dfa3805..afd4e353f37a 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -2146,6 +2146,27 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge) return &cdns_mhdp_state->base; } +static u32 *cdns_mhdp_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 = kzalloc(sizeof(*input_fmts), GFP_KERNEL); + if (!input_fmts) + return NULL; + + *num_input_fmts = 1; + input_fmts[0] = MEDIA_BUS_FMT_RGB121212_1X36; + + return input_fmts; +} + static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, @@ -2210,6 +2231,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state, .atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state, .atomic_reset = cdns_mhdp_bridge_atomic_reset, + .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts, .detect = cdns_mhdp_bridge_detect, .get_edid = cdns_mhdp_bridge_get_edid, .hpd_enable = cdns_mhdp_bridge_hpd_enable, From patchwork Tue Jun 6 08:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3247813vqr; Tue, 6 Jun 2023 02:00:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ745CTB4h4kYM2SMnIDFumkCoqroT6SsOwg0GWcVbbqbpWvVXUYFQpf9MnraI5xLakWiXhv X-Received: by 2002:a17:90b:3e8e:b0:24e:3b69:a87f with SMTP id rj14-20020a17090b3e8e00b0024e3b69a87fmr1382394pjb.25.1686042018598; Tue, 06 Jun 2023 02:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686042018; cv=none; d=google.com; s=arc-20160816; b=sfsmUxGyuo2QVCN/bldbmuKtfGJ+PunEj6sATm4MDeBcI+CvQynYWzE6wckCpdaH1o 8m872r5q0p+Xf2qE3ZEkwUgMOS8d0AAEf232b88LXXVqz5Y4a3e6M7QuZ0yeosS2T0Up nfeoykUfZv5zzfmpcSJ8iYqnk8uaZt2FSZd2pjr1IPUFi91EaUg1H3L1Y+yOJYnkps5g MrmSOeS5yCByW/Pwl6Je333yJ8DILEVap+QDIXdxaAgUU6WaYjSRfXGwadRZY7FSR1aw EpJWBOluMkpOJOWxF0OQbwZAeJFP00QLX5HcopuZnN0/vjuPg8sU3lfqT/zMB4SLoWHo On7w== 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=mjYpsc+6ZhUsQIeleXa9Eds0jfiF2j5ius90btBqRFM=; b=CIsMm3PmXTVzpNLkpc1hbPx1noWVsHqjd0R1aCXZeFtQ1qQrj1IfhVjQZvJEfI3jUH QNkyteuR0G5DmpSbiUTkDqp1XIsUuQF9zYBpORMvT9tUtdhmlTUt0DAXz7TuGyfrsXWT +CCvkBhS84Waco9cKQvmxOBfj9I5xgdRxJwwa4rybi2sIpobfeZq8p7lX8zRU9Nk5PnR 5PCK/m/EJZP8sjtTKB3xOOWegJpKXematqmdTSXOxLVgcawvciRO9kG19czB90ECKX8w DguiKQUqRFqAizz1CUr3+YTxNkG8m933f+aqzj38dREnP3JGhra+Cdtq6vvrt/VF6Y4r P+Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yS69vnxe; 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 s15-20020a63af4f000000b005429415454bsi6795585pgo.377.2023.06.06.02.00.05; Tue, 06 Jun 2023 02:00:18 -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=yS69vnxe; 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 S236353AbjFFIWa (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236424AbjFFIWT (ORCPT ); Tue, 6 Jun 2023 04:22:19 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56871E68 for ; Tue, 6 Jun 2023 01:22:14 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568Loke038647; Tue, 6 Jun 2023 03:21:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039710; bh=mjYpsc+6ZhUsQIeleXa9Eds0jfiF2j5ius90btBqRFM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yS69vnxej8xEelM955x4bn2SULn98zRZU0y5awrwzn1E8Fv7ug9wt1vlEevG8as/Z Wua+/aRo0cYUbxy23oFhkuc9NUdccrBO6OpfscDct/Uqa1OFXsGBfAdFEt/+LDh3dn aJT2LGyvmn/CHaySHSTr3b+EeXPo5sVv7ruIA2lE= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568LnkQ012419 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:50 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) 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:49 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE106.ent.ti.com (10.64.6.27) 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:49 -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 3568LmKO019572; Tue, 6 Jun 2023 03:21:49 -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 4/8] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check Date: Tue, 6 Jun 2023 13:51:38 +0530 Message-ID: <20230606082142.23760-5-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 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?1767943195880510343?= X-GMAIL-MSGID: =?utf-8?q?1767943195880510343?= From: Nikhil Devshatwar input_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check. Signed-off-by: Nikhil Devshatwar [a-bhatia1: replace timings in cdns_mhdp_platform_info by input_bus_flags] Signed-off-by: Aradhya Bhatia Reviewed-by: Neil Armstrong --- Notes: changes from v5: * remove the wrongly addded return statement in tfp410 driver. * replace the timings field in cdns_mhdp_platform_info by input_bus_flags field, in order to get rid of bridge->timings altogether. changes from v6: * Add Neil Armstrong's R-b tag. drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 11 ++++++++--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h | 2 +- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c | 9 ++++----- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index afd4e353f37a..f12fb62821f7 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -2186,6 +2186,13 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, return -EINVAL; } + /* + * There might be flags negotiation supported in future. + * Set the bus flags in atomic_check statically for now. + */ + if (mhdp->info) + bridge_state->input_bus_cfg.flags = *mhdp->info->input_bus_flags; + mutex_unlock(&mhdp->link_mutex); return 0; } @@ -2551,8 +2558,6 @@ static int cdns_mhdp_probe(struct platform_device *pdev) mhdp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; mhdp->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - if (mhdp->info) - mhdp->bridge.timings = mhdp->info->timings; ret = phy_init(mhdp->phy); if (ret) { @@ -2639,7 +2644,7 @@ static const struct of_device_id mhdp_ids[] = { #ifdef CONFIG_DRM_CDNS_MHDP8546_J721E { .compatible = "ti,j721e-mhdp8546", .data = &(const struct cdns_mhdp_platform_info) { - .timings = &mhdp_ti_j721e_bridge_timings, + .input_bus_flags = &mhdp_ti_j721e_bridge_input_bus_flags, .ops = &mhdp_ti_j721e_ops, }, }, diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h index bedddd510d17..bad2fc0c7306 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h @@ -336,7 +336,7 @@ struct cdns_mhdp_bridge_state { }; struct cdns_mhdp_platform_info { - const struct drm_bridge_timings *timings; + const u32 *input_bus_flags; const struct mhdp_platform_ops *ops; }; diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c index dfe1b59514f7..12d04be4e242 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c @@ -71,8 +71,7 @@ const struct mhdp_platform_ops mhdp_ti_j721e_ops = { .disable = cdns_mhdp_j721e_disable, }; -const struct drm_bridge_timings mhdp_ti_j721e_bridge_timings = { - .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE | - DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE | - DRM_BUS_FLAG_DE_HIGH, -}; +const u32 +mhdp_ti_j721e_bridge_input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE | + DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE | + DRM_BUS_FLAG_DE_HIGH; diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h index 97d20d115a24..5ddca07a4255 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.h @@ -14,6 +14,6 @@ struct mhdp_platform_ops; extern const struct mhdp_platform_ops mhdp_ti_j721e_ops; -extern const struct drm_bridge_timings mhdp_ti_j721e_bridge_timings; +extern const u32 mhdp_ti_j721e_bridge_input_bus_flags; #endif /* !CDNS_MHDP8546_J721E_H */ From patchwork Tue Jun 6 08:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3237441vqr; Tue, 6 Jun 2023 01:34:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lw0a31Xi7s6wOhxSEPwrf9Q/5tUhUG05gtS6Qro2gQld0f3xaG2rJlBeb/4qKuo3Bzj5g X-Received: by 2002:a05:620a:2814:b0:75e:c64f:3db7 with SMTP id f20-20020a05620a281400b0075ec64f3db7mr1520655qkp.2.1686040458652; Tue, 06 Jun 2023 01:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040458; cv=none; d=google.com; s=arc-20160816; b=F8UV/bLw9sZwvOXNvWfpSz5PqOtxMrjfcuqWYQjU93VTWPuj8jB1R7NLJ2dlNtcj4O l/3ZBG4kcipAOVsM5wlh6zEXd6cU95QFcWCuu/eMyJKL6DDPM36W4hoy3ZLm/2R+KjVz xbOKasVUsQhsz0jHKj5y5dzm6q4O3Plklj3/SCdJYDRAeY1fMxAwrxcoLVex0vPlhrUY CwhmS4kcC5ydwhwN7ldJKQIAQDpwm+MLvjvxEFAkPDKdc0mnWqJmFk4aao1J/Px6VheK w7hfWKu+jbP5DU9ir41N4U94pQkdzeXi3rI73FRA0FlQ00OysFKCa7OCiqiGoBXLyeOt SVxA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pe35-20020a05620a852300b0075c9eae7323si5427488qkn.681.2023.06.06.01.34.04; Tue, 06 Jun 2023 01:34:18 -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 S236512AbjFFIW2 (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 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?1767941560014573845?= X-GMAIL-MSGID: =?utf-8?q?1767941560014573845?= 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) From patchwork Tue Jun 6 08:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3237305vqr; Tue, 6 Jun 2023 01:34:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fEcn8XYAPNmD8ndgRczOvX14jMpvAXyl0U1ABwPYH9rFoMatN1478ShU5dPa26DduGP5u X-Received: by 2002:a05:622a:116:b0:3f5:c9f:1b27 with SMTP id u22-20020a05622a011600b003f50c9f1b27mr1686302qtw.1.1686040444016; Tue, 06 Jun 2023 01:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040444; cv=none; d=google.com; s=arc-20160816; b=02R+ywao0P2S0irPET9Zorpt6G9GSV/3Nu+mGwra2hujPY4mOy+o/HpHQisOpnkJww 2OO/qOhRHZPf7Ml36/XsYqUSxtzsqPDk5SCWvKKfh/E7glqYhGN0OcK6qJcQhZ+njPNj 2AfsgznIeJ4cVd6fqLMmy9lVUxSfybCWWDG/VEfd/iDuu3uRIOOz6wo4HK95tAXlFuvq cUUSHt7v5c2RgyzgoNbW/Bex3xd+4dUUTd9XvMgOT2HeAoHDdCHskwi8hFqtjyL9BY80 KIJxmFlP/UgGpGQ2GzW+voXaC5Mr2uh3skzl4nPZuTo6CTnZs1tGHBgmS6X4M50jhN8o ltjQ== 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=U9ozOmsuQQic6oaJc3ZfjadaTi3g2owitvvLoaNCHAI=; b=NiqhWKZkGJVhCrs+/psqD473Gb8br7SdMxrmH5sObPo0/BuPMjbS9/OBrL/CjXNuwK Gj4gGSpGYnowK3Y+UMjmEMmVLEri/oKlyVDZrrIhEBUnnerCUlpm7DzefA1LXN5aS+Kr /f11dHtBbFlUQOwY3yq4cZ62Jx0BgmXsdFooWfiVKAAU9iNx4/jFOqK1mlEB0qaeAelx 6t9Yg/rE9/d9zOn5uhignjYLnLNUeZbWElQL+L4L7GCB4VqyYPEd+KRdhArUuW1sG+zF 3ZlHbBfbykD05XQUZP7+L22PVuZ6Kn5sdllLAbK6O7FCREqXqICgKK8ZrOvw3hCmPAmC BifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gAoYblKj; 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 p5-20020ad45f45000000b00625b9a391e8si6024285qvg.414.2023.06.06.01.33.50; Tue, 06 Jun 2023 01:34: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=gAoYblKj; 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 S236424AbjFFIWw (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236374AbjFFIWW (ORCPT ); Tue, 6 Jun 2023 04:22:22 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13C23E47 for ; Tue, 6 Jun 2023 01:22:19 -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 3568Lq7A013077; Tue, 6 Jun 2023 03:21:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039712; bh=U9ozOmsuQQic6oaJc3ZfjadaTi3g2owitvvLoaNCHAI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gAoYblKjLuSvwiziQGi4ic7D6Lp/hXIwVzpbQ8F7bdElNuoKpESljRKCsDKjB0qPp 2rZtbp0lQizqofxFY5sMyazpVVtkQmPDX8gO6liOf3cKrRTUFB/kQJ3CKkufKJfAQL 8uZpIqspe0s+xjZLK92xb9X7uIRJxpdEL7Q1mrrY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568Lq0R012376 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:52 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) 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:52 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) 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:52 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lp6w019614; Tue, 6 Jun 2023 03:21:52 -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 6/8] drm/bridge: sii902x: Set input_bus_flags in atomic_check Date: Tue, 6 Jun 2023 13:51:40 +0530 Message-ID: <20230606082142.23760-7-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 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?1767941544766519347?= X-GMAIL-MSGID: =?utf-8?q?1767941544766519347?= input_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check. Implement atomic_check hook for the same. 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 70aeb04b7f77..8f1ec526863a 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -494,6 +494,20 @@ static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, return input_fmts; } +static int sii902x_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + /* + * There might be flags negotiation supported in future but + * set the bus flags in atomic_check statically for now. + */ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; + + return 0; +} + static const struct drm_bridge_funcs sii902x_bridge_funcs = { .attach = sii902x_bridge_attach, .mode_set = sii902x_bridge_mode_set, @@ -505,6 +519,7 @@ static const struct drm_bridge_funcs sii902x_bridge_funcs = { .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, + .atomic_check = sii902x_bridge_atomic_check, }; static int sii902x_mute(struct sii902x *sii902x, bool mute) From patchwork Tue Jun 6 08:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3247454vqr; Tue, 6 Jun 2023 01:59:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6qU3pg0b4mIlb3CaUUyYkQsADPew/2iR5U0jAdYKF5vO42li8voPTVp20b5ShIm30wQhxH X-Received: by 2002:a05:620a:47af:b0:75d:50bb:b181 with SMTP id dt47-20020a05620a47af00b0075d50bbb181mr1272414qkb.44.1686041979621; Tue, 06 Jun 2023 01:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686041979; cv=none; d=google.com; s=arc-20160816; b=0MtaJoAJrleKXtnCHTvWaSDEwMvX6TwG4yNr4KxpfR+HF8MxBV7jne66FtM+I/ghCv 6+YbeDhOws9tKTTMEtaM2Y4nEeezb6+8AdnwY12o8gEaf38dFnnOZmjJ41iRNb0Ge27s J6q1yJpztT0qN7db6BJfFnPR2OccqxWROG44m4aoFpUAqJRrTzivD7dCVLxi4NYcSdJi PW8XhfPDvIBT+vM35mgtVXCOVJnDYqd37QyU7FYt/btSoJjvJvPry50Mc51iBLdXzPTl 6DiRLrxPaXVjfAJwT4iZDnzGFP4lhy7wQ/dFWTmXXSMuMINJKjgtr3gtQrqZEHA1fWDl QIpw== 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=ZFTuDRCNh0K2sxCkjXJOFdyKf3fRWYBGiUnO3q2fd4Q=; b=I+AZZ5H+cF2NlYjzSas0LVD1PVe29m3SEroIXMP/Oipgt42fg03OkDYPd28uvz4bn7 O2FOx12LGEHdTis8ORYdtRl2a50d7k/nIgPuKgqd+lPFUZWeS6K2O2fCsLfY6nPWs0m1 cwNThyDdZLUDI4Cd4boeWGXIkgFHgyhnuyYmTLhMarswvCXl7vrNYdonQrOd3MUDE6ZA gGCZJvI3mBlSqkfxFc4KjdRslvENpoH6IhihGXvykDhNl/f6oNuA7GYP7vtfk63G95M9 jJFQS14VVVyfNOWt2q6XTP99gv2nV4l8TgtVU4z2rNDhZxUz9W7NRK9HOKYeB7fNjEJr CO+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=E3+fJdfg; 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 c18-20020a05620a11b200b0075938f5f300si5806449qkk.287.2023.06.06.01.59.25; Tue, 06 Jun 2023 01:59:39 -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=E3+fJdfg; 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 S236365AbjFFIWs (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236409AbjFFIWV (ORCPT ); Tue, 6 Jun 2023 04:22:21 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A97D3AF for ; Tue, 6 Jun 2023 01:22:18 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lse3038662; Tue, 6 Jun 2023 03:21:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039714; bh=ZFTuDRCNh0K2sxCkjXJOFdyKf3fRWYBGiUnO3q2fd4Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=E3+fJdfg6JrTVqO2/K1qWkriVmYPDbL4GteKGTxbJBSXTSc/jmNczCyRwaUIpOiZH EDEQLduqvzKjHIRsRRI0MVfXy8eUVa/jooJ/EaLeESsmkELLIMmNsySElbm/d+bpmU o00A5vrPWzdrvdnhlZrHRqI1Ti3zpM+0xYUKTywI= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568LsQ8032040 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:54 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE108.ent.ti.com (157.170.170.38) 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:53 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE112.ent.ti.com (157.170.170.23) 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:53 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lr2L090266; Tue, 6 Jun 2023 03:21:53 -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 7/8] drm/tidss: Update encoder/bridge chain connect model Date: Tue, 6 Jun 2023 13:51:41 +0530 Message-ID: <20230606082142.23760-8-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 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?1767943154977171629?= X-GMAIL-MSGID: =?utf-8?q?1767943154977171629?= With the new encoder/bridge chain model, the display controller driver is required to create a drm_connector entity instead of asking the bridge to do so during drm_bridge_attach. Moreover, the controller driver should create a drm_bridge entity to negotiate bus formats and a 'simple' drm_encoder entity to expose it to userspace. Update the encoder/bridge initialization sequence in tidss as per the new model. Signed-off-by: Aradhya Bhatia --- Notes: changes from v5: * Drop patches 5 and 6 from the original series. * Instead add this patch that addresses Boris Brezillon's comments of creating bridge, simple encoder and connector. drivers/gpu/drm/tidss/tidss_encoder.c | 140 ++++++++++++++++---------- drivers/gpu/drm/tidss/tidss_encoder.h | 5 +- drivers/gpu/drm/tidss/tidss_kms.c | 12 +-- 3 files changed, 94 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c index 0d4865e9c03d..17a86bed8054 100644 --- a/drivers/gpu/drm/tidss/tidss_encoder.c +++ b/drivers/gpu/drm/tidss/tidss_encoder.c @@ -6,91 +6,125 @@ #include +#include +#include +#include #include #include #include #include +#include #include "tidss_crtc.h" #include "tidss_drv.h" #include "tidss_encoder.h" -static int tidss_encoder_atomic_check(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) +struct tidss_encoder { + struct drm_bridge bridge; + struct drm_encoder encoder; + struct drm_connector *connector; + struct drm_bridge *next_bridge; + struct tidss_device *tidss; +}; + +static inline struct tidss_encoder +*bridge_to_tidss_encoder(struct drm_bridge *b) +{ + return container_of(b, struct tidss_encoder, bridge); +} + +static int tidss_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct tidss_encoder *t_enc = bridge_to_tidss_encoder(bridge); + + return drm_bridge_attach(bridge->encoder, t_enc->next_bridge, + bridge, flags); +} + +static int tidss_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { - struct drm_device *ddev = encoder->dev; + struct tidss_encoder *t_enc = bridge_to_tidss_encoder(bridge); + struct tidss_device *tidss = t_enc->tidss; struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state); struct drm_display_info *di = &conn_state->connector->display_info; - struct drm_bridge *bridge; - bool bus_flags_set = false; - - dev_dbg(ddev->dev, "%s\n", __func__); - - /* - * Take the bus_flags from the first bridge that defines - * bridge timings, or from the connector's display_info if no - * bridge defines the timings. - */ - drm_for_each_bridge_in_chain(encoder, bridge) { - if (!bridge->timings) - continue; - - tcrtc_state->bus_flags = bridge->timings->input_bus_flags; - bus_flags_set = true; - break; - } + struct drm_bridge_state *next_bridge_state = NULL; + + if (t_enc->next_bridge) + next_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, + t_enc->next_bridge); - if (!di->bus_formats || di->num_bus_formats == 0) { - dev_err(ddev->dev, "%s: No bus_formats in connected display\n", + if (next_bridge_state) { + tcrtc_state->bus_flags = next_bridge_state->input_bus_cfg.flags; + tcrtc_state->bus_format = next_bridge_state->input_bus_cfg.format; + } else if (di->num_bus_formats) { + tcrtc_state->bus_format = di->bus_formats[0]; + tcrtc_state->bus_flags = di->bus_flags; + } else { + dev_err(tidss->dev, "%s: No bus_formats in connected display\n", __func__); return -EINVAL; } - // XXX any cleaner way to set bus format and flags? - tcrtc_state->bus_format = di->bus_formats[0]; - if (!bus_flags_set) - tcrtc_state->bus_flags = di->bus_flags; - return 0; } -static void tidss_encoder_destroy(struct drm_encoder *encoder) -{ - drm_encoder_cleanup(encoder); - kfree(encoder); -} - -static const struct drm_encoder_helper_funcs encoder_helper_funcs = { - .atomic_check = tidss_encoder_atomic_check, -}; - -static const struct drm_encoder_funcs encoder_funcs = { - .destroy = tidss_encoder_destroy, +static const struct drm_bridge_funcs tidss_bridge_funcs = { + .attach = tidss_bridge_attach, + .atomic_check = tidss_bridge_atomic_check, + .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, }; -struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, - u32 encoder_type, u32 possible_crtcs) +int tidss_encoder_create(struct tidss_device *tidss, + struct drm_bridge *next_bridge, + u32 encoder_type, u32 possible_crtcs) { + struct tidss_encoder *t_enc; struct drm_encoder *enc; + struct drm_connector *connector; int ret; - enc = kzalloc(sizeof(*enc), GFP_KERNEL); - if (!enc) - return ERR_PTR(-ENOMEM); + t_enc = drmm_simple_encoder_alloc(&tidss->ddev, struct tidss_encoder, + encoder, encoder_type); + if (IS_ERR(t_enc)) + return PTR_ERR(t_enc); + + t_enc->tidss = tidss; + t_enc->next_bridge = next_bridge; + t_enc->bridge.funcs = &tidss_bridge_funcs; + enc = &t_enc->encoder; enc->possible_crtcs = possible_crtcs; - ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs, - encoder_type, NULL); - if (ret < 0) { - kfree(enc); - return ERR_PTR(ret); + /* Attaching first bridge to the encoder */ + ret = drm_bridge_attach(enc, &t_enc->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret) { + dev_err(tidss->dev, "bridge attach failed: %d\n", ret); + return ret; + } + + /* Initializing the connector at the end of bridge-chain */ + connector = drm_bridge_connector_init(&tidss->ddev, enc); + if (IS_ERR(connector)) { + dev_err(tidss->dev, "bridge_connector create failed\n"); + return PTR_ERR(connector); + } + + ret = drm_connector_attach_encoder(connector, enc); + if (ret) { + dev_err(tidss->dev, "attaching encoder to connector failed\n"); + return ret; } - drm_encoder_helper_add(enc, &encoder_helper_funcs); + t_enc->connector = connector; dev_dbg(tidss->dev, "Encoder create done\n"); - return enc; + return ret; } diff --git a/drivers/gpu/drm/tidss/tidss_encoder.h b/drivers/gpu/drm/tidss/tidss_encoder.h index ace877c0e0fd..3e561d6b1e83 100644 --- a/drivers/gpu/drm/tidss/tidss_encoder.h +++ b/drivers/gpu/drm/tidss/tidss_encoder.h @@ -11,7 +11,8 @@ struct tidss_device; -struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, - u32 encoder_type, u32 possible_crtcs); +int tidss_encoder_create(struct tidss_device *tidss, + struct drm_bridge *next_bridge, + u32 encoder_type, u32 possible_crtcs); #endif diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c index ad2fa3c3d4a7..c979ad1af236 100644 --- a/drivers/gpu/drm/tidss/tidss_kms.c +++ b/drivers/gpu/drm/tidss/tidss_kms.c @@ -193,7 +193,6 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) for (i = 0; i < num_pipes; ++i) { struct tidss_plane *tplane; struct tidss_crtc *tcrtc; - struct drm_encoder *enc; u32 hw_plane_id = feat->vid_order[tidss->num_planes]; int ret; @@ -216,16 +215,13 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss) tidss->crtcs[tidss->num_crtcs++] = &tcrtc->crtc; - enc = tidss_encoder_create(tidss, pipes[i].enc_type, + ret = tidss_encoder_create(tidss, pipes[i].bridge, + pipes[i].enc_type, 1 << tcrtc->crtc.index); - if (IS_ERR(enc)) { + if (ret) { dev_err(tidss->dev, "encoder create failed\n"); - return PTR_ERR(enc); - } - - ret = drm_bridge_attach(enc, pipes[i].bridge, NULL, 0); - if (ret) return ret; + } } /* create overlay planes of the leftover planes */ From patchwork Tue Jun 6 08:21:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aradhya Bhatia X-Patchwork-Id: 103631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3236796vqr; Tue, 6 Jun 2023 01:32:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6g5Dll9GPjhmgxf77gHZBucDQaz37WBeALplORE9Isv8dRlyIxFtfeX7fwetNbzp77a/qb X-Received: by 2002:a05:620a:22b8:b0:75e:d11d:5198 with SMTP id p24-20020a05620a22b800b0075ed11d5198mr378064qkh.36.1686040372682; Tue, 06 Jun 2023 01:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040372; cv=none; d=google.com; s=arc-20160816; b=mz/KrBt6YbWyePbo3sU8foTDF8cN3Nxy2fGCpkneROXvGUY4IXSPT7h8guXxdqOyxF eXsoHLSRr50VfOr5NEeWMxlZkzeNBakmakpYBOtvm70ujxftui+cFxjq+qvd9vu+GPQY +rb1e8EYo54n54HmOO3ZCBgs1V6OJ/78Ng6Gh+4ul7PLPXnPbeW8Taiidm45WrCvPXTE SdluAKc9j6ZFXecdndkLGyjTSZ21T+7/FzBkyzyNclovs9jSxSzGewdLoVyHtjHsazzu 4IVt03yxM9RL9xR1v8/W6qNAmCDAGO8pSwyJXJ8eBskdwd6YmRgfRdc2cBNYI1NDkxXY K1NA== 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=P+Pz7QTxeDNcMEQ6FvThwTsTY3IJY+048fGtIqlAyL0=; b=PRSPxDBW1XLQ8IYGxdAzxZbc1RjdGFe1A2WyaxOMcwesBI/R9BV7xH965ENieAbkJA xtKP/0kVAxUUMvsmunrhMpWmI8y/CXYBR6OF2DyX+tp5DL4xoE/Ximo3Kgqd1CRQoTSG IfI0kzQKnLoiLCF72csM8nLuYth4NptzsoKYzJCvcmiTmLWx/skzmOLo/ZAgq7GdChW4 x3uH4MBtq789WRuq4hUc0j4T34cF0WQHjcdtK18uIj6RzyzkPwVY/jVwmxNcqtQtoUBy AdmaU53ga7HrCDZgUoZPWbcS6zSTA9ig3EIJRlg7Tbg5U1Ah9OJCUkF3I6gFvUCWOt+s 4Wdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="ZsV/i6Dw"; 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 z7-20020ae9c107000000b0075aecc49462si5478208qki.326.2023.06.06.01.32.38; Tue, 06 Jun 2023 01:32:52 -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="ZsV/i6Dw"; 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 S236651AbjFFIWp (ORCPT + 99 others); Tue, 6 Jun 2023 04:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236349AbjFFIWV (ORCPT ); Tue, 6 Jun 2023 04:22:21 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295C9197 for ; Tue, 6 Jun 2023 01:22:17 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3568LtZR066276; Tue, 6 Jun 2023 03:21:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1686039715; bh=P+Pz7QTxeDNcMEQ6FvThwTsTY3IJY+048fGtIqlAyL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZsV/i6DwmTLq+1vo24Pdi+doxkjSmMF/ilhw2np/Vu9nDSeawHI+zU5OvQaN7785N q9MNoLPlyQ0/3XCat/CKi60xpjE+SuDc8PY481xxw+CpnGoqdQ+t92Kat6gx++u1FE w1g4fSAY/swWNjDos+tEyuEo/roeR9ItN8URwstE= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3568Lt2e012409 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jun 2023 03:21:55 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE105.ent.ti.com (157.170.170.35) 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:55 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.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, 6 Jun 2023 03:21:55 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3568Lsb5019672; Tue, 6 Jun 2023 03:21:55 -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 8/8] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable Date: Tue, 6 Jun 2023 13:51:42 +0530 Message-ID: <20230606082142.23760-9-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 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?1767941469823107044?= X-GMAIL-MSGID: =?utf-8?q?1767941469823107044?= From: Nikhil Devshatwar When removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver. [ 43.238895] irq 31: nobody cared (try booting with the "irqpoll" option) ... [snipped backtrace] [ 43.330735] handlers: [ 43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>] cdns_mhdp_irq_handler [cdns_mhdp8546] [ 43.344607] Disabling IRQ #31 This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver. Fix this with a read-modify-write to update only required bits. Use the enable / disable function as required in other places. Signed-off-by: Nikhil Devshatwar Reviewed-by: Swapnil Jakhade Reviewed-by: Tomi Valkeinen Signed-off-by: Aradhya Bhatia --- Notes: changes from v2: * Fix the interrupt enable logic at other places in code * Reorder functions so that they can be used earlier in the program changes from v5: * Manual rebase to linux-next. .../drm/bridge/cadence/cdns-mhdp8546-core.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index f12fb62821f7..ecb935e46b62 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -54,6 +54,26 @@ #include "cdns-mhdp8546-hdcp.h" #include "cdns-mhdp8546-j721e.h" +static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge) +{ + struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); + + /* Enable SW event interrupts */ + if (mhdp->bridge_attached) + writel(readl(mhdp->regs + CDNS_APB_INT_MASK) & + ~CDNS_APB_INT_MASK_SW_EVENT_INT, + mhdp->regs + CDNS_APB_INT_MASK); +} + +static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) +{ + struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); + + writel(readl(mhdp->regs + CDNS_APB_INT_MASK) | + CDNS_APB_INT_MASK_SW_EVENT_INT, + mhdp->regs + CDNS_APB_INT_MASK); +} + static int cdns_mhdp_mailbox_read(struct cdns_mhdp_device *mhdp) { int ret, empty; @@ -749,9 +769,7 @@ static int cdns_mhdp_fw_activate(const struct firmware *fw, * MHDP_HW_STOPPED happens only due to driver removal when * bridge should already be detached. */ - if (mhdp->bridge_attached) - writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT, - mhdp->regs + CDNS_APB_INT_MASK); + cdns_mhdp_bridge_hpd_enable(&mhdp->bridge); spin_unlock(&mhdp->start_lock); @@ -1740,8 +1758,7 @@ static int cdns_mhdp_attach(struct drm_bridge *bridge, /* Enable SW event interrupts */ if (hw_ready) - writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT, - mhdp->regs + CDNS_APB_INT_MASK); + cdns_mhdp_bridge_hpd_enable(bridge); return 0; aux_unregister: @@ -2212,23 +2229,6 @@ static struct edid *cdns_mhdp_bridge_get_edid(struct drm_bridge *bridge, return cdns_mhdp_get_edid(mhdp, connector); } -static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge) -{ - struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); - - /* Enable SW event interrupts */ - if (mhdp->bridge_attached) - writel(~(u32)CDNS_APB_INT_MASK_SW_EVENT_INT, - mhdp->regs + CDNS_APB_INT_MASK); -} - -static void cdns_mhdp_bridge_hpd_disable(struct drm_bridge *bridge) -{ - struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); - - writel(CDNS_APB_INT_MASK_SW_EVENT_INT, mhdp->regs + CDNS_APB_INT_MASK); -} - static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_enable = cdns_mhdp_atomic_enable, .atomic_disable = cdns_mhdp_atomic_disable,