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
This commit is contained in:
Filip Matijević 2018-01-09 17:42:55 +01:00 committed by Oliver Smith
parent be5ae77c0a
commit 2cc6ae4a9d
23 changed files with 8254 additions and 0 deletions

View file

@ -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"

View file

@ -0,0 +1,19 @@
# Reference: <https://postmarketos.org/deviceinfo>
# 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"

View file

@ -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 &

View file

@ -0,0 +1,3 @@
[core]
xwayland=true
backend=drm-backend.so

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
From f68a4284dbd93282df0ceda099cab49aa8ef0ec0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 28 Oct 2017 09:18:10 +0200
Subject: [PATCH 02/12] drm: add/rename MIPI_DCS_SET_PARTIAL_XXX
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Rename MIPI_DCS_SET_PARTIAL_AREA to MIPI_DCS_SET_PARTIAL_ROWS
Add MIPI_DCS_SET_PARTIAL_COLUMNS
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
include/video/mipi_display.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h
index 19aa65a35546..1d9fdd685ded 100644
--- a/include/video/mipi_display.h
+++ b/include/video/mipi_display.h
@@ -102,7 +102,8 @@ enum {
MIPI_DCS_WRITE_MEMORY_START = 0x2C,
MIPI_DCS_WRITE_LUT = 0x2D,
MIPI_DCS_READ_MEMORY_START = 0x2E,
- MIPI_DCS_SET_PARTIAL_AREA = 0x30,
+ MIPI_DCS_SET_PARTIAL_ROWS = 0x30,
+ MIPI_DCS_SET_PARTIAL_COLUMNS = 0x31,
MIPI_DCS_SET_SCROLL_AREA = 0x33,
MIPI_DCS_SET_TEAR_OFF = 0x34,
MIPI_DCS_SET_TEAR_ON = 0x35,
--
2.14.1

View file

@ -0,0 +1,62 @@
From d1b874e139935761ea4ef21a9e5c7add46241461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 28 Oct 2017 14:39:23 +0200
Subject: [PATCH 03/12] drm/omap: panel-dsi-cm: use defines from mipi_display.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 996991de674b..29a8b1287531 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -33,8 +33,6 @@
#define TCH 0
#define DCS_READ_NUM_ERRORS 0x05
-#define DCS_BRIGHTNESS 0x51
-#define DCS_CTRL_DISPLAY 0x53
#define DCS_GET_ID1 0xda
#define DCS_GET_ID2 0xdb
#define DCS_GET_ID3 0xdc
@@ -385,7 +383,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
r = dsicm_wake_up(ddata);
if (!r)
- r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
+ level);
in->ops.dsi->bus_unlock(in);
}
@@ -667,11 +666,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
- r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
if (r)
goto err;
- r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
+ r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
(1<<2) | (1<<5)); /* BL | BCTRL */
if (r)
goto err;
@@ -1100,7 +1099,8 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
goto err2;
while (buf_used < size) {
- u8 dcs_cmd = first ? 0x2e : 0x3e;
+ u8 dcs_cmd = first ? MIPI_DCS_READ_MEMORY_START :
+ MIPI_DCS_READ_MEMORY_CONTINUE;
first = 0;
r = in->ops.dsi->dcs_read(in, ddata->channel, dcs_cmd,
--
2.14.1

View file

@ -0,0 +1,123 @@
From 9bf187094ccde898c00538e3b23ae4c76dfa11d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 28 Oct 2017 14:32:54 +0200
Subject: [PATCH 04/12] ARM: dts: n9: add display support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add basic panel support for the Nokia N9.
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
arch/arm/boot/dts/omap3-n9.dts | 91 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
index 39e35f8b8206..7bf1c0c1f884 100644
--- a/arch/arm/boot/dts/omap3-n9.dts
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -17,6 +17,26 @@
compatible = "nokia,omap3-n9", "ti,omap36xx", "ti,omap3";
};
+&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";
@@ -72,3 +92,74 @@
st,max-limit-y = <46>;
st,max-limit-z = <46>;
};
+
+&dss {
+ status = "ok";
+
+ vdda_video-supply = <&vdac>;
+};
+
+&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 4 5 0 1>;
+ };
+ };
+
+ lcd0: display {
+ compatible = "nokia,pyrenees", "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 = <48>; /* 48.240 mm */
+ height-mm = <87>; /* 86.832 mm */
+
+ 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>;
+ };
+ };
+ };
+};
--
2.14.1

View file

@ -0,0 +1,70 @@
From faaa1d9e395ea7231534561d5bd2ed6e1d9a760c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Thu, 2 Nov 2017 18:46:21 +0100
Subject: [PATCH 05/12] Revert "drm/omap: work-around for omap3 display enable"
This reverts commit fc5cc9678e130196012c17b37e555d53d3d3476b.
---
drivers/gpu/drm/omapdrm/omap_drv.c | 47 ++++++++++++++------------------------
1 file changed, 17 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index cdf5b0601eba..9b3c36b48356 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -84,36 +84,23 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state)
/* Apply the atomic update. */
drm_atomic_helper_commit_modeset_disables(dev, old_state);
- if (priv->omaprev != 0x3430) {
- /* With the current dss dispc implementation we have to enable
- * the new modeset before we can commit planes. The dispc ovl
- * configuration relies on the video mode configuration been
- * written into the HW when the ovl configuration is
- * calculated.
- *
- * This approach is not ideal because after a mode change the
- * plane update is executed only after the first vblank
- * interrupt. The dispc implementation should be fixed so that
- * it is able use uncommitted drm state information.
- */
- drm_atomic_helper_commit_modeset_enables(dev, old_state);
- omap_atomic_wait_for_completion(dev, old_state);
-
- drm_atomic_helper_commit_planes(dev, old_state, 0);
-
- drm_atomic_helper_commit_hw_done(old_state);
- } else {
- /*
- * OMAP3 DSS seems to have issues with the work-around above,
- * resulting in endless sync losts if a crtc is enabled without
- * a plane. For now, skip the WA for OMAP3.
- */
- drm_atomic_helper_commit_planes(dev, old_state, 0);
-
- drm_atomic_helper_commit_modeset_enables(dev, old_state);
-
- drm_atomic_helper_commit_hw_done(old_state);
- }
+ /* With the current dss dispc implementation we have to enable
+ * the new modeset before we can commit planes. The dispc ovl
+ * configuration relies on the video mode configuration been
+ * written into the HW when the ovl configuration is
+ * calculated.
+ *
+ * This approach is not ideal because after a mode change the
+ * plane update is executed only after the first vblank
+ * interrupt. The dispc implementation should be fixed so that
+ * it is able use uncommitted drm state information.
+ */
+ drm_atomic_helper_commit_modeset_enables(dev, old_state);
+ omap_atomic_wait_for_completion(dev, old_state);
+
+ drm_atomic_helper_commit_planes(dev, old_state, 0);
+
+ drm_atomic_helper_commit_hw_done(old_state);
/*
* Wait for completion of the page flips to ensure that old buffers
--
2.14.1

View file

@ -0,0 +1,28 @@
From 4f521a6bc38b208fb740b2585e1a217893f0f437 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Wed, 1 Nov 2017 18:25:45 +0100
Subject: [PATCH 06/12] HACK: drm/omap: panel-dsi-cm: force 0xff for brigthness
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 29a8b1287531..36a05da2f818 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -374,6 +374,8 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
else
level = 0;
+ level = 0xff;
+
dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
mutex_lock(&ddata->lock);
--
2.14.1

View file

@ -0,0 +1,40 @@
From 29c40823eee0bd4d3a40938dfdabd0187e34625f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Thu, 23 Nov 2017 19:58:07 +0100
Subject: [PATCH 07/12] ARM: dts: N9: Add support for volume keys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
arch/arm/boot/dts/omap3-n9.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
index 7bf1c0c1f884..9e417ba08deb 100644
--- a/arch/arm/boot/dts/omap3-n9.dts
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -11,6 +11,7 @@
/dts-v1/;
#include "omap3-n950-n9.dtsi"
+#include <dt-bindings/input/input.h>
/ {
model = "Nokia N9";
@@ -79,6 +80,12 @@
compatible = "nokia,n9-modem";
};
+&twl_keypad {
+ linux,keymap = < MATRIX_KEY(6, 8, KEY_VOLUMEUP)
+ MATRIX_KEY(7, 8, KEY_VOLUMEDOWN)
+ >;
+};
+
&lis302 {
st,axis-x = <1>; /* LIS3_DEV_X */
st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */
--
2.14.1

