From f297140472566b1fd1c00677012ac456f44d877f Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 24 Dec 2018 14:57:19 +0100 Subject: [PATCH] Rebase patches for rpi_ws281x-git --- ...0001-Allow-to-adjust-build-directory.patch | 6 +- ...ter-to-uintptr_t-instead-of-uint32_t.patch | 51 ------------ ...02-Update-help-text-for-default-DMA.patch} | 6 +- rpi_ws281x/git/0003-Adjust-LED-defs.patch | 27 +++++++ ...n-from-proc-device-tree-on-arm64-clo.patch | 79 ------------------- rpi_ws281x/git/PKGBUILD | 16 ++-- 6 files changed, 40 insertions(+), 145 deletions(-) delete mode 100644 rpi_ws281x/git/0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch rename rpi_ws281x/git/{0003-Update-help-text-for-default-DMA.patch => 0002-Update-help-text-for-default-DMA.patch} (85%) create mode 100644 rpi_ws281x/git/0003-Adjust-LED-defs.patch delete mode 100644 rpi_ws281x/git/0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch diff --git a/rpi_ws281x/git/0001-Allow-to-adjust-build-directory.patch b/rpi_ws281x/git/0001-Allow-to-adjust-build-directory.patch index e37acdf4..f18116c2 100644 --- a/rpi_ws281x/git/0001-Allow-to-adjust-build-directory.patch +++ b/rpi_ws281x/git/0001-Allow-to-adjust-build-directory.patch @@ -1,7 +1,7 @@ -From 5291f6a3694f8622c5548a93b4e3ce65261fd9fc Mon Sep 17 00:00:00 2001 +From 4f4d7b74391db1cdec6b32d085090a9c6a8d4cad Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 1 Nov 2018 04:58:01 +0000 -Subject: [PATCH 1/5] Allow to adjust build directory +Subject: [PATCH 1/3] Allow to adjust build directory --- SConstruct | 3 ++- @@ -20,5 +20,5 @@ index 64c14c7..16ac279 100644 +SConscript('SConscript', variant_dir=GetOption('build'), duplicate=0); -- -2.19.1 +2.20.1 diff --git a/rpi_ws281x/git/0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch b/rpi_ws281x/git/0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch deleted file mode 100644 index 515673aa..00000000 --- a/rpi_ws281x/git/0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch +++ /dev/null @@ -1,51 +0,0 @@ -From a4c6fc90385b6be5cab7d9b70d234ebeef87a8cf Mon Sep 17 00:00:00 2001 -From: Martchus -Date: Thu, 1 Nov 2018 04:59:59 +0000 -Subject: [PATCH 2/5] Cast pointer to uintptr_t instead of uint32_t - -For compatibility with aarch64 ---- - mailbox.c | 4 ++-- - ws2811.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/mailbox.c b/mailbox.c -index f42e04a..23f7d5a 100644 ---- a/mailbox.c -+++ b/mailbox.c -@@ -67,8 +67,8 @@ void *mapmem(uint32_t base, uint32_t size, const char *mem_dev) { - } - - void *unmapmem(void *addr, uint32_t size) { -- uint32_t pagemask = ~0UL ^ (getpagesize() - 1); -- uint32_t baseaddr = (uint32_t)addr & pagemask; -+ uintptr_t pagemask = ~0UL ^ (getpagesize() - 1); -+ uintptr_t baseaddr = (uintptr_t)addr & pagemask; - int s; - - s = munmap((void *)baseaddr, size); -diff --git a/ws2811.c b/ws2811.c -index 6ac82bf..63e50fe 100644 ---- a/ws2811.c -+++ b/ws2811.c -@@ -392,7 +392,7 @@ static int setup_pwm(ws2811_t *ws2811) - - dma_cb->source_ad = addr_to_bus(device, device->pxl_raw); - -- dma_cb->dest_ad = (uint32_t)&((pwm_t *)PWM_PERIPH_PHYS)->fif1; -+ dma_cb->dest_ad = (uintptr_t)&((pwm_t *)PWM_PERIPH_PHYS)->fif1; - dma_cb->txfr_len = byte_count; - dma_cb->stride = 0; - dma_cb->nextconbk = 0; -@@ -457,7 +457,7 @@ static int setup_pcm(ws2811_t *ws2811) - RPI_DMA_TI_SRC_INC; // Increment src addr - - dma_cb->source_ad = addr_to_bus(device, device->pxl_raw); -- dma_cb->dest_ad = (uint32_t)&((pcm_t *)PCM_PERIPH_PHYS)->fifo; -+ dma_cb->dest_ad = (uintptr_t)&((pcm_t *)PCM_PERIPH_PHYS)->fifo; - dma_cb->txfr_len = byte_count; - dma_cb->stride = 0; - dma_cb->nextconbk = 0; --- -2.19.1 - diff --git a/rpi_ws281x/git/0003-Update-help-text-for-default-DMA.patch b/rpi_ws281x/git/0002-Update-help-text-for-default-DMA.patch similarity index 85% rename from rpi_ws281x/git/0003-Update-help-text-for-default-DMA.patch rename to rpi_ws281x/git/0002-Update-help-text-for-default-DMA.patch index 8a418ce5..e9ddbe7d 100644 --- a/rpi_ws281x/git/0003-Update-help-text-for-default-DMA.patch +++ b/rpi_ws281x/git/0002-Update-help-text-for-default-DMA.patch @@ -1,7 +1,7 @@ -From aef253cb667e4cc7352a3a8be8caafb8d4afd25e Mon Sep 17 00:00:00 2001 +From 4bba7f43328617ae742ed342e16d9fc5d8f1e0fe Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 1 Nov 2018 05:02:52 +0000 -Subject: [PATCH 3/5] Update help text for default DMA +Subject: [PATCH 2/3] Update help text for default DMA --- main.c | 2 +- @@ -21,5 +21,5 @@ index 85ecd67..f88414a 100644 " If omitted, default is 18 (PWM0)\n" "-i (--invert) - invert pin output (pulse LOW)\n" -- -2.19.1 +2.20.1 diff --git a/rpi_ws281x/git/0003-Adjust-LED-defs.patch b/rpi_ws281x/git/0003-Adjust-LED-defs.patch new file mode 100644 index 00000000..b5222ba6 --- /dev/null +++ b/rpi_ws281x/git/0003-Adjust-LED-defs.patch @@ -0,0 +1,27 @@ +From c5f98979c69d1bfbe1bba5349103d8872499dee8 Mon Sep 17 00:00:00 2001 +From: Martchus +Date: Thu, 1 Nov 2018 05:05:06 +0000 +Subject: [PATCH 3/3] Adjust LED defs + +--- + main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/main.c b/main.c +index f88414a..d15a06c 100644 +--- a/main.c ++++ b/main.c +@@ -63,8 +63,8 @@ static char VERSION[] = "XX.YY.ZZ"; + #define STRIP_TYPE WS2811_STRIP_GBR // WS2812/SK6812RGB integrated chip+leds + //#define STRIP_TYPE SK6812_STRIP_RGBW // SK6812RGBW (NOT SK6812RGB) + +-#define WIDTH 8 +-#define HEIGHT 8 ++#define WIDTH (24 + 16 + 6 + 1) ++#define HEIGHT 1 + #define LED_COUNT (WIDTH * HEIGHT) + + int width = WIDTH; +-- +2.20.1 + diff --git a/rpi_ws281x/git/0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch b/rpi_ws281x/git/0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch deleted file mode 100644 index aa6b24e8..00000000 --- a/rpi_ws281x/git/0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 8863b65325b1669dcf46310d5d4e8a57fa9d0823 Mon Sep 17 00:00:00 2001 -From: James Lu -Date: Sun, 26 Aug 2018 19:38:53 -0700 -Subject: [PATCH 4/5] Read CPU revision from /proc/device-tree on arm64 (closes - #289) - ---- - rpihw.c | 32 +++++++++++++++++++++++++++++--- - 1 file changed, 29 insertions(+), 3 deletions(-) - -diff --git a/rpihw.c b/rpihw.c -index a0df569..d825970 100644 ---- a/rpihw.c -+++ b/rpihw.c -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - #include "rpihw.h" - -@@ -324,9 +325,34 @@ static const rpi_hw_t rpi_hw_info[] = { - - const rpi_hw_t *rpi_hw_detect(void) - { -+ const rpi_hw_t *result = NULL; -+#ifdef __aarch64__ -+ // On ARM64, read revision from /proc/device-tree as it is not shown in -+ // /proc/cpuinfo -+ FILE *f = fopen("/proc/device-tree/system/linux,revision", "r"); -+ if (!f) -+ { -+ return NULL; -+ } -+ uint32_t rev; -+ fread(&rev, sizeof(uint32_t), 1, f); -+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+ rev = bswap_32(rev); // linux,revision appears to be in big endian -+ #endif -+ -+ for (unsigned i = 0; i < (sizeof(rpi_hw_info) / sizeof(rpi_hw_info[0])); i++) -+ { -+ uint32_t hwver = rpi_hw_info[i].hwver; -+ if (rev == hwver) -+ { -+ result = &rpi_hw_info[i]; -+ -+ goto done; -+ } -+ } -+#else - FILE *f = fopen("/proc/cpuinfo", "r"); - char line[LINE_WIDTH_MAX]; -- const rpi_hw_t *result = NULL; - - if (!f) - { -@@ -361,7 +387,7 @@ const rpi_hw_t *rpi_hw_detect(void) - // Take out warranty and manufacturer bits - hwver &= ~(RPI_WARRANTY_MASK | RPI_MANUFACTURER_MASK); - rev &= ~(RPI_WARRANTY_MASK | RPI_MANUFACTURER_MASK); -- -+ - if (rev == hwver) - { - result = &rpi_hw_info[i]; -@@ -371,7 +397,7 @@ const rpi_hw_t *rpi_hw_detect(void) - } - } - } -- -+#endif - done: - fclose(f); - --- -2.19.1 - diff --git a/rpi_ws281x/git/PKGBUILD b/rpi_ws281x/git/PKGBUILD index 06a3145b..f1ae7313 100644 --- a/rpi_ws281x/git/PKGBUILD +++ b/rpi_ws281x/git/PKGBUILD @@ -6,7 +6,7 @@ _reponame=rpi_ws281x pkgname=rpi_ws281x-git _name=${pkgname%-git} -pkgver=173.e4a05d6 +pkgver=182.14aacad pkgrel=1 arch=('armv6h' 'armv7h' 'aarch64') pkgdesc='Userspace Raspberry Pi PWM library for WS281X LEDs' @@ -17,15 +17,13 @@ provides=("${_name}") conflicts=("${_name}") url="https://github.com/jgarff/${_reponame}" source=("${_reponame}::git://github.com/jgarff/${_reponame}.git" - 0001-Allow-to-adjust-build-directory.patch - 0002-Cast-pointer-to-uintptr_t-instead-of-uint32_t.patch - 0003-Update-help-text-for-default-DMA.patch - 0004-Read-CPU-revision-from-proc-device-tree-on-arm64-clo.patch) + '0001-Allow-to-adjust-build-directory.patch' + '0002-Update-help-text-for-default-DMA.patch' + '0003-Adjust-LED-defs.patch') sha256sums=('SKIP' - 'd98ae1d48bc78e78da9488e1519b3751c1a91311fa4f054714f199aa82084436' - '3013ee02539e3d6120ae8c66db6dfff88ddf79ef38bc7badd11ff87ec2015ef7' - '4b14dceb422e48036367db0bbcb5fe8152e2b58b2fc213c31775c160512ee45b' - 'f1fac8430be31860324cb14b047182f88d4ab59b7bc186d16c0a782a68b54966') + '26119114589fc5aef067fd1de99b532c27416642aeab9ad1150dcc5badc95b59' + '2ca78207da848ac22d7c791c564988c9a0a0c407c710fe9540ac57a580c5df1c' + 'daaa7f46c988b7b37f5528361648ff2d830d3b929f0be032a9fdc4a751b9829e') prepare() { cd "$srcdir/$_reponame"