Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3944464ybi; Mon, 10 Jun 2019 21:06:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBO3ChOnfhDqmQVX2xUzvMLuYKQuCTFLB5TLmtl0HQhgvU6ATKgs+S/VsBxMzY7dVAQ5AS X-Received: by 2002:a17:90a:2244:: with SMTP id c62mr8572471pje.29.1560225972233; Mon, 10 Jun 2019 21:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560225972; cv=none; d=google.com; s=arc-20160816; b=G1luzy2Sj22fzi/tCkZx7DHWIoPpHlahwhfIOY8lh6ELyEzRJ8PZvMJkI8KSLQP/eY w12rOo9PuRYs1JaYOO0SYU9u6seBgOZSFHgW7VuRxPJAvROYq02KwMEwElnQVvsxWG7Q ZVImTZx5n3yIaB2AAeme/u4n/TiHNv0inHKhZWpZZAk2TLUQkLBzTiyRc04xuLp7lbDW hOd5MLoq2sD3iRP3+VonkiqtlCuVwoFkk0GBYGMC+135zaD0/lUK+d66ijpbpSHBkJzp u+FUWrBzKNean4BqFFK/ZJHOpzMk/17cs1n6s/j0BRBO4JJwLPAAOKij24L5Dty+mD24 OxbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7l9eJCs2PeowUasvujNxJ+tq7unRBQcTxAKWiz4JMIE=; b=mNPXO3dD6BO5SoinArSbtx5wyKkoJ440+RYlhZ53YH8m+cLHuoOOvFdDdb0OlWbZiP OdNqp9MhVEWfnQf3kvhS4XedhHRXXJ5Qi2o44hdhPjCti48PfB6G2QR7ZcLaBl2HyTZv kxHZAac+aAD7K7kQLsJ6yuML/jF9KrVpjkRXSr5EGKWoPc+9S2tKg8ATWaqA9TPUVLww dLrtW0zRMz7FRWnkDde8g47nhFYNeDqlc7xvAuLRUSg95l4tKkvIRSJE9PM6FMNHID2x kwxjWY4eJBJjiIv/zAidAFaCsQ7KcmyH+t6etloorO1uJ65ep/xZ9vqTrPEZMlGOP63N VigA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LeWcjnR+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si11001479pgp.39.2019.06.10.21.05.56; Mon, 10 Jun 2019 21:06:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LeWcjnR+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728984AbfFKEEP (ORCPT + 99 others); Tue, 11 Jun 2019 00:04:15 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42199 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388847AbfFKED7 (ORCPT ); Tue, 11 Jun 2019 00:03:59 -0400 Received: by mail-pg1-f194.google.com with SMTP id l19so3555962pgh.9 for ; Mon, 10 Jun 2019 21:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7l9eJCs2PeowUasvujNxJ+tq7unRBQcTxAKWiz4JMIE=; b=LeWcjnR+t+om64koZ6/R7cE71bujGm69PJfYXHwBJFGIEBgWa3nQCcjJskR2SOqfDx 8FfVoU3o/Q7/B8eVi0j0M5VdkxdYsRjGxHm1O2i+Ynte0IiaoGGgyiP7Srs/0VHfY8pZ GoyR+VQn83u0DFekQcp1z2sEX3Qkb7x/WEOsw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7l9eJCs2PeowUasvujNxJ+tq7unRBQcTxAKWiz4JMIE=; b=B5YS85CqfRxuWuPnamcE3nIW3zCk/IyyOok75HN0Wmt4V++yKu4VfNCltGJUpWdoAM Qj2yMfna6WkvyHY2WrrpaCrCjlqh/xzoOpV/XVvWEudUpCmXJ3CUhzddUikK1lEpk5Wv 9VDZulp+2jIBAx2+GlBS8ls3tx65xgIMtGV/bwD8StvPt4F0gQxH3qs2MjO7iJGwwm0Q Az5wP+Jqo5tmjTSXgauvKo/MKgrQhgGRseu6YFr5c9TgrxVp3HNCkGzEoYIQ+fk8uMEi epG5HihX/xRwLzMshMpJNTfUhf+mfeT1TgAMU28zVCL4O2owHr6QbHhlrJH7mIE/6nE4 BMYw== X-Gm-Message-State: APjAAAXcauBz7Z+k0Q7hhN/r/cgu1PkxrO2HSW3QB8EMy5zkUY/kbrfX wuYAmr52aiv3U+gk7hNywFPN85SmSns= X-Received: by 2002:a62:5883:: with SMTP id m125mr15522265pfb.248.1560225838902; Mon, 10 Jun 2019 21:03:58 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id y133sm13301185pfb.28.2019.06.10.21.03.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 21:03:58 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Cc: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Maarten Lankhorst , Maxime Ripard , Sean Paul , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Derek Basehore Subject: [PATCH 3/5] drm/panel: Add attach/detach callbacks Date: Mon, 10 Jun 2019 21:03:48 -0700 Message-Id: <20190611040350.90064-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190611040350.90064-1-dbasehore@chromium.org> References: <20190611040350.90064-1-dbasehore@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the attach/detach callbacks. These are for setting up internal state for the connector/panel pair that can't be done at probe (since the connector doesn't exist) and which don't need to be repeatedly done for every get/modes, prepare, or enable callback. Values such as the panel orientation, and display size can be filled in for the connector. Signed-off-by: Derek Basehore --- drivers/gpu/drm/drm_panel.c | 14 ++++++++++++++ include/drm/drm_panel.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 3b689ce4a51a..72f67678d9d5 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -104,12 +104,23 @@ EXPORT_SYMBOL(drm_panel_remove); */ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) { + int ret; + if (panel->connector) return -EBUSY; panel->connector = connector; panel->drm = connector->dev; + if (panel->funcs->attach) { + ret = panel->funcs->attach(panel); + if (ret < 0) { + panel->connector = NULL; + panel->drm = NULL; + return ret; + } + } + return 0; } EXPORT_SYMBOL(drm_panel_attach); @@ -128,6 +139,9 @@ EXPORT_SYMBOL(drm_panel_attach); */ int drm_panel_detach(struct drm_panel *panel) { + if (panel->funcs->detach) + panel->funcs->detach(panel); + panel->connector = NULL; panel->drm = NULL; diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 13631b2efbaa..e136e3a3c996 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -37,6 +37,8 @@ struct display_timing; * struct drm_panel_funcs - perform operations on a given panel * @disable: disable panel (turn off back light, etc.) * @unprepare: turn off panel + * @detach: detach panel->connector (clear internal state, etc.) + * @attach: attach panel->connector (update internal state, etc.) * @prepare: turn on panel and perform set up * @enable: enable panel (turn on back light, etc.) * @get_modes: add modes to the connector that the panel is attached to and @@ -70,6 +72,8 @@ struct display_timing; struct drm_panel_funcs { int (*disable)(struct drm_panel *panel); int (*unprepare)(struct drm_panel *panel); + void (*detach)(struct drm_panel *panel); + int (*attach)(struct drm_panel *panel); int (*prepare)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel); -- 2.22.0.rc2.383.gf4fbbf30c2-goog