From patchwork Fri Feb 11 22:40:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 541799 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp3463664imo; Fri, 11 Feb 2022 14:40:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJz01WP27lT0njKYVkX4pUDMlx6pOEN5LHUDc/TzrzDPCQJw1y2vbiqJ0N/Vuf8Fm2XnN2Aq X-Received: by 2002:a63:4752:: with SMTP id w18mr3095355pgk.349.1644619244146; Fri, 11 Feb 2022 14:40:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644619244; cv=none; d=google.com; s=arc-20160816; b=08tXwJ1uJJCagDW7gcDwuVzOTz7EtU0zFLs5HwAhdn42fzxNWaqziUg0s3jNYAuGqP 4KsvwggeAQ0/2VapUET+hHeizIn8K27CBuoRlX513UGc3jM1NO/7qv9MbKOLrCKBL+7I Ay/Kzp3oqzTtnA8zLjZF7mG75+gBUVKcvwgH+/yqne6qH5W7GlBUR6a+ve28A9fO2w8+ xql7sF+MG3wXt71hm8ucc+hdYQnR+2kecixsEcPc2xwO9skDKP+fSQs2eYbqA4RoRqMj jDhetrdsAAvB6KTA9LRafcZpZ4uqEtvNWpKV0BzguLHt5969Bb+hr7qd94kenKmXqKrz 1MbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=wQf3XP4BZfuzc3ylEELAJ2OjaNg6jTxSBCBJwv6w5qM=; b=cv+ibhQLUJG/XcYdCKa+6kJTO7jTBTnn3vRQilX41lvGIFRRikyQWLRDL1YgrEFgGo LB9voQ+vSJ9Z1Oer+iG9guxTbTptlAJT+l+y6+qDG2rbpYhs6pK7amW9vor9C+ssQS+H hoGfuTKTUNyZMTpsgWg81adJrYOZ69ydsRDAsGNMDKyhDi9o6tFsZXCe9q3rjBFkTNQ4 ZKCzaeC1XQ2pYJ088TMwCMNHCSeU99BkjIsQ9uJKEadpwJ0L+XY1HGRW+LnwrU9VR2gb ECWaEbL56zgCVXW6SLnWAZwS+mgdg9qfwRs7bsDW25ybKYWukWOzqumn0dtk7YoIVC4S dP0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DHUDXkod; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id u6si2258625ple.14.2022.02.11.14.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DHUDXkod; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC8BC10EBB9; Fri, 11 Feb 2022 22:40:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id E94EA10EBA9 for ; Fri, 11 Feb 2022 22:40:09 +0000 (UTC) Received: by mail-lj1-x22f.google.com with SMTP id c10so1695445ljr.9 for ; Fri, 11 Feb 2022 14:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wQf3XP4BZfuzc3ylEELAJ2OjaNg6jTxSBCBJwv6w5qM=; b=DHUDXkodYg67FoSIT/jyDwu8mai51ctlRRP+iWjmYaBMn7H74cJ0iXyxOMtA9CdYf2 Dvo+Ly8DjcW/FBEf1N9HChiPIEVIoKSslEznKV/Mk1Fg8PkonubmzrZzhCc9I79/bpgl Thahc/0zhXOY9qlHD1SSp9lQOtG5HjWGL/7dqnlFjqL1/YsiHUYByNo+6mgNLkxV3p6U RfL6A2HepzBInkrjkCUSYRUE1Jv0UM72YLFjGpaj3xDKQEhwOvHam0Au3aOZ3vc1bkOv XHog+VMigQ4eCHAfiGf5YGfgTGPQEquGI3Kk+8/TwT0RVr7WfiAoF9+B88gM5J3hcV4L estg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wQf3XP4BZfuzc3ylEELAJ2OjaNg6jTxSBCBJwv6w5qM=; b=CRc465NlGM7gHufFXrromHbTcLSBxlD5WLfh4AyhWAYsTFu647MXyaszFOcjn/lxAy IhLFZrXFsZqtlWFcNVJcyEoIIHt0KKT0Y1ZPrqU/ww5z0EoOz/g3T/tAi47NUGGfkjoz kb8JOnw5BTmCRlVH1NB6PNePAkZZcS4Eq+WRR40FC+67Ylc956b/htJnq4JrJMm29g93 njLsa9YukvtBcuQiyuYEN6O4BqLzPgSYMnP+GwQv6Y1pgFbc4RNmQFUiSKaoK9EWdKzI rrq78rS7OrvRp3rvItYRDUC3O7SdqL2hW51QBGIcndB98HSfxrRquaM6ZG38Wp+XIl7L r+KQ== X-Gm-Message-State: AOAM532hzGZtYKY5q/uSfNHI0MjfgIbj7e2WQwYXpEp4D6dbqeX9koNp fSLKv4PiSYcUg0ImFYRbEZpg2w== X-Received: by 2002:a2e:5810:: with SMTP id m16mr2204599ljb.261.1644619208126; Fri, 11 Feb 2022 14:40:08 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a6sm3319983ljb.93.2022.02.11.14.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:07 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar , Kuogee Hsieh Subject: [RFC PATCH v2 1/5] drm/msm/dp: fix panel bridge attachment Date: Sat, 12 Feb 2022 01:40:02 +0300 Message-Id: <20220211224006.1797846-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> References: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In commit 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable") the DP driver received a drm_bridge instance, which is always attached to the encoder as a root bridge. However it conflicts with the panel_bridge support for eDP panels. The panel bridge attaches to the encoder before the "dp" bridge has a chace to do so. Change panel_bridge attachment to come after dp_bridge attachment. Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable") Cc: Kuogee Hsieh Signed-off-by: Dmitry Baryshkov Tested-by: Kuogee Hsieh Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/dp/dp_drm.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index d4d360d19eba..26ef41a4c1b6 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -169,16 +169,6 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) drm_connector_attach_encoder(connector, dp_display->encoder); - if (dp_display->panel_bridge) { - ret = drm_bridge_attach(dp_display->encoder, - dp_display->panel_bridge, NULL, - DRM_BRIDGE_ATTACH_NO_CONNECTOR); - if (ret < 0) { - DRM_ERROR("failed to attach panel bridge: %d\n", ret); - return ERR_PTR(ret); - } - } - return connector; } @@ -246,5 +236,16 @@ struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_devi return ERR_PTR(rc); } + if (dp_display->panel_bridge) { + rc = drm_bridge_attach(dp_display->encoder, + dp_display->panel_bridge, bridge, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (rc < 0) { + DRM_ERROR("failed to attach panel bridge: %d\n", rc); + drm_bridge_remove(bridge); + return ERR_PTR(rc); + } + } + return bridge; } From patchwork Fri Feb 11 22:40:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 541802 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp3463812imo; Fri, 11 Feb 2022 14:40:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1ozzyG+sX0sL8vGNLkukqu/qP3proBaPJqLhhDzW4p5MgbOEZLSDzH0uuUI006shWl2ia X-Received: by 2002:a17:90b:3a8f:: with SMTP id om15mr2646200pjb.196.1644619257601; Fri, 11 Feb 2022 14:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644619257; cv=none; d=google.com; s=arc-20160816; b=FMLx3rPfZZ4b9ybpk6egrO6V4D5MaNK8oeNRzJ/WWgLPYveus0onInkKdMbo4VzZ9f 7xZVsGH9efNe+AZzb4KBpMmZWW4WoURHLcD83Fzjndk5Y/eIyUuNONufyntTdx96o4UO yDexCl5Spd/3S2s3GGKH7lHn/Gn0XzoekSlYJx/hP59LuHbNizuQ3rQRUt6H0Fn9A+j1 QQCoM3Hnc+dPtYj1hxqk4gh1vtL7W+64Z5B57gtuxbBPd46/+BjZmzF14Hs126gr2Oes AvPzCtj26JAwrU94HroE5EuCOhiJY9vs09gOT+NQZTrWSySstfXfOx4zTTJ+8amFbxRK pjIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=6MuToI+AtPTkDW3n8E622FciNL++kHbqA2jvYbU4GMc=; b=qYUpFiUXd6oOmA0TK67C4wFwm8P66+zfLCVgzvNTMuDt3j1C5Yyp8c8O83z9PTZRLO J/WRfN0EhWBnulsH8wwxdvyoal3LDVRnj2HZtYUhSBecbj0WHQ1CMV1m1atxrx0EluMo y7TPpfSXD/9HKJd9njhbGoBXk4iO8x3r29h4UYrKg2kJqkTVqv0L4fPqkT1FemU2bZyY ebhg12TbByo7nZLvVsMWMwHsT3CiTpFX/pmAyJ4V3bBkiuTRcYMlHi0xKH8GPOVuraQb gKh2Y0n1Cjl757/IAJDj8tIdSeD/dLxrGay9y7oLv072aR/ONZcjX37iMN0hMoFvxUVP 4fkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Is77PA2G; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id f2si7677813pgv.426.2022.02.11.14.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Is77PA2G; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F32710EBA7; Fri, 11 Feb 2022 22:40:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD92510EBA7 for ; Fri, 11 Feb 2022 22:40:10 +0000 (UTC) Received: by mail-lf1-x131.google.com with SMTP id bu29so13990336lfb.0 for ; Fri, 11 Feb 2022 14:40:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6MuToI+AtPTkDW3n8E622FciNL++kHbqA2jvYbU4GMc=; b=Is77PA2GuHi1v0TsAP/eKKC0RAIj1Gu2uqklot7h9Qg5jFPP6/JiQwb3etMeiVCNHS TMNh23Z0bOzBjwkvLfB2eHC5P/zGH69inkDyaFilqwuyvWpMKEagZtvwrAvhcg5KVE8l nqIW6EvQJbXsl0H8oGuwBUsy1QABBkb8sVlciPZTirkV9+iNgGxlrp4dZtst2JE9gN6Y 1/ENQwJmUrg+b9sHbZWTbdoJ1o6D5PpkOwFsihWbXp43+m1lEcwYTe5IZ3PwBfQaDqVK vFMlGafAvc8Njf36SB1Rvjqu+HEc6fK8pVS5Dl1JbBOCwCbiiu0j4siBdD2avLDewRLH InIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6MuToI+AtPTkDW3n8E622FciNL++kHbqA2jvYbU4GMc=; b=HQMYeGfPdSdSAJ8R/4bFYS3ezx0Wf70IhtLBRqj/vQhzIA5LbXnML2nm5GE8ZiLV6F /zTdRjBuoc/7gVe/19uHz6aQOgBh6CcSJWVMRBHpYTV/vX4r5f9a46eYjb9psLw/lC4P RhvprDsR41Ip6f2qvnryV0n/+zSPhtILTqaPmlz3FTKYeOAnjRekwUTebalbCl1UWpZx btTJ0ol3SrpZrH9iyAAe1GgJnVSGnUFNwIiHjYJ0OKwr8Zdg/tJ6oBkqf18JK/q1mVC1 stScgcPOkpBLQOn/pv0hP3wQufNbv8XPdgDn07Z5igoASPdi+GiYxHambUjGD0POp056 HGFg== X-Gm-Message-State: AOAM5321d/h7S5uE/su5cNtxFEhspRxuVl0Hkkc+YoUCR6FC/L6urcFR MeY4g8TUwIvHUOIVkCql4Bo1AQ== X-Received: by 2002:a05:6512:3186:: with SMTP id i6mr2700451lfe.47.1644619209016; Fri, 11 Feb 2022 14:40:09 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a6sm3319983ljb.93.2022.02.11.14.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:08 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar , Kuogee Hsieh Subject: [RFC PATCH v2 2/5] drm/msm/dp: support attaching bridges to the DP encoder Date: Sat, 12 Feb 2022 01:40:03 +0300 Message-Id: <20220211224006.1797846-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> References: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently DP driver will allocate panel bridge for eDP panels. This supports only the following topology: - eDP encoder ⇒ eDP panel (wrapped using panel-bridge) Simplify this code to just check if there is any next bridge in the chain (be it a panel bridge or regular bridge). Rename panel_bridge field to next_bridge accordingly. This allows one to use e.g. one of the following display topologies: - eDP encoder ⇒ ptn3460 ⇒ fixed LVDS panel - eDP encoder ⇒ ptn3460 ⇒ LVDS connector with EDID lines for panel autodetect - eDP encoder ⇒ ptn3460 ⇒ THC63LVD1024 ⇒ DPI panel. - eDP encoder ⇒ LT8912 ⇒ DSI panel Signed-off-by: Dmitry Baryshkov Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- drivers/gpu/drm/msm/dp/dp_display.h | 2 +- drivers/gpu/drm/msm/dp/dp_drm.c | 4 ++-- drivers/gpu/drm/msm/dp/dp_parser.c | 31 +++++++++++++++-------------- drivers/gpu/drm/msm/dp/dp_parser.h | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 44d42c76c2a3..45f9a912ecc5 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -266,7 +266,7 @@ static int dp_display_bind(struct device *dev, struct device *master, goto end; } - dp->dp_display.panel_bridge = dp->parser->panel_bridge; + dp->dp_display.next_bridge = dp->parser->next_bridge; dp->aux->drm_dev = drm; rc = dp_aux_register(dp->aux); diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index e3adcd578a90..7af2b186d2d9 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -16,7 +16,7 @@ struct msm_dp { struct drm_bridge *bridge; struct drm_connector *connector; struct drm_encoder *encoder; - struct drm_bridge *panel_bridge; + struct drm_bridge *next_bridge; bool is_connected; bool audio_enabled; bool power_on; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 26ef41a4c1b6..80f59cf99089 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -236,9 +236,9 @@ struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_devi return ERR_PTR(rc); } - if (dp_display->panel_bridge) { + if (dp_display->next_bridge) { rc = drm_bridge_attach(dp_display->encoder, - dp_display->panel_bridge, bridge, + dp_display->next_bridge, bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc < 0) { DRM_ERROR("failed to attach panel bridge: %d\n", rc); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index a7acc23f742b..901d7967370f 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -265,23 +265,16 @@ static int dp_parser_clock(struct dp_parser *parser) return 0; } -static int dp_parser_find_panel(struct dp_parser *parser) +static int dp_parser_find_next_bridge(struct dp_parser *parser) { struct device *dev = &parser->pdev->dev; - struct drm_panel *panel; - int rc; + struct drm_bridge *bridge; - rc = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL); - if (rc) { - DRM_ERROR("failed to acquire DRM panel: %d\n", rc); - return rc; - } + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); + if (IS_ERR(bridge)) + return PTR_ERR(bridge); - parser->panel_bridge = devm_drm_panel_bridge_add(dev, panel); - if (IS_ERR(parser->panel_bridge)) { - DRM_ERROR("failed to create panel bridge\n"); - return PTR_ERR(parser->panel_bridge); - } + parser->next_bridge = bridge; return 0; } @@ -307,10 +300,18 @@ static int dp_parser_parse(struct dp_parser *parser, int connector_type) if (rc) return rc; + /* + * Currently we support external bridges only for eDP connectors. + * + * No external bridges are expected for the DisplayPort connector, + * it is physically present in a form of a DP or USB-C connector. + */ if (connector_type == DRM_MODE_CONNECTOR_eDP) { - rc = dp_parser_find_panel(parser); - if (rc) + rc = dp_parser_find_next_bridge(parser); + if (rc) { + DRM_ERROR("DP: failed to find next bridge\n"); return rc; + } } /* Map the corresponding regulator information according to diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 3172da089421..4cec851e38d9 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -123,7 +123,7 @@ struct dp_parser { struct dp_display_data disp_data; const struct dp_regulator_cfg *regulator_cfg; u32 max_dp_lanes; - struct drm_bridge *panel_bridge; + struct drm_bridge *next_bridge; int (*parse)(struct dp_parser *parser, int connector_type); }; From patchwork Fri Feb 11 22:40:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 541801 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp3463725imo; Fri, 11 Feb 2022 14:40:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpY71uKgPc6/VoMT6iiAs91SjfcF+10tx0LTPtbMEzrGjyjU5hXncoZXFyWfaVUHWhn8tn X-Received: by 2002:a65:458f:: with SMTP id o15mr1464325pgq.92.1644619249246; Fri, 11 Feb 2022 14:40:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644619249; cv=none; d=google.com; s=arc-20160816; b=hlfd1okSVLhkpyM2zyH4D+0pRSpUkovuOTo5oL6VRKRlHoRTKQ0VJvuCRYNuJXk8z4 0W7giYGpB3agxzv58oDbCsMhuZY2qi+iTLoeBNPK7qCzrfpzxeYF0NVLkdb7+Frrn1UM NRgsCF8isfxFriPRpmT+5d0G/mznJX/m3WwMKEpNtKio/bmIYjTXsro2KQA2dsDr+MwM wUE0o5Hw8QPPP1xOISnrcKPcn6Q4W4VubM/SLAOQhGjovtABEg8okF5JTo7ZSFm+soVM WFlOjUsmBEQzq95aRk8kr/fOVQqC88H2irnB4QStEvZdExn42ThpBjRp0j/kCvNaL9Qf r0BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=A8ctvX5zLKvSPusbxBXHP85Dtil9Pv7DuZ+PpnlfzHc=; b=xwF9yaF0wicK+ck9C5FRJxhx+Wvgdymfu4bH5+3fvGUNH65Lqq61dcXvpx53xBBWVf 7vpwamH5KcGq2/9u45WM1i8SkHMBsj/3l7oK4CBB9w2gff8Enfh/IsUcILyqfJZZRKlK JZPJJkkajXd6mNHnZleF1+Ie9jxBqi4CWRu7Wq62rnY6nYm2DID5AKYTHsN0fCBxJ5SH 7gNKXquw/RzG9HXgJg0DPr+8aOC7nStxQ/J9r+/e6IRnC9aY+a+lAGMS6N2KcQf64oKi fE34+k+E5rCPP27RZUQpNQoGzAZnrdHnawFZYVytfzJ9XS7BKmatteuX1VMZ6UNZzn2x XqLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QObfsafJ; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r23si23083296pga.495.2022.02.11.14.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QObfsafJ; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1630210EBBB; Fri, 11 Feb 2022 22:40:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D91910EBA9 for ; Fri, 11 Feb 2022 22:40:11 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id x15so2034878lfu.10 for ; Fri, 11 Feb 2022 14:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A8ctvX5zLKvSPusbxBXHP85Dtil9Pv7DuZ+PpnlfzHc=; b=QObfsafJ4EWjse6VV3bqb1uHiZBP6amKZbxvvjbIOlPJ/J+NAmh2xeY7cjkwbN4HmV kx5r+NO8p9TPow6xwADjImn0CnGaDXEqQYEaCI0lhrOEvsub7dTkUgy4KFfhUJymo7RH o2nl/LNJqSEcwIYoom14Srv5mHwd8OIgarz3lN0RGoUFWG876V7YTv9rJFsnNpuYMt/4 o7DpaoSbzbrRiUFK60QECAKO2wja0Eq24yYVB25HKIRykLkjQeznFgOJNk0lW0joMfeG 1oWCBu+o2KYPe+oIPmtduDKh9AoHKWhDXqgjQgsHv/ePg2JmaJOQIFbpXLwOETiEoAEV VLfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A8ctvX5zLKvSPusbxBXHP85Dtil9Pv7DuZ+PpnlfzHc=; b=YnQFFC/utUGJof6BeT4Y7q29zVVtMCGT1/FhCaavoRcHjivZEv4UG3ioMG4CpzcssM 2oS+9PgrTj/YQvyMvh87Y3EAOyRZsqozMAtKp0PzlY40qSUck0IrjFx+IDjF0b/j2CAH zSnzj4LqsSTCpQApRmv0zDt3pbGMdlHKjiH3dS/CJ1sXsMBjUK09oWXB/LwDXgrzq1CW LkoqpRU8vEWSG2yAQ5S1u54iGQm2gR9ofwg8tT4VVCM4XUw5wY4Iknii+Yg5rfW7d+KW ePFYEb+Nr4yuo0m0otgNWzZcagG7yeOr0AdylGbeKkZ9zRht3G8rlNX5V6eNBSmQRh9T C04Q== X-Gm-Message-State: AOAM530BoNibLU2JYtY+2vzaVhpFuZb8WFHCf6LLO6HtYF9OzzT2gsh9 jqhvx275Do1IQogq1ggeN8x6Rnyxb0U8KA== X-Received: by 2002:a05:6512:398d:: with SMTP id j13mr2623942lfu.251.1644619209897; Fri, 11 Feb 2022 14:40:09 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a6sm3319983ljb.93.2022.02.11.14.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:09 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar , Kuogee Hsieh Subject: [RFC PATCH v2 3/5] drm/msm/dp: support finding next bridge even for DP interfaces Date: Sat, 12 Feb 2022 01:40:04 +0300 Message-Id: <20220211224006.1797846-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> References: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It is possible to supply display-connector (bridge) to the DP interface, add support for parsing it too. Signed-off-by: Dmitry Baryshkov Tested-by: Kuogee Hsieh Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/dp/dp_parser.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 901d7967370f..1056b8d5755b 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -301,17 +301,22 @@ static int dp_parser_parse(struct dp_parser *parser, int connector_type) return rc; /* - * Currently we support external bridges only for eDP connectors. + * External bridges are mandatory for eDP interfaces: one has to + * provide at least an eDP panel (which gets wrapped into panel-bridge). * - * No external bridges are expected for the DisplayPort connector, - * it is physically present in a form of a DP or USB-C connector. + * For DisplayPort interfaces external bridges are optional, so + * silently ignore an error if one is not present (-ENODEV). */ - if (connector_type == DRM_MODE_CONNECTOR_eDP) { - rc = dp_parser_find_next_bridge(parser); - if (rc) { - DRM_ERROR("DP: failed to find next bridge\n"); + rc = dp_parser_find_next_bridge(parser); + if (rc == -ENODEV) { + if (connector_type == DRM_MODE_CONNECTOR_eDP) { + DRM_ERROR("eDP: next bridge is not present\n"); return rc; } + } else if (rc) { + if (rc != -EPROBE_DEFER) + DRM_ERROR("DP: error parsing next bridge: %d\n", rc); + return rc; } /* Map the corresponding regulator information according to From patchwork Fri Feb 11 22:40:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 541798 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp3463618imo; Fri, 11 Feb 2022 14:40:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyVETSnQI6VdzDnfP+OsBQIv+qKZchMhmimpap0SS19ogeGpSRYlMeN6I2ZBvmuv47LXDa X-Received: by 2002:a17:902:eac4:: with SMTP id p4mr3679892pld.90.1644619240862; Fri, 11 Feb 2022 14:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644619240; cv=none; d=google.com; s=arc-20160816; b=W2ONL9w3u4WczL0mNvg0DEEe1+VYQRk3AdXRQxBraqr0/KB1tcIgH+p70LcY2K8AmV Bg8QVFPaAk3w2/y1drMMcFlf5l8mDH896pcqUBaIoQ00Gs5r8E+F2hHJiiPx70bIP/TN dxFe463h7yI/eXSR494e91T4OCjwJLetiwrdYjlHehPHLwh2goIgcFasyGoAosNqez/B kLwbw//iOIjH2eUlYR9jwymlOcgfYTtCAkaZnpGkbyPye98MLqPpMlUlOXw62I6wlf3t VMIp5nU62O1DUVQqvW3SFngwd0/sgUyszowz8SofWyWDII3mx/IlW1Jw2PYpPva8Drt5 Ahfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=Fg9TRplUb884/7xEwUwKKEkX1C8Z/BTh0v2KWcHKmjk=; b=oWxIUDZDrlwcSIzeLQoThaHnk+oiWB22YYxT2JmlAc1+KUcl+MN/52gEqVEELV+0Rq rdOqtj8D+OP0M2Fxr5t2RNaqHI/FXu0ufT7pb83Lia1QFDfDrsxv+9bTjYVw9hXkE2OB SFWkV2FoKJ7SW6QSyKOH6A+Pt506PBdho6RMNz+RUUq2SbVE94hxct3U9k3WmvZ3f8yV t2NrQiykFTkaaYDFkuIuMq8FK5xC5zk/YJhdHDB0BimH13QZE0BHYlw962uPXYz9K/42 Ecp08p1DBfq6o/Gbe1hinqZY9HZwsTXdqfHfnzesVBN72tY1H1ftzFgXuSqwyfTJrauF hU3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oV45of6v; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id j22si5480708pll.304.2022.02.11.14.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oV45of6v; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8A2F10EBB1; Fri, 11 Feb 2022 22:40:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AB6A10EBAD for ; Fri, 11 Feb 2022 22:40:12 +0000 (UTC) Received: by mail-lj1-x232.google.com with SMTP id o17so14419520ljp.1 for ; Fri, 11 Feb 2022 14:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Fg9TRplUb884/7xEwUwKKEkX1C8Z/BTh0v2KWcHKmjk=; b=oV45of6vJhkxipSaeLBfFJADgHQGRmjThJUHX9T+CVoNQ1U9oLSdYoTFwoJ7YhlTun 4aLJFO4i5TTtt4iMklZcq24T3tTKuyubhPAgG8YPG0nvB1NdHEluwZ53QOahd7V6v3LR HmLNnwJUP91xfRhwU8/yAqw+0B7TDoi+KBU6J212qBd9V8JhRWQoRzpLZwAagArl1n3v +JUThQKPGUrGKZJFOyFbGfcZJn76dkHSDX3Bgek0zEIw1YkBvqzfctAA06vTRVOoZtgh IQIoXQSZNfy3tz/MRwc9/DnqPNRwjBwA5CPxmopbOL0PB4e1MjMfI2RXwQBQoyiyTxs+ mvlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fg9TRplUb884/7xEwUwKKEkX1C8Z/BTh0v2KWcHKmjk=; b=mvbiYioFeK3OlIDw7kJtYeFwitywGss/iO6m+4nm4PPP8qyGGnhZXfMWE0P71QxyGa xt1uwDTfOV9VMhUU2xfcQJ/8P2+qixIdM6ui+U4Iaukck9mfG3vkUxqRHA0qR+T1htEY 7cipSALT1CN5aV+mPVD6YphzTTdKgn8Q32hhqk/pSmoVNMYZwf6K72deDRwkp94E7LW/ tvxnAmN5HTkBN47wKhbcJSxgzf7V95Q5pEY7OP6E0Lo8VEraG7+kHNKa7LmD5Ws1zh0L YlUDXfX6P7TxRmv+CslZxfojCTg2Wyxc/HMY1Eb09Z25lys4pjaF2dOtgAwNJ0NgtM4C AMQA== X-Gm-Message-State: AOAM530Fk0vYnrEFG8vwx093Y8GOKAkwPOwKeaNmXUwPdWZsOkv5AYnz aoguWwnD8hDhhuz1NMhJ6ItrsQ== X-Received: by 2002:a2e:5857:: with SMTP id x23mr2170269ljd.529.1644619210725; Fri, 11 Feb 2022 14:40:10 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a6sm3319983ljb.93.2022.02.11.14.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:10 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar , Kuogee Hsieh Subject: [RFC PATCH v2 4/5] drm/msm/dp: replace dp_connector with drm_bridge_connector Date: Sat, 12 Feb 2022 01:40:05 +0300 Message-Id: <20220211224006.1797846-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> References: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is little point in having both connector and root bridge implementation in the same driver. Move connector's functionality to the bridge to let next bridge in chain to override it. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 22 +++--- drivers/gpu/drm/msm/dp/dp_drm.c | 113 ++++++++++------------------ 2 files changed, 52 insertions(+), 83 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 45f9a912ecc5..59e5e5b8e5b4 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1501,6 +1501,17 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, dp_display->encoder = encoder; + dp_display->bridge = msm_dp_bridge_init(dp_display, dev, encoder); + if (IS_ERR(dp_display->bridge)) { + ret = PTR_ERR(dp_display->bridge); + DRM_DEV_ERROR(dev->dev, + "failed to create dp bridge: %d\n", ret); + dp_display->bridge = NULL; + return ret; + } + + priv->bridges[priv->num_bridges++] = dp_display->bridge; + dp_display->connector = dp_drm_connector_init(dp_display); if (IS_ERR(dp_display->connector)) { ret = PTR_ERR(dp_display->connector); @@ -1514,17 +1525,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, priv->connectors[priv->num_connectors++] = dp_display->connector; - dp_display->bridge = msm_dp_bridge_init(dp_display, dev, encoder); - if (IS_ERR(dp_display->bridge)) { - ret = PTR_ERR(dp_display->bridge); - DRM_DEV_ERROR(dev->dev, - "failed to create dp bridge: %d\n", ret); - dp_display->bridge = NULL; - return ret; - } - - priv->bridges[priv->num_bridges++] = dp_display->bridge; - return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 80f59cf99089..57800b865fe6 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "msm_drv.h" @@ -20,24 +21,16 @@ struct msm_dp_bridge { #define to_dp_display(x) container_of((x), struct msm_dp_bridge, bridge) -struct dp_connector { - struct drm_connector base; - struct msm_dp *dp_display; -}; -#define to_dp_connector(x) container_of(x, struct dp_connector, base) - /** - * dp_connector_detect - callback to determine if connector is connected - * @conn: Pointer to drm connector structure - * @force: Force detect setting from drm framework - * Returns: Connector 'is connected' status + * dp_bridge_detect - callback to determine if connector is connected + * @bridge: Pointer to drm bridge structure + * Returns: Bridge's 'is connected' status */ -static enum drm_connector_status dp_connector_detect(struct drm_connector *conn, - bool force) +static enum drm_connector_status dp_bridge_detect(struct drm_bridge *bridge) { struct msm_dp *dp; - dp = to_dp_connector(conn)->dp_display; + dp = to_dp_display(bridge)->dp_display; DRM_DEBUG_DP("is_connected = %s\n", (dp->is_connected) ? "true" : "false"); @@ -47,11 +40,12 @@ static enum drm_connector_status dp_connector_detect(struct drm_connector *conn, } /** - * dp_connector_get_modes - callback to add drm modes via drm_mode_probed_add() + * dp_bridge_get_modes - callback to add drm modes via drm_mode_probed_add() + * @bridge: Poiner to drm bridge * @connector: Pointer to drm connector structure * Returns: Number of modes added */ -static int dp_connector_get_modes(struct drm_connector *connector) +static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector) { int rc = 0; struct msm_dp *dp; @@ -61,7 +55,7 @@ static int dp_connector_get_modes(struct drm_connector *connector) if (!connector) return 0; - dp = to_dp_connector(connector)->dp_display; + dp = to_dp_display(bridge)->dp_display; dp_mode = kzalloc(sizeof(*dp_mode), GFP_KERNEL); if (!dp_mode) @@ -102,18 +96,20 @@ static int dp_connector_get_modes(struct drm_connector *connector) } /** - * dp_connector_mode_valid - callback to determine if specified mode is valid - * @connector: Pointer to drm connector structure + * dp_bridge_mode_valid - callback to determine if specified mode is valid + * @bridge: Pointer to drm bridge structure + * @info: display info * @mode: Pointer to drm mode structure * Returns: Validity status for specified mode */ -static enum drm_mode_status dp_connector_mode_valid( - struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status dp_bridge_mode_valid( + struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode) { struct msm_dp *dp_disp; - dp_disp = to_dp_connector(connector)->dp_display; + dp_disp = to_dp_display(bridge)->dp_display; if ((dp_disp->max_pclk_khz <= 0) || (dp_disp->max_pclk_khz > DP_MAX_PIXEL_CLK_KHZ) || @@ -123,55 +119,6 @@ static enum drm_mode_status dp_connector_mode_valid( return dp_display_validate_mode(dp_disp, mode->clock); } -static const struct drm_connector_funcs dp_connector_funcs = { - .detect = dp_connector_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static const struct drm_connector_helper_funcs dp_connector_helper_funcs = { - .get_modes = dp_connector_get_modes, - .mode_valid = dp_connector_mode_valid, -}; - -/* connector initialization */ -struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) -{ - struct drm_connector *connector = NULL; - struct dp_connector *dp_connector; - int ret; - - dp_connector = devm_kzalloc(dp_display->drm_dev->dev, - sizeof(*dp_connector), - GFP_KERNEL); - if (!dp_connector) - return ERR_PTR(-ENOMEM); - - dp_connector->dp_display = dp_display; - - connector = &dp_connector->base; - - ret = drm_connector_init(dp_display->drm_dev, connector, - &dp_connector_funcs, - dp_display->connector_type); - if (ret) - return ERR_PTR(ret); - - drm_connector_helper_add(connector, &dp_connector_helper_funcs); - - /* - * Enable HPD to let hpd event is handled when cable is connected. - */ - connector->polled = DRM_CONNECTOR_POLL_HPD; - - drm_connector_attach_encoder(connector, dp_display->encoder); - - return connector; -} - static void dp_bridge_mode_set(struct drm_bridge *drm_bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -211,6 +158,9 @@ static const struct drm_bridge_funcs dp_bridge_ops = { .disable = dp_bridge_disable, .post_disable = dp_bridge_post_disable, .mode_set = dp_bridge_mode_set, + .mode_valid = dp_bridge_mode_valid, + .get_modes = dp_bridge_get_modes, + .detect = dp_bridge_detect, }; struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, @@ -228,7 +178,12 @@ struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_devi bridge = &dp_bridge->bridge; bridge->funcs = &dp_bridge_ops; - bridge->encoder = encoder; + bridge->type = dp_display->connector_type; + + bridge->ops = + DRM_BRIDGE_OP_DETECT | + DRM_BRIDGE_OP_HPD | + DRM_BRIDGE_OP_MODES; rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc) { @@ -249,3 +204,17 @@ struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_devi return bridge; } + +/* connector initialization */ +struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) +{ + struct drm_connector *connector = NULL; + + connector = drm_bridge_connector_init(dp_display->drm_dev, dp_display->encoder); + if (IS_ERR(connector)) + return connector; + + drm_connector_attach_encoder(connector, dp_display->encoder); + + return connector; +} From patchwork Fri Feb 11 22:40:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 541800 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp3463681imo; Fri, 11 Feb 2022 14:40:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHcOm5DWMcW9HZKv1aOfkty2Q4fpKzUEs0qP/OwB6p4//9sr5KTpZoE9VkdGA1uE5MSSeE X-Received: by 2002:a17:90b:164c:: with SMTP id il12mr2611523pjb.178.1644619245846; Fri, 11 Feb 2022 14:40:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644619245; cv=none; d=google.com; s=arc-20160816; b=uNv8qXjk6xo+PwnmWlxNhyVZ2Zps0LwJ/vSDlN4gQDvaiatOyPcdpq8FJdeqh4ifHC IAi+sQSR3ZMz5DiCSo/SrGvAaGetzvBrmve62obyNnSWPHeawRj5HN3wlBzhVhD8Rprq sf9Ho4mLujogFYB16R2Fkg/YEEdhSqrHFViiTTtqt2qYQ/ub1JwH9yanGsJ3e1inl5ob Zm/IGFueioXMAbcdjUUp8AdzsJwgRqTHxDmUvgSDjfQhQ1d33AXa1rHsUSNxBIE/vPVt swEkepZmiKaMNl24bgRFUjK0RtYxvcF93V0nz8nut70wxzIeTD8QO7o+5nCm+USy7QTv pJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=SBUYoGN6o4Dyxbi6sA/h7qKj6NEx5YhCR4BssGplT28=; b=uS5w5hZ2bdFazZ5OVUVGszAfIxqnVnZSM9TdURQAuaKRqYePWzuOnD8ySTwv924a9k NsZwbNJkOyqmTuPVrkRWtL5a8RTPHHhi34nFvXtdGERO/H7gWiXnf9RHvhXr3DwGmJjd YBsOdFECTrpElzr1xcm1t0OrgnNxWZz+tDUGL/qv7ta66iqcDCpXAZPSIclhrJzVOdsy zBCeYok+usq1c9HL//X7xxZyNdzhK3T+0YlnM4M9Rf1Xaawx1W0jx5vJaUzIl4SOzMgL k99P/bU7EHX4Ui1xmDOjtxy7FSguRtjtGb8L+0XtrXEPIkJHPPYrSE1gbN+tu31agj2E jcgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=afFOmyEX; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id y3si22481081pgp.711.2022.02.11.14.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=afFOmyEX; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C507210EBB8; Fri, 11 Feb 2022 22:40:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6136810EBAD for ; Fri, 11 Feb 2022 22:40:13 +0000 (UTC) Received: by mail-lf1-x132.google.com with SMTP id o2so19275451lfd.1 for ; Fri, 11 Feb 2022 14:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SBUYoGN6o4Dyxbi6sA/h7qKj6NEx5YhCR4BssGplT28=; b=afFOmyEXvgJZcDXWgSX+Y2jf62X9o6x/8F+IcpChySQ11pwH33JrfVkS7Fy40LVWOm 5Gb1rLUoQb9166elS3WQvb9yRdn4Vp+5aCHWb9DDHko4WLPGxSPosIQiCLPaeQreEwXa t/FB3k8wJEKVCUX1gNxiYfsszkdiKKEV476+PlUM1pQq8fEu7MZbmHMmkLuhlLOJz5N7 S+GDMmeHtVsJbFehFdra3DMrqxX8CYmo9jcwku8j1xOobkQrh6r0J73EUBxsAY2+e+GX 9MKli1AqewqwZbSKkoJemkq69TgJ9ZOALfITCGdXGPGSLpI9+SqgE+mQxZWtYFn69NLR 2olQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SBUYoGN6o4Dyxbi6sA/h7qKj6NEx5YhCR4BssGplT28=; b=sTPGnZU4F9CVeK75S9ir/GDg+zGqSOoHO/a3w0/KX9JkV3qkYKl9+4+RnejuLV0rSj jiXwi3J71tnKfuhUwI+1h2oenbBpiK3JjqZ2MCjQ19g0n9sDZF3WZ4v7nwlNUZncQZ7i 8qSPPPwYvilQU/DCcCdlR1tGK2kl2XXkOdxFJJkvUr7n8Ii1jEsVFQYjPqDJR/1az/VC ES8DPXNJmCW+scUYTbZp9+QGX+8gYbHd889ZyU9dCnrOhVn1sN66k5R+KWfaoJS+jHBi zLVfscOWMP1cFwyLFKDv+TRCZ8Z/0/OsngVpe0z7EyygajJ0/qKx28ZhLv4iT8x+tc7M fY5Q== X-Gm-Message-State: AOAM531YSB4Wgztu+SZNwvVZFrvv6daX0pVXVWM+W4pbSX51lpNLD+XX SLIljphx30u0MFDoCI6HFjVfIA== X-Received: by 2002:a05:6512:128f:: with SMTP id u15mr2743104lfs.359.1644619211687; Fri, 11 Feb 2022 14:40:11 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id a6sm3319983ljb.93.2022.02.11.14.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 14:40:11 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar , Kuogee Hsieh Subject: [RFC PATCH v2 5/5] drm/msm/dp: remove extra wrappers and public functions Date: Sat, 12 Feb 2022 01:40:06 +0300 Message-Id: <20220211224006.1797846-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> References: <20220211224006.1797846-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" dp_bridge's functions are thin wrappers around the msm_dp_display_* family. Squash dp_bridge callbacks into respective msm_dp_display functions, removing the latter functions from public space. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 54 +++++++++++++++------- drivers/gpu/drm/msm/dp/dp_display.h | 1 - drivers/gpu/drm/msm/dp/dp_drm.c | 72 ++--------------------------- drivers/gpu/drm/msm/dp/dp_drm.h | 22 ++++++++- drivers/gpu/drm/msm/msm_drv.h | 31 ------------- 5 files changed, 60 insertions(+), 120 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 59e5e5b8e5b4..a9b641a68bff 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "msm_drv.h" #include "msm_kms.h" @@ -945,18 +944,36 @@ int dp_display_set_plugged_cb(struct msm_dp *dp_display, return 0; } -int dp_display_validate_mode(struct msm_dp *dp, u32 mode_pclk_khz) +/** + * dp_bridge_mode_valid - callback to determine if specified mode is valid + * @bridge: Pointer to drm bridge structure + * @info: display info + * @mode: Pointer to drm mode structure + * Returns: Validity status for specified mode + */ +enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode) { const u32 num_components = 3, default_bpp = 24; struct dp_display_private *dp_display; struct dp_link_info *link_info; u32 mode_rate_khz = 0, supported_rate_khz = 0, mode_bpp = 0; + struct msm_dp *dp; + int mode_pclk_khz = mode->clock; + + dp = to_dp_bridge(bridge)->dp_display; if (!dp || !mode_pclk_khz || !dp->connector) { DRM_ERROR("invalid params\n"); return -EINVAL; } + if ((dp->max_pclk_khz <= 0) || + (dp->max_pclk_khz > DP_MAX_PIXEL_CLK_KHZ) || + (mode->clock > dp->max_pclk_khz)) + return MODE_BAD; + dp_display = container_of(dp, struct dp_display_private, dp_display); link_info = &dp_display->panel->link_info; @@ -1501,7 +1518,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, dp_display->encoder = encoder; - dp_display->bridge = msm_dp_bridge_init(dp_display, dev, encoder); + dp_display->bridge = dp_bridge_init(dp_display, dev, encoder); if (IS_ERR(dp_display->bridge)) { ret = PTR_ERR(dp_display->bridge); DRM_DEV_ERROR(dev->dev, @@ -1528,8 +1545,10 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, return 0; } -int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) +void dp_bridge_enable(struct drm_bridge *drm_bridge) { + struct msm_dp_bridge *dp_bridge = to_dp_bridge(drm_bridge); + struct msm_dp *dp = dp_bridge->dp_display; int rc = 0; struct dp_display_private *dp_display; u32 state; @@ -1537,7 +1556,7 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) dp_display = container_of(dp, struct dp_display_private, dp_display); if (!dp_display->dp_mode.drm_mode.clock) { DRM_ERROR("invalid params\n"); - return -EINVAL; + return; } mutex_lock(&dp_display->event_mutex); @@ -1549,14 +1568,14 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) if (rc) { DRM_ERROR("Failed to perform a mode set, rc=%d\n", rc); mutex_unlock(&dp_display->event_mutex); - return rc; + return; } rc = dp_display_prepare(dp); if (rc) { DRM_ERROR("DP display prepare failed, rc=%d\n", rc); mutex_unlock(&dp_display->event_mutex); - return rc; + return; } state = dp_display->hpd_state; @@ -1581,23 +1600,23 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder) dp_display->hpd_state = ST_CONNECTED; mutex_unlock(&dp_display->event_mutex); - - return rc; } -int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder) +void dp_bridge_disable(struct drm_bridge *drm_bridge) { + struct msm_dp_bridge *dp_bridge = to_dp_bridge(drm_bridge); + struct msm_dp *dp = dp_bridge->dp_display; struct dp_display_private *dp_display; dp_display = container_of(dp, struct dp_display_private, dp_display); dp_ctrl_push_idle(dp_display->ctrl); - - return 0; } -int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder) +void dp_bridge_post_disable(struct drm_bridge *drm_bridge) { + struct msm_dp_bridge *dp_bridge = to_dp_bridge(drm_bridge); + struct msm_dp *dp = dp_bridge->dp_display; int rc = 0; u32 state; struct dp_display_private *dp_display; @@ -1624,13 +1643,14 @@ int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder) } mutex_unlock(&dp_display->event_mutex); - return rc; } -void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode) +void dp_bridge_mode_set(struct drm_bridge *drm_bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) { + struct msm_dp_bridge *dp_bridge = to_dp_bridge(drm_bridge); + struct msm_dp *dp = dp_bridge->dp_display; struct dp_display_private *dp_display; dp_display = container_of(dp, struct dp_display_private, dp_display); diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 7af2b186d2d9..49a1d89681ac 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -32,7 +32,6 @@ struct msm_dp { int dp_display_set_plugged_cb(struct msm_dp *dp_display, hdmi_codec_plugged_cb fn, struct device *codec_dev); -int dp_display_validate_mode(struct msm_dp *dp_display, u32 mode_pclk_khz); int dp_display_get_modes(struct msm_dp *dp_display, struct dp_display_mode *dp_mode); int dp_display_request_irq(struct msm_dp *dp_display); diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 57800b865fe6..7ce1aca48687 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -13,14 +13,6 @@ #include "msm_kms.h" #include "dp_drm.h" - -struct msm_dp_bridge { - struct drm_bridge bridge; - struct msm_dp *dp_display; -}; - -#define to_dp_display(x) container_of((x), struct msm_dp_bridge, bridge) - /** * dp_bridge_detect - callback to determine if connector is connected * @bridge: Pointer to drm bridge structure @@ -30,7 +22,7 @@ static enum drm_connector_status dp_bridge_detect(struct drm_bridge *bridge) { struct msm_dp *dp; - dp = to_dp_display(bridge)->dp_display; + dp = to_dp_bridge(bridge)->dp_display; DRM_DEBUG_DP("is_connected = %s\n", (dp->is_connected) ? "true" : "false"); @@ -55,7 +47,7 @@ static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector * if (!connector) return 0; - dp = to_dp_display(bridge)->dp_display; + dp = to_dp_bridge(bridge)->dp_display; dp_mode = kzalloc(sizeof(*dp_mode), GFP_KERNEL); if (!dp_mode) @@ -95,64 +87,6 @@ static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector * return rc; } -/** - * dp_bridge_mode_valid - callback to determine if specified mode is valid - * @bridge: Pointer to drm bridge structure - * @info: display info - * @mode: Pointer to drm mode structure - * Returns: Validity status for specified mode - */ -static enum drm_mode_status dp_bridge_mode_valid( - struct drm_bridge *bridge, - const struct drm_display_info *info, - const struct drm_display_mode *mode) -{ - struct msm_dp *dp_disp; - - dp_disp = to_dp_display(bridge)->dp_display; - - if ((dp_disp->max_pclk_khz <= 0) || - (dp_disp->max_pclk_khz > DP_MAX_PIXEL_CLK_KHZ) || - (mode->clock > dp_disp->max_pclk_khz)) - return MODE_BAD; - - return dp_display_validate_mode(dp_disp, mode->clock); -} - -static void dp_bridge_mode_set(struct drm_bridge *drm_bridge, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode) -{ - struct msm_dp_bridge *dp_bridge = to_dp_display(drm_bridge); - struct msm_dp *dp_display = dp_bridge->dp_display; - - msm_dp_display_mode_set(dp_display, drm_bridge->encoder, mode, adjusted_mode); -} - -static void dp_bridge_enable(struct drm_bridge *drm_bridge) -{ - struct msm_dp_bridge *dp_bridge = to_dp_display(drm_bridge); - struct msm_dp *dp_display = dp_bridge->dp_display; - - msm_dp_display_enable(dp_display, drm_bridge->encoder); -} - -static void dp_bridge_disable(struct drm_bridge *drm_bridge) -{ - struct msm_dp_bridge *dp_bridge = to_dp_display(drm_bridge); - struct msm_dp *dp_display = dp_bridge->dp_display; - - msm_dp_display_pre_disable(dp_display, drm_bridge->encoder); -} - -static void dp_bridge_post_disable(struct drm_bridge *drm_bridge) -{ - struct msm_dp_bridge *dp_bridge = to_dp_display(drm_bridge); - struct msm_dp *dp_display = dp_bridge->dp_display; - - msm_dp_display_disable(dp_display, drm_bridge->encoder); -} - static const struct drm_bridge_funcs dp_bridge_ops = { .enable = dp_bridge_enable, .disable = dp_bridge_disable, @@ -163,7 +97,7 @@ static const struct drm_bridge_funcs dp_bridge_ops = { .detect = dp_bridge_detect, }; -struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, +struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) { int rc; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h index c27bfceefdf0..f4b1ed1e24f7 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.h +++ b/drivers/gpu/drm/msm/dp/dp_drm.h @@ -7,12 +7,30 @@ #define _DP_DRM_H_ #include -#include -#include +#include #include "msm_drv.h" #include "dp_display.h" +struct msm_dp_bridge { + struct drm_bridge bridge; + struct msm_dp *dp_display; +}; + +#define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge) + struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display); +struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, + struct drm_encoder *encoder); + +void dp_bridge_enable(struct drm_bridge *drm_bridge); +void dp_bridge_disable(struct drm_bridge *drm_bridge); +void dp_bridge_post_disable(struct drm_bridge *drm_bridge); +enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode); +void dp_bridge_mode_set(struct drm_bridge *drm_bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode); #endif /* _DP_DRM_H_ */ diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index d7574e6bd4e4..b698a3be6072 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -385,16 +385,6 @@ int __init msm_dp_register(void); void __exit msm_dp_unregister(void); int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder); -int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder); -int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder); -int msm_dp_display_pre_disable(struct msm_dp *dp, struct drm_encoder *encoder); -void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode); - -struct drm_bridge *msm_dp_bridge_init(struct msm_dp *dp_display, - struct drm_device *dev, - struct drm_encoder *encoder); void msm_dp_irq_postinstall(struct msm_dp *dp_display); void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp_display); @@ -414,27 +404,6 @@ static inline int msm_dp_modeset_init(struct msm_dp *dp_display, { return -EINVAL; } -static inline int msm_dp_display_enable(struct msm_dp *dp, - struct drm_encoder *encoder) -{ - return -EINVAL; -} -static inline int msm_dp_display_disable(struct msm_dp *dp, - struct drm_encoder *encoder) -{ - return -EINVAL; -} -static inline int msm_dp_display_pre_disable(struct msm_dp *dp, - struct drm_encoder *encoder) -{ - return -EINVAL; -} -static inline void msm_dp_display_mode_set(struct msm_dp *dp, - struct drm_encoder *encoder, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode) -{ -} static inline void msm_dp_irq_postinstall(struct msm_dp *dp_display) {