linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mfd: wcd934x: add mbhc interrupts
@ 2021-05-10  9:12 Srinivas Kandagatla
  2021-05-10  9:12 ` [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts Srinivas Kandagatla
  2021-05-10  9:12 ` [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support Srinivas Kandagatla
  0 siblings, 2 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2021-05-10  9:12 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-kernel, alsa-devel, Srinivas Kandagatla

This patchset adds interrupts required to enable MBHC (Mulit Button
Headset Control) support for Jack and headset button detection
in WCD938x Codec.

Codec side patches are sent in a separate patch set.

Tested it on Lenovo Yoga C630.

--srini

Srinivas Kandagatla (2):
  mfd: wcd934x: add macro for adding new interrupts
  mfd: wcd934x: add additional interrupts required for MBHC support

 drivers/mfd/wcd934x.c | 50 +++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts
  2021-05-10  9:12 [PATCH 0/2] mfd: wcd934x: add mbhc interrupts Srinivas Kandagatla
@ 2021-05-10  9:12 ` Srinivas Kandagatla
  2021-05-19 12:01   ` Lee Jones
  2021-05-10  9:12 ` [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support Srinivas Kandagatla
  1 sibling, 1 reply; 5+ messages in thread
From: Srinivas Kandagatla @ 2021-05-10  9:12 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-kernel, alsa-devel, Srinivas Kandagatla

Currently only two interrupts supported is added in wcd934x interrupt controller,
however if we are adding more interrupts the file will become too much unreadable.

So add a macro to make adding new interrupts easy and also convert existing
slim and soundwire interrupts to use it.
This is in preparation to enable Multi Button Headset Control support on this
codec.

WCD934x supports Multi Button Headset control which enable headset detection
along with headset button detection.

This patch adds interrupts required for MBHC functionality.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mfd/wcd934x.c | 43 +++++++++++++++++--------------------------
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
index c274d733b656..53d46fadcf5a 100644
--- a/drivers/mfd/wcd934x.c
+++ b/drivers/mfd/wcd934x.c
@@ -17,6 +17,21 @@
 #include <linux/regulator/consumer.h>
 #include <linux/slimbus.h>
 
+#define WCD934X_REGMAP_IRQ_REG(_irq, _off, _mask)		\
+	[_irq] = {						\
+		.reg_offset = (_off),				\
+		.mask = (_mask),				\
+		.type = {					\
+			.type_reg_offset = (_off),		\
+			.types_supported = IRQ_TYPE_EDGE_BOTH,	\
+			.type_reg_mask  = (_mask),		\
+			.type_level_low_val = (_mask),		\
+			.type_level_high_val = (_mask),		\
+			.type_falling_val = 0,			\
+			.type_rising_val = 0,			\
+		},						\
+	}
+
 static const struct mfd_cell wcd934x_devices[] = {
 	{
 		.name = "wcd934x-codec",
@@ -30,32 +45,8 @@ static const struct mfd_cell wcd934x_devices[] = {
 };
 
 static const struct regmap_irq wcd934x_irqs[] = {
-	[WCD934X_IRQ_SLIMBUS] = {
-		.reg_offset = 0,
-		.mask = BIT(0),
-		.type = {
-			.type_reg_offset = 0,
-			.types_supported = IRQ_TYPE_EDGE_BOTH,
-			.type_reg_mask  = BIT(0),
-			.type_level_low_val = BIT(0),
-			.type_level_high_val = BIT(0),
-			.type_falling_val = 0,
-			.type_rising_val = 0,
-		},
-	},
-	[WCD934X_IRQ_SOUNDWIRE] = {
-		.reg_offset = 2,
-		.mask = BIT(4),
-		.type = {
-			.type_reg_offset = 2,
-			.types_supported = IRQ_TYPE_EDGE_BOTH,
-			.type_reg_mask  = BIT(4),
-			.type_level_low_val = BIT(4),
-			.type_level_high_val = BIT(4),
-			.type_falling_val = 0,
-			.type_rising_val = 0,
-		},
-	},
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SLIMBUS, 0, BIT(0)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
 };
 
 static const struct regmap_irq_chip wcd934x_regmap_irq_chip = {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support
  2021-05-10  9:12 [PATCH 0/2] mfd: wcd934x: add mbhc interrupts Srinivas Kandagatla
  2021-05-10  9:12 ` [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts Srinivas Kandagatla
@ 2021-05-10  9:12 ` Srinivas Kandagatla
  2021-05-19 12:01   ` Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Srinivas Kandagatla @ 2021-05-10  9:12 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-kernel, alsa-devel, Srinivas Kandagatla

WCD934x supports Multi Button Headset control which enable headset detection
along with headset button detection.

This patch adds interrupts required for MBHC functionality.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mfd/wcd934x.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
index 53d46fadcf5a..aa19a6a4fdbf 100644
--- a/drivers/mfd/wcd934x.c
+++ b/drivers/mfd/wcd934x.c
@@ -46,6 +46,13 @@ static const struct mfd_cell wcd934x_devices[] = {
 
 static const struct regmap_irq wcd934x_irqs[] = {
 	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SLIMBUS, 0, BIT(0)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_HPH_PA_OCPL_FAULT, 0, BIT(2)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_HPH_PA_OCPR_FAULT, 0, BIT(3)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_MBHC_SW_DET, 1, BIT(0)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_MBHC_ELECT_INS_REM_DET, 1, BIT(1)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_MBHC_BUTTON_PRESS_DET, 1, BIT(2)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_MBHC_BUTTON_RELEASE_DET, 1, BIT(3)),
+	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_MBHC_ELECT_INS_REM_LEG_DET, 1, BIT(4)),
 	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
 };
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts
  2021-05-10  9:12 ` [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts Srinivas Kandagatla
@ 2021-05-19 12:01   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2021-05-19 12:01 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: linux-kernel, alsa-devel

On Mon, 10 May 2021, Srinivas Kandagatla wrote:

> Currently only two interrupts supported is added in wcd934x interrupt controller,
> however if we are adding more interrupts the file will become too much unreadable.
> 
> So add a macro to make adding new interrupts easy and also convert existing
> slim and soundwire interrupts to use it.
> This is in preparation to enable Multi Button Headset Control support on this
> codec.
> 
> WCD934x supports Multi Button Headset control which enable headset detection
> along with headset button detection.
> 
> This patch adds interrupts required for MBHC functionality.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/mfd/wcd934x.c | 43 +++++++++++++++++--------------------------
>  1 file changed, 17 insertions(+), 26 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support
  2021-05-10  9:12 ` [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support Srinivas Kandagatla
@ 2021-05-19 12:01   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2021-05-19 12:01 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: linux-kernel, alsa-devel

On Mon, 10 May 2021, Srinivas Kandagatla wrote:

> WCD934x supports Multi Button Headset control which enable headset detection
> along with headset button detection.
> 
> This patch adds interrupts required for MBHC functionality.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/mfd/wcd934x.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-19 12:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  9:12 [PATCH 0/2] mfd: wcd934x: add mbhc interrupts Srinivas Kandagatla
2021-05-10  9:12 ` [PATCH 1/2] mfd: wcd934x: add macro for adding new interrupts Srinivas Kandagatla
2021-05-19 12:01   ` Lee Jones
2021-05-10  9:12 ` [PATCH 2/2] mfd: wcd934x: add additional interrupts required for MBHC support Srinivas Kandagatla
2021-05-19 12:01   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).