Author Topic: Update: C1000 / Akita support  (Read 11889 times)

slaanesh

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.slaanesh.net/
Update: C1000 / Akita support
« Reply #15 on: August 15, 2017, 06:02:39 am »
Quote from: greguu
I noticed that too, I think this was introduced in the 4.12-rc1 kernel. Can you confirm that is the kernel you booted ? If yes, try the version below 4.9-rc3.

Quote from: slaanesh
Just found a problem on the SL-C1000:

Some of capital letters only work with either the left or right shift key but not both.
ie. to get 'A' I have to use the right hand side 'shift' key. ie <rshift>+a, <lshift>+a doesn't work.

Capital 'S' is the opposite: I can only type it with the left 'shift' key. ie <lshift>+s, <rshift>+s doesn't work.

Caps lock always works.

Probably GPIO misconfiguration (assuming the keyboard is GPIO driven?).

I can confirm it's the  4.12.0-rc1 kernel.

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
    • http://github.com/greguu
Update: C1000 / Akita support
« Reply #16 on: August 16, 2017, 02:23:23 am »
Quote from: slaanesh
Quote from: greguu
I noticed that too, I think this was introduced in the 4.12-rc1 kernel. Can you confirm that is the kernel you booted ? If yes, try the version below 4.9-rc3.

Quote from: slaanesh
Just found a problem on the SL-C1000:

Some of capital letters only work with either the left or right shift key but not both.
ie. to get 'A' I have to use the right hand side 'shift' key. ie <rshift>+a, <lshift>+a doesn't work.

Capital 'S' is the opposite: I can only type it with the left 'shift' key. ie <lshift>+s, <rshift>+s doesn't work.

Caps lock always works.

Probably GPIO misconfiguration (assuming the keyboard is GPIO driven?).

I can confirm it's the  4.12.0-rc1 kernel.

Thanks, I will review this with the next kernel build. If it is too much of an issue, please use 4.9-rc3 in the meantime.
Gemini-PDA (Stock Android) / LG Nexus 5 (Sailfish OS) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

slaanesh

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.slaanesh.net/
Update: C1000 / Akita support
« Reply #17 on: August 17, 2017, 01:06:25 am »
Quote from: greguu
Thanks, I will review this with the next kernel build. If it is too much of an issue, please use 4.9-rc3 in the meantime.
It's no big deal at the moment.

I'd like to start my project but the real blocker for me is that I can't get USB ethernet working.

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
    • http://github.com/greguu
Update: C1000 / Akita support
« Reply #18 on: August 18, 2017, 12:55:44 am »
Quote from: slaanesh
Quote from: greguu
Thanks, I will review this with the next kernel build. If it is too much of an issue, please use 4.9-rc3 in the meantime.
It's no big deal at the moment.

I'd like to start my project but the real blocker for me is that I can't get USB ethernet working.

https://archlinuxarm.org/forum/viewtopic.php?f=48&t=5504

Try the suggestions in that thread.
Gemini-PDA (Stock Android) / LG Nexus 5 (Sailfish OS) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

slaanesh

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.slaanesh.net/
Update: C1000 / Akita support
« Reply #19 on: August 18, 2017, 07:25:23 am »
Seems that guide is old as some of the directories and files references don't exist on my filesystem.

Also starting with the usb cable plugged in to my computer results in a hang at boot time:

[ Ok ] Started udev Coldplug all Devices.

This is the last line of the boot sequence and it just sits there forever.
« Last Edit: August 18, 2017, 07:54:44 am by slaanesh »

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
    • http://github.com/greguu
Update: C1000 / Akita support
« Reply #20 on: August 29, 2017, 01:25:59 am »
Quote from: slaanesh
Seems that guide is old as some of the directories and files references don't exist on my filesystem.

Also starting with the usb cable plugged in to my computer results in a hang at boot time:

[ Ok ] Started udev Coldplug all Devices.

This is the last line of the boot sequence and it just sits there forever.

Yes, the USB Ethernet Gadget only works if setup on both computers and can be a pain to setup. I have not attempted it for ages. I would recommend to get a USB to Ethernet adaptor instead (  ASIX AX88772 based ) or a CF Ethernet card. Some CF WiFi cards are still available too.
Gemini-PDA (Stock Android) / LG Nexus 5 (Sailfish OS) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #21 on: June 09, 2019, 06:36:01 am »
Hi all,

@greguu: Thank you for your work!

I have installed ALARM on my C1000 following the installation howto yesterday. Here are some observations:

Installing the 2.6-kexecboot firmware worked like a charm.

I used the most recent rootfs and replaced the kernel with the slightly updated/fixed one provided by greguu (file date of zImage: 20.02.2018 vs. 11.02.2018)
Rootfs: https://github.com/greguu/alarm-zaurus-c3x00/releases (Attention: the release on the top is NOT the most recent one. Scroll down.)
Kernel: https://github.com/greguu/linux-4.14.18-c3x00/releases

I made the following changes to the rootfs.
All paths are absolute paths, so you need to adjust them if you are changing the rootfs on a SD card mounted on your main computer.

Create /etc/dropbear/ directory
This directory is missing in the rootfs which causes dropbear to drop any SSH connection requests.

Code: [Select]
mkdir /etc/dropbear/

Swap file instead of partition (might have drawbacks).

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']dd if=/dev/zero of=/swapfile bs=1024 count=400000
mkswap /swapfile
swapon /swapfile
[/div]

in /etc/sysctl.d/zaurus:
Code: [Select]
vm.swappiness=10
in /etc/fstab (i also changed rootfs type to ext3 here):
Code: [Select]
/swapfile  none  swap  sw 0  0
Upgrading Arch

The following was necessary to upgrade Arch (I used a CF network card to connect to the internet):

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']pacman -Syu
pacman-key --init
pacman-key --populate
pacman-key --refresh

pacman -S vim # etc...[/div]

Backlight problem
The backlight on my Akita can not be controlled by the kernel:

Code: [Select]
corgi-lcd spi2.1: failed to request GPIO207 for backlight_on
There are two gpiochips available in /sys/class/gpio/:

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']root: ~ $ cat /sys/class/gpio/gpiochip0/label
gpio-pxa
root: ~ $ cat /sys/class/gpio/gpiochip0/base
0
root: ~ $ cat /sys/class/gpio/gpiochip0/ngpio
121
root: ~ $ cat /sys/class/gpio/gpiochip192/label
sharp-scoop.0
root: ~ $ cat /sys/class/gpio/gpiochip192/base  
192
root: ~ $ cat /sys/class/gpio/gpiochip192/ngpio
12
[/div]

So, no GPIO 207 seems to be available. I'm not sure about the mapping.
As backlight control does not work, the backlight will not switch off on suspend.
I would appreciate any hints on how to fix this issue.

USB device/gadget mode
The Zaurus boots with USB host mode, i.e. one may attach USB devices with a OTG adapter cable.
I would have liked to activate USB device mode but did not get it to work yet.
It is possible to load the pxa27x_udc and g_ether modules. However, these do not automatically switch the USB port to device mode. IIRC, one might need to toggle some GPIO pins?

Power management
The MAX1111 ADC seems to report battery voltage / temp and charging voltage.
One can read out values via
Code: [Select]
/sys/class/hwmon/hwmon0/device/in0_input (etc.).
However, an error message appears in dmesg:
Code: [Select]
max1111 spi2.2: spi_sync failed with -108There are no files in
Code: [Select]
/sys/class/power_supply/. Thus, it is not possible to directly read battery status.

Drawing on framebuffer
I do not want to run X11. Therefore, I tried running PyQt apps directly on the framebuffer.
This works (in principle) in this way (after installing python-pyqt5):
[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']$ export QT_QPA_PLATFORM=linuxfb
$ python demo.py -qws
[/div]

This shows my demo app directly (and fullscreen) on the display. However, text is not rendered at all, and the widgets do not receive touchscreen or keyboard input. I haven't had time to address these issues yet.

I would greatly appreciate any tips regarding the aforementioned issues.
« Last Edit: June 17, 2019, 02:58:24 am by raphman »

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #22 on: June 09, 2019, 06:50:26 am »
An excerpt from dmesg showing power management errors:
[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\'][ 2106.573003] PM: noirq suspend of devices failed
[ 2106.648693] usb usb1: root hub lost power or was reset
[ 2106.915414] corgi-lcd spi2.1: failed to request GPIO207 for backlight_on
[ 2106.916743] OOM killer enabled.
[ 2106.916759] Restarting tasks ... done.
[ 2106.960863] PM: suspend exit
[ 2120.801892] sharpsl-pm sharpsl-pm: Fatal Off
[ 2120.801994] PM: suspend entry (deep)
[ 2120.802008] PM: Syncing filesystems ... done.
[ 2121.022417] Freezing user space processes ... (elapsed 0.005 seconds) done.
[ 2121.027627] OOM killer disabled.
[ 2121.027639] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2121.029158] Suspending console(s) (use no_console_suspend to debug)
[ 2121.191199] max1111 spi2.2: spi_sync failed with -108
[ 2121.191199] max1111 spi2.2: spi_sync failed with -108
[ 2121.191199] max1111 spi2.2: spi_sync failed with -108
[ 2121.191199] max1111 spi2.2: spi_sync failed with -108
[ 2121.191199] max1111 spi2.2: spi_sync failed with -108
[ 2121.191199] sharpsl-pm sharpsl-pm: Error: AC check failed: voltage -108.
[ 2121.191199] sharpsl-pm sharpsl-pm: Offline Charger: Error occurred.
[ 2121.191199] sharpsl-pm sharpsl-pm: Charging Error!
[ 2122.028649] usb usb1: root hub lost power or was reset
[ 2122.294406] OOM killer enabled.
[ 2122.294422] Restarting tasks ...
[ 2122.295445] corgi-lcd spi2.1: failed to request GPIO207 for backlight_on
[ 2122.349729] done.
[ 2122.360647] PM: suspend exit
[ 5576.875554] export_store: invalid GPIO 207
[/div]

Varti

  • Administrator
  • Hero Member
  • *****
  • Posts: 1085
    • View Profile
Update: C1000 / Akita support
« Reply #23 on: June 10, 2019, 09:16:14 am »
Quote from: raphman
Backlight problem
The backlight on my Akita can not be controlled by the kernel:

Code: [Select]
corgi-lcd spi2.1: failed to request GPIO207 for backlight_on
There are two gpiochips available in /sys/class/gpio/:

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']root: ~ $ cat /sys/class/gpio/gpiochip0/label
gpio-pxa
root: ~ $ cat /sys/class/gpio/gpiochip0/base
0
root: ~ $ cat /sys/class/gpio/gpiochip0/ngpio
121
root: ~ $ cat /sys/class/gpio/gpiochip192/label
sharp-scoop.0
root: ~ $ cat /sys/class/gpio/gpiochip192/base  
192
root: ~ $ cat /sys/class/gpio/gpiochip192/ngpio
12
[/div]

So, no GPIO 207 seems to be available. I'm not sure about the mapping.
As backlight control does not work, the backlight will not switch off on suspend.
I would appreciate any hints on how to fix this issue.
Hi,

I can confirm that backlight control doesn't work on my Akita, too, and it seems only these models are affected.
@greguu: I might find some free time during these days to help debugging this issue with the serial Zaurus cable I have.

Varti
Planet Gemini PDA WiFi/LTE with Mediatek x27
SL-C1000 running Arch Linux ARM May2017, K30225 Wi-Fi CF Card, 64GB SDXC card
and many other Zauruses!

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #24 on: June 10, 2019, 06:16:14 pm »
Thanks for your reply (and the wonderful forum)!
I dug a little bit through kernel sources.
I guess that the root cause for most problems (also battery power not being available via sysfs) is that the kernel thinks that this is a Spitz device, not an Akita.
Spitz and Akita handle many things (e.g., backlight) differently, because the Spitz devices have an additional (SCOOP) controller which they need for the internal drive.
On Spitz, the backlight GPIO seems to be attached to this controller, whereas the Akita has to handle things via another GPIO.

arch/arm/mach-pxa/include/mach/spitz.h:
Code: [Select]
#define SPITZ_GPIO_BACKLIGHT_ON          (SPITZ_SCP2_GPIO_BASE + 7)
Code: [Select]
#define AKITA_GPIO_BACKLIGHT_ON          (AKITA_IOEXP_GPIO_BASE + 3)
(That's probably where GPIO207 is coming from).

So, why does the kernel think that it is running on a Spitz? My guess is that somehow the wrong ARM machine ID is set (see http://www.simtec.co.uk/products/SWLINUX/f...ng_article.html and https://www.arm.linux.org.uk/developer/machines/).
But I haven't yet found out why the wrong machine ID is set.
The code setting the machine ID seems to be in arch/arm/boot/compressed/head-sharpsl.S
It checks whether 16 MiB of flash are available (-> Spitz), and if not: if a second SCOOP chip is available (-> Borzoi). If neither of these conditions are true, it stores the Akita Machine ID in the CPU register.

Maybe the kexecboot loader somehow changes the machine ID?
« Last Edit: June 10, 2019, 06:17:22 pm by raphman »

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #25 on: June 10, 2019, 06:38:46 pm »
Oh, I seem to have gotten something wrong:

Quote from: raphman
arch/arm/mach-pxa/include/mach/spitz.h:
Code: [Select]
#define SPITZ_GPIO_BACKLIGHT_ON          (SPITZ_SCP2_GPIO_BASE + 7)
Code: [Select]
#define AKITA_GPIO_BACKLIGHT_ON          (AKITA_IOEXP_GPIO_BASE + 3)
(That's probably where GPIO207 is coming from).

So, why does the kernel think that it is running on a Spitz?

I was wrong. GPIO207 is the right one for Akita. So, the Machine ID is set correctly. However, for some reason, the IO Expander (Max7310 connected via I2C) does not show GPIO pins to the kernel.
Still stumped.

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #26 on: June 10, 2019, 07:37:28 pm »
Hmm, maybe this is the culprit:

Code: [Select]
CONFIG_GPIO_PCA953X is not set (from greguu's 5.0 kernel config)

The PCA953X driver is responsible for making the MAX7310  IO expander's GPIO pins available to the system - and spitz.c seems to try to register the GPIO pins:

Code: [Select]
#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
  static struct pca953x_platform_data akita_pca953x_pdata = {
          .gpio_base              = AKITA_IOEXP_GPIO_BASE,
  };
  
  static struct i2c_board_info spitz_i2c_devs[] = {
          {
                  .type           = "wm8750",
                  .addr           = 0x1b,
          }, {
                  .type           = "max7310",
                  .addr           = 0x18,
                  .platform_data  = &akita_pca953x_pdata,
          },
  };

@greguu : would it be possible for you to recompile the 5.0 kernel with this flag enabled?

Varti

  • Administrator
  • Hero Member
  • *****
  • Posts: 1085
    • View Profile
Update: C1000 / Akita support
« Reply #27 on: June 11, 2019, 05:00:06 am »
Nice detective work, and thanks for your kind words about the forum, I'm really happy to see the Zaurus subforums to be still useful to someone. I'd also like to have backilght control working on the Akita, I have pinged greguu on IRC, he's lately probably busy with other stuff.

Varti
Planet Gemini PDA WiFi/LTE with Mediatek x27
SL-C1000 running Arch Linux ARM May2017, K30225 Wi-Fi CF Card, 64GB SDXC card
and many other Zauruses!

greguu

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
    • http://github.com/greguu
Update: C1000 / Akita support
« Reply #28 on: June 17, 2019, 02:22:12 am »
Quote from: raphman
@greguu : would it be possible for you to recompile the 5.0 kernel with this flag enabled?

Hi raphman,
Sure thing, can do. See kernel attached. Unfortunately I have no C1000 to test myself.

This flag is actually part of the akita defconfig and I must have missed it some time ago..

Nice to see some usage of the 5.0 kernel and the old rootfs.
Battery status could be read via apm tools in the distant past, but I have not looked into it since then.
Last time I used framebuffer with QT amd GTK was via DirectFB. This worked surprisingly well but the project is abandoned for several years now.

Cheers!
« Last Edit: June 17, 2019, 03:02:43 am by greguu »
Gemini-PDA (Stock Android) / LG Nexus 5 (Sailfish OS) / Nokia N9 (MeeGo/Harmattan)
Sharp Zaurus C3100 (Borzoi) - Void Linux (voidz) Kernel 5.0.0 - Hardware (Buffalo CF LAN, DLink 660 CF WiFi, ASIX AX88772 USB Ethernet)

raphman

  • Newbie
  • *
  • Posts: 7
    • View Profile
Update: C1000 / Akita support
« Reply #29 on: June 17, 2019, 02:53:31 am »
Quote from: greguu
Sure thing, can do. I will have a look tomorrow and can build the kernel with this flag enabled. Unfortunately I have no C1000 to test myself.
Happy to test. Did you document the required cross-compilation toolchain somewhere? I'd be happy to compile the kernel myself.

Quote from: greguu
Have you booted the 5.0 kernel with ALARM on your C1000 ?

Yes.

Quote from: greguu
It seems that the latest (old) rootfs for ALARM still worked fine for initial setup, but could you do a clean upgrade with pacman -Syu ?
Yes. See my first post for the steps it took me.
Another important change I had to make (and somehow forgot to document at first): One needs to manually create /etc/dropbear/ - otherwise dropbear will fail to accept any SSH connection requests.

Quote from: greguu
(...)
You may want to try the Void port that is available too, but it may lack some packages... still WIP. You can request packages in the voidz thead for the next build if needed.
Yeah, I had a look but wanted to stay with a more common distro first as it makes troubleshooting and trying out things a little bit easier.
What would be the main benefits of using Voidz in you opinion?