From patchwork Thu Sep 26 23:06:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 2951761 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7609FBFF0B for ; Thu, 26 Sep 2013 23:12:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A54B7202EA for ; Thu, 26 Sep 2013 23:12:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CAD59202E6 for ; Thu, 26 Sep 2013 23:12:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DA7EE7F6B for ; Thu, 26 Sep 2013 16:12:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f172.google.com (mail-qc0-f172.google.com [209.85.216.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F11EE5CE1; Thu, 26 Sep 2013 16:06:51 -0700 (PDT) Received: by mail-qc0-f172.google.com with SMTP id l13so1250587qcy.31 for ; Thu, 26 Sep 2013 16:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M5eMPusaeloI9sSBgzMnsgZsCAvMzPB0lL2wo8hweVw=; b=WjGRQy3VLipzpnenCzc0HeKVyejmI7Ys2fcfunIFXuDbpLSpXNVPQPkUqrFVcUsuoA ijDzC5PPpCpvjcpeJbPVYIpnXc65/1NVlaS96y1iK2okppCNVqvFRyxF1GI+G5/xrjMT mAl0xd0e9+7AjQZ0mFWF7bZqg1q6o8uAJDAeYHAqs0C/XduGEBpYkb8pmUeiWjnTTnqK OGc8eT3ujD0OzE3bMHeXG3u3o8E2R0OmTs0eCeLas/tlQemL/JNU9ZcmpKKLq1gFDQEP RTqAp45x/VT+xGIoMViLf8DMeXQrTgI1ti/t3qJotDsanHioxGDlIiOYZ7xKNWhy7RQw kFmA== X-Received: by 10.229.244.69 with SMTP id lp5mr5045374qcb.14.1380236811276; Thu, 26 Sep 2013 16:06:51 -0700 (PDT) Received: from localhost.localdomain ([187.112.183.101]) by mx.google.com with ESMTPSA id m6sm12528338qaa.13.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 26 Sep 2013 16:06:50 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/5] tty/vt: add con_bind and con_unbind functions Date: Thu, 26 Sep 2013 20:06:00 -0300 Message-Id: <1380236762-1698-4-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1380236762-1698-1-git-send-email-przanoni@gmail.com> References: <1380236762-1698-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni The consoles who need to do something when unbinding or binding can optionally implement these functions. The current problem I'm trying to solve is that when i915+fbcon is loaded on Haswell, if we disable the power well (to save power) the VGA interface gets completely disabled, so when we unbind fbcon we need to restore the VGA interface to allow vgacon to work. Signed-off-by: Paulo Zanoni --- drivers/tty/vt/vt.c | 6 ++++++ include/linux/console.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 9a8e8c5..beb5986 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3014,6 +3014,9 @@ static int do_bind_con_driver(const struct consw *csw, int first, int last, if (retval) goto err; + if (csw->con_bind) + csw->con_bind(); + if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) { csw->con_startup(); con_driver->flag |= CON_DRIVER_FLAG_INIT; @@ -3152,6 +3155,9 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt if (!con_is_bound(csw)) goto err; + if (csw->con_unbind) + csw->con_unbind(); + first = max(first, con_driver->first); last = min(last, con_driver->last); diff --git a/include/linux/console.h b/include/linux/console.h index 7571a16..5cd2c35 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -65,6 +65,8 @@ struct consw { * Restore the console to its pre-debug state as closely as possible. */ int (*con_debug_leave)(struct vc_data *); + void (*con_bind)(void); + void (*con_unbind)(void); }; extern const struct consw *conswitchp;