Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1158015pxb; Tue, 17 Aug 2021 05:20:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLqqc4qlgQ4ZAxWZ+8QYBThQ+FlqiCfSb/22MmkTCt3FsW/Q7mJ5pA9TmYN43SiO1g/EPo X-Received: by 2002:a17:907:393:: with SMTP id ss19mr3819018ejb.468.1629202853961; Tue, 17 Aug 2021 05:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629202853; cv=none; d=google.com; s=arc-20160816; b=Kva5yYs/Rw5VJW3N8D92wtgdTaY2Q4amyj/ftXl8QEipf3VP0yqvguXCyS8BddCHmS VO1rR1GnkgUqMpBBIMnxQPd3nIJ+AWlBMhHkxpr+1JyJU2cBFiiExHOm5vqw5HGO8lpa PX1+zvzFXGmJ2pZT3g2doAGj5MHBrts/VraT+jrZfnwdu3AMfTXhykKew/xYjd8tA2dZ JkxpARO52MKtmM6/4BehrWpXMI9tyLW2OuyHI6421yUn3KtvHMBtv5OrAJPdqFCJjOBp oYiqVG+NMnIaI41h82QVzJiOBzwZfsC9XuvxwDP4nySBtF8Dg5ZUZaXZoSsEyOpz2/CF oScQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wefpxcHaurBW7M5LFNFrZAtpgBOixxlnwNY64544D/U=; b=QeeRZA8PYIhn2jXh4OJCX8HTVtrDQp3RmOvVOOEEKOKmt6kknVJM4j2VMqBX4Ul6nu JqR+KX/4rF2ttFUyrY6KEPel3ZbcxtYqt3B6st7rOtTdRYnk0Z1eB4f7o1xi9C8tsvYz jsRSzyC0JqYmeEsspJal3sMeeJ5ZrLqOagxNxWjJRXG2JZJcxxQCywDVZlm83EohJ4Nk xqrBQcc1tumVfyEfN9Jjt5Fireqbkxi6A2xcnPzguNGUA2vKB//M+OfjZPFXSz40wNHM DYrGQDnrXQ9ZxwVs96Pbuyi5/vKyrgOfGgzeFIkaL0/rL2l3Lr2z7NMPxAVQxeQE5r75 jVXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Swx9iRFf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si2069579eji.269.2021.08.17.05.20.29; Tue, 17 Aug 2021 05:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Swx9iRFf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237001AbhHQMRP (ORCPT + 99 others); Tue, 17 Aug 2021 08:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236113AbhHQMRO (ORCPT ); Tue, 17 Aug 2021 08:17:14 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EFC9C061764 for ; Tue, 17 Aug 2021 05:16:41 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id z1so3209814ioh.7 for ; Tue, 17 Aug 2021 05:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wefpxcHaurBW7M5LFNFrZAtpgBOixxlnwNY64544D/U=; b=Swx9iRFfeZ6MiwAQx6u/BshU1w2spO29F7zo/5L5JXhxy4SzmtBdkDi3nKAnm8w0vi 8ZDDcTL2uONb/o50GwteP/PipJJk7f8jAhvdC7m6ukm6uItJIlYapPS7o8z8hyQL59EE 5zbWsvUNYHQT0R7bN3Aj6zMoTCq4/pLUQ2aXE/C8xarGsyksyYG76ZfuOGeK9tV6if4V q0jp060H/YWPdsw3taHZQrYh8ERRcNi0SpR3j/CZDh9pD9j1kMx+M8Q521qbHgdtUfdP WWl5+1YZ5xU4SDCCV2v78H4kfhFrttvEDZ1EW9vaNwclL5ANh3vHl26E7lgI/1nxbKWN dyOg== 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=wefpxcHaurBW7M5LFNFrZAtpgBOixxlnwNY64544D/U=; b=D03br12Lg4p+QgGiWe5LSqorUxNK1PQs25ku8DM1HehkVdxuMysaPm+qLSli9ISSfm LuaN5nuoG2rTzV9lcifpAyB7SndHMa2OfVFL8hJD3TkdSWGaI6ZIT4U1v0BvUvKJehEq gg4BfXeDwzwir4KF02SnpJnWwDrEaF48wuOPEJzKWD8ZXBfS8lmgkjI+wHBvNyMFog2x 4EpbmJaQPTY2wk3pXDgAF79wob1BHQf1LTwTfnq8B3OIxvhLZQQmfdUFJcbw5465dCii JQ9yujOXhPm0BvqcMaLflthP7jj74mDG1RuZfTQtOt4x++b1ceJN+o9cga7EAxTbYMJr dyjw== X-Gm-Message-State: AOAM532x91mRDxXLi8TxjS8cc/d0E8ZiwhnS+3ZbTKo4uwKAHCFhtDYq ie2yFYYlJKMRD9NVp9vNN2MG2SsqBQzLw+jtsI8= X-Received: by 2002:a5d:8541:: with SMTP id b1mr2660137ios.105.1629202600822; Tue, 17 Aug 2021 05:16:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alistair Francis Date: Tue, 17 Aug 2021 22:16:14 +1000 Message-ID: Subject: Re: Revert "video: fbdev: mxsfb: Remove driver" To: Marek Vasut Cc: Fabio Estevam , Shawn Guo , Sascha Hauer , dl-linux-imx , b.zolnierkie@samsung.com, Linux Kernel Mailing List , Alistair Francis , Sam Ravnborg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 17, 2021 at 8:03 PM Marek Vasut wrote: > > On 8/17/21 11:08 AM, Alistair Francis wrote: > > On Mon, Aug 16, 2021 at 5:55 PM Marek Vasut wrote: > >> > >> On 8/16/21 9:34 AM, Alistair Francis wrote: > >>> On Sun, Aug 15, 2021 at 10:31 PM Marek Vasut wrote: > >>>> > >>>> On 8/15/21 2:16 PM, Alistair Francis wrote: > >>>>> Hello, > >>>>> > >>>>> Commit f225f1393f034 "video: fbdev: mxsfb: Remove driver" removed the > >>>>> mxsfb fbdev driver. > >>>>> > >>>>> I am now working on getting mainline Linux running on the reMarkable 2 > >>>>> eInk reader [1]. Unfortunately the rM2 doesn't use the standard EPD > >>>>> controller on the i.MX SoC, but instead uses the LCD controller. > >>>>> > >>>>> eInk panels are complex to control and require writing temperature > >>>>> dependent waveforms. As these waveforms are proprietary [2] the rM > >>>>> team runs closed source software called SWTCON in userspace to control > >>>>> the panel [3]. > >>>>> > >>>>> This closed source software expects the fbdev mxsfb driver and it > >>>>> doesn't work with the DRM mxsfb driver (at least not that I can get it > >>>>> to). > >>>>> > >>>>> The NXP fork of Linux also re-adds the fbdev driver [4], so they also > >>>>> see some uses for it. > >>>>> > >>>>> I was wondering if the community would be open to re-adding the fbdev > >>>>> mxsfb driver to mainline? It could be re-added with a different > >>>>> dt-binding so that it is not used by default and only enabled for > >>>>> boards when required (like for the rM2). > >>>>> > >>>>> 1: https://remarkable.com/store/remarkable-2 > >>>>> 2: https://goodereader.com/blog/e-paper/e-ink-waveforms-are-a-closely-guarded-secret > >>>>> 3: https://remarkablewiki.com/tech/rm2_framebuffer > >>>>> 4: https://source.codeaurora.org/external/imx/linux-imx/log/drivers/video/fbdev/mxsfb.c?h=lf-5.10.35-2.0.0 > >>>> > >>>> +CC Sam. > >>>> > >>>> What sort of special thing does your proprietary userspace do that > >>>> cannot be added to the DRM driver or the fbdev emulation (if needed) ? > >>> > >>> It's hard to tell. When using the DRM driver I get cryptic errors > >>> about the frame buffer not being available. > >> > >> Do you have fbdev emulation enabled ? Does /dev/fbX exist ? > > > > I do and /dev/fb0 exists > > > >> > >> What sort of messages do you get and from where ? > > > > This is the error I get: > > > > xochitl[252]: Error writing variable information: Invalid argument... > > Some ioctl returns -EINVAL maybe ? strace would tell you. Ok, good progress. When xochitl works or doesn't work I see this for strace accesses: ``` openat(AT_FDCWD, "/dev/fb0", O_RDWR) = 5 ``` That's the only access for both the working case or the non-working case. The actual application provides this log for the not working case (where it then hangs) ``` /usr/bin/xochitl --system 10:53.013 default 2021-06-11T11:42:05Z heads/releases/bertwhistle 264f47ba0 (int main(int, char**) /usr/src/debug/xochitl/override+gitAUTOINC+264f47ba03-r0/git/src/main.cpp:294) Registering exit handlers 10:53.018 default we're running on an epaper device (int main(int, char**) /usr/src/debug/xochitl/override+gitAUTOINC+264f47ba03-r0/git/src/main.cpp:301) Reading waveforms from /usr/share/remarkable/320_R349_AF0411_ED103TC2U2_VB3300-KCD_TC.wbf Error writing variable information: Invalid argument ``` These are the EINVAL strace tells me in the not working case: prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument) ioctl(5, FBIOPUT_VSCREENINFO, 0x4ce8e0) = -1 EINVAL (Invalid argument) I'm guessing it's related to FBIOPUT_VSCREENINFO then, is that something that could be added to the DRM emulation? > > > xochitl is the proprietary userspace code. I don't really have a good > > idea of what that error would mean. > > > > I also see this: > > > > Framebuffer has wrong id: "mxcfb" > > Are you sure you're not confusing mxcfb (The freescale imx scanout > engine) with mxsfb (The originally sgtl block, bought by freescale) ? This is the full commit that gets everything working for me: https://github.com/alistair23/linux/commit/ee0e684e3d776c6de98b6491d1a87d8305c44734 It includes mxcfb, but I think that is just to allow the mxsfb to compile. > > >> You could run strace on the application to see how it communicates with > >> the old driver via the ioctl interface and compare it with the fbdev > >> emulation on the new driver, maybe there is some odd ioctl which is not > >> emulated. > > > > I had a quick look at this. > > > > xochitl does a lot more than just controls the display, it interacts > > with lots of other hardware and strace produces a lot of logs. I also > > don't see the error when manually starting it, only at boot (but it > > still doesn't work). > > > > A quick run with > > > > strace -f xochitcl > > > > and I don't even see an access to /dev/fb0, so I'm not sure where the > > accesses are coming from. > > You can try writing the output of strace to file (strace -o) for easier > analysis. Then grep for either access to /dev/fb0 (or any symlink to it > which might exist), or search for the mxcfb string, maybe the > application aborts even before opening the fbdev due to some other problem. Thanks, I figured out there was a script that I was running instead. I can now see the /dev/fb0 access. Alistair