View file

@ -0,0 +1,69 @@
From 09b9ba32a440a95dc1a544198e84107d33a40cf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Mon, 13 Nov 2017 17:20:42 +0100
Subject: [PATCH 08/12] ARM: dts: N9/N950: Add touchscreen support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
---
arch/arm/boot/dts/omap3-n950-n9.dtsi | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index 12fbb3da5fce..f615428b9f4d 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -141,6 +141,14 @@
OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx */
>;
};
+
+ ts_pins: pinmux_ts_pins {
+ pinctrl-single,pins = <
+ /* REVISIT pinmuxing gpmc_nbe1 to gpio_61 breaks Atmel maXTouch */
+ /*OMAP3_CORE1_IOPAD(0x20c8, PIN_INPUT | MUX_MODE4)*/ /* gpmc_nbe1.gpio_61 -> TINTX */
+ OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE4) /* dss_data11.gpio_81 -> TRESX */
+ >;
+ };
};
&omap3_pmx_core2 {
@@ -199,6 +207,7 @@
regulator-name = "vaux1";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
+ regulator-always-on; /* needed for Atmel maXTouch */
};
/* CSI-2 receiver */
@@ -261,6 +270,7 @@
regulator-name = "vio";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
+ regulator-always-on; /* needed for Atmel maXTouch */
};
&i2c2 {
@@ -283,6 +293,18 @@
led-max-microamp = <10000>;
};
};
+
+ touch@4b {
+ compatible = "atmel,maxtouch";
+ reg = <0x4b>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&ts_pins>;
+
+ interrupt-parent = <&gpio2>;
+ interrupts = <29 IRQ_TYPE_EDGE_FALLING>; /* gpio_61 */
+ reset-gpios = <&gpio3 17 0>; /* gpio_81 */
+ };
};
&i2c3 {
--
2.14.1

View file

@ -0,0 +1,192 @@
From 260d242959b20570b2a6e5dbc4709c0933ccb722 Mon Sep 17 00:00:00 2001
From: filippz <filip.matijevic.pz@gmail.com>
Date: Thu, 28 Dec 2017 06:57:45 +0100
Subject: [PATCH 09/12] misc: apds990x: Add device tree support
Signed-off-by: filippz <filip.matijevic.pz@gmail.com>
---
.../devicetree/bindings/misc/avago-apds990x.txt | 41 +++++++++++
drivers/misc/apds990x.c | 85 +++++++++++++++++++++-
2 files changed, 123 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/misc/avago-apds990x.txt
diff --git a/Documentation/devicetree/bindings/misc/avago-apds990x.txt b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
new file mode 100644
index 000000000000..480c0b1c570d
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
@@ -0,0 +1,41 @@
+Avago APDS990X driver
+
+https://docs.broadcom.com/docs/AV02-2867EN
+
+Required properties:
+- compatible: "avago,apds990x"
+- reg: address on the I2C bus
+- interrupts: external interrupt line number
+- vdd-supply: power supply for VDD
+- vled-supply: power supply for LEDA
+- avago,ga: Glass attenuation
+- avago,cf1: Clear channel factor 1
+- avago,irf1: IR channel factor 1
+- avago,cf2: Clear channel factor 2
+- avago,irf2: IR channel factor 2
+- avago,df: Device factor
+- avago,pdrive: IR current, one of APDS_IRLED_CURR_XXXmA values
+- avago,ppcount: Proximity pulse count
+
+Example (Nokia N9):
+
+ als_ps@39 {
+ compatible = "avago,apds990x";
+ reg = <0x39>;
+
+ interrupt-parent = <&gpio3>;
+ interrupts = <19 (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)>; /* gpio_83 */
+
+ vdd-supply = <&vaux1>;
+ vled-supply = <&vbat>;
+
+ avago,ga = <168834>;
+ avago,cf1 = <4096>;
+ avago,irf1 = <7824>;
+ avago,cf2 = <877>;
+ avago,irf2 = <1575>;
+ avago,df = <52>;
+
+ avago,pdrive = <0x2>; /* APDS_IRLED_CURR_25mA */
+ avago,ppcount = <5>;
+ };
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index c9f07032c2fc..77c168d928f8 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -33,6 +33,8 @@
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/platform_data/apds990x.h>
+#include <linux/gpio.h>
+#include <linux/of_gpio.h>
/* Register map */
#define APDS990X_ENABLE 0x00 /* Enable of states and interrupts */
@@ -195,8 +197,8 @@ static const u16 arates_hz[] = {10, 5, 2, 1};
static const u8 apersis[] = {1, 2, 4, 5};
/* Regulators */
-static const char reg_vcc[] = "Vdd";
-static const char reg_vled[] = "Vled";
+static const char reg_vcc[] = "vdd";
+static const char reg_vled[] = "vled";
static int apds990x_read_byte(struct apds990x_chip *chip, u8 reg, u8 *data)
{
@@ -1055,11 +1057,71 @@ static const struct attribute_group apds990x_attribute_group[] = {
{.attrs = sysfs_attrs_ctrl },
};
+static const int apds990x_parse_dt(struct device *dev,
+ struct apds990x_platform_data *pdata)
+{
+ struct device_node *np = dev->of_node;
+ int res;
+
+ if (!np)
+ return -EINVAL;
+
+ res = of_property_read_s32(np, "avago,ga", &pdata->cf.ga);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve ga from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_s32(np, "avago,cf1", &pdata->cf.cf1);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve cf1 from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_s32(np, "avago,irf1", &pdata->cf.irf1);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve irf1 from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_s32(np, "cf2", &pdata->cf.cf2);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve cf2 from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_s32(np, "avago,irf2", &pdata->cf.irf2);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve irf2 from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_s32(np, "avago,df", &pdata->cf.df);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve irf1 from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_u8(np, "avago,pdrive", &pdata->pdrive);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve pdrive from device tree\n");
+ return -EINVAL;
+ }
+
+ res = of_property_read_u8(np, "avago,ppcount", &pdata->ppcount);
+ if (res < 0) {
+ dev_err(dev, "Failed to retrieve ppcount from device tree\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int apds990x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct apds990x_chip *chip;
- int err;
+ int err = 0;
chip = kzalloc(sizeof *chip, GFP_KERNEL);
if (!chip)
@@ -1072,6 +1134,16 @@ static int apds990x_probe(struct i2c_client *client,
mutex_init(&chip->mutex);
chip->pdata = client->dev.platform_data;
+ if (chip->pdata == NULL) {
+ chip->pdata = devm_kzalloc(&client->dev, sizeof(*chip->pdata),
+ GFP_KERNEL);
+ if (!chip->pdata)
+ return -ENOMEM;
+ err = apds990x_parse_dt(&client->dev, chip->pdata);
+ }
+ if (err < 0)
+ return err;
+
if (chip->pdata == NULL) {
dev_err(&client->dev, "platform data is mandatory\n");
err = -EINVAL;
@@ -1272,9 +1344,16 @@ static const struct dev_pm_ops apds990x_pm_ops = {
NULL)
};
+static const struct of_device_id apds990x_of_match[] = {
+ {.compatible = "avago,apds990x" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, apds990x_of_match);
+
static struct i2c_driver apds990x_driver = {
.driver = {
.name = "apds990x",
+ .of_match_table = apds990x_of_match,
.pm = &apds990x_pm_ops,
},
.probe = apds990x_probe,
--
2.14.1

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
From f9b31361e92f0e7e48a4972ecf919443631ff8ff Mon Sep 17 00:00:00 2001
From: filippz <filip.matijevic.pz@gmail.com>
Date: Thu, 28 Dec 2017 07:00:11 +0100
Subject: [PATCH 11/12] ARM: dts: N9: Add support for apds990x ALS/PS
Signed-off-by: filippz <filip.matijevic.pz@gmail.com>
---
arch/arm/boot/dts/omap3-n9.dts | 24 ++++++++++++++++++++++++
arch/arm/boot/dts/omap3-n950-n9.dtsi | 14 ++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/arch/arm/boot/dts/omap3-n9.dts b/arch/arm/boot/dts/omap3-n9.dts
index 9e417ba08deb..b0b4a49da016 100644
--- a/arch/arm/boot/dts/omap3-n9.dts
+++ b/arch/arm/boot/dts/omap3-n9.dts
@@ -57,6 +57,30 @@
};
};
};
+
+ als_ps@39 {
+ compatible = "avago,apds990x";
+ reg = <0x39>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&als_ps_gpio>;
+
+ interrupt-parent = <&gpio3>;
+ interrupts = <19 (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)>; /* gpio_83 */
+
+ vdd-supply = <&vaux1>;
+ vled-supply = <&vbat>;
+
+ avago,ga = <168834>;
+ avago,cf1 = <4096>;
+ avago,irf1 = <7824>;
+ avago,cf2 = <877>;
+ avago,irf2 = <1575>;
+ avago,df = <52>;
+
+ avago,pdrive = /bits/ 8 <2>; /* APDS_IRLED_CURR_25mA */
+ avago,ppcount = /bits/ 8 <5>;
+ };
};
&isp {
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index f615428b9f4d..6192b47b18ca 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -39,6 +39,14 @@
enable-active-high;
};
+ vbat: fixedregulator1 {
+ compatible = "regulator-fixed";
+ regulator-name = "VBAT";
+ regulator-min-microvolt = <3700000>;
+ regulator-max-microvolt = <3700000>;
+ regulator-boot-on;
+ };
+
vwlan_fixed: fixedregulator2 {
compatible = "regulator-fixed";
regulator-name = "VWLAN";
@@ -157,6 +165,12 @@
OMAP3630_CORE2_IOPAD(0x25ec, PIN_OUTPUT | MUX_MODE4) /* gpio_23 (cmt_en) */
>;
};
+
+ als_ps_gpio: pinmux_als_ps_gpio {
+ pinctrl-single,pins = <
+ OMAP3_CORE1_IOPAD(0x20f6, PIN_INPUT | MUX_MODE4) /* dss_data13.gpio_83 -> APDS990X/BHSFH IRQ */
+ >;
+ };
};
&i2c1 {
--
2.14.1

View file

@ -0,0 +1,26 @@
From 2a8dfb35dea840d1759ad8dbae12408c3017f721 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 16 Dec 2017 07:41:32 +0100
Subject: [PATCH 12/12] HACK: export dma access functions needed by PVR drivers
---
arch/arm/mm/dma-mapping.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ada8eb206a90..877f7f96462d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2409,3 +2409,10 @@ void arch_teardown_dma_ops(struct device *dev)
arm_teardown_iommu_dma_ops(dev);
}
+
+/* export the cache management functions */
+#ifndef MULTI_CACHE
+EXPORT_SYMBOL(__glue(_CACHE,_dma_map_area));
+EXPORT_SYMBOL(__glue(_CACHE,_dma_unmap_area));
+EXPORT_SYMBOL(__glue(_CACHE,_dma_flush_range));
+#endif
--
2.14.1

View file

@ -0,0 +1,133 @@
_flavor=nokia-rm-696
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=4.15_rc6
_pkgver=${pkgver/_/-}
_kernver=${pkgver%_rc*}
_mainver=${_kernver%.*}
_patchlevel=${_kernver/$_mainver./}
_basever=${_mainver}.$((_patchlevel-1))
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=0
arch="armhf"
pkgdesc="Nokia N9 kernel"
url="https://kernel.org"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers openssl-dev"
options="!strip !check !tracedeps"
source="
https://cdn.kernel.org/pub/linux/kernel/v$_mainver.x/linux-$_basever.tar.xz
linux-v$_basever-v$_pkgver.patch::https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v$_pkgver&id2=v$_basever
0001-SEB.patch
0002-drm-add-rename-MIPI_DCS_SET_PARTIAL_XXX.patch
0003-drm-omap-panel-dsi-cm-use-defines-from-mipi_display..patch
0004-ARM-dts-n9-add-display-support.patch
0005-Revert-drm-omap-work-around-for-omap3-display-enable.patch
0006-HACK-drm-omap-panel-dsi-cm-force-0xff-for-brigthness.patch
0007-ARM-dts-N9-Add-support-for-volume-keys.patch
0008-ARM-dts-N9-N950-Add-touchscreen-support.patch
0009-misc-apds990x-Add-device-tree-support.patch
0010-misc-apds990x-convert-to-iio.patch
0011-ARM-dts-N9-Add-support-for-apds990x-ALS-PS.patch
0012-HACK-export-dma-access-functions-needed-by-PVR-drive.patch
$_config
RM-696_Pyrenees_SMD_V1_6.raw
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/linux-$_basever"
prepare() {
local _patch_failed=
cd "$ksrcdir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
# Atmel maXTouch configuration
cp "$srcdir/RM-696_Pyrenees_SMD_V1_6.raw" "$ksrcdir/firmware/maxtouch.cfg"
mkdir -p "$srcdir"/build
cp "$srcdir"/$_config "$srcdir"/build/.config || return 1
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
olddefconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$srcdir"/build || return 1
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
|| return 1
cd ${ksrcdir}
}
package() {
cd "$srcdir/build/arch/arm/boot"
cat zImage dts/omap3-n9.dtb > zImage-dtb
install -Dm644 "$srcdir/build/arch/arm/boot/zImage-dtb" \
"$pkgdir/boot/vmlinuz-$_flavor"
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
make -j1 modules_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1
}
sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz
b68965ef7b78ed9a0547d3a00432b0afaa8441a77412026c84d9b91b751f62d54cb263ec0ffc3547196038f0fe39bdcdfd1e7535776dc8f7a139528ea8ce3dcc linux-v4.14-v4.15-rc6.patch
bb34025e9487957b2fd14168bf406d8c96fe1d2e3e025d7468b785c1960acde165a3b3a8fbe0271ef7e6b35ee0bf1c49d9e8e005c2fce1ecdc3915f872bd5aec 0001-SEB.patch
b92039d222e43d372c7ca3d5d117154800b83216b04d972b038accd9fce7c38a9da48e838391808d7ddb436252eab537f2e61d70656a767b933c5131b6b95afe 0002-drm-add-rename-MIPI_DCS_SET_PARTIAL_XXX.patch
afd2f16e058e576c441263554701afce37c3f0ee9cacced55b60add9c3fb258f9dda911ca52997ea3acdc933468ac279851e3d5c3f7862449fc17f638a887b16 0003-drm-omap-panel-dsi-cm-use-defines-from-mipi_display..patch
ef272ab381ceba0f8226017d46b96545971092938d12a3f58444b87b07e273c24c9af0368b5f5bc3db91df5a271cb49dc727b08eaec70687c874ce9f7e2ca75c 0004-ARM-dts-n9-add-display-support.patch
b4b01583d639c75b3667398a917e0db57dee128af7def919ff859568ca812336a9c7b349dc9cb8b6f0e4b69afb806d7d5b761631e328b49d9402e3ed43c09ef0 0005-Revert-drm-omap-work-around-for-omap3-display-enable.patch
5b9e3b550feee69cd93945abb6e07cbd1067078b978617ff375fd6f1aa8f4731ad7abc314a3e15e3830c248da6c79c80654891803b24e3fef46940278827838a 0006-HACK-drm-omap-panel-dsi-cm-force-0xff-for-brigthness.patch
34930e488871e660d55b0174cda7778f45f381cf4bfaccab266f9cbc37858627330bdf0631bb78ebf51249003881ac814a3441c2ae0a96a000c9a5de1e4c945b 0007-ARM-dts-N9-Add-support-for-volume-keys.patch
d1ae4758f669de894b4c612e2d6e4599226e0be5c9e2f61d67a0885c30a8de1e3bf0832a57951c604c9098197fe730e7adb6ddfab7cec60a1af9ef993a4b100b 0008-ARM-dts-N9-N950-Add-touchscreen-support.patch
9006182627f533621b4b272c9a5160c8e530a1b6c7fe63a352da1e2ae42347a2dc9222833fd916f2d61ce178a70ca2a848fdd0c6f40f0832f10440a5ade681e1 0009-misc-apds990x-Add-device-tree-support.patch
4600c0ef918c03c22ce1f280d4c7e329e0e5b8e9fabea4cee29f5e521e521b08ff7f7b0cc0937e92acf16af130218b9eab66e212cc108c0d5163399b4d87a6e1 0010-misc-apds990x-convert-to-iio.patch
acc0399f7f3fda4d8c1e0a0c0ac7c36d27e8704d8aac4f085ad3a0c6460e55ce51dd541d692aa8d79e239d9005e9859d4263a599b058801f4dc43e0e75ae18e9 0011-ARM-dts-N9-Add-support-for-apds990x-ALS-PS.patch
02da1c4538cc16b344745f6b7dab76a42286e9e17e549229273930557b5498f70628aa1a24654dbbdbb504942a8d502037f4e722d6119921a20bb14be21e3784 0012-HACK-export-dma-access-functions-needed-by-PVR-drive.patch
b666d18e505bdf9f806f133b0930555ab911cd8625f84b6d2a9caa9cffa805c6fc2c9c0485f9e3dea19b29c7c43cd688d4a5f2d3722d33f67b6435944a164ee0 config-nokia-rm-696.armhf
a9b2eba95ead1226108bf664f49bcad70be99df7284ba807abdbd86a8dc68ebda6fc5d88c15846009f7748f1ae4d6735477d316bb9f298e7728071dad506b35f RM-696_Pyrenees_SMD_V1_6.raw"

View file

@ -0,0 +1,19 @@
OBP_RAW V1
80 01 16 AB 13 0B 11
FF341C
000000
0026 0000 0008 00 00 00 00 00 00 00 00
0007 0000 0003 14 07 32
0008 0000 0008 08 00 14 14 00 00 0A 0F
0009 0000 001F 8F 00 00 13 0B 00 11 23 02 01 00 08 06 0F 0A 0A 0A 0A 55 03 DF 01 00 11 05 0A 94 32 9A 55 00
000F 0000 000B 00 00 00 00 00 00 00 00 00 00 00
0012 0000 0002 00 00
0013 0000 0010 01 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00
0014 0000 000C 00 00 00 00 00 00 00 00 00 00 00 00
0016 0000 0011 05 00 00 00 00 00 00 00 0F 00 00 00 0A 0F FF FF 00
0017 0000 000F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0018 0000 0013 00 01 08 00 08 50 64 00 64 00 00 E8 03 C8 00 64 00 E8 03
0019 0000 000E 03 00 EC 2C 7C 15 00 00 00 00 00 00 00 00
001B 0000 0007 00 00 00 00 00 00 00
001C 0000 0006 00 00 03 04 08 0A
0025 0000 0082 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
pkgname=watchdog-kick
pkgver=0.1
pkgrel=0
pkgdesc="Periodically kich watchdogs"
url="https://github.com/postmarketOS"
arch="noarch"
license="GPL2"
install="$pkgname.post-install"
options="!check"
source="
watchdog-kick.init
watchdog-kick
"
package() {
install -Dm755 "${srcdir}/watchdog-kick" \
"${pkgdir}/usr/sbin/watchdog-kick"
install -Dm755 "${srcdir}/watchdog-kick.init" \
"${pkgdir}/etc/init.d/watchdog-kick"
}
sha512sums="de1608d98a9132cf97459698ec5ead22947ecb938fc0f8fdb7684566c3466afe99303d954598f548dc27cd677f0172ffa3f21c88d84c5c7a288c45e4a11fca06 watchdog-kick.init
6c4d60db6e1b2b231ba6cc5a046be5436f348e3da49927bb98f89f1194a49ca07402cfa4a389936ce34936f4cfe15093f1c2a27b72375096475b98827e8a6ef5 watchdog-kick"

View file

@ -0,0 +1,20 @@
#!/bin/sh
watchdog_kick() {
while true; do
for wd in /dev/watchdog*; do
[ -c $wd ] && echo X > $wd
done
[ -z "$1" ] && sleep 10s || exit
done
}
if [ -z "$1" ]; then
watchdog_kick
else
if [ "$1" != "-1" ]; then
echo "Invalid argument"
exit 1
fi
watchdog_kick $1
fi

View file

@ -0,0 +1,27 @@
#!/sbin/openrc-run
cmd=/usr/sbin/watchdog-kick
pid=/run/watchdog-kick.pid
depend() {
after udev
}
start() {
ebegin "Starting watchdog-kick"
start-stop-daemon --start --exec $cmd --background --make-pidfile \
--pidfile $pid
eend $?
}
stop() {
ebegin "Stopping watchdog-kick"
start-stop-daemon --stop --exec $cmd --pidfile $pid
$cmd -1
eend $?
}
restart() {
stop
start
}

View file

@ -0,0 +1,3 @@
#!/bin/sh
rc-update -q add watchdog-kick sysinit