Add libgpiod v2 compatible bitbang master

The API was completely re-invented with libgpiod 2.0. Hence we add a
new driver as we would otherwise only share boilerplate with the old
driver. The new API makes it easier to re-configure GPIO pins on-the-
fly. Which we will use to implement dual- and quad-i/o modes in the
future.

One downside of the new API is that there is no function to open a
chip by number anymore. So we have to emulate that behavior now for
backwards compatibility.

Change-Id: If6a02d98f15def51b61fe0c3f09092cf286a37eb
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/83
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/meson.build b/meson.build
index c14ab4b..940f113 100644
--- a/meson.build
+++ b/meson.build
@@ -298,7 +298,9 @@
     'systems' : [ 'linux' ],
     'deps'    : [ libgpiod ],
     'groups'  : [ group_gpiod, group_external ],
-    'srcs'    : files('linux_gpio_spi.c'),
+    'srcs'    : libgpiod.version() < '2.0.0'
+                  ? files('linux_gpio_spi.c')
+                  : files('linux_gpio2_spi.c'),
     'flags'   : [ '-DCONFIG_LINUX_GPIO_SPI=1' ],
   },
   'linux_mtd' : {