Re: [PATCH v5 8/8] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

2018-11-24 Thread kbuild test robot
Hi Charles,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[cannot apply to next-20181123]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Charles-Keepax/regulator-lochnagar-Move-driver-to-binding-from-DT/20181123-133943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/regulator/lochnagar-regulator.c:115:21: error: undefined identifier 
>> 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'
>> drivers/regulator/lochnagar-regulator.c:116:20: error: undefined identifier 
>> 'LOCHNAGAR2_P1_MICBIAS_SRC_MASK'
>> drivers/regulator/lochnagar-regulator.c:123:23: error: undefined identifier 
>> 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:148:31: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:149:32: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:150:29: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:151:30: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c:171:31: error: undefined identifier 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:172:32: error: undefined identifier 
>> 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK'
   drivers/regulator/lochnagar-regulator.c:186:31: error: undefined identifier 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:187:32: error: undefined identifier 
>> 'LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:201:31: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:202:32: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:203:29: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:204:30: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c: In function 
'lochnagar_micbias_of_parse':
   drivers/regulator/lochnagar-regulator.c:115:7: error: 
'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT' undeclared (first use in this function); did 
you mean 'LOCHNAGAR_DEVICE_ID_SHIFT'?
  LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
  ^~~
  LOCHNAGAR_DEVICE_ID_SHIFT
   drivers/regulator/lochnagar-regulator.c:115:7: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/regulator/lochnagar-regulator.c:116:13: error: 
'LOCHNAGAR2_P1_MICBIAS_SRC_MASK' undeclared (first use in this function); did 
you mean 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'?
 int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
^~
LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT
   In file included from drivers/regulator/lochnagar-regulator.c:18:0:
   drivers/regulator/lochnagar-regulator.c:124:7: error: 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared (first use in this function)
  LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
  ^
   include/linux/regmap.h:77:31: note: in definition of macro 
'regmap_update_bits'
 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
  ^~~
   drivers/regulator/lochnagar-regulator.c: At top level:
   drivers/regulator/lochnagar-regulator.c:148:17: error: 
'LOCHNAGAR2_MICVDD_CTRL1' undeclared here (not in a function); did you mean 
'LOCHNAGAR_MICVDD'?
  .enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
^~~
LOCHNAGAR_MICVDD
   drivers/regulator/lochnagar-regulator.c:149:18: error: 
'LOCHNAGAR2_MICVDD_REG_ENA_MASK' undeclared here (not in a function); did you 
mean 'LOCHNAGAR2_MICVDD_CTRL1'?
  .enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
 ^~
 LOCHNAGAR2_MICVDD_CTRL1
   drivers/regulator/lochnagar-regulator.c:150:15: error: 
'LOCHNAGAR2_MICVDD_CTRL2' undeclared here (not in a function); did you mean 
'LOCHNAGAR2_MICVDD_CTRL1'?
  .vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
  ^~~
  LOCHNAGAR2_MICVDD_CTRL1
   drivers/regulator/lochnagar-regulator.c:151:16: error: 
'LOCHNAGAR2_MICVDD_VSEL_MASK' undeclared here (not in a function); did you mean 
'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
  .vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
   ^~~
   

Re: [PATCH v5 8/8] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

2018-11-24 Thread kbuild test robot
Hi Charles,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[cannot apply to next-20181123]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Charles-Keepax/regulator-lochnagar-Move-driver-to-binding-from-DT/20181123-133943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/regulator/lochnagar-regulator.c:115:21: error: undefined identifier 
>> 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'
>> drivers/regulator/lochnagar-regulator.c:116:20: error: undefined identifier 
>> 'LOCHNAGAR2_P1_MICBIAS_SRC_MASK'
>> drivers/regulator/lochnagar-regulator.c:123:23: error: undefined identifier 
>> 'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:148:31: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:149:32: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:150:29: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:151:30: error: undefined identifier 
>> 'LOCHNAGAR2_MICVDD_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c:171:31: error: undefined identifier 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:172:32: error: undefined identifier 
>> 'LOCHNAGAR2_P1_INPUT_BIAS_ENA_MASK'
   drivers/regulator/lochnagar-regulator.c:186:31: error: undefined identifier 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:187:32: error: undefined identifier 
>> 'LOCHNAGAR2_P2_INPUT_BIAS_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:201:31: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_CTRL1'
>> drivers/regulator/lochnagar-regulator.c:202:32: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_REG_ENA_MASK'
>> drivers/regulator/lochnagar-regulator.c:203:29: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_CTRL2'
>> drivers/regulator/lochnagar-regulator.c:204:30: error: undefined identifier 
>> 'LOCHNAGAR2_VDDCORE_CDC_VSEL_MASK'
   drivers/regulator/lochnagar-regulator.c: In function 
'lochnagar_micbias_of_parse':
   drivers/regulator/lochnagar-regulator.c:115:7: error: 
'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT' undeclared (first use in this function); did 
you mean 'LOCHNAGAR_DEVICE_ID_SHIFT'?
  LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT;
  ^~~
  LOCHNAGAR_DEVICE_ID_SHIFT
   drivers/regulator/lochnagar-regulator.c:115:7: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/regulator/lochnagar-regulator.c:116:13: error: 
'LOCHNAGAR2_P1_MICBIAS_SRC_MASK' undeclared (first use in this function); did 
you mean 'LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT'?
 int mask = LOCHNAGAR2_P1_MICBIAS_SRC_MASK << shift;
^~
LOCHNAGAR2_P2_MICBIAS_SRC_SHIFT
   In file included from drivers/regulator/lochnagar-regulator.c:18:0:
   drivers/regulator/lochnagar-regulator.c:124:7: error: 
'LOCHNAGAR2_ANALOGUE_PATH_CTRL2' undeclared (first use in this function)
  LOCHNAGAR2_ANALOGUE_PATH_CTRL2,
  ^
   include/linux/regmap.h:77:31: note: in definition of macro 
'regmap_update_bits'
 regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
  ^~~
   drivers/regulator/lochnagar-regulator.c: At top level:
   drivers/regulator/lochnagar-regulator.c:148:17: error: 
'LOCHNAGAR2_MICVDD_CTRL1' undeclared here (not in a function); did you mean 
'LOCHNAGAR_MICVDD'?
  .enable_reg = LOCHNAGAR2_MICVDD_CTRL1,
^~~
LOCHNAGAR_MICVDD
   drivers/regulator/lochnagar-regulator.c:149:18: error: 
'LOCHNAGAR2_MICVDD_REG_ENA_MASK' undeclared here (not in a function); did you 
mean 'LOCHNAGAR2_MICVDD_CTRL1'?
  .enable_mask = LOCHNAGAR2_MICVDD_REG_ENA_MASK,
 ^~
 LOCHNAGAR2_MICVDD_CTRL1
   drivers/regulator/lochnagar-regulator.c:150:15: error: 
'LOCHNAGAR2_MICVDD_CTRL2' undeclared here (not in a function); did you mean 
'LOCHNAGAR2_MICVDD_CTRL1'?
  .vsel_reg = LOCHNAGAR2_MICVDD_CTRL2,
  ^~~
  LOCHNAGAR2_MICVDD_CTRL1
   drivers/regulator/lochnagar-regulator.c:151:16: error: 
'LOCHNAGAR2_MICVDD_VSEL_MASK' undeclared here (not in a function); did you mean 
'LOCHNAGAR2_MICVDD_REG_ENA_MASK'?
  .vsel_mask = LOCHNAGAR2_MICVDD_VSEL_MASK,
   ^~~
   

[PATCH v5 8/8] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

2018-11-20 Thread Charles Keepax
Lochnagar is an evaluation and development board for Cirrus
Logic Smart CODEC and Amp devices. It allows the connection of
most Cirrus Logic devices on mini-cards, as well as allowing
connection of various application processor systems to provide a
full evaluation platform. This driver supports the board
controller chip on the Lochnagar board.

Lochnagar provides many pins which can generally be used for an
audio function such as an AIF or a PDM interface, but also as
GPIOs.

Reviewed-by: Linus Walleij 
Signed-off-by: Charles Keepax 
---

Changes since v4:
 - Removed pinctrl-lochnagar.h and moved its contents into the source
   file
 - Removed template chip and just set values directly

Thanks,
Charles

 drivers/pinctrl/cirrus/Kconfig |   10 +
 drivers/pinctrl/cirrus/Makefile|2 +
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 1236 
 3 files changed, 1248 insertions(+)
 create mode 100644 drivers/pinctrl/cirrus/pinctrl-lochnagar.c

diff --git a/drivers/pinctrl/cirrus/Kconfig b/drivers/pinctrl/cirrus/Kconfig
index 27013e5949bc..74af07e25174 100644
--- a/drivers/pinctrl/cirrus/Kconfig
+++ b/drivers/pinctrl/cirrus/Kconfig
@@ -1,3 +1,13 @@
+config PINCTRL_LOCHNAGAR
+   tristate "Cirrus Logic Lochnagar pinctrl driver"
+   depends on MFD_LOCHNAGAR
+   select PINMUX
+   select PINCONF
+   select GENERIC_PINCONF
+   help
+ This driver supports configuring the GPIO and other pin configuration
+ of the Cirrus Logic Lochnagar audio development board.
+
 # This is all selected by the Madera MFD driver Kconfig options
 config PINCTRL_MADERA
tristate
diff --git a/drivers/pinctrl/cirrus/Makefile b/drivers/pinctrl/cirrus/Makefile
index 6e4938cde9e3..20baebf438f6 100644
--- a/drivers/pinctrl/cirrus/Makefile
+++ b/drivers/pinctrl/cirrus/Makefile
@@ -1,4 +1,6 @@
 # Cirrus Logic pinctrl drivers
+obj-$(CONFIG_PINCTRL_LOCHNAGAR)+= pinctrl-lochnagar.o
+
 pinctrl-madera-objs:= pinctrl-madera-core.o
 ifeq ($(CONFIG_PINCTRL_CS47L35),y)
 pinctrl-madera-objs+= pinctrl-cs47l35.o
diff --git a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c 
b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
new file mode 100644
index ..35d40200e432
--- /dev/null
+++ b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
@@ -0,0 +1,1236 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Lochnagar pin and GPIO control
+ *
+ * Copyright (c) 2017-2018 Cirrus Logic, Inc. and
+ * Cirrus Logic International Semiconductor Ltd.
+ *
+ * Author: Charles Keepax 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "../pinctrl-utils.h"
+
+#define LN2_NUM_GPIO_CHANNELS  16
+
+#define LN_CDC_AIF1_STR"codec-aif1"
+#define LN_CDC_AIF2_STR"codec-aif2"
+#define LN_CDC_AIF3_STR"codec-aif3"
+#define LN_DSP_AIF1_STR"dsp-aif1"
+#define LN_DSP_AIF2_STR"dsp-aif2"
+#define LN_PSIA1_STR   "psia1"
+#define LN_PSIA2_STR   "psia2"
+#define LN_GF_AIF1_STR "gf-aif1"
+#define LN_GF_AIF2_STR "gf-aif2"
+#define LN_GF_AIF3_STR "gf-aif3"
+#define LN_GF_AIF4_STR "gf-aif4"
+#define LN_SPDIF_AIF_STR   "spdif-aif"
+#define LN_USB_AIF1_STR"usb-aif1"
+#define LN_USB_AIF2_STR"usb-aif2"
+#define LN_ADAT_AIF_STR"adat-aif"
+#define LN_SOUNDCARD_AIF_STR   "soundcard-aif"
+
+#define LN_PIN_GPIO(REV, ID, NAME, REG, SHIFT, INVERT) \
+static const struct lochnagar_pin lochnagar##REV##_##ID##_pin = { \
+   .name = NAME, .type = LN_PTYPE_GPIO, .reg = LOCHNAGAR##REV##_##REG, \
+   .shift = LOCHNAGAR##REV##_##SHIFT##_SHIFT, .invert = INVERT, \
+}
+
+#define LN_PIN_SAIF(REV, ID, NAME) \
+static const struct lochnagar_pin lochnagar##REV##_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_AIF, }
+
+#define LN_PIN_AIF(REV, ID) \
+   LN_PIN_SAIF(REV, ID##_BCLK,  LN_##ID##_STR"-bclk"); \
+   LN_PIN_SAIF(REV, ID##_LRCLK, LN_##ID##_STR"-lrclk"); \
+   LN_PIN_SAIF(REV, ID##_RXDAT, LN_##ID##_STR"-rxdat"); \
+   LN_PIN_SAIF(REV, ID##_TXDAT, LN_##ID##_STR"-txdat")
+
+#define LN1_PIN_GPIO(ID, NAME, REG, SHIFT, INVERT) \
+   LN_PIN_GPIO(1, ID, NAME, REG, SHIFT, INVERT)
+
+#define LN1_PIN_MUX(ID, NAME) \
+static const struct lochnagar_pin lochnagar1_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_MUX, .reg = LOCHNAGAR1_##ID, }
+
+#define LN1_PIN_AIF(ID) LN_PIN_AIF(1, ID)
+
+#define LN2_PIN_GPIO(ID, NAME, REG, SHIFT, INVERT) \
+   LN_PIN_GPIO(2, ID, NAME, REG, SHIFT, INVERT)
+
+#define LN2_PIN_MUX(ID, NAME) \
+static const struct lochnagar_pin lochnagar2_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_MUX, .reg = LOCHNAGAR2_GPIO_##ID, }
+
+#define LN2_PIN_AIF(ID) LN_PIN_AIF(2, ID)
+
+#define LN2_PIN_GAI(ID) \
+   

[PATCH v5 8/8] pinctrl: lochnagar: Add support for the Cirrus Logic Lochnagar

2018-11-20 Thread Charles Keepax
Lochnagar is an evaluation and development board for Cirrus
Logic Smart CODEC and Amp devices. It allows the connection of
most Cirrus Logic devices on mini-cards, as well as allowing
connection of various application processor systems to provide a
full evaluation platform. This driver supports the board
controller chip on the Lochnagar board.

Lochnagar provides many pins which can generally be used for an
audio function such as an AIF or a PDM interface, but also as
GPIOs.

Reviewed-by: Linus Walleij 
Signed-off-by: Charles Keepax 
---

Changes since v4:
 - Removed pinctrl-lochnagar.h and moved its contents into the source
   file
 - Removed template chip and just set values directly

Thanks,
Charles

 drivers/pinctrl/cirrus/Kconfig |   10 +
 drivers/pinctrl/cirrus/Makefile|2 +
 drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 1236 
 3 files changed, 1248 insertions(+)
 create mode 100644 drivers/pinctrl/cirrus/pinctrl-lochnagar.c

diff --git a/drivers/pinctrl/cirrus/Kconfig b/drivers/pinctrl/cirrus/Kconfig
index 27013e5949bc..74af07e25174 100644
--- a/drivers/pinctrl/cirrus/Kconfig
+++ b/drivers/pinctrl/cirrus/Kconfig
@@ -1,3 +1,13 @@
+config PINCTRL_LOCHNAGAR
+   tristate "Cirrus Logic Lochnagar pinctrl driver"
+   depends on MFD_LOCHNAGAR
+   select PINMUX
+   select PINCONF
+   select GENERIC_PINCONF
+   help
+ This driver supports configuring the GPIO and other pin configuration
+ of the Cirrus Logic Lochnagar audio development board.
+
 # This is all selected by the Madera MFD driver Kconfig options
 config PINCTRL_MADERA
tristate
diff --git a/drivers/pinctrl/cirrus/Makefile b/drivers/pinctrl/cirrus/Makefile
index 6e4938cde9e3..20baebf438f6 100644
--- a/drivers/pinctrl/cirrus/Makefile
+++ b/drivers/pinctrl/cirrus/Makefile
@@ -1,4 +1,6 @@
 # Cirrus Logic pinctrl drivers
+obj-$(CONFIG_PINCTRL_LOCHNAGAR)+= pinctrl-lochnagar.o
+
 pinctrl-madera-objs:= pinctrl-madera-core.o
 ifeq ($(CONFIG_PINCTRL_CS47L35),y)
 pinctrl-madera-objs+= pinctrl-cs47l35.o
diff --git a/drivers/pinctrl/cirrus/pinctrl-lochnagar.c 
b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
new file mode 100644
index ..35d40200e432
--- /dev/null
+++ b/drivers/pinctrl/cirrus/pinctrl-lochnagar.c
@@ -0,0 +1,1236 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Lochnagar pin and GPIO control
+ *
+ * Copyright (c) 2017-2018 Cirrus Logic, Inc. and
+ * Cirrus Logic International Semiconductor Ltd.
+ *
+ * Author: Charles Keepax 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "../pinctrl-utils.h"
+
+#define LN2_NUM_GPIO_CHANNELS  16
+
+#define LN_CDC_AIF1_STR"codec-aif1"
+#define LN_CDC_AIF2_STR"codec-aif2"
+#define LN_CDC_AIF3_STR"codec-aif3"
+#define LN_DSP_AIF1_STR"dsp-aif1"
+#define LN_DSP_AIF2_STR"dsp-aif2"
+#define LN_PSIA1_STR   "psia1"
+#define LN_PSIA2_STR   "psia2"
+#define LN_GF_AIF1_STR "gf-aif1"
+#define LN_GF_AIF2_STR "gf-aif2"
+#define LN_GF_AIF3_STR "gf-aif3"
+#define LN_GF_AIF4_STR "gf-aif4"
+#define LN_SPDIF_AIF_STR   "spdif-aif"
+#define LN_USB_AIF1_STR"usb-aif1"
+#define LN_USB_AIF2_STR"usb-aif2"
+#define LN_ADAT_AIF_STR"adat-aif"
+#define LN_SOUNDCARD_AIF_STR   "soundcard-aif"
+
+#define LN_PIN_GPIO(REV, ID, NAME, REG, SHIFT, INVERT) \
+static const struct lochnagar_pin lochnagar##REV##_##ID##_pin = { \
+   .name = NAME, .type = LN_PTYPE_GPIO, .reg = LOCHNAGAR##REV##_##REG, \
+   .shift = LOCHNAGAR##REV##_##SHIFT##_SHIFT, .invert = INVERT, \
+}
+
+#define LN_PIN_SAIF(REV, ID, NAME) \
+static const struct lochnagar_pin lochnagar##REV##_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_AIF, }
+
+#define LN_PIN_AIF(REV, ID) \
+   LN_PIN_SAIF(REV, ID##_BCLK,  LN_##ID##_STR"-bclk"); \
+   LN_PIN_SAIF(REV, ID##_LRCLK, LN_##ID##_STR"-lrclk"); \
+   LN_PIN_SAIF(REV, ID##_RXDAT, LN_##ID##_STR"-rxdat"); \
+   LN_PIN_SAIF(REV, ID##_TXDAT, LN_##ID##_STR"-txdat")
+
+#define LN1_PIN_GPIO(ID, NAME, REG, SHIFT, INVERT) \
+   LN_PIN_GPIO(1, ID, NAME, REG, SHIFT, INVERT)
+
+#define LN1_PIN_MUX(ID, NAME) \
+static const struct lochnagar_pin lochnagar1_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_MUX, .reg = LOCHNAGAR1_##ID, }
+
+#define LN1_PIN_AIF(ID) LN_PIN_AIF(1, ID)
+
+#define LN2_PIN_GPIO(ID, NAME, REG, SHIFT, INVERT) \
+   LN_PIN_GPIO(2, ID, NAME, REG, SHIFT, INVERT)
+
+#define LN2_PIN_MUX(ID, NAME) \
+static const struct lochnagar_pin lochnagar2_##ID##_pin = \
+   { .name = NAME, .type = LN_PTYPE_MUX, .reg = LOCHNAGAR2_GPIO_##ID, }
+
+#define LN2_PIN_AIF(ID) LN_PIN_AIF(2, ID)
+
+#define LN2_PIN_GAI(ID) \
+