Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4842222imb; Thu, 7 Mar 2019 01:41:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzr6AkfvogqHxUaEV4dpGGM/10K6F8JVKUawJNJdidrmcAjz2hykr/RR+pSVYyKywM0Qau8 X-Received: by 2002:aa7:854d:: with SMTP id y13mr11838278pfn.175.1551951678115; Thu, 07 Mar 2019 01:41:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551951678; cv=none; d=google.com; s=arc-20160816; b=v0eFC6G7VzHet/ZcrGOE/GlQ7Z7BtKhGq3NUM1nS3vjq2OXHdUBAujTB4c7ao7LtSD h4J9RckKq5XlGEyni/rbsOLVNqwG8w1cZeWQ90Cl57Kgcj062JOMjmSDlG4rkTOUDWby RUUWpTMLPPGXYYrPaWLXZ2P34msFLa0fHrHdTKHXGYLXEJxP8QRBHASxE/7BVZwou+DB ESkf0lLDzR8tSEg445nDa7/+oKUZZywbrY+3Tt9ZnXf8Gg8P7/P303shI4qdNVJrbEgN xkMOOTi0nSJ1mKWqkS+JAbHyRGVdNBgm84b9LjwLfPVXmBwxlCm3pGc95lST0V4vLkXT 6m6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=d4+VprPDJEzEhmtGEvPgsb6lf60i3/fCoOU7mG6GuUs=; b=kmDUPEamO92SaujLXBKPy4d3BUW5Ags/2tJztP3GQHUWj89uwG2zjYr7w5r+1J5blG eRSAKF4sGg6ezpMFeJygbOci/6HMT1jEDF/0WfLb9U+c1JquVIAOMJkBC3VFNEQquRgW +yhgAxcSo4Lr93fcHHPfJg+CjNOBCK9n5nPGQuIHX7+Qk2ykclfVNIarUkjGZEEI2/eV IgNRh+k2iy/LPPQg20Sgkw1psSBoKoyQQNzoMZ9yVf7MVdKq8zW/1aqVmBHva3RhuNvq xhDNThgcjunPLg3/sMbdFcpkkPyu6UnsukIvq9Itz9rJjTDrfFgExTbbtuJSL0w8DJV8 En/g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79si3754795pfh.202.2019.03.07.01.41.02; Thu, 07 Mar 2019 01:41:18 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbfCGJjh (ORCPT + 99 others); Thu, 7 Mar 2019 04:39:37 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:40124 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfCGJjg (ORCPT ); Thu, 7 Mar 2019 04:39:36 -0500 Received: by mail-vk1-f195.google.com with SMTP id d84so3547222vke.7; Thu, 07 Mar 2019 01:39:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d4+VprPDJEzEhmtGEvPgsb6lf60i3/fCoOU7mG6GuUs=; b=BP/IbROSjQxMZnxExlv7pFuealp7Id6NKXGeeCTNn2W9Cn86/AWEFl2v0frW1LUxS6 GpBlCSJ7E7bbGV70pUbKDt3X49eBKqrNW1RsH0DILPqP1pVTQRpSmocMFNmoUtblVHXX jkhf2SJyJDCAQHyN271r0PWlecCa113AYomGc1iBM8rjWG33GWqu0kbBNScuAGurmFvf TJ5NtHdy1ke7RduBBzFSF/+lYln/6STdJfWtNjkF8ybF0G0CPH3KqVqNTnrM7dkmbEW/ g872gIi2RBByvrlco3NipYGYecpr4XFIjIzXi88fdC51shjAHk9Pr8+G/taPC7cbLmK6 q03w== X-Gm-Message-State: APjAAAWZ5jIX153bSrYvaCQe/krFWpR2/g66j1nODuXA1diEXu3JnEVJ UQD7yZqkddY2NM5/ydIs3oasjI2UlwvVjDgXK3A= X-Received: by 2002:a1f:be81:: with SMTP id o123mr5834879vkf.83.1551951575281; Thu, 07 Mar 2019 01:39:35 -0800 (PST) MIME-Version: 1.0 References: <20190307051641.GA7012@localhost.localdomain> <871s3jm532.fsf@intel.com> In-Reply-To: <871s3jm532.fsf@intel.com> From: Geert Uytterhoeven Date: Thu, 7 Mar 2019 10:39:23 +0100 Message-ID: Subject: Re: Is it possible to reset graphics controller on reboot in a framebuffer driver? To: Jani Nikula Cc: Linux Fbdev development list , DRI Development , Linux Kernel Mailing List , Bartlomiej Zolnierkiewicz , Sudip Mukherjee , Yifeng Li , Teddy Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jani, On Thu, Mar 7, 2019 at 10:00 AM Jani Nikula wrote: > On Thu, 07 Mar 2019, Tom Li wrote: > > As you may have noticed, recently I've been working on a reworked version > > of sm712fb, and planned to convert it to a DRM/KMS driver. Besides using > > it on embedded/non-x86 systems, I thought it would be a good idea to support > > histrocial x86 laptops with this VGA chipset as well, so I've acquired a > > machine for testing. > > > > However, soon I found a nasty problem. The BIOS does not reset the chip > > on boot! Like most graphics controller of that era, sm712 chipset has a > > VGA compatible mode and a 2D framebuffer mode. The power-on default is > > VGA. The BIOS writer just assumed this, and does nothing to reinitialize > > it. If one uses the framebuffer driver under Linux, once the machine reboots, > > the entire LCD panel becomes a piece of garbage. > > > > AFAIK, the framebuffer driver would be running throughout the kernel's life- > > cycle, is it really possible to workaround this issue by restoring on VGA > > state upon reboot? > > It's possible to do this using a reboot notifier. I am not sure if there > are better ways to achieve the same, but there's at least one example of > using reboot notifiers to achieve the exact same goal. > > See drivers/video/fbdev/aty/atyfb_base.c, look for > register_reboot_notifier(). Or a shutdown handler, which is more device-centric? (cfr. "[3/4] fbdev: atafb: Fix broken frame buffer after kexec", https://patchwork.kernel.org/patch/10814381/). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds