Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

motorola-potter: init #359

Merged
merged 21 commits into from
Jun 28, 2021
Merged

motorola-potter: init #359

merged 21 commits into from
Jun 28, 2021

Conversation

telent
Copy link
Contributor

@telent telent commented May 25, 2021

Based closely on addison, but with a different kernel upstream

  • boots into 'hello' example
  • framebuffer works
  • adb works
  • touchscreen works
  • wlan0 works (use the addison process to get modem firmware), tested with wpa_supplicant/dhcp/ping

nixpkgs hash 900115a4f7fdd9189e7803ca781a65be663f2c89 (23 May)

@samueldr samueldr changed the title Beatrix motorola-potter: init May 25, 2021
Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misc things, I expect some were just "TODO" not done yet on your end :).

devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/kernel/config.armv7l Outdated Show resolved Hide resolved
devices/motorola-potter/kernel/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/partitions_32GB.gdisk Outdated Show resolved Hide resolved
@telent
Copy link
Contributor Author

telent commented May 31, 2021

Just for completeness sake, some numbers for boot.img size:

-r--r--r-- 1 root root 18151424 Jan  1  1970 /nix/store/wzyhviakn0sbc82dzq3jqd1fswlw00nz-mobile-nixos_motorola-potter_boot.img
-r--r--r-- 1 root root 18118656 Jan  1  1970 /nix/store/30rncw27lybk0jw6r5ksc5zx21l25sp8-mobile-nixos_motorola-potter_boot.img -CONFIG_AUDIT
-r--r--r-- 1 root root 18468864 Jan  1  1970 /nix/store/6zfy0s6ljip3vnvpcwa7qg0f9jasx7p5-mobile-nixos_motorola-potter_boot.img busybox musl
-r--r--r-- 1 root root 17631232 Jan  1  1970 /nix/store/j5rj0k8s4bdv3vjhf7r06k697f39n281-mobile-nixos_motorola-potter_boot.img busybox minimal (!musl)
-r--r--r-- 1 root root 17160192 Jan  1  1970 /nix/store/vbpzxxh7wnwllycg0nybsgmvbdxgqgc7-mobile-nixos_motorola-potter_boot.img actually fixing the DTBs (!minimal)
-r--r--r-- 1 root root 16510976 Jan  1  1970 /nix/store/r2lkfisj1p97i9029qcq9gqf5f3hgmc9-mobile-nixos_motorola-potter_boot.img sysemdMinimal for udev in initrd

All builds after the first have CONFIG_AUDIT unset. busybox musl and minimal changes were each reverted: the first didn't help and the second probably wasn't going to work

@telent telent marked this pull request as ready for review June 2, 2021 11:31
@telent
Copy link
Contributor Author

telent commented Jun 2, 2021

Touchscreen works, boot.img < 16MB, wifi works, previous comments addressed - is there anything else I need to look at to make this mergable?

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial notes

devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
modules/quirks/qualcomm/touchscreen-powerup.nix Outdated Show resolved Hide resolved
overlay/mobile-nixos/kernel/builder.nix Outdated Show resolved Hide resolved
overlay/mobile-nixos/kernel/builder.nix Outdated Show resolved Hide resolved
@samueldr
Copy link
Member

samueldr commented Jun 2, 2021

I'm not sure about the out of tree DTS thing. I don't dislike the concept, but I think in your situation it would be better served with a proper .patch that requires no change in the tooling. Since anyway the way it ends up working in your case is through a kernel patch.

Does that make sense?

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes.

Looking good on the whole, lots of nits :).

I haven't taken a look at the commits history yet, but when you're fixing up these changes, you can take the time to cleanup what isn't needed. But as we discussed, please keep some of your steps and stumbles visible, as it has values in showing how a port can be made.

devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/default.nix Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
devices/motorola-potter/README.adoc Outdated Show resolved Hide resolved
overlay/mobile-nixos/kernel/builder.nix Outdated Show resolved Hide resolved
telent and others added 14 commits June 27, 2021 23:24
I haven't tested this extensively, but it causes wlan0 to exist, so
we're on the right track at least
Moto Potter boot partition is only 16MB, which is tight. In the vendor
kernel it has seven hwrev variants with a dts file for each - but four
of them are identical to three of the others. We can make a
significant saving on image size by shipping one of each of the
differing dts files and adding the board-id values of the other
identical hwrevs to each.
saves 649216 bytes on Potter
we've already disabled SELinux, not sure if it has any other uses,
and it saved 32k
This is needed for potter: I found the fix in
https://wiki.postmarketos.org/wiki/Troubleshooting#Touch_screen_device_present_but_not_outputting_any_touch_events

which suggests that other motorola devices have the same issue, so I
implemented it as a quirk. I don't yet have any insight on how to find
the correct device path portably
CONFIG_SCREEN_OFF_GESTURES adds 5000 to the reported X co-ordinate
when it believes the screen is suspended, but it always believes the
screen is suspended even when it isn't. Hypothesis is that (1)
the pm_ops are not supplied in the i2c_driver code, so the
`suspended=false` line in synaptics_rmi4_resume is not called by
that path; (2) something odd is happening in synaptics_dsx_panel_cb
- which is passed to fb_register_client - such that the equivalent
message from the framebuffer is not being recognised as a reason to
call synaptics_rmi4_resume then either. </Handwaving>
Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
... this turns out to be all of them. Tested with

  fastboot boot boot.img  --cmdline "nixos.foo=true"

and then once booted, verify that most or all of the options in
device boot.kernelParams are not present

ched_enable_hmp=1
sched_enable_power_aware=1
nixos.foo=true
androidboot.emmc=true
androidboot.serialno=[redacted]
androidboot.baseband=msm
androidboot.mode=normal
androidboot.device=potter
androidboot.hwrev=0x83B0
androidboot.radio=EMEA
androidboot.powerup_reason=0x00004000
androidboot.bootreason=reboot
msm_poweroff.download_mode=0
androidboot.fsg-id=
androidboot.wifimacaddr=[redacted]
androidboot.btmacaddr=[redacted]
mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_mot_boe_520_1080p_vid_v0
androidboot.bootloader=0xC092
androidboot.carrier=retgb
androidboot.poweroff_alarm=0
androidboot.hardware.sku=XT1685
androidboot.secure_hardware=1
androidboot.bl_state=2
androidboot.cid=0x32
androidboot.uid=[redacted]
androidboot.write_protect=0
androidboot.ssm_data=[redacted]
androidboot.dualsim=true
mdss_fb_release_all runs when the display blanks between the splash
screen and launching the main menu (in "hello" example). If ref_cnt is
zero, it calls fb_notifier_call_chain with the payload of
FB_BLANK_POWERDOWN. The synaptics_dsx_i2c touchscreen driver is
subscribed to this notifier, and disables touch.

This is all fine except that the corresponding opposite operation - to
notify the subscribers with FB_BLANK_UNBLANK when the display
is *opened* - is not done anywhere. Add a call to mdss_fb_open
to do this whenever it's calling mdss_fb_blank_sub

For context, this behaviour was introduced in

   commit a12be25aec3fd648f2a9c4c27e88d470bed41f67
   Author: parasur <parasur@motorola.com>
   Date:   Mon Nov 7 09:45:54 2016 +0800
   LineageOS/android_kernel_motorola_msm8953@a12be25#diff-eab94fa9ea3e15183d23b93fbaf4e08bc137ae4ebbdc589fc106355b753d1b6a

but probably (speculating) goes unnoticed in Androd because the
framebuffer is never closed in Android unless something crashes, at
which point most people probably reboot anyway
Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
telent and others added 2 commits June 27, 2021 23:49
Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
@telent
Copy link
Contributor Author

telent commented Jun 27, 2021

Hi Samuel - think I've addressed all open comments, please take another look

I've done some (light, minor) cleanups of the timeline, based on the criterion:

  • technical wrong turns and discoveries (e.g the weird touchscreen stuff) I left intact
  • simple "process" wrong turns (out of tree DTS, or adding cruft in motorola-potter/default.nix) I've fixed

@samueldr
Copy link
Member

samueldr commented Jun 28, 2021

Note to self: I need to pick an arbitrary device and build with this PR applied to verify the changes to the package selected for udev in stage-1.

  • Validate udev changes... just in case

@samueldr samueldr merged commit 9139a1c into NixOS:master Jun 28, 2021
@samueldr
Copy link
Member

♥ Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. type: port New device port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants