Initial support for GPD Pocket #48

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants

lbonn commented Jan 14, 2018

Here is a small number of settings for a reasonably functional system running on a GPD Pocket

Some parts might be out of scope for this repo (the environment variables at the end?). I'll let you be the judge of that: please tell me what I should remove.

This comment has been minimized.

Show comment Hide comment
@andir

andir Jan 14, 2018

Member

Another GPD Pocket User 👍

Have a look at https://github.com/andir/nixos-gpd-pocket those are my configuration files for the gpd pocket. I am currently running nixos unstable on it since there are a few parts that have been patched in newer alsa, kernel, … versions. It also comes with the (almost always) latest version of the Kernel of Hans de Goede (RedHat employee that works on the hardware support for this and many other devices).

Things that do work for me with those settings:

  • booting it with a image created from the repo
  • X Server rotation (gnome does it's own thing os that is still broken, Has has submitted patches to gnome and they are in gnome master, will be released with next stable release IIRC)
  • WiFi works - I bundled that custom pci textfile that was required
  • Suspend/Resume works
  • Charging Support (via USB-C PD)
  • Backlight controls are working

I did intend to provide those changes to this repo as soon as everything is mainline/upstream. Feel free to pull those changes into your PR :-)

Member

andir commented Jan 14, 2018

Another GPD Pocket User 👍

Have a look at https://github.com/andir/nixos-gpd-pocket those are my configuration files for the gpd pocket. I am currently running nixos unstable on it since there are a few parts that have been patched in newer alsa, kernel, … versions. It also comes with the (almost always) latest version of the Kernel of Hans de Goede (RedHat employee that works on the hardware support for this and many other devices).

Things that do work for me with those settings:

  • booting it with a image created from the repo
  • X Server rotation (gnome does it's own thing os that is still broken, Has has submitted patches to gnome and they are in gnome master, will be released with next stable release IIRC)
  • WiFi works - I bundled that custom pci textfile that was required
  • Suspend/Resume works
  • Charging Support (via USB-C PD)
  • Backlight controls are working

I did intend to provide those changes to this repo as soon as everything is mainline/upstream. Feel free to pull those changes into your PR :-)

This comment has been minimized.

Show comment Hide comment
@lbonn

lbonn Jan 14, 2018

Thanks, that looks indeed more polished, I'll look into it.

This setup is also intended to be used on the unstable channel, with a stock 4.14 kernel. As a result some of the support is still missing. On the plus side, this could already be mergeable and updated later (on 4.15's release?)

But I also realized that I forgot to include the brcmfmac4356 firmware anyway so my PR won't work as is.

Definitely opened it too fast...

lbonn commented Jan 14, 2018

Thanks, that looks indeed more polished, I'll look into it.

This setup is also intended to be used on the unstable channel, with a stock 4.14 kernel. As a result some of the support is still missing. On the plus side, this could already be mergeable and updated later (on 4.15's release?)

But I also realized that I forgot to include the brcmfmac4356 firmware anyway so my PR won't work as is.

Definitely opened it too fast...

This comment has been minimized.

Show comment Hide comment
@andir

andir Jan 14, 2018

Member

Yep, mailine support is what this repo should probably prefer.

Don't worry. That is why there is review :-) You can improve over time.

Member

andir commented Jan 14, 2018

Yep, mailine support is what this repo should probably prefer.

Don't worry. That is why there is review :-) You can improve over time.

gpd/gpd-pocket/default.nix
+ };
+
+ # wifi
+ nixpkgs.config.allowUnfree = true;

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

It should be up to the end user whether to allow unfree packages or not, even when crucial to hardware functionality.

Moreover, it would make sense to only enable the firmware if user explicitly allows unfree packages, so that people that don't install unfree packages can still use the profile, even if without functioning Wi-Fi:

nixpkgs.firmware = with pkgs; lib.optionals config.nixpkgs.config.allowUnfree [
  brcmfmac4356-firmware
]

See:

hardware.facetimehd.enable = lib.mkDefault
(config.nixpkgs.config.allowUnfree or false);

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

It should be up to the end user whether to allow unfree packages or not, even when crucial to hardware functionality.

Moreover, it would make sense to only enable the firmware if user explicitly allows unfree packages, so that people that don't install unfree packages can still use the profile, even if without functioning Wi-Fi:

nixpkgs.firmware = with pkgs; lib.optionals config.nixpkgs.config.allowUnfree [
  brcmfmac4356-firmware
]

See:

hardware.facetimehd.enable = lib.mkDefault
(config.nixpkgs.config.allowUnfree or false);

gpd/gpd-pocket/default.nix
+ # wifi
+ nixpkgs.config.allowUnfree = true;
+ hardware.firmware = with pkgs; [
+ brcmfmac4356-firmware

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This doesn't evaluate:

undefined variable brcmfmac4356-firmware at /home/travis/build/NixOS/nixos-hardware/gpd/gpd-pocket/default.nix:29:5

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This doesn't evaluate:

undefined variable brcmfmac4356-firmware at /home/travis/build/NixOS/nixos-hardware/gpd/gpd-pocket/default.nix:29:5

gpd/gpd-pocket/default.nix
+
+ # power management
+ services.tlp = {
+ enable = true;

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This is already defined in laptop profile:

services.tlp.enable = lib.mkDefault true;

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This is already defined in laptop profile:

services.tlp.enable = lib.mkDefault true;

gpd/gpd-pocket/default.nix
+ '';
+ xrandrHeads = [ { output= "DSI1"; monitorConfig = "Option \"Rotate\" \"right\""; } ];
+ libinput = {
+ enable = true;

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This is already defined in PC profile:

services.xserver.libinput.enable = lib.mkDefault true;

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

This is already defined in PC profile:

services.xserver.libinput.enable = lib.mkDefault true;

Also, gpd/gpd-pocket should be moved to gpd/pocket, following the current naming convention.

gpd/gpd-pocket/default.nix
+ };
+
+ environment.variables = {
+ GDK_SCALE = "2"; # DPI

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

All non-mergable attributes should be set via lib.mkDefault so that they can be overrided in user profile:

GDK_SCALE = lib.mkDefault "2";
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

All non-mergable attributes should be set via lib.mkDefault so that they can be overrided in user profile:

GDK_SCALE = lib.mkDefault "2";
gpd/gpd-pocket/default.nix
+ libinput = {
+ enable = true;
+ };
+ inputClassSections = [''

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Is this required to discover input devices?

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Is this required to discover input devices?

gpd/gpd-pocket/default.nix
+ Option "TearFree" "true"
+ Option "DRI" "3"
+ '';
+ xrandrHeads = [ { output= "DSI1"; monitorConfig = "Option \"Rotate\" \"right\""; } ];

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Nitpick: "Option \"Rotate\" \"right\"" -> ''Option "Rotate" "right"''
Also, it would be easier to read with each attribute on a separate line.

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Nitpick: "Option \"Rotate\" \"right\"" -> ''Option "Rotate" "right"''
Also, it would be easier to read with each attribute on a separate line.

gpd/gpd-pocket/default.nix
+ services.xserver = {
+ dpi = 168;
+ deviceSection = ''
+ Option "AccelMethod" "sna"

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Does explicit acceleration method affect anything?

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Does explicit acceleration method affect anything?

gpd/gpd-pocket/default.nix
+ };
+
+ # TODO: fix media keys
+ # sound.mediaKeys.enable = true;

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

sound.mediaKeys.enable overlaps with some desktop managers (e.g. Xfce), which is why it is not set in this repo even if the device does have media keys.

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

sound.mediaKeys.enable overlaps with some desktop managers (e.g. Xfce), which is why it is not set in this repo even if the device does have media keys.

gpd/gpd-pocket/default.nix
+ hardware.pulseaudio = {
+ enable = true;
+ extraConfig = ''
+ set-card-profile alsa_card.platform-cht-bsw-rt5645 HiFi

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Is this required to make audio work?

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Is this required to make audio work?

This comment has been minimized.

Show comment Hide comment
@andir

andir Jan 14, 2018

Member

There are some hacks required with current mainline kernels. This will change in the future (4.15+).
I am not sure if this is exactly the one since I've been running the 4.15-rc kernels on mine.

@andir

andir Jan 14, 2018

Member

There are some hacks required with current mainline kernels. This will change in the future (4.15+).
I am not sure if this is exactly the one since I've been running the 4.15-rc kernels on mine.

gpd/gpd-pocket/default.nix
+ set-sink-port alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5645_0__sink [Out] Speaker
+ '';
+ daemon.config = {
+ realtime-scheduling = "no";

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Why is it disabled?

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Why is it disabled?

gpd/gpd-pocket/default.nix
+ };
+
+ hardware.pulseaudio = {
+ enable = true;

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

So far there are no profiles that explicitly depend on PulseAudio: the idea is to not force PulseAudio (there are cases that warrant pure ALSA setup, or Jack). Extra configuration for PulseAudio (to make it work once it's enabled) is of course welcome.

@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

So far there are no profiles that explicitly depend on PulseAudio: the idea is to not force PulseAudio (there are cases that warrant pure ALSA setup, or Jack). Extra configuration for PulseAudio (to make it work once it's enabled) is of course welcome.

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 14, 2018

Member

Also, would you license this work under CC0-1.0? License is not in the master branch yet, see #47.

Member

yegortimoshenko commented Jan 14, 2018

Also, would you license this work under CC0-1.0? License is not in the master branch yet, see #47.

This comment has been minimized.

Show comment Hide comment
@lbonn

lbonn Jan 15, 2018

Licensing it under CC0-1.0 is fine by me, if @andir also agrees for the part I'd eventually take from their repo.

I tried to apply some of your changes and I'll do some test later to verify that nothing is extraneous.

About the wifi firmware, I suppose it's not really the place to put some blobs (see https://github.com/andir/nixos-gpd-pocket/tree/master/firmware). Would there be an alternate solution, for example leaving some instructions for the user to add and include from another channel?

lbonn commented Jan 15, 2018

Licensing it under CC0-1.0 is fine by me, if @andir also agrees for the part I'd eventually take from their repo.

I tried to apply some of your changes and I'll do some test later to verify that nothing is extraneous.

About the wifi firmware, I suppose it's not really the place to put some blobs (see https://github.com/andir/nixos-gpd-pocket/tree/master/firmware). Would there be an alternate solution, for example leaving some instructions for the user to add and include from another channel?

This comment has been minimized.

Show comment Hide comment
@andir

andir Jan 15, 2018

Member

For what it is worth you could pull that from my repo.... I also grant permission to re-use my configuration from THAT repo under CC0-1.0.

Member

andir commented Jan 15, 2018

For what it is worth you could pull that from my repo.... I also grant permission to re-use my configuration from THAT repo under CC0-1.0.

This comment has been minimized.

Show comment Hide comment
@yegortimoshenko

yegortimoshenko Jan 16, 2018

Member

I think blob here will do, but it could be merged with Nixpkgs for a wider reach, perhaps later.

Member

yegortimoshenko commented Jan 16, 2018

I think blob here will do, but it could be merged with Nixpkgs for a wider reach, perhaps later.

This comment has been minimized.

Show comment Hide comment
@Mic92

Mic92 Mar 9, 2018

Contributor

any news here?

Contributor

Mic92 commented Mar 9, 2018

any news here?

This comment has been minimized.

Show comment Hide comment
@lbonn

lbonn Mar 12, 2018

@Mic92 I'm a bit short on time these days unfortunately, if someone wants to make progress on that, be my guest

lbonn commented Mar 12, 2018

@Mic92 I'm a bit short on time these days unfortunately, if someone wants to make progress on that, be my guest

This comment has been minimized.

Show comment Hide comment
@Ma27

Ma27 Mar 12, 2018

Contributor

@lbonn wrong username? ;)

Contributor

Ma27 commented Mar 12, 2018

@lbonn wrong username? ;)

This comment has been minimized.

Show comment Hide comment
@lbonn

lbonn Mar 12, 2018

Oops, sorry

lbonn commented Mar 12, 2018

Oops, sorry

This comment has been minimized.

Show comment Hide comment
@grahamc

grahamc Mar 12, 2018

Member
Member

grahamc commented Mar 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment