From 2cc6ae4a9db273ff8f4303a415089e16dc4e645f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Matijevi=C4=87?= Date: Tue, 9 Jan 2018 17:42:55 +0100 Subject: [PATCH] Add basic support for Nokia N9 (#1101) Also added the watchdog-kick package: Some devices (namely Nokia N9/950) use more than one watchdog, and watchdog-kick package kicks all of /dev/watchdogs? every 10 seconds so they don't reset the device --- device/device-nokia-rm-696/APKBUILD | 35 + device/device-nokia-rm-696/deviceinfo | 19 + device/device-nokia-rm-696/initfs-hook.sh | 18 + device/device-nokia-rm-696/weston.ini | 3 + device/linux-nokia-rm-696/0001-SEB.patch | 1158 ++++ ...-add-rename-MIPI_DCS_SET_PARTIAL_XXX.patch | 32 + ...si-cm-use-defines-from-mipi_display..patch | 62 + .../0004-ARM-dts-n9-add-display-support.patch | 123 + ...work-around-for-omap3-display-enable.patch | 70 + ...nel-dsi-cm-force-0xff-for-brigthness.patch | 28 + ...M-dts-N9-Add-support-for-volume-keys.patch | 40 + ...-dts-N9-N950-Add-touchscreen-support.patch | 69 + ...isc-apds990x-Add-device-tree-support.patch | 192 + .../0010-misc-apds990x-convert-to-iio.patch | 1273 +++++ ...s-N9-Add-support-for-apds990x-ALS-PS.patch | 80 + ...access-functions-needed-by-PVR-drive.patch | 26 + device/linux-nokia-rm-696/APKBUILD | 133 + .../RM-696_Pyrenees_SMD_V1_6.raw | 19 + .../config-nokia-rm-696.armhf | 4802 +++++++++++++++++ main/watchdog-kick/APKBUILD | 22 + main/watchdog-kick/watchdog-kick | 20 + main/watchdog-kick/watchdog-kick.init | 27 + main/watchdog-kick/watchdog-kick.post-install | 3 + 23 files changed, 8254 insertions(+) create mode 100644 device/device-nokia-rm-696/APKBUILD create mode 100644 device/device-nokia-rm-696/deviceinfo create mode 100644 device/device-nokia-rm-696/initfs-hook.sh create mode 100644 device/device-nokia-rm-696/weston.ini create mode 100644 device/linux-nokia-rm-696/0001-SEB.patch create mode 100644 device/linux-nokia-rm-696/0002-drm-add-rename-MIPI_DCS_SET_PARTIAL_XXX.patch create mode 100644 device/linux-nokia-rm-696/0003-drm-omap-panel-dsi-cm-use-defines-from-mipi_display..patch create mode 100644 device/linux-nokia-rm-696/0004-ARM-dts-n9-add-display-support.patch create mode 100644 device/linux-nokia-rm-696/0005-Revert-drm-omap-work-around-for-omap3-display-enable.patch create mode 100644 device/linux-nokia-rm-696/0006-HACK-drm-omap-panel-dsi-cm-force-0xff-for-brigthness.patch create mode 100644 device/linux-nokia-rm-696/0007-ARM-dts-N9-Add-support-for-volume-keys.patch create mode 100644 device/linux-nokia-rm-696/0008-ARM-dts-N9-N950-Add-touchscreen-support.patch create mode 100644 device/linux-nokia-rm-696/0009-misc-apds990x-Add-device-tree-support.patch create mode 100644 device/linux-nokia-rm-696/0010-misc-apds990x-convert-to-iio.patch create mode 100644 device/linux-nokia-rm-696/0011-ARM-dts-N9-Add-support-for-apds990x-ALS-PS.patch create mode 100644 device/linux-nokia-rm-696/0012-HACK-export-dma-access-functions-needed-by-PVR-drive.patch create mode 100644 device/linux-nokia-rm-696/APKBUILD create mode 100644 device/linux-nokia-rm-696/RM-696_Pyrenees_SMD_V1_6.raw create mode 100644 device/linux-nokia-rm-696/config-nokia-rm-696.armhf create mode 100644 main/watchdog-kick/APKBUILD create mode 100644 main/watchdog-kick/watchdog-kick create mode 100644 main/watchdog-kick/watchdog-kick.init create mode 100644 main/watchdog-kick/watchdog-kick.post-install diff --git a/device/device-nokia-rm-696/APKBUILD b/device/device-nokia-rm-696/APKBUILD new file mode 100644 index 000000000..e70b823f4 --- /dev/null +++ b/device/device-nokia-rm-696/APKBUILD @@ -0,0 +1,35 @@ +pkgname=device-nokia-rm-696 +pkgver=1 +pkgrel=0 +pkgdesc="Nokia N9" +url="https://github.com/postmarketOS" +arch="noarch" +license="MIT" +depends="linux-nokia-rm-696 linux-firmware ofono watchdog-kick" +makedepends="" +install="" +subpackages="$pkgname-weston:weston" +source=" + deviceinfo + initfs-hook.sh + weston.ini + $install +" +options="!check" + +package() { + install -D -m644 "$srcdir"/deviceinfo \ + "$pkgdir"/etc/deviceinfo + install -D -m644 "$srcdir"/initfs-hook.sh \ + "$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh +} + +weston() { + install_if="$pkgname weston" + install -Dm644 "$srcdir"/weston.ini \ + "$subpkgdir"/etc/xdg/weston/weston.ini +} + +sha512sums="3298afa3312a032836e271d4c6808d304436470545472beb4a4ac1a4b8f93ec25d5b895f5bebf351ffb6e910a155f97a4d96b1d74f1d8ab278c246cb3815bf79 deviceinfo +61d9e6bf94f3b9cab0ccb2e18c18e5886a08aae5e70fe5e7b7d7cc2a8d655dc11cdec603731c4328dd288f13ba3aa9328f2fc46e7a473be3da31767786978b05 initfs-hook.sh +df0fe900693e5f176076c59f5379e56aaa96c3df16a4120448f15b71f530170730b43e5fe32733c40c118a00ca3581043231a062a8a1eb0a930bfbfbb6c52a47 weston.ini" diff --git a/device/device-nokia-rm-696/deviceinfo b/device/device-nokia-rm-696/deviceinfo new file mode 100644 index 000000000..c42f3e163 --- /dev/null +++ b/device/device-nokia-rm-696/deviceinfo @@ -0,0 +1,19 @@ +# Reference: +# Please use double quotes only. You can source this file in shell scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Nokia N9" +deviceinfo_manufacturer="Nokia" +deviceinfo_date="" +deviceinfo_keyboard="false" +deviceinfo_keymaps="" +deviceinfo_nonfree="????" +deviceinfo_dtb="omap3-n9" +deviceinfo_modules_initfs="" +deviceinfo_external_disk="false" +deviceinfo_external_disk_install="false" +deviceinfo_arch="armhf" + +# Splash screen +deviceinfo_screen_width="480" +deviceinfo_screen_height="864" diff --git a/device/device-nokia-rm-696/initfs-hook.sh b/device/device-nokia-rm-696/initfs-hook.sh new file mode 100644 index 000000000..a1f10da95 --- /dev/null +++ b/device/device-nokia-rm-696/initfs-hook.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +watchdog_kick() { + while true; do + for wd in /dev/watchdog*; do + [ -c $wd ] && echo X > $wd + done + + # /etc/postmarketos-mkinitfs/hooks/00-device-nokia-rm696.sh: line 12: sleep: not found + if [ -f /bin/sleep ]; then + /bin/sleep 2s + else + return 0 + fi + done +} + +watchdog_kick & diff --git a/device/device-nokia-rm-696/weston.ini b/device/device-nokia-rm-696/weston.ini new file mode 100644 index 000000000..97356c2b9 --- /dev/null +++ b/device/device-nokia-rm-696/weston.ini @@ -0,0 +1,3 @@ +[core] +xwayland=true +backend=drm-backend.so diff --git a/device/linux-nokia-rm-696/0001-SEB.patch b/device/linux-nokia-rm-696/0001-SEB.patch new file mode 100644 index 000000000..0a3902054 --- /dev/null +++ b/device/linux-nokia-rm-696/0001-SEB.patch @@ -0,0 +1,1158 @@ +From f70f270793e34ae99ab777f6cb27cb1e72054d78 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Filip=20Matijevi=C4=87?= +Date: Sat, 28 Oct 2017 14:28:52 +0200 +Subject: [PATCH 01/12] SEB + +--- + arch/arm/boot/dts/omap3-n950.dts | 88 ++++++++ + arch/arm/boot/dts/omap4-droid4-xt894.dts | 6 +- + drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 289 +++++++++++++++++------- + drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++ + drivers/gpu/drm/omapdrm/dss/omapdss.h | 5 +- + drivers/gpu/drm/omapdrm/omap_connector.c | 14 ++ + drivers/gpu/drm/omapdrm/omap_crtc.c | 158 ++++++++++++- + drivers/gpu/drm/omapdrm/omap_drv.h | 4 + + drivers/gpu/drm/omapdrm/omap_fb.c | 20 ++ + drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 - + drivers/gpu/drm/omapdrm/omap_irq.c | 24 ++ + 11 files changed, 529 insertions(+), 98 deletions(-) + +diff --git a/arch/arm/boot/dts/omap3-n950.dts b/arch/arm/boot/dts/omap3-n950.dts +index c354a1ed1e70..2354e09343f3 100644 +--- a/arch/arm/boot/dts/omap3-n950.dts ++++ b/arch/arm/boot/dts/omap3-n950.dts +@@ -51,6 +51,26 @@ + }; + }; + ++&omap3_pmx_core { ++ dsi_pins: pinmux_dsi_pins { ++ pinctrl-single,pins = < ++ OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE1) /* dsi_dx0 - data0+ */ ++ OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT | MUX_MODE1) /* dsi_dy0 - data0- */ ++ OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT | MUX_MODE1) /* dsi_dx1 - clk+ */ ++ OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE1) /* dsi_dy1 - clk- */ ++ OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE1) /* dsi_dx2 - data1+ */ ++ OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE1) /* dsi_dy2 - data1- */ ++ >; ++ }; ++ ++ display_pins: pinmux_display_pins { ++ pinctrl-single,pins = < ++ OMAP3_CORE1_IOPAD(0x20ca, PIN_INPUT | MUX_MODE4) /* gpio 62 - display te */ ++ OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT | MUX_MODE4) /* gpio 87 - display reset */ ++ >; ++ }; ++}; ++ + &i2c2 { + smia_1: camera@10 { + compatible = "nokia,smia"; +@@ -186,3 +206,71 @@ + st,max-limit-y = <32>; + st,max-limit-z = <32>; + }; ++ ++&dss { ++ status = "ok"; ++ ++ vdda_video-supply = <&vdac>; ++}; ++ ++&dsi { ++ status = "ok"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dsi_pins>; ++ ++ vdd-supply = <&vpll2>; ++ ++ port { ++ dsi_out_ep: endpoint { ++ remote-endpoint = <&lcd0_in>; ++ lanes = <2 3 0 1 4 5>; ++ }; ++ }; ++ ++ lcd0: display { ++ compatible = "nokia,himalaya", "panel-dsi-cm"; ++ label = "lcd0"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&display_pins>; ++ ++ vpnl-supply = <&vmmc2>; ++ vddi-supply = <&vio>; ++ ++ reset-gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */ ++ te-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>; /* 62 */ ++ ++ width-mm = <49>; /* 48.960 mm */ ++ height-mm = <88>; /* 88.128 mm */ ++ ++ /* TODO: ++ * - panel is upside-down ++ * - top + bottom 5px are not visible ++ */ ++ panel-timing { ++ clock-frequency = <0>; /* Calculated by dsi */ ++ ++ hback-porch = <2>; ++ hactive = <480>; ++ hfront-porch = <0>; ++ hsync-len = <2>; ++ ++ vback-porch = <1>; ++ vactive = <864>; ++ vfront-porch = <0>; ++ vsync-len = <1>; ++ ++ hsync-active = <0>; ++ vsync-active = <0>; ++ de-active = <1>; ++ pixelclk-active = <1>; ++ }; ++ ++ port { ++ lcd0_in: endpoint { ++ remote-endpoint = <&dsi_out_ep>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts +index 24a463f8641f..b21084da490b 100644 +--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts ++++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts +@@ -177,6 +177,10 @@ + vddi-supply = <&lcd_regulator>; + reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */ + ++ width-mm = <50>; ++ height-mm = <89>; ++ backlight = <&lcd_backlight>; ++ + panel-timing { + clock-frequency = <0>; /* Calculated by dsi */ + +@@ -346,7 +350,7 @@ + + enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>; + +- backlight { ++ lcd_backlight: backlight { + compatible = "ti,lm3532-backlight"; + + lcd { +diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +index 92c556ac22c7..996991de674b 100644 +--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c ++++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +@@ -22,9 +22,10 @@ + #include + #include + #include +-#include ++#include + + #include