* [PATCH v2 01/19] ASoC: tlv320aic31xx: File header and copyright cleanup
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-30 12:29 ` Mark Brown
2017-11-30 12:33 ` Applied "ASoC: tlv320aic31xx: File header and copyright cleanup" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 02/19] ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void Andrew F. Davis
` (15 subsequent siblings)
16 siblings, 2 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
Fix header copyright tags, while we are here, also switch to SPDX
and fixup MODULE tags to match.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 26 +++++++++-----------------
sound/soc/codecs/tlv320aic31xx.h | 15 ++++-----------
2 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 4837f25b0760..b98d9b1f216f 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1,22 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * ALSA SoC TLV320AIC31XX codec driver
+ * ALSA SoC TLV320AIC31xx CODEC Driver
*
- * Copyright (C) 2014 Texas Instruments, Inc.
- *
- * Author: Jyri Sarha <jsarha@ti.com>
+ * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Jyri Sarha <jsarha@ti.com>
*
* Based on ground work by: Ajit Kulkarni <x0175765@ti.com>
*
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * The TLV320AIC31xx series of audio codec is a low-power, highly integrated
- * high performance codec which provides a stereo DAC, a mono ADC,
+ * The TLV320AIC31xx series of audio codecs are low-power, highly integrated
+ * high performance codecs which provides a stereo DAC, a mono ADC,
* and mono/stereo Class-D speaker driver.
*/
@@ -1414,6 +1406,6 @@ static struct i2c_driver aic31xx_i2c_driver = {
module_i2c_driver(aic31xx_i2c_driver);
-MODULE_DESCRIPTION("ASoC TLV320AIC3111 codec driver");
-MODULE_AUTHOR("Jyri Sarha");
-MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
+MODULE_DESCRIPTION("ASoC TLV320AIC31xx CODEC Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 730fb2058869..a9ea2f99eba0 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -1,17 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * ALSA SoC TLV320AIC31XX codec driver
- *
- * Copyright (C) 2013 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * ALSA SoC TLV320AIC31xx CODEC Driver Definitions
*
+ * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
*/
+
#ifndef _TLV320AIC31XX_H
#define _TLV320AIC31XX_H
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Re: [PATCH v2 01/19] ASoC: tlv320aic31xx: File header and copyright cleanup
2017-11-29 21:32 ` [PATCH v2 01/19] ASoC: tlv320aic31xx: File header and copyright cleanup Andrew F. Davis
@ 2017-11-30 12:29 ` Mark Brown
2017-11-30 12:33 ` Applied "ASoC: tlv320aic31xx: File header and copyright cleanup" to the asoc tree Mark Brown
1 sibling, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-11-30 12:29 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
[-- Attachment #1.1: Type: text/plain, Size: 535 bytes --]
On Wed, Nov 29, 2017 at 03:32:42PM -0600, Andrew F. Davis wrote:
> Fix header copyright tags, while we are here, also switch to SPDX
> and fixup MODULE tags to match.
> - * The TLV320AIC31xx series of audio codec is a low-power, highly integrated
> - * high performance codec which provides a stereo DAC, a mono ADC,
> + * The TLV320AIC31xx series of audio codecs are low-power, highly integrated
> + * high performance codecs which provides a stereo DAC, a mono ADC,
...and also correct some grammar in the description of the part.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: File header and copyright cleanup" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 01/19] ASoC: tlv320aic31xx: File header and copyright cleanup Andrew F. Davis
2017-11-30 12:29 ` Mark Brown
@ 2017-11-30 12:33 ` Mark Brown
1 sibling, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-11-30 12:33 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: File header and copyright cleanup
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From b1c52b7e7cc6a57128869008b84d98a4de78fe2d Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:42 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: File header and copyright cleanup
Fix header copyright tags, while we are here, also switch to SPDX
and fixup MODULE tags to match.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 26 +++++++++-----------------
sound/soc/codecs/tlv320aic31xx.h | 15 ++++-----------
2 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 4837f25b0760..b98d9b1f216f 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1,22 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * ALSA SoC TLV320AIC31XX codec driver
+ * ALSA SoC TLV320AIC31xx CODEC Driver
*
- * Copyright (C) 2014 Texas Instruments, Inc.
- *
- * Author: Jyri Sarha <jsarha@ti.com>
+ * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Jyri Sarha <jsarha@ti.com>
*
* Based on ground work by: Ajit Kulkarni <x0175765@ti.com>
*
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * The TLV320AIC31xx series of audio codec is a low-power, highly integrated
- * high performance codec which provides a stereo DAC, a mono ADC,
+ * The TLV320AIC31xx series of audio codecs are low-power, highly integrated
+ * high performance codecs which provides a stereo DAC, a mono ADC,
* and mono/stereo Class-D speaker driver.
*/
@@ -1414,6 +1406,6 @@ static struct i2c_driver aic31xx_i2c_driver = {
module_i2c_driver(aic31xx_i2c_driver);
-MODULE_DESCRIPTION("ASoC TLV320AIC3111 codec driver");
-MODULE_AUTHOR("Jyri Sarha");
-MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
+MODULE_DESCRIPTION("ASoC TLV320AIC31xx CODEC Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 730fb2058869..a9ea2f99eba0 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -1,17 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * ALSA SoC TLV320AIC31XX codec driver
- *
- * Copyright (C) 2013 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * ALSA SoC TLV320AIC31xx CODEC Driver Definitions
*
+ * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
*/
+
#ifndef _TLV320AIC31XX_H
#define _TLV320AIC31XX_H
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 02/19] ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 01/19] ASoC: tlv320aic31xx: File header and copyright cleanup Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-30 12:32 ` Applied "ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void" to the asoc tree Mark Brown
[not found] ` <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>
` (14 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
The return value is not checked, and even if it was there is nothing
we could do about it and messages are already printed.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index b98d9b1f216f..0563a49cc5e4 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1081,16 +1081,13 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
return 0;
}
-static int aic31xx_power_off(struct snd_soc_codec *codec)
+static void aic31xx_power_off(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
regcache_cache_only(aic31xx->regmap, true);
- ret = regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
- aic31xx->supplies);
-
- return ret;
+ regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
+ aic31xx->supplies);
}
static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 02/19] ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void Andrew F. Davis
@ 2017-11-30 12:32 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-11-30 12:32 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: Change aic31xx_power_off return type to void
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From c7734e8e7eddf065c15e865b8de4224b01f03409 Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:43 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Change aic31xx_power_off return type to
void
The return value is not checked, and even if it was there is nothing
we could do about it and messages are already printed.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index b98d9b1f216f..0563a49cc5e4 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1081,16 +1081,13 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
return 0;
}
-static int aic31xx_power_off(struct snd_soc_codec *codec)
+static void aic31xx_power_off(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
regcache_cache_only(aic31xx->regmap, true);
- ret = regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
- aic31xx->supplies);
-
- return ret;
+ regulator_bulk_disable(ARRAY_SIZE(aic31xx->supplies),
+ aic31xx->supplies);
}
static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
[parent not found: <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>]
* [PATCH v2 03/19] ASoC: tlv320aic31xx: Move ACPI table next to OF table
[not found] ` <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-30 12:32 ` Applied "ASoC: tlv320aic31xx: Move ACPI table next to OF table" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 18/19] ASoC: tlv320aic31xx: Add headphone/headset detection Andrew F. Davis
2 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew F . Davis
Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
---
sound/soc/codecs/tlv320aic31xx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 0563a49cc5e4..d974e8651e30 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1285,6 +1285,14 @@ static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
}
#endif /* CONFIG_OF */
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id aic31xx_acpi_match[] = {
+ { "10TI3100", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
+#endif
+
static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
{
int ret, i;
@@ -1382,14 +1390,6 @@ static const struct i2c_device_id aic31xx_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id);
-#ifdef CONFIG_ACPI
-static const struct acpi_device_id aic31xx_acpi_match[] = {
- { "10TI3100", 0 },
- { }
-};
-MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
-#endif
-
static struct i2c_driver aic31xx_i2c_driver = {
.driver = {
.name = "tlv320aic31xx-codec",
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: Move ACPI table next to OF table" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 03/19] ASoC: tlv320aic31xx: Move ACPI table next to OF table Andrew F. Davis
@ 2017-11-30 12:32 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-11-30 12:32 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: Move ACPI table next to OF table
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 09303601bacda714220048a61f6864f88594b231 Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:44 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Move ACPI table next to OF table
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 0563a49cc5e4..d974e8651e30 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1285,6 +1285,14 @@ static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
}
#endif /* CONFIG_OF */
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id aic31xx_acpi_match[] = {
+ { "10TI3100", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
+#endif
+
static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
{
int ret, i;
@@ -1382,14 +1390,6 @@ static const struct i2c_device_id aic31xx_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id);
-#ifdef CONFIG_ACPI
-static const struct acpi_device_id aic31xx_acpi_match[] = {
- { "10TI3100", 0 },
- { }
-};
-MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
-#endif
-
static struct i2c_driver aic31xx_i2c_driver = {
.driver = {
.name = "tlv320aic31xx-codec",
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
[not found] ` <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>
2017-11-29 21:32 ` [PATCH v2 03/19] ASoC: tlv320aic31xx: Move ACPI table next to OF table Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-04 16:47 ` Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 18/19] ASoC: tlv320aic31xx: Add headphone/headset detection Andrew F. Davis
2 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew F . Davis
Move to using newer gpiod_* GPIO handling functions. This simplifies
the code and eases dropping platform data in the next patch. Also
remember GPIO are active low, so set "1" to reset.
Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
---
sound/soc/codecs/tlv320aic31xx.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index c84febd991a0..ab03a19f6aaa 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -157,6 +157,7 @@ struct aic31xx_priv {
u8 i2c_regs_status;
struct device *dev;
struct regmap *regmap;
+ struct gpio_desc *gpio_reset;
struct aic31xx_pdata pdata;
struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
@@ -1020,8 +1021,8 @@ static int aic31xx_regulator_event(struct notifier_block *nb,
* Put codec to reset and as at least one of the
* supplies was disabled.
*/
- if (gpio_is_valid(aic31xx->pdata.gpio_reset))
- gpio_set_value(aic31xx->pdata.gpio_reset, 0);
+ if (aic31xx->gpio_reset)
+ gpiod_set_value(aic31xx->gpio_reset, 1);
regcache_mark_dirty(aic31xx->regmap);
dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
@@ -1073,8 +1074,8 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
if (ret)
return ret;
- if (gpio_is_valid(aic31xx->pdata.gpio_reset)) {
- gpio_set_value(aic31xx->pdata.gpio_reset, 1);
+ if (aic31xx->gpio_reset) {
+ gpiod_set_value(aic31xx->gpio_reset, 0);
udelay(100);
}
regcache_cache_only(aic31xx->regmap, false);
@@ -1334,15 +1335,11 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
else if (aic31xx->dev->of_node)
aic31xx_pdata_from_of(aic31xx);
- if (aic31xx->pdata.gpio_reset) {
- ret = devm_gpio_request_one(aic31xx->dev,
- aic31xx->pdata.gpio_reset,
- GPIOF_OUT_INIT_HIGH,
- "aic31xx-reset-pin");
- if (ret < 0) {
- dev_err(aic31xx->dev, "not able to acquire gpio\n");
- return ret;
- }
+ aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(aic31xx->gpio_reset)) {
+ dev_err(aic31xx->dev, "not able to acquire gpio\n");
+ return PTR_ERR(aic31xx->gpio_reset);
}
for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Re: [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
2017-11-29 21:32 ` [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API Andrew F. Davis
@ 2017-12-04 16:47 ` Andrew F. Davis
2017-12-05 21:23 ` Andrew F. Davis
0 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-12-04 16:47 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel
On 11/29/2017 03:32 PM, Andrew F. Davis wrote:
> Move to using newer gpiod_* GPIO handling functions. This simplifies
> the code and eases dropping platform data in the next patch. Also
> remember GPIO are active low, so set "1" to reset.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
Kbuild bot seems mad a this one, looks like I need to include
linux/gpio/consumer.h, will fix for v3.
> sound/soc/codecs/tlv320aic31xx.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
> index c84febd991a0..ab03a19f6aaa 100644
> --- a/sound/soc/codecs/tlv320aic31xx.c
> +++ b/sound/soc/codecs/tlv320aic31xx.c
> @@ -157,6 +157,7 @@ struct aic31xx_priv {
> u8 i2c_regs_status;
> struct device *dev;
> struct regmap *regmap;
> + struct gpio_desc *gpio_reset;
> struct aic31xx_pdata pdata;
> struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
> struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
> @@ -1020,8 +1021,8 @@ static int aic31xx_regulator_event(struct notifier_block *nb,
> * Put codec to reset and as at least one of the
> * supplies was disabled.
> */
> - if (gpio_is_valid(aic31xx->pdata.gpio_reset))
> - gpio_set_value(aic31xx->pdata.gpio_reset, 0);
> + if (aic31xx->gpio_reset)
> + gpiod_set_value(aic31xx->gpio_reset, 1);
>
> regcache_mark_dirty(aic31xx->regmap);
> dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
> @@ -1073,8 +1074,8 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
> if (ret)
> return ret;
>
> - if (gpio_is_valid(aic31xx->pdata.gpio_reset)) {
> - gpio_set_value(aic31xx->pdata.gpio_reset, 1);
> + if (aic31xx->gpio_reset) {
> + gpiod_set_value(aic31xx->gpio_reset, 0);
> udelay(100);
> }
> regcache_cache_only(aic31xx->regmap, false);
> @@ -1334,15 +1335,11 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
> else if (aic31xx->dev->of_node)
> aic31xx_pdata_from_of(aic31xx);
>
> - if (aic31xx->pdata.gpio_reset) {
> - ret = devm_gpio_request_one(aic31xx->dev,
> - aic31xx->pdata.gpio_reset,
> - GPIOF_OUT_INIT_HIGH,
> - "aic31xx-reset-pin");
> - if (ret < 0) {
> - dev_err(aic31xx->dev, "not able to acquire gpio\n");
> - return ret;
> - }
> + aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
> + GPIOD_OUT_LOW);
> + if (IS_ERR(aic31xx->gpio_reset)) {
> + dev_err(aic31xx->dev, "not able to acquire gpio\n");
> + return PTR_ERR(aic31xx->gpio_reset);
> }
>
> for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
>
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
2017-12-04 16:47 ` Andrew F. Davis
@ 2017-12-05 21:23 ` Andrew F. Davis
2017-12-06 12:46 ` Mark Brown
0 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-12-05 21:23 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel
On 12/04/2017 10:47 AM, Andrew F. Davis wrote:
> On 11/29/2017 03:32 PM, Andrew F. Davis wrote:
>> Move to using newer gpiod_* GPIO handling functions. This simplifies
>> the code and eases dropping platform data in the next patch. Also
>> remember GPIO are active low, so set "1" to reset.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> ---
>
>
> Kbuild bot seems mad a this one, looks like I need to include
> linux/gpio/consumer.h, will fix for v3.
>
Looks like you already have this in your -next branch, how do you want
this fix, I can send a delta patch with the added include, a new v3
version that you can replace the patch in-tree with, or if it's easier
for you manually fix in-tree?
>
>> sound/soc/codecs/tlv320aic31xx.c | 23 ++++++++++-------------
>> 1 file changed, 10 insertions(+), 13 deletions(-)
>>
>> diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
>> index c84febd991a0..ab03a19f6aaa 100644
>> --- a/sound/soc/codecs/tlv320aic31xx.c
>> +++ b/sound/soc/codecs/tlv320aic31xx.c
>> @@ -157,6 +157,7 @@ struct aic31xx_priv {
>> u8 i2c_regs_status;
>> struct device *dev;
>> struct regmap *regmap;
>> + struct gpio_desc *gpio_reset;
>> struct aic31xx_pdata pdata;
>> struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
>> struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
>> @@ -1020,8 +1021,8 @@ static int aic31xx_regulator_event(struct notifier_block *nb,
>> * Put codec to reset and as at least one of the
>> * supplies was disabled.
>> */
>> - if (gpio_is_valid(aic31xx->pdata.gpio_reset))
>> - gpio_set_value(aic31xx->pdata.gpio_reset, 0);
>> + if (aic31xx->gpio_reset)
>> + gpiod_set_value(aic31xx->gpio_reset, 1);
>>
>> regcache_mark_dirty(aic31xx->regmap);
>> dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
>> @@ -1073,8 +1074,8 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
>> if (ret)
>> return ret;
>>
>> - if (gpio_is_valid(aic31xx->pdata.gpio_reset)) {
>> - gpio_set_value(aic31xx->pdata.gpio_reset, 1);
>> + if (aic31xx->gpio_reset) {
>> + gpiod_set_value(aic31xx->gpio_reset, 0);
>> udelay(100);
>> }
>> regcache_cache_only(aic31xx->regmap, false);
>> @@ -1334,15 +1335,11 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
>> else if (aic31xx->dev->of_node)
>> aic31xx_pdata_from_of(aic31xx);
>>
>> - if (aic31xx->pdata.gpio_reset) {
>> - ret = devm_gpio_request_one(aic31xx->dev,
>> - aic31xx->pdata.gpio_reset,
>> - GPIOF_OUT_INIT_HIGH,
>> - "aic31xx-reset-pin");
>> - if (ret < 0) {
>> - dev_err(aic31xx->dev, "not able to acquire gpio\n");
>> - return ret;
>> - }
>> + aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
>> + GPIOD_OUT_LOW);
>> + if (IS_ERR(aic31xx->gpio_reset)) {
>> + dev_err(aic31xx->dev, "not able to acquire gpio\n");
>> + return PTR_ERR(aic31xx->gpio_reset);
>> }
>>
>> for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
>>
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
2017-12-05 21:23 ` Andrew F. Davis
@ 2017-12-06 12:46 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-06 12:46 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
[-- Attachment #1.1: Type: text/plain, Size: 683 bytes --]
On Tue, Dec 05, 2017 at 03:23:49PM -0600, Andrew F. Davis wrote:
> On 12/04/2017 10:47 AM, Andrew F. Davis wrote:
> > Kbuild bot seems mad a this one, looks like I need to include
> > linux/gpio/consumer.h, will fix for v3.
> Looks like you already have this in your -next branch, how do you want
> this fix, I can send a delta patch with the added include, a new v3
> version that you can replace the patch in-tree with, or if it's easier
> for you manually fix in-tree?
As the patch applied mail says:
| If any updates are required or you are submitting further changes they
| should be sent as incremental updates against current git, existing
| patches will not be replaced.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v2 18/19] ASoC: tlv320aic31xx: Add headphone/headset detection
[not found] ` <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>
2017-11-29 21:32 ` [PATCH v2 03/19] ASoC: tlv320aic31xx: Move ACPI table next to OF table Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 08/19] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
[not found] ` <20171129213300.20021-19-afd-l0cyMroinI0@public.gmane.org>
2 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew F . Davis
This device can detect the insertion/removal of headphones and headsets.
Enable reporting this status by enabling this interrupt and forwarding
this to upper-layers if a jack has been defined.
This jack definition and the resulting operation from a jack detection
event must currently be defined by sound card platform code until CODEC
outputs to jack mappings can be defined generically.
Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
---
sound/soc/codecs/tlv320aic31xx.c | 33 +++++++++++++++++++++++++++++++++
sound/soc/codecs/tlv320aic31xx.h | 11 +++++++++++
2 files changed, 44 insertions(+)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 094b1596f9cc..471b31be55d1 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -25,6 +25,7 @@
#include <linux/of_gpio.h>
#include <linux/slab.h>
#include <sound/core.h>
+#include <sound/jack.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -89,6 +90,7 @@ static bool aic31xx_volatile(struct device *dev, unsigned int reg)
case AIC31XX_INTRADCFLAG: /* Sticky interrupt flags */
case AIC31XX_INTRDACFLAG2:
case AIC31XX_INTRADCFLAG2:
+ case AIC31XX_HSDETECT:
return true;
}
return false;
@@ -161,6 +163,7 @@ struct aic31xx_priv {
struct gpio_desc *gpio_reset;
int micbias_vg;
struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
+ struct snd_soc_jack *jack;
unsigned int sysclk;
u8 p_div;
int rate_div_line;
@@ -1277,6 +1280,32 @@ static irqreturn_t aic31xx_irq(int irq, void *data)
if (value & AIC31XX_HPRSCDETECT)
dev_err(dev, "Short circuit on Right output is detected\n");
+ if (value & AIC31XX_HSPLUG) {
+ int status = 0;
+
+ ret = regmap_read(aic31xx->regmap, AIC31XX_HSDETECT, &value);
+ if (ret) {
+ dev_err(dev, "Failed to read headset type: %d\n", ret);
+ return IRQ_NONE;
+ }
+
+ switch ((value & AIC31XX_HSD_TYPE_MASK) >>
+ AIC31XX_HSD_TYPE_SHIFT) {
+ case AIC31XX_HSD_HP:
+ status |= SND_JACK_HEADPHONE;
+ break;
+ case AIC31XX_HSD_HS:
+ status |= SND_JACK_HEADSET;
+ break;
+ default:
+ break;
+ }
+
+ if (aic31xx->jack)
+ snd_soc_jack_report(aic31xx->jack, status,
+ AIC31XX_JACK_MASK);
+ }
+
ret = regmap_read(aic31xx->regmap, AIC31XX_OFFLAG, &value);
if (ret) {
dev_err(dev, "Failed to read overflow flag: %d\n", ret);
@@ -1365,9 +1394,13 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
AIC31XX_GPIO1_FUNC_SHIFT);
regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL,
+ AIC31XX_HSPLUGDET |
AIC31XX_SC |
AIC31XX_ENGINE);
+ regmap_write(aic31xx->regmap, AIC31XX_HSDETECT,
+ AIC31XX_HSD_ENABLE);
+
ret = devm_request_threaded_irq(aic31xx->dev, aic31xx->irq,
NULL, aic31xx_irq,
IRQF_ONESHOT, "aic31xx-irq",
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index d062663f66b5..66c85df4d5be 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -20,6 +20,9 @@
#define AIC31XX_MINIDSP_BIT BIT(2)
#define DAC31XX_BIT BIT(3)
+#define AIC31XX_JACK_MASK (SND_JACK_HEADPHONE | \
+ SND_JACK_HEADSET)
+
enum aic31xx_type {
AIC3100 = 0,
AIC3110 = AIC31XX_STEREO_CLASS_D_BIT,
@@ -213,6 +216,14 @@ enum aic31xx_type {
/* AIC31XX_DACMUTE */
#define AIC31XX_DACMUTE_MASK GENMASK(3, 2)
+/* AIC31XX_HSDETECT */
+#define AIC31XX_HSD_ENABLE BIT(7)
+#define AIC31XX_HSD_TYPE_MASK GENMASK(6, 5)
+#define AIC31XX_HSD_TYPE_SHIFT 5
+#define AIC31XX_HSD_NONE 0x00
+#define AIC31XX_HSD_HP 0x01
+#define AIC31XX_HSD_HS 0x03
+
/* AIC31XX_MICBIAS */
#define AIC31XX_MICBIAS_MASK GENMASK(1, 0)
#define AIC31XX_MICBIAS_SHIFT 0
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 04/19] ASoC: tlv320aic31xx: General source formatting cleanup
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (2 preceding siblings ...)
[not found] ` <20171129213300.20021-1-afd-l0cyMroinI0@public.gmane.org>
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-01 13:43 ` Applied "ASoC: tlv320aic31xx: General source formatting cleanup" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 05/19] ASoC: tlv320aic31xx: Fix GPIO1 register definition Andrew F. Davis
` (12 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
Simple non-functional changes including:
* Fix spelling errors
* Reformat code for easier reading
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return paths
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 63 ++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index d974e8651e30..07c014501e5e 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -136,8 +136,7 @@ static const struct regmap_config aic31xx_i2c_regmap = {
.max_register = 12 * 128,
};
-#define AIC31XX_NUM_SUPPLIES 6
-static const char * const aic31xx_supply_names[AIC31XX_NUM_SUPPLIES] = {
+static const char * const aic31xx_supply_names[] = {
"HPVDD",
"SPRVDD",
"SPLVDD",
@@ -146,6 +145,8 @@ static const char * const aic31xx_supply_names[AIC31XX_NUM_SUPPLIES] = {
"DVDD",
};
+#define AIC31XX_NUM_SUPPLIES ARRAY_SIZE(aic31xx_supply_names)
+
struct aic31xx_disable_nb {
struct notifier_block nb;
struct aic31xx_priv *aic31xx;
@@ -177,7 +178,7 @@ struct aic31xx_rate_divs {
u8 madc;
};
-/* ADC dividers can be disabled by cofiguring them to 0 */
+/* ADC dividers can be disabled by configuring them to 0 */
static const struct aic31xx_rate_divs aic31xx_divs[] = {
/* mclk/p rate pll: j d dosr ndac mdac aors nadc madc */
/* 8k rate */
@@ -832,11 +833,17 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
dev_dbg(codec->dev,
"pll %d.%04d/%d dosr %d n %d m %d aosr %d n %d m %d bclk_n %d\n",
- aic31xx_divs[i].pll_j, aic31xx_divs[i].pll_d,
- aic31xx->p_div, aic31xx_divs[i].dosr,
- aic31xx_divs[i].ndac, aic31xx_divs[i].mdac,
- aic31xx_divs[i].aosr, aic31xx_divs[i].nadc,
- aic31xx_divs[i].madc, bclk_n);
+ aic31xx_divs[i].pll_j,
+ aic31xx_divs[i].pll_d,
+ aic31xx->p_div,
+ aic31xx_divs[i].dosr,
+ aic31xx_divs[i].ndac,
+ aic31xx_divs[i].mdac,
+ aic31xx_divs[i].aosr,
+ aic31xx_divs[i].nadc,
+ aic31xx_divs[i].madc,
+ bclk_n
+ );
return 0;
}
@@ -973,8 +980,9 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
dev_dbg(codec->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n",
__func__, clk_id, freq, dir);
- for (i = 1; freq/i > 20000000 && i < 8; i++)
- ;
+ for (i = 1; i < 8; i++)
+ if (freq / i <= 20000000)
+ break;
if (freq/i > 20000000) {
dev_err(aic31xx->dev, "%s: Too high mclk frequency %u\n",
__func__, freq);
@@ -982,9 +990,9 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
}
aic31xx->p_div = i;
- for (i = 0; i < ARRAY_SIZE(aic31xx_divs) &&
- aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++)
- ;
+ for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++)
+ if (aic31xx_divs[i].mclk_p == freq / aic31xx->p_div)
+ break;
if (i == ARRAY_SIZE(aic31xx_divs)) {
dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
__func__, freq);
@@ -996,6 +1004,7 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
clk_id << AIC31XX_PLL_CLKIN_SHIFT);
aic31xx->sysclk = freq;
+
return 0;
}
@@ -1057,7 +1066,7 @@ static void aic31xx_clk_off(struct snd_soc_codec *codec)
static int aic31xx_power_on(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
+ int ret;
ret = regulator_bulk_enable(ARRAY_SIZE(aic31xx->supplies),
aic31xx->supplies);
@@ -1070,7 +1079,7 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
}
regcache_cache_only(aic31xx->regmap, false);
ret = regcache_sync(aic31xx->regmap);
- if (ret != 0) {
+ if (ret) {
dev_err(codec->dev,
"Failed to restore cache: %d\n", ret);
regcache_cache_only(aic31xx->regmap, true);
@@ -1078,6 +1087,7 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
aic31xx->supplies);
return ret;
}
+
return 0;
}
@@ -1126,14 +1136,11 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
static int aic31xx_codec_probe(struct snd_soc_codec *codec)
{
- int ret = 0;
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int i;
+ int i, ret;
dev_dbg(aic31xx->dev, "## %s\n", __func__);
- aic31xx = snd_soc_codec_get_drvdata(codec);
-
aic31xx->codec = codec;
for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) {
@@ -1158,8 +1165,10 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec)
return ret;
ret = aic31xx_add_widgets(codec);
+ if (ret)
+ return ret;
- return ret;
+ return 0;
}
static int aic31xx_codec_remove(struct snd_soc_codec *codec)
@@ -1322,10 +1331,12 @@ static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
ret = devm_regulator_bulk_get(aic31xx->dev,
ARRAY_SIZE(aic31xx->supplies),
aic31xx->supplies);
- if (ret != 0)
+ if (ret) {
dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
+ return ret;
+ }
- return ret;
+ return 0;
}
static int aic31xx_i2c_probe(struct i2c_client *i2c,
@@ -1333,18 +1344,15 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
{
struct aic31xx_priv *aic31xx;
int ret;
- const struct regmap_config *regmap_config;
dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
id->name, (int) id->driver_data);
- regmap_config = &aic31xx_i2c_regmap;
-
aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
- if (aic31xx == NULL)
+ if (!aic31xx)
return -ENOMEM;
- aic31xx->regmap = devm_regmap_init_i2c(i2c, regmap_config);
+ aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
if (IS_ERR(aic31xx->regmap)) {
ret = PTR_ERR(aic31xx->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1400,7 +1408,6 @@ static struct i2c_driver aic31xx_i2c_driver = {
.remove = aic31xx_i2c_remove,
.id_table = aic31xx_i2c_id,
};
-
module_i2c_driver(aic31xx_i2c_driver);
MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: General source formatting cleanup" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 04/19] ASoC: tlv320aic31xx: General source formatting cleanup Andrew F. Davis
@ 2017-12-01 13:43 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-01 13:43 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: General source formatting cleanup
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From ca7840fb47208a3521f3b60c1b78a2f0c59b4dc5 Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:45 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: General source formatting cleanup
Simple non-functional changes including:
* Fix spelling errors
* Reformat code for easier reading
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return paths
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 63 ++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index d974e8651e30..07c014501e5e 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -136,8 +136,7 @@ static const struct regmap_config aic31xx_i2c_regmap = {
.max_register = 12 * 128,
};
-#define AIC31XX_NUM_SUPPLIES 6
-static const char * const aic31xx_supply_names[AIC31XX_NUM_SUPPLIES] = {
+static const char * const aic31xx_supply_names[] = {
"HPVDD",
"SPRVDD",
"SPLVDD",
@@ -146,6 +145,8 @@ static const char * const aic31xx_supply_names[AIC31XX_NUM_SUPPLIES] = {
"DVDD",
};
+#define AIC31XX_NUM_SUPPLIES ARRAY_SIZE(aic31xx_supply_names)
+
struct aic31xx_disable_nb {
struct notifier_block nb;
struct aic31xx_priv *aic31xx;
@@ -177,7 +178,7 @@ struct aic31xx_rate_divs {
u8 madc;
};
-/* ADC dividers can be disabled by cofiguring them to 0 */
+/* ADC dividers can be disabled by configuring them to 0 */
static const struct aic31xx_rate_divs aic31xx_divs[] = {
/* mclk/p rate pll: j d dosr ndac mdac aors nadc madc */
/* 8k rate */
@@ -832,11 +833,17 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
dev_dbg(codec->dev,
"pll %d.%04d/%d dosr %d n %d m %d aosr %d n %d m %d bclk_n %d\n",
- aic31xx_divs[i].pll_j, aic31xx_divs[i].pll_d,
- aic31xx->p_div, aic31xx_divs[i].dosr,
- aic31xx_divs[i].ndac, aic31xx_divs[i].mdac,
- aic31xx_divs[i].aosr, aic31xx_divs[i].nadc,
- aic31xx_divs[i].madc, bclk_n);
+ aic31xx_divs[i].pll_j,
+ aic31xx_divs[i].pll_d,
+ aic31xx->p_div,
+ aic31xx_divs[i].dosr,
+ aic31xx_divs[i].ndac,
+ aic31xx_divs[i].mdac,
+ aic31xx_divs[i].aosr,
+ aic31xx_divs[i].nadc,
+ aic31xx_divs[i].madc,
+ bclk_n
+ );
return 0;
}
@@ -973,8 +980,9 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
dev_dbg(codec->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n",
__func__, clk_id, freq, dir);
- for (i = 1; freq/i > 20000000 && i < 8; i++)
- ;
+ for (i = 1; i < 8; i++)
+ if (freq / i <= 20000000)
+ break;
if (freq/i > 20000000) {
dev_err(aic31xx->dev, "%s: Too high mclk frequency %u\n",
__func__, freq);
@@ -982,9 +990,9 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
}
aic31xx->p_div = i;
- for (i = 0; i < ARRAY_SIZE(aic31xx_divs) &&
- aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++)
- ;
+ for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++)
+ if (aic31xx_divs[i].mclk_p == freq / aic31xx->p_div)
+ break;
if (i == ARRAY_SIZE(aic31xx_divs)) {
dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
__func__, freq);
@@ -996,6 +1004,7 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
clk_id << AIC31XX_PLL_CLKIN_SHIFT);
aic31xx->sysclk = freq;
+
return 0;
}
@@ -1057,7 +1066,7 @@ static void aic31xx_clk_off(struct snd_soc_codec *codec)
static int aic31xx_power_on(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int ret = 0;
+ int ret;
ret = regulator_bulk_enable(ARRAY_SIZE(aic31xx->supplies),
aic31xx->supplies);
@@ -1070,7 +1079,7 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
}
regcache_cache_only(aic31xx->regmap, false);
ret = regcache_sync(aic31xx->regmap);
- if (ret != 0) {
+ if (ret) {
dev_err(codec->dev,
"Failed to restore cache: %d\n", ret);
regcache_cache_only(aic31xx->regmap, true);
@@ -1078,6 +1087,7 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
aic31xx->supplies);
return ret;
}
+
return 0;
}
@@ -1126,14 +1136,11 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
static int aic31xx_codec_probe(struct snd_soc_codec *codec)
{
- int ret = 0;
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int i;
+ int i, ret;
dev_dbg(aic31xx->dev, "## %s\n", __func__);
- aic31xx = snd_soc_codec_get_drvdata(codec);
-
aic31xx->codec = codec;
for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) {
@@ -1158,8 +1165,10 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec)
return ret;
ret = aic31xx_add_widgets(codec);
+ if (ret)
+ return ret;
- return ret;
+ return 0;
}
static int aic31xx_codec_remove(struct snd_soc_codec *codec)
@@ -1322,10 +1331,12 @@ static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
ret = devm_regulator_bulk_get(aic31xx->dev,
ARRAY_SIZE(aic31xx->supplies),
aic31xx->supplies);
- if (ret != 0)
+ if (ret) {
dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
+ return ret;
+ }
- return ret;
+ return 0;
}
static int aic31xx_i2c_probe(struct i2c_client *i2c,
@@ -1333,18 +1344,15 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
{
struct aic31xx_priv *aic31xx;
int ret;
- const struct regmap_config *regmap_config;
dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
id->name, (int) id->driver_data);
- regmap_config = &aic31xx_i2c_regmap;
-
aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
- if (aic31xx == NULL)
+ if (!aic31xx)
return -ENOMEM;
- aic31xx->regmap = devm_regmap_init_i2c(i2c, regmap_config);
+ aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
if (IS_ERR(aic31xx->regmap)) {
ret = PTR_ERR(aic31xx->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1400,7 +1408,6 @@ static struct i2c_driver aic31xx_i2c_driver = {
.remove = aic31xx_i2c_remove,
.id_table = aic31xx_i2c_id,
};
-
module_i2c_driver(aic31xx_i2c_driver);
MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>");
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 05/19] ASoC: tlv320aic31xx: Fix GPIO1 register definition
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (3 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 04/19] ASoC: tlv320aic31xx: General source formatting cleanup Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-30 12:32 ` Applied "ASoC: tlv320aic31xx: Fix GPIO1 register definition" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 06/19] ASoC: tlv320aic31xx: Reformat header file using GENMASK and BIT macros Andrew F. Davis
` (11 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
GPIO1 control register is number 51, fix this here.
Fixes: bafcbfe429eb ("ASoC: tlv320aic31xx: Make the register values human readable")
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index a9ea2f99eba0..6efea0485392 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -109,7 +109,7 @@ struct aic31xx_pdata {
/* INT2 interrupt control */
#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49)
/* GPIO1 control */
-#define AIC31XX_GPIO1 AIC31XX_REG(0, 50)
+#define AIC31XX_GPIO1 AIC31XX_REG(0, 51)
#define AIC31XX_DACPRB AIC31XX_REG(0, 60)
/* ADC Instruction Set Register */
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: Fix GPIO1 register definition" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 05/19] ASoC: tlv320aic31xx: Fix GPIO1 register definition Andrew F. Davis
@ 2017-11-30 12:32 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-11-30 12:32 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren, Mark Brown,
Liam Girdwood, stable, linux-kernel, Rob Herring,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: Fix GPIO1 register definition
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 737e0b7b67bdfe24090fab2852044bb283282fc5 Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:46 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Fix GPIO1 register definition
GPIO1 control register is number 51, fix this here.
Fixes: bafcbfe429eb ("ASoC: tlv320aic31xx: Make the register values human readable")
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
sound/soc/codecs/tlv320aic31xx.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 730fb2058869..1ff3edb7bbb6 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -116,7 +116,7 @@ struct aic31xx_pdata {
/* INT2 interrupt control */
#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49)
/* GPIO1 control */
-#define AIC31XX_GPIO1 AIC31XX_REG(0, 50)
+#define AIC31XX_GPIO1 AIC31XX_REG(0, 51)
#define AIC31XX_DACPRB AIC31XX_REG(0, 60)
/* ADC Instruction Set Register */
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 06/19] ASoC: tlv320aic31xx: Reformat header file using GENMASK and BIT macros
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (4 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 05/19] ASoC: tlv320aic31xx: Fix GPIO1 register definition Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 07/19] ASoC: tlv320aic31xx: Merge init function into probe Andrew F. Davis
` (10 subsequent siblings)
16 siblings, 0 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
We also move the comments describing the registers to after the register
definition to remove non-uniform vertical white-space, this makes
cross-referencing with the datasheet much easier.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.h | 460 +++++++++++++++++----------------------
1 file changed, 203 insertions(+), 257 deletions(-)
rewrite sound/soc/codecs/tlv320aic31xx.h (80%)
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
dissimilarity index 80%
index 6efea0485392..15ac7cba86fe 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -1,257 +1,203 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * ALSA SoC TLV320AIC31xx CODEC Driver Definitions
- *
- * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
- */
-
-#ifndef _TLV320AIC31XX_H
-#define _TLV320AIC31XX_H
-
-#define AIC31XX_RATES SNDRV_PCM_RATE_8000_192000
-
-#define AIC31XX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
- | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE \
- | SNDRV_PCM_FMTBIT_S32_LE)
-
-
-#define AIC31XX_STEREO_CLASS_D_BIT 0x1
-#define AIC31XX_MINIDSP_BIT 0x2
-#define DAC31XX_BIT 0x4
-
-enum aic31xx_type {
- AIC3100 = 0,
- AIC3110 = AIC31XX_STEREO_CLASS_D_BIT,
- AIC3120 = AIC31XX_MINIDSP_BIT,
- AIC3111 = (AIC31XX_STEREO_CLASS_D_BIT | AIC31XX_MINIDSP_BIT),
- DAC3100 = DAC31XX_BIT,
- DAC3101 = DAC31XX_BIT | AIC31XX_STEREO_CLASS_D_BIT,
-};
-
-struct aic31xx_pdata {
- enum aic31xx_type codec_type;
- unsigned int gpio_reset;
- int micbias_vg;
-};
-
-#define AIC31XX_REG(page, reg) ((page * 128) + reg)
-
-/* Page Control Register */
-#define AIC31XX_PAGECTL AIC31XX_REG(0, 0)
-
-/* Page 0 Registers */
-/* Software reset register */
-#define AIC31XX_RESET AIC31XX_REG(0, 1)
-/* OT FLAG register */
-#define AIC31XX_OT_FLAG AIC31XX_REG(0, 3)
-/* Clock clock Gen muxing, Multiplexers*/
-#define AIC31XX_CLKMUX AIC31XX_REG(0, 4)
-/* PLL P and R-VAL register */
-#define AIC31XX_PLLPR AIC31XX_REG(0, 5)
-/* PLL J-VAL register */
-#define AIC31XX_PLLJ AIC31XX_REG(0, 6)
-/* PLL D-VAL MSB register */
-#define AIC31XX_PLLDMSB AIC31XX_REG(0, 7)
-/* PLL D-VAL LSB register */
-#define AIC31XX_PLLDLSB AIC31XX_REG(0, 8)
-/* DAC NDAC_VAL register*/
-#define AIC31XX_NDAC AIC31XX_REG(0, 11)
-/* DAC MDAC_VAL register */
-#define AIC31XX_MDAC AIC31XX_REG(0, 12)
-/* DAC OSR setting register 1, MSB value */
-#define AIC31XX_DOSRMSB AIC31XX_REG(0, 13)
-/* DAC OSR setting register 2, LSB value */
-#define AIC31XX_DOSRLSB AIC31XX_REG(0, 14)
-#define AIC31XX_MINI_DSP_INPOL AIC31XX_REG(0, 16)
-/* Clock setting register 8, PLL */
-#define AIC31XX_NADC AIC31XX_REG(0, 18)
-/* Clock setting register 9, PLL */
-#define AIC31XX_MADC AIC31XX_REG(0, 19)
-/* ADC Oversampling (AOSR) Register */
-#define AIC31XX_AOSR AIC31XX_REG(0, 20)
-/* Clock setting register 9, Multiplexers */
-#define AIC31XX_CLKOUTMUX AIC31XX_REG(0, 25)
-/* Clock setting register 10, CLOCKOUT M divider value */
-#define AIC31XX_CLKOUTMVAL AIC31XX_REG(0, 26)
-/* Audio Interface Setting Register 1 */
-#define AIC31XX_IFACE1 AIC31XX_REG(0, 27)
-/* Audio Data Slot Offset Programming */
-#define AIC31XX_DATA_OFFSET AIC31XX_REG(0, 28)
-/* Audio Interface Setting Register 2 */
-#define AIC31XX_IFACE2 AIC31XX_REG(0, 29)
-/* Clock setting register 11, BCLK N Divider */
-#define AIC31XX_BCLKN AIC31XX_REG(0, 30)
-/* Audio Interface Setting Register 3, Secondary Audio Interface */
-#define AIC31XX_IFACESEC1 AIC31XX_REG(0, 31)
-/* Audio Interface Setting Register 4 */
-#define AIC31XX_IFACESEC2 AIC31XX_REG(0, 32)
-/* Audio Interface Setting Register 5 */
-#define AIC31XX_IFACESEC3 AIC31XX_REG(0, 33)
-/* I2C Bus Condition */
-#define AIC31XX_I2C AIC31XX_REG(0, 34)
-/* ADC FLAG */
-#define AIC31XX_ADCFLAG AIC31XX_REG(0, 36)
-/* DAC Flag Registers */
-#define AIC31XX_DACFLAG1 AIC31XX_REG(0, 37)
-#define AIC31XX_DACFLAG2 AIC31XX_REG(0, 38)
-/* Sticky Interrupt flag (overflow) */
-#define AIC31XX_OFFLAG AIC31XX_REG(0, 39)
-/* Sticy DAC Interrupt flags */
-#define AIC31XX_INTRDACFLAG AIC31XX_REG(0, 44)
-/* Sticy ADC Interrupt flags */
-#define AIC31XX_INTRADCFLAG AIC31XX_REG(0, 45)
-/* DAC Interrupt flags 2 */
-#define AIC31XX_INTRDACFLAG2 AIC31XX_REG(0, 46)
-/* ADC Interrupt flags 2 */
-#define AIC31XX_INTRADCFLAG2 AIC31XX_REG(0, 47)
-/* INT1 interrupt control */
-#define AIC31XX_INT1CTRL AIC31XX_REG(0, 48)
-/* INT2 interrupt control */
-#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49)
-/* GPIO1 control */
-#define AIC31XX_GPIO1 AIC31XX_REG(0, 51)
-
-#define AIC31XX_DACPRB AIC31XX_REG(0, 60)
-/* ADC Instruction Set Register */
-#define AIC31XX_ADCPRB AIC31XX_REG(0, 61)
-/* DAC channel setup register */
-#define AIC31XX_DACSETUP AIC31XX_REG(0, 63)
-/* DAC Mute and volume control register */
-#define AIC31XX_DACMUTE AIC31XX_REG(0, 64)
-/* Left DAC channel digital volume control */
-#define AIC31XX_LDACVOL AIC31XX_REG(0, 65)
-/* Right DAC channel digital volume control */
-#define AIC31XX_RDACVOL AIC31XX_REG(0, 66)
-/* Headset detection */
-#define AIC31XX_HSDETECT AIC31XX_REG(0, 67)
-/* ADC Digital Mic */
-#define AIC31XX_ADCSETUP AIC31XX_REG(0, 81)
-/* ADC Digital Volume Control Fine Adjust */
-#define AIC31XX_ADCFGA AIC31XX_REG(0, 82)
-/* ADC Digital Volume Control Coarse Adjust */
-#define AIC31XX_ADCVOL AIC31XX_REG(0, 83)
-
-
-/* Page 1 Registers */
-/* Headphone drivers */
-#define AIC31XX_HPDRIVER AIC31XX_REG(1, 31)
-/* Class-D Speakear Amplifier */
-#define AIC31XX_SPKAMP AIC31XX_REG(1, 32)
-/* HP Output Drivers POP Removal Settings */
-#define AIC31XX_HPPOP AIC31XX_REG(1, 33)
-/* Output Driver PGA Ramp-Down Period Control */
-#define AIC31XX_SPPGARAMP AIC31XX_REG(1, 34)
-/* DAC_L and DAC_R Output Mixer Routing */
-#define AIC31XX_DACMIXERROUTE AIC31XX_REG(1, 35)
-/* Left Analog Vol to HPL */
-#define AIC31XX_LANALOGHPL AIC31XX_REG(1, 36)
-/* Right Analog Vol to HPR */
-#define AIC31XX_RANALOGHPR AIC31XX_REG(1, 37)
-/* Left Analog Vol to SPL */
-#define AIC31XX_LANALOGSPL AIC31XX_REG(1, 38)
-/* Right Analog Vol to SPR */
-#define AIC31XX_RANALOGSPR AIC31XX_REG(1, 39)
-/* HPL Driver */
-#define AIC31XX_HPLGAIN AIC31XX_REG(1, 40)
-/* HPR Driver */
-#define AIC31XX_HPRGAIN AIC31XX_REG(1, 41)
-/* SPL Driver */
-#define AIC31XX_SPLGAIN AIC31XX_REG(1, 42)
-/* SPR Driver */
-#define AIC31XX_SPRGAIN AIC31XX_REG(1, 43)
-/* HP Driver Control */
-#define AIC31XX_HPCONTROL AIC31XX_REG(1, 44)
-/* MIC Bias Control */
-#define AIC31XX_MICBIAS AIC31XX_REG(1, 46)
-/* MIC PGA*/
-#define AIC31XX_MICPGA AIC31XX_REG(1, 47)
-/* Delta-Sigma Mono ADC Channel Fine-Gain Input Selection for P-Terminal */
-#define AIC31XX_MICPGAPI AIC31XX_REG(1, 48)
-/* ADC Input Selection for M-Terminal */
-#define AIC31XX_MICPGAMI AIC31XX_REG(1, 49)
-/* Input CM Settings */
-#define AIC31XX_MICPGACM AIC31XX_REG(1, 50)
-
-/* Bits, masks and shifts */
-
-/* AIC31XX_CLKMUX */
-#define AIC31XX_PLL_CLKIN_MASK 0x0c
-#define AIC31XX_PLL_CLKIN_SHIFT 2
-#define AIC31XX_PLL_CLKIN_MCLK 0
-#define AIC31XX_CODEC_CLKIN_MASK 0x03
-#define AIC31XX_CODEC_CLKIN_SHIFT 0
-#define AIC31XX_CODEC_CLKIN_PLL 3
-#define AIC31XX_CODEC_CLKIN_BCLK 1
-
-/* AIC31XX_PLLPR, AIC31XX_NDAC, AIC31XX_MDAC, AIC31XX_NADC, AIC31XX_MADC,
- AIC31XX_BCLKN */
-#define AIC31XX_PLL_MASK 0x7f
-#define AIC31XX_PM_MASK 0x80
-
-/* AIC31XX_IFACE1 */
-#define AIC31XX_WORD_LEN_16BITS 0x00
-#define AIC31XX_WORD_LEN_20BITS 0x01
-#define AIC31XX_WORD_LEN_24BITS 0x02
-#define AIC31XX_WORD_LEN_32BITS 0x03
-#define AIC31XX_IFACE1_DATALEN_MASK 0x30
-#define AIC31XX_IFACE1_DATALEN_SHIFT (4)
-#define AIC31XX_IFACE1_DATATYPE_MASK 0xC0
-#define AIC31XX_IFACE1_DATATYPE_SHIFT (6)
-#define AIC31XX_I2S_MODE 0x00
-#define AIC31XX_DSP_MODE 0x01
-#define AIC31XX_RIGHT_JUSTIFIED_MODE 0x02
-#define AIC31XX_LEFT_JUSTIFIED_MODE 0x03
-#define AIC31XX_IFACE1_MASTER_MASK 0x0C
-#define AIC31XX_BCLK_MASTER 0x08
-#define AIC31XX_WCLK_MASTER 0x04
-
-/* AIC31XX_DATA_OFFSET */
-#define AIC31XX_DATA_OFFSET_MASK 0xFF
-
-/* AIC31XX_IFACE2 */
-#define AIC31XX_BCLKINV_MASK 0x08
-#define AIC31XX_BDIVCLK_MASK 0x03
-#define AIC31XX_DAC2BCLK 0x00
-#define AIC31XX_DACMOD2BCLK 0x01
-#define AIC31XX_ADC2BCLK 0x02
-#define AIC31XX_ADCMOD2BCLK 0x03
-
-/* AIC31XX_ADCFLAG */
-#define AIC31XX_ADCPWRSTATUS_MASK 0x40
-
-/* AIC31XX_DACFLAG1 */
-#define AIC31XX_LDACPWRSTATUS_MASK 0x80
-#define AIC31XX_RDACPWRSTATUS_MASK 0x08
-#define AIC31XX_HPLDRVPWRSTATUS_MASK 0x20
-#define AIC31XX_HPRDRVPWRSTATUS_MASK 0x02
-#define AIC31XX_SPLDRVPWRSTATUS_MASK 0x10
-#define AIC31XX_SPRDRVPWRSTATUS_MASK 0x01
-
-/* AIC31XX_INTRDACFLAG */
-#define AIC31XX_HPSCDETECT_MASK 0x80
-#define AIC31XX_BUTTONPRESS_MASK 0x20
-#define AIC31XX_HSPLUG_MASK 0x10
-#define AIC31XX_LDRCTHRES_MASK 0x08
-#define AIC31XX_RDRCTHRES_MASK 0x04
-#define AIC31XX_DACSINT_MASK 0x02
-#define AIC31XX_DACAINT_MASK 0x01
-
-/* AIC31XX_INT1CTRL */
-#define AIC31XX_HSPLUGDET_MASK 0x80
-#define AIC31XX_BUTTONPRESSDET_MASK 0x40
-#define AIC31XX_DRCTHRES_MASK 0x20
-#define AIC31XX_AGCNOISE_MASK 0x10
-#define AIC31XX_OC_MASK 0x08
-#define AIC31XX_ENGINE_MASK 0x04
-
-/* AIC31XX_DACSETUP */
-#define AIC31XX_SOFTSTEP_MASK 0x03
-
-/* AIC31XX_DACMUTE */
-#define AIC31XX_DACMUTE_MASK 0x0C
-
-/* AIC31XX_MICBIAS */
-#define AIC31XX_MICBIAS_MASK 0x03
-#define AIC31XX_MICBIAS_SHIFT 0
-
-#endif /* _TLV320AIC31XX_H */
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * ALSA SoC TLV320AIC31xx CODEC Driver Definitions
+ *
+ * Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+#ifndef _TLV320AIC31XX_H
+#define _TLV320AIC31XX_H
+
+#define AIC31XX_RATES SNDRV_PCM_RATE_8000_192000
+
+#define AIC31XX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
+ SNDRV_PCM_FMTBIT_S20_3LE | \
+ SNDRV_PCM_FMTBIT_S24_3LE | \
+ SNDRV_PCM_FMTBIT_S24_LE | \
+ SNDRV_PCM_FMTBIT_S32_LE)
+
+#define AIC31XX_STEREO_CLASS_D_BIT BIT(1)
+#define AIC31XX_MINIDSP_BIT BIT(2)
+#define DAC31XX_BIT BIT(3)
+
+enum aic31xx_type {
+ AIC3100 = 0,
+ AIC3110 = AIC31XX_STEREO_CLASS_D_BIT,
+ AIC3120 = AIC31XX_MINIDSP_BIT,
+ AIC3111 = AIC31XX_STEREO_CLASS_D_BIT | AIC31XX_MINIDSP_BIT,
+ DAC3100 = DAC31XX_BIT,
+ DAC3101 = DAC31XX_BIT | AIC31XX_STEREO_CLASS_D_BIT,
+};
+
+struct aic31xx_pdata {
+ enum aic31xx_type codec_type;
+ unsigned int gpio_reset;
+ int micbias_vg;
+};
+
+#define AIC31XX_REG(page, reg) ((page * 128) + reg)
+
+#define AIC31XX_PAGECTL AIC31XX_REG(0, 0) /* Page Control Register */
+
+/* Page 0 Registers */
+#define AIC31XX_RESET AIC31XX_REG(0, 1) /* Software reset register */
+#define AIC31XX_OT_FLAG AIC31XX_REG(0, 3) /* OT FLAG register */
+#define AIC31XX_CLKMUX AIC31XX_REG(0, 4) /* Clock clock Gen muxing, Multiplexers*/
+#define AIC31XX_PLLPR AIC31XX_REG(0, 5) /* PLL P and R-VAL register */
+#define AIC31XX_PLLJ AIC31XX_REG(0, 6) /* PLL J-VAL register */
+#define AIC31XX_PLLDMSB AIC31XX_REG(0, 7) /* PLL D-VAL MSB register */
+#define AIC31XX_PLLDLSB AIC31XX_REG(0, 8) /* PLL D-VAL LSB register */
+#define AIC31XX_NDAC AIC31XX_REG(0, 11) /* DAC NDAC_VAL register*/
+#define AIC31XX_MDAC AIC31XX_REG(0, 12) /* DAC MDAC_VAL register */
+#define AIC31XX_DOSRMSB AIC31XX_REG(0, 13) /* DAC OSR setting register 1, MSB value */
+#define AIC31XX_DOSRLSB AIC31XX_REG(0, 14) /* DAC OSR setting register 2, LSB value */
+#define AIC31XX_MINI_DSP_INPOL AIC31XX_REG(0, 16)
+#define AIC31XX_NADC AIC31XX_REG(0, 18) /* Clock setting register 8, PLL */
+#define AIC31XX_MADC AIC31XX_REG(0, 19) /* Clock setting register 9, PLL */
+#define AIC31XX_AOSR AIC31XX_REG(0, 20) /* ADC Oversampling (AOSR) Register */
+#define AIC31XX_CLKOUTMUX AIC31XX_REG(0, 25) /* Clock setting register 9, Multiplexers */
+#define AIC31XX_CLKOUTMVAL AIC31XX_REG(0, 26) /* Clock setting register 10, CLOCKOUT M divider value */
+#define AIC31XX_IFACE1 AIC31XX_REG(0, 27) /* Audio Interface Setting Register 1 */
+#define AIC31XX_DATA_OFFSET AIC31XX_REG(0, 28) /* Audio Data Slot Offset Programming */
+#define AIC31XX_IFACE2 AIC31XX_REG(0, 29) /* Audio Interface Setting Register 2 */
+#define AIC31XX_BCLKN AIC31XX_REG(0, 30) /* Clock setting register 11, BCLK N Divider */
+#define AIC31XX_IFACESEC1 AIC31XX_REG(0, 31) /* Audio Interface Setting Register 3, Secondary Audio Interface */
+#define AIC31XX_IFACESEC2 AIC31XX_REG(0, 32) /* Audio Interface Setting Register 4 */
+#define AIC31XX_IFACESEC3 AIC31XX_REG(0, 33) /* Audio Interface Setting Register 5 */
+#define AIC31XX_I2C AIC31XX_REG(0, 34) /* I2C Bus Condition */
+#define AIC31XX_ADCFLAG AIC31XX_REG(0, 36) /* ADC FLAG */
+#define AIC31XX_DACFLAG1 AIC31XX_REG(0, 37) /* DAC Flag Registers */
+#define AIC31XX_DACFLAG2 AIC31XX_REG(0, 38)
+#define AIC31XX_OFFLAG AIC31XX_REG(0, 39) /* Sticky Interrupt flag (overflow) */
+#define AIC31XX_INTRDACFLAG AIC31XX_REG(0, 44) /* Sticy DAC Interrupt flags */
+#define AIC31XX_INTRADCFLAG AIC31XX_REG(0, 45) /* Sticy ADC Interrupt flags */
+#define AIC31XX_INTRDACFLAG2 AIC31XX_REG(0, 46) /* DAC Interrupt flags 2 */
+#define AIC31XX_INTRADCFLAG2 AIC31XX_REG(0, 47) /* ADC Interrupt flags 2 */
+#define AIC31XX_INT1CTRL AIC31XX_REG(0, 48) /* INT1 interrupt control */
+#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49) /* INT2 interrupt control */
+#define AIC31XX_GPIO1 AIC31XX_REG(0, 51) /* GPIO1 control */
+#define AIC31XX_DACPRB AIC31XX_REG(0, 60)
+#define AIC31XX_ADCPRB AIC31XX_REG(0, 61) /* ADC Instruction Set Register */
+#define AIC31XX_DACSETUP AIC31XX_REG(0, 63) /* DAC channel setup register */
+#define AIC31XX_DACMUTE AIC31XX_REG(0, 64) /* DAC Mute and volume control register */
+#define AIC31XX_LDACVOL AIC31XX_REG(0, 65) /* Left DAC channel digital volume control */
+#define AIC31XX_RDACVOL AIC31XX_REG(0, 66) /* Right DAC channel digital volume control */
+#define AIC31XX_HSDETECT AIC31XX_REG(0, 67) /* Headset detection */
+#define AIC31XX_ADCSETUP AIC31XX_REG(0, 81) /* ADC Digital Mic */
+#define AIC31XX_ADCFGA AIC31XX_REG(0, 82) /* ADC Digital Volume Control Fine Adjust */
+#define AIC31XX_ADCVOL AIC31XX_REG(0, 83) /* ADC Digital Volume Control Coarse Adjust */
+
+/* Page 1 Registers */
+#define AIC31XX_HPDRIVER AIC31XX_REG(1, 31) /* Headphone drivers */
+#define AIC31XX_SPKAMP AIC31XX_REG(1, 32) /* Class-D Speakear Amplifier */
+#define AIC31XX_HPPOP AIC31XX_REG(1, 33) /* HP Output Drivers POP Removal Settings */
+#define AIC31XX_SPPGARAMP AIC31XX_REG(1, 34) /* Output Driver PGA Ramp-Down Period Control */
+#define AIC31XX_DACMIXERROUTE AIC31XX_REG(1, 35) /* DAC_L and DAC_R Output Mixer Routing */
+#define AIC31XX_LANALOGHPL AIC31XX_REG(1, 36) /* Left Analog Vol to HPL */
+#define AIC31XX_RANALOGHPR AIC31XX_REG(1, 37) /* Right Analog Vol to HPR */
+#define AIC31XX_LANALOGSPL AIC31XX_REG(1, 38) /* Left Analog Vol to SPL */
+#define AIC31XX_RANALOGSPR AIC31XX_REG(1, 39) /* Right Analog Vol to SPR */
+#define AIC31XX_HPLGAIN AIC31XX_REG(1, 40) /* HPL Driver */
+#define AIC31XX_HPRGAIN AIC31XX_REG(1, 41) /* HPR Driver */
+#define AIC31XX_SPLGAIN AIC31XX_REG(1, 42) /* SPL Driver */
+#define AIC31XX_SPRGAIN AIC31XX_REG(1, 43) /* SPR Driver */
+#define AIC31XX_HPCONTROL AIC31XX_REG(1, 44) /* HP Driver Control */
+#define AIC31XX_MICBIAS AIC31XX_REG(1, 46) /* MIC Bias Control */
+#define AIC31XX_MICPGA AIC31XX_REG(1, 47) /* MIC PGA*/
+#define AIC31XX_MICPGAPI AIC31XX_REG(1, 48) /* Delta-Sigma Mono ADC Channel Fine-Gain Input Selection for P-Terminal */
+#define AIC31XX_MICPGAMI AIC31XX_REG(1, 49) /* ADC Input Selection for M-Terminal */
+#define AIC31XX_MICPGACM AIC31XX_REG(1, 50) /* Input CM Settings */
+
+/* Bits, masks, and shifts */
+
+/* AIC31XX_CLKMUX */
+#define AIC31XX_PLL_CLKIN_MASK GENMASK(3, 2)
+#define AIC31XX_PLL_CLKIN_SHIFT (2)
+#define AIC31XX_PLL_CLKIN_MCLK 0x00
+#define AIC31XX_PLL_CLKIN_BCKL 0x01
+#define AIC31XX_PLL_CLKIN_GPIO1 0x02
+#define AIC31XX_PLL_CLKIN_DIN 0x03
+#define AIC31XX_CODEC_CLKIN_MASK GENMASK(1, 0)
+#define AIC31XX_CODEC_CLKIN_SHIFT (0)
+#define AIC31XX_CODEC_CLKIN_MCLK 0x00
+#define AIC31XX_CODEC_CLKIN_BCLK 0x01
+#define AIC31XX_CODEC_CLKIN_GPIO1 0x02
+#define AIC31XX_CODEC_CLKIN_PLL 0x03
+
+/* AIC31XX_PLLPR */
+/* AIC31XX_NDAC */
+/* AIC31XX_MDAC */
+/* AIC31XX_NADC */
+/* AIC31XX_MADC */
+/* AIC31XX_BCLKN */
+#define AIC31XX_PLL_MASK GENMASK(6, 0)
+#define AIC31XX_PM_MASK BIT(7)
+
+/* AIC31XX_IFACE1 */
+#define AIC31XX_IFACE1_DATATYPE_MASK GENMASK(7, 6)
+#define AIC31XX_IFACE1_DATATYPE_SHIFT (6)
+#define AIC31XX_I2S_MODE 0x00
+#define AIC31XX_DSP_MODE 0x01
+#define AIC31XX_RIGHT_JUSTIFIED_MODE 0x02
+#define AIC31XX_LEFT_JUSTIFIED_MODE 0x03
+#define AIC31XX_IFACE1_DATALEN_MASK GENMASK(5, 4)
+#define AIC31XX_IFACE1_DATALEN_SHIFT (4)
+#define AIC31XX_WORD_LEN_16BITS 0x00
+#define AIC31XX_WORD_LEN_20BITS 0x01
+#define AIC31XX_WORD_LEN_24BITS 0x02
+#define AIC31XX_WORD_LEN_32BITS 0x03
+#define AIC31XX_IFACE1_MASTER_MASK GENMASK(3, 2)
+#define AIC31XX_BCLK_MASTER BIT(2)
+#define AIC31XX_WCLK_MASTER BIT(3)
+
+/* AIC31XX_DATA_OFFSET */
+#define AIC31XX_DATA_OFFSET_MASK GENMASK(7, 0)
+
+/* AIC31XX_IFACE2 */
+#define AIC31XX_BCLKINV_MASK BIT(3)
+#define AIC31XX_BDIVCLK_MASK GENMASK(1, 0)
+#define AIC31XX_DAC2BCLK 0x00
+#define AIC31XX_DACMOD2BCLK 0x01
+#define AIC31XX_ADC2BCLK 0x02
+#define AIC31XX_ADCMOD2BCLK 0x03
+
+/* AIC31XX_ADCFLAG */
+#define AIC31XX_ADCPWRSTATUS_MASK BIT(6)
+
+/* AIC31XX_DACFLAG1 */
+#define AIC31XX_LDACPWRSTATUS_MASK BIT(7)
+#define AIC31XX_HPLDRVPWRSTATUS_MASK BIT(5)
+#define AIC31XX_SPLDRVPWRSTATUS_MASK BIT(4)
+#define AIC31XX_RDACPWRSTATUS_MASK BIT(3)
+#define AIC31XX_HPRDRVPWRSTATUS_MASK BIT(1)
+#define AIC31XX_SPRDRVPWRSTATUS_MASK BIT(0)
+
+/* AIC31XX_INTRDACFLAG */
+#define AIC31XX_HPLSCDETECT BIT(7)
+#define AIC31XX_HPRSCDETECT BIT(6)
+#define AIC31XX_BUTTONPRESS BIT(5)
+#define AIC31XX_HSPLUG BIT(4)
+#define AIC31XX_LDRCTHRES BIT(3)
+#define AIC31XX_RDRCTHRES BIT(2)
+#define AIC31XX_DACSINT BIT(1)
+#define AIC31XX_DACAINT BIT(0)
+
+/* AIC31XX_INT1CTRL */
+#define AIC31XX_HSPLUGDET BIT(7)
+#define AIC31XX_BUTTONPRESSDET BIT(6)
+#define AIC31XX_DRCTHRES BIT(5)
+#define AIC31XX_AGCNOISE BIT(4)
+#define AIC31XX_SC BIT(3)
+#define AIC31XX_ENGINE BIT(2)
+
+/* AIC31XX_DACSETUP */
+#define AIC31XX_SOFTSTEP_MASK GENMASK(1, 0)
+
+/* AIC31XX_DACMUTE */
+#define AIC31XX_DACMUTE_MASK GENMASK(3, 2)
+
+/* AIC31XX_MICBIAS */
+#define AIC31XX_MICBIAS_MASK GENMASK(1, 0)
+#define AIC31XX_MICBIAS_SHIFT 0
+
+#endif /* _TLV320AIC31XX_H */
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 07/19] ASoC: tlv320aic31xx: Merge init function into probe
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (5 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 06/19] ASoC: tlv320aic31xx: Reformat header file using GENMASK and BIT macros Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 09/19] ASoC: tlv320aic31xx: Remove platform data Andrew F. Davis
` (9 subsequent siblings)
16 siblings, 0 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
The function aic31xx_device_init() is only called from probe and
does nothing that logically shouldn't be in probe, remove this
unneeded function call and move its code into probe where it was called.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 55 ++++++++++++++++------------------------
1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 07c014501e5e..c84febd991a0 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1302,9 +1302,29 @@ static const struct acpi_device_id aic31xx_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
#endif
-static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
+static int aic31xx_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
{
- int ret, i;
+ struct aic31xx_priv *aic31xx;
+ int i, ret;
+
+ dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
+ id->name, (int)id->driver_data);
+
+ aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
+ if (!aic31xx)
+ return -ENOMEM;
+
+ aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
+ if (IS_ERR(aic31xx->regmap)) {
+ ret = PTR_ERR(aic31xx->regmap);
+ dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
+ ret);
+ return ret;
+ }
+ aic31xx->dev = &i2c->dev;
+
+ aic31xx->pdata.codec_type = id->driver_data;
dev_set_drvdata(aic31xx->dev, aic31xx);
@@ -1336,37 +1356,6 @@ static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
return ret;
}
- return 0;
-}
-
-static int aic31xx_i2c_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
-{
- struct aic31xx_priv *aic31xx;
- int ret;
-
- dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
- id->name, (int) id->driver_data);
-
- aic31xx = devm_kzalloc(&i2c->dev, sizeof(*aic31xx), GFP_KERNEL);
- if (!aic31xx)
- return -ENOMEM;
-
- aic31xx->regmap = devm_regmap_init_i2c(i2c, &aic31xx_i2c_regmap);
- if (IS_ERR(aic31xx->regmap)) {
- ret = PTR_ERR(aic31xx->regmap);
- dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
- ret);
- return ret;
- }
- aic31xx->dev = &i2c->dev;
-
- aic31xx->pdata.codec_type = id->driver_data;
-
- ret = aic31xx_device_init(aic31xx);
- if (ret)
- return ret;
-
if (aic31xx->pdata.codec_type & DAC31XX_BIT)
return snd_soc_register_codec(&i2c->dev,
&soc_codec_driver_aic31xx,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 09/19] ASoC: tlv320aic31xx: Remove platform data
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (6 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 07/19] ASoC: tlv320aic31xx: Merge init function into probe Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
[not found] ` <20171129213300.20021-10-afd-l0cyMroinI0@public.gmane.org>
2017-11-29 21:32 ` [PATCH v2 10/19] ASoC: tlv320aic31xx: Add MICBIAS off setting Andrew F. Davis
` (8 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
Platform data is not used by anyone (at least in upstream) so
drop this data and switch to using fwnode(DT/ACPI) only.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 72 +++++++++++++---------------------------
sound/soc/codecs/tlv320aic31xx.h | 6 ----
2 files changed, 23 insertions(+), 55 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index ab03a19f6aaa..0e00421d363b 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -157,8 +157,9 @@ struct aic31xx_priv {
u8 i2c_regs_status;
struct device *dev;
struct regmap *regmap;
+ enum aic31xx_type codec_type;
struct gpio_desc *gpio_reset;
- struct aic31xx_pdata pdata;
+ int micbias_vg;
struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
unsigned int sysclk;
@@ -450,7 +451,7 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
/* change mic bias voltage to user defined */
snd_soc_update_bits(codec, AIC31XX_MICBIAS,
AIC31XX_MICBIAS_MASK,
- aic31xx->pdata.micbias_vg <<
+ aic31xx->micbias_vg <<
AIC31XX_MICBIAS_SHIFT);
dev_dbg(codec->dev, "%s: turned on\n", __func__);
break;
@@ -673,14 +674,14 @@ static int aic31xx_add_controls(struct snd_soc_codec *codec)
int ret = 0;
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- if (!(aic31xx->pdata.codec_type & DAC31XX_BIT))
+ if (!(aic31xx->codec_type & DAC31XX_BIT))
ret = snd_soc_add_codec_controls(
codec, aic31xx_snd_controls,
ARRAY_SIZE(aic31xx_snd_controls));
if (ret)
return ret;
- if (aic31xx->pdata.codec_type & AIC31XX_STEREO_CLASS_D_BIT)
+ if (aic31xx->codec_type & AIC31XX_STEREO_CLASS_D_BIT)
ret = snd_soc_add_codec_controls(
codec, aic311x_snd_controls,
ARRAY_SIZE(aic311x_snd_controls));
@@ -698,7 +699,7 @@ static int aic31xx_add_widgets(struct snd_soc_codec *codec)
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
int ret = 0;
- if (aic31xx->pdata.codec_type & DAC31XX_BIT) {
+ if (aic31xx->codec_type & DAC31XX_BIT) {
ret = snd_soc_dapm_new_controls(
dapm, dac31xx_dapm_widgets,
ARRAY_SIZE(dac31xx_dapm_widgets));
@@ -722,7 +723,7 @@ static int aic31xx_add_widgets(struct snd_soc_codec *codec)
return ret;
}
- if (aic31xx->pdata.codec_type & AIC31XX_STEREO_CLASS_D_BIT) {
+ if (aic31xx->codec_type & AIC31XX_STEREO_CLASS_D_BIT) {
ret = snd_soc_dapm_new_controls(
dapm, aic311x_dapm_widgets,
ARRAY_SIZE(aic311x_dapm_widgets));
@@ -1257,42 +1258,6 @@ static const struct of_device_id tlv320aic31xx_of_match[] = {
{},
};
MODULE_DEVICE_TABLE(of, tlv320aic31xx_of_match);
-
-static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
-{
- struct device_node *np = aic31xx->dev->of_node;
- unsigned int value = MICBIAS_2_0V;
- int ret;
-
- of_property_read_u32(np, "ai31xx-micbias-vg", &value);
- switch (value) {
- case MICBIAS_2_0V:
- case MICBIAS_2_5V:
- case MICBIAS_AVDDV:
- aic31xx->pdata.micbias_vg = value;
- break;
- default:
- dev_err(aic31xx->dev,
- "Bad ai31xx-micbias-vg value %d DT\n",
- value);
- aic31xx->pdata.micbias_vg = MICBIAS_2_0V;
- }
-
- ret = of_get_named_gpio(np, "reset-gpios", 0);
- if (ret > 0) {
- aic31xx->pdata.gpio_reset = ret;
- } else {
- ret = of_get_named_gpio(np, "gpio-reset", 0);
- if (ret > 0) {
- dev_warn(aic31xx->dev, "Using deprecated property \"gpio-reset\", please update your DT");
- aic31xx->pdata.gpio_reset = ret;
- }
- }
-}
-#else /* CONFIG_OF */
-static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
-{
-}
#endif /* CONFIG_OF */
#ifdef CONFIG_ACPI
@@ -1307,6 +1272,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct aic31xx_priv *aic31xx;
+ unsigned int micbias_value = MICBIAS_2_0V;
int i, ret;
dev_dbg(&i2c->dev, "## %s: %s codec_type = %d\n", __func__,
@@ -1325,15 +1291,23 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
}
aic31xx->dev = &i2c->dev;
- aic31xx->pdata.codec_type = id->driver_data;
+ aic31xx->codec_type = id->driver_data;
dev_set_drvdata(aic31xx->dev, aic31xx);
- if (dev_get_platdata(aic31xx->dev))
- memcpy(&aic31xx->pdata, dev_get_platdata(aic31xx->dev),
- sizeof(aic31xx->pdata));
- else if (aic31xx->dev->of_node)
- aic31xx_pdata_from_of(aic31xx);
+ fwnode_property_read_u32(aic31xx->dev->fwnode, "ai31xx-micbias-vg",
+ &micbias_value);
+ switch (micbias_value) {
+ case MICBIAS_2_0V:
+ case MICBIAS_2_5V:
+ case MICBIAS_AVDDV:
+ aic31xx->micbias_vg = micbias_value;
+ break;
+ default:
+ dev_err(aic31xx->dev, "Bad ai31xx-micbias-vg value %d in DT\n",
+ micbias_value);
+ aic31xx->micbias_vg = MICBIAS_2_0V;
+ }
aic31xx->gpio_reset = devm_gpiod_get_optional(aic31xx->dev, "reset",
GPIOD_OUT_LOW);
@@ -1353,7 +1327,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
return ret;
}
- if (aic31xx->pdata.codec_type & DAC31XX_BIT)
+ if (aic31xx->codec_type & DAC31XX_BIT)
return snd_soc_register_codec(&i2c->dev,
&soc_codec_driver_aic31xx,
dac31xx_dai_driver,
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 15ac7cba86fe..ab94e6a0c742 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -29,12 +29,6 @@ enum aic31xx_type {
DAC3101 = DAC31XX_BIT | AIC31XX_STEREO_CLASS_D_BIT,
};
-struct aic31xx_pdata {
- enum aic31xx_type codec_type;
- unsigned int gpio_reset;
- int micbias_vg;
-};
-
#define AIC31XX_REG(page, reg) ((page * 128) + reg)
#define AIC31XX_PAGECTL AIC31XX_REG(0, 0) /* Page Control Register */
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 10/19] ASoC: tlv320aic31xx: Add MICBIAS off setting
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (7 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 09/19] ASoC: tlv320aic31xx: Remove platform data Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
[not found] ` <20171129213300.20021-11-afd-l0cyMroinI0@public.gmane.org>
2017-11-29 21:32 ` [PATCH v2 11/19] ASoC: tlv320aic31xx: Check clock and divider before division Andrew F. Davis
` (7 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
Leaving microphone bias off is a valid setting and even used in the DT
binding document example. Add this setting here and document the same.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/sound/tlv320aic31xx.txt | 1 +
include/dt-bindings/sound/tlv320aic31xx-micbias.h | 1 +
sound/soc/codecs/tlv320aic31xx.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
index 5b3c33bb99e5..411cc46a2c58 100644
--- a/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
+++ b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
@@ -24,6 +24,7 @@ Optional properties:
- reset-gpios - GPIO specification for the active low RESET input.
- ai31xx-micbias-vg - MicBias Voltage setting
+ 0 or MICBIAS_OFF - MICBIAS output is powered off
1 or MICBIAS_2_0V - MICBIAS output is powered to 2.0V
2 or MICBIAS_2_5V - MICBIAS output is powered to 2.5V
3 or MICBIAS_AVDD - MICBIAS output is connected to AVDD
diff --git a/include/dt-bindings/sound/tlv320aic31xx-micbias.h b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
index c6895a18a455..069484070fcf 100644
--- a/include/dt-bindings/sound/tlv320aic31xx-micbias.h
+++ b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
@@ -2,6 +2,7 @@
#ifndef __DT_TLV320AIC31XX_MICBIAS_H
#define __DT_TLV320AIC31XX_MICBIAS_H
+#define MICBIAS_OFF 0
#define MICBIAS_2_0V 1
#define MICBIAS_2_5V 2
#define MICBIAS_AVDDV 3
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 0e00421d363b..252d99af6688 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1298,6 +1298,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
fwnode_property_read_u32(aic31xx->dev->fwnode, "ai31xx-micbias-vg",
&micbias_value);
switch (micbias_value) {
+ case MICBIAS_OFF:
case MICBIAS_2_0V:
case MICBIAS_2_5V:
case MICBIAS_AVDDV:
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 11/19] ASoC: tlv320aic31xx: Check clock and divider before division
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (8 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 10/19] ASoC: tlv320aic31xx: Add MICBIAS off setting Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-29 21:32 ` [PATCH v2 12/19] ASoC: tlv320aic31xx: Add CODEC clock slave support Andrew F. Davis
` (6 subsequent siblings)
16 siblings, 0 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
If our set_sysclk DAI callback has not been called yet p_div will be 0
and dividing by this will cause an error. Print an error message and
leave before this.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 252d99af6688..41e2d8077a62 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -755,11 +755,17 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
int bclk_score = snd_soc_params_to_frame_size(params);
- int mclk_p = aic31xx->sysclk / aic31xx->p_div;
+ int mclk_p;
int bclk_n = 0;
int match = -1;
int i;
+ if (!aic31xx->sysclk || !aic31xx->p_div) {
+ dev_err(codec->dev, "Master clock not supplied\n");
+ return -EINVAL;
+ }
+ mclk_p = aic31xx->sysclk / aic31xx->p_div;
+
/* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */
snd_soc_update_bits(codec, AIC31XX_CLKMUX,
AIC31XX_CODEC_CLKIN_MASK, AIC31XX_CODEC_CLKIN_PLL);
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 12/19] ASoC: tlv320aic31xx: Add CODEC clock slave support
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (9 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 11/19] ASoC: tlv320aic31xx: Check clock and divider before division Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-01 13:43 ` Applied "ASoC: tlv320aic31xx: Add CODEC clock slave support" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 13/19] ASoC: tlv320aic31xx: Fix inverted BCLK handling Andrew F. Davis
` (5 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
This CODEC supports being the WCLK and/or BCLK slave, add
support for this here.
Also make the alert into an error as alert is more urgent
than needed here and is rarely used.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 41e2d8077a62..b39db3eb06d0 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -926,8 +926,16 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
case SND_SOC_DAIFMT_CBM_CFM:
iface_reg1 |= AIC31XX_BCLK_MASTER | AIC31XX_WCLK_MASTER;
break;
+ case SND_SOC_DAIFMT_CBS_CFM:
+ iface_reg1 |= AIC31XX_WCLK_MASTER;
+ break;
+ case SND_SOC_DAIFMT_CBM_CFS:
+ iface_reg1 |= AIC31XX_BCLK_MASTER;
+ break;
+ case SND_SOC_DAIFMT_CBS_CFS:
+ break;
default:
- dev_alert(codec->dev, "Invalid DAI master/slave interface\n");
+ dev_err(codec->dev, "Invalid DAI master/slave interface\n");
return -EINVAL;
}
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: Add CODEC clock slave support" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 12/19] ASoC: tlv320aic31xx: Add CODEC clock slave support Andrew F. Davis
@ 2017-12-01 13:43 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-01 13:43 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: Add CODEC clock slave support
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 77f8b3cfc33cd4231cc2748bcac9f43b9eea546c Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:53 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Add CODEC clock slave support
This CODEC supports being the WCLK and/or BCLK slave, add
support for this here.
Also make the alert into an error as alert is more urgent
than needed here and is rarely used.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 05e6d194d6a9..d77cc36d7360 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -925,8 +925,16 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
case SND_SOC_DAIFMT_CBM_CFM:
iface_reg1 |= AIC31XX_BCLK_MASTER | AIC31XX_WCLK_MASTER;
break;
+ case SND_SOC_DAIFMT_CBS_CFM:
+ iface_reg1 |= AIC31XX_WCLK_MASTER;
+ break;
+ case SND_SOC_DAIFMT_CBM_CFS:
+ iface_reg1 |= AIC31XX_BCLK_MASTER;
+ break;
+ case SND_SOC_DAIFMT_CBS_CFS:
+ break;
default:
- dev_alert(codec->dev, "Invalid DAI master/slave interface\n");
+ dev_err(codec->dev, "Invalid DAI master/slave interface\n");
return -EINVAL;
}
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 13/19] ASoC: tlv320aic31xx: Fix inverted BCLK handling
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (10 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 12/19] ASoC: tlv320aic31xx: Add CODEC clock slave support Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-01 13:42 ` Applied "ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes" to the asoc tree Mark Brown
2017-11-29 21:32 ` [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling Andrew F. Davis
` (4 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
Currently BCLK inverting is only handled when the DAI format is
DSP, but the BCLK may be inverted in any supported mode. Without
this using this CODEC in any other mode than DSP with the BCLK
inverted leads to bad sampling timing and very poor audio quality.
Fixes: e00447fafbf7 ("ASoC: tlv320aic31xx: Add basic codec driver implementation")
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index b39db3eb06d0..f7b1ec96d826 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -939,6 +939,18 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
return -EINVAL;
}
+ /* signal polarity */
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+ case SND_SOC_DAIFMT_NB_NF:
+ break;
+ case SND_SOC_DAIFMT_IB_NF:
+ iface_reg2 |= AIC31XX_BCLKINV_MASK;
+ break;
+ default:
+ dev_err(codec->dev, "Invalid DAI clock signal polarity\n");
+ return -EINVAL;
+ }
+
/* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
@@ -946,16 +958,12 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
case SND_SOC_DAIFMT_DSP_A:
dsp_a_val = 0x1; /* fall through */
case SND_SOC_DAIFMT_DSP_B:
- /* NOTE: BCLKINV bit value 1 equas NB and 0 equals IB */
- switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
- case SND_SOC_DAIFMT_NB_NF:
- iface_reg2 |= AIC31XX_BCLKINV_MASK;
- break;
- case SND_SOC_DAIFMT_IB_NF:
- break;
- default:
- return -EINVAL;
- }
+ /*
+ * NOTE: This CODEC samples on the falling edge of BCLK in
+ * DSP mode, this is inverted compared to what most DAIs
+ * expect, so we invert for this mode
+ */
+ iface_reg2 ^= AIC31XX_BCLKINV_MASK;
iface_reg1 |= (AIC31XX_DSP_MODE <<
AIC31XX_IFACE1_DATATYPE_SHIFT);
break;
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Applied "ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes" to the asoc tree
2017-11-29 21:32 ` [PATCH v2 13/19] ASoC: tlv320aic31xx: Fix inverted BCLK handling Andrew F. Davis
@ 2017-12-01 13:42 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-01 13:42 UTC (permalink / raw)
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, Rob Herring, linux-kernel, Mark Brown,
Benoît Cousson, Andrew F . Davis
The patch
ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From dcb407b257af06fa58b0544ec01ec9e0d3927e02 Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <afd@ti.com>
Date: Wed, 29 Nov 2017 15:32:54 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modes
Currently BCLK inverting is only handled when the DAI format is
DSP, but the BCLK may be inverted in any supported mode. Without
this using this CODEC in any other mode than DSP with the BCLK
inverted leads to bad sampling timing and very poor audio quality.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/tlv320aic31xx.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index d77cc36d7360..38fd6ea275fb 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -938,6 +938,18 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
return -EINVAL;
}
+ /* signal polarity */
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+ case SND_SOC_DAIFMT_NB_NF:
+ break;
+ case SND_SOC_DAIFMT_IB_NF:
+ iface_reg2 |= AIC31XX_BCLKINV_MASK;
+ break;
+ default:
+ dev_err(codec->dev, "Invalid DAI clock signal polarity\n");
+ return -EINVAL;
+ }
+
/* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
@@ -945,16 +957,12 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
case SND_SOC_DAIFMT_DSP_A:
dsp_a_val = 0x1; /* fall through */
case SND_SOC_DAIFMT_DSP_B:
- /* NOTE: BCLKINV bit value 1 equas NB and 0 equals IB */
- switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
- case SND_SOC_DAIFMT_NB_NF:
- iface_reg2 |= AIC31XX_BCLKINV_MASK;
- break;
- case SND_SOC_DAIFMT_IB_NF:
- break;
- default:
- return -EINVAL;
- }
+ /*
+ * NOTE: This CODEC samples on the falling edge of BCLK in
+ * DSP mode, this is inverted compared to what most DAIs
+ * expect, so we invert for this mode
+ */
+ iface_reg2 ^= AIC31XX_BCLKINV_MASK;
iface_reg1 |= (AIC31XX_DSP_MODE <<
AIC31XX_IFACE1_DATATYPE_SHIFT);
break;
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (11 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 13/19] ASoC: tlv320aic31xx: Fix inverted BCLK handling Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-01 13:36 ` Mark Brown
2017-11-29 21:32 ` [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up Andrew F. Davis
` (3 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
A regulator being forcefully disabled is a catastrophic event that
should never happen to most devices, especially not sound CODECs.
In addition, our handler sets the reset line but never disables it
as no one is listening for an enable event, this is certainly broken
and was mosy likely just copied from other CODECs, lets just remove
this code.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 50 ----------------------------------------
1 file changed, 50 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index f7b1ec96d826..b51c2777e8d1 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -161,7 +161,6 @@ struct aic31xx_priv {
struct gpio_desc *gpio_reset;
int micbias_vg;
struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES];
- struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES];
unsigned int sysclk;
u8 p_div;
int rate_div_line;
@@ -1032,28 +1031,6 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return 0;
}
-static int aic31xx_regulator_event(struct notifier_block *nb,
- unsigned long event, void *data)
-{
- struct aic31xx_disable_nb *disable_nb =
- container_of(nb, struct aic31xx_disable_nb, nb);
- struct aic31xx_priv *aic31xx = disable_nb->aic31xx;
-
- if (event & REGULATOR_EVENT_DISABLE) {
- /*
- * Put codec to reset and as at least one of the
- * supplies was disabled.
- */
- if (aic31xx->gpio_reset)
- gpiod_set_value(aic31xx->gpio_reset, 1);
-
- regcache_mark_dirty(aic31xx->regmap);
- dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__);
- }
-
- return 0;
-}
-
static void aic31xx_clk_on(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
@@ -1167,20 +1144,6 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec)
aic31xx->codec = codec;
- for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) {
- aic31xx->disable_nb[i].nb.notifier_call =
- aic31xx_regulator_event;
- aic31xx->disable_nb[i].aic31xx = aic31xx;
- ret = regulator_register_notifier(aic31xx->supplies[i].consumer,
- &aic31xx->disable_nb[i].nb);
- if (ret) {
- dev_err(codec->dev,
- "Failed to request regulator notifier: %d\n",
- ret);
- return ret;
- }
- }
-
regcache_cache_only(aic31xx->regmap, true);
regcache_mark_dirty(aic31xx->regmap);
@@ -1195,21 +1158,8 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec)
return 0;
}
-static int aic31xx_codec_remove(struct snd_soc_codec *codec)
-{
- struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
- int i;
-
- for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++)
- regulator_unregister_notifier(aic31xx->supplies[i].consumer,
- &aic31xx->disable_nb[i].nb);
-
- return 0;
-}
-
static const struct snd_soc_codec_driver soc_codec_driver_aic31xx = {
.probe = aic31xx_codec_probe,
- .remove = aic31xx_codec_remove,
.set_bias_level = aic31xx_set_bias_level,
.suspend_bias_off = true,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Re: [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
2017-11-29 21:32 ` [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling Andrew F. Davis
@ 2017-12-01 13:36 ` Mark Brown
2017-12-01 15:01 ` Andrew F. Davis
0 siblings, 1 reply; 63+ messages in thread
From: Mark Brown @ 2017-12-01 13:36 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Liam Girdwood, Rob Herring, Mark Rutland, Benoît Cousson,
Tony Lindgren, alsa-devel, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
On Wed, Nov 29, 2017 at 03:32:55PM -0600, Andrew F. Davis wrote:
> A regulator being forcefully disabled is a catastrophic event that
> should never happen to most devices, especially not sound CODECs.
That's not what the disable notification handling is for. It's there so
that the driver can skip having to reinitialize the device if other
constraints mean the power doesn't actually get turned off when it
disables the regualtors. It's nothing to do with forced disables.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
2017-12-01 13:36 ` Mark Brown
@ 2017-12-01 15:01 ` Andrew F. Davis
2017-12-01 15:55 ` Mark Brown
0 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-12-01 15:01 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
On 12/01/2017 07:36 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:55PM -0600, Andrew F. Davis wrote:
>> A regulator being forcefully disabled is a catastrophic event that
>> should never happen to most devices, especially not sound CODECs.
>
> That's not what the disable notification handling is for. It's there so
> that the driver can skip having to reinitialize the device if other
> constraints mean the power doesn't actually get turned off when it
> disables the regualtors. It's nothing to do with forced disables.
>
Looking into the call sites, at least in this case the only time this
notification will be called, outside the normal enable/disable paths
(which do the same thing here: turn on regmap cache only mode and mark
it dirty), will be during a force disable scenario.
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling
2017-12-01 15:01 ` Andrew F. Davis
@ 2017-12-01 15:55 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-01 15:55 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
[-- Attachment #1.1: Type: text/plain, Size: 431 bytes --]
On Fri, Dec 01, 2017 at 09:01:19AM -0600, Andrew F. Davis wrote:
> Looking into the call sites, at least in this case the only time this
> notification will be called, outside the normal enable/disable paths
> (which do the same thing here: turn on regmap cache only mode and mark
> it dirty), will be during a force disable scenario.
If all the disable sites in the driver mark the cache dirty then they
should be fixed not to.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (12 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 14/19] ASoC: tlv320aic31xx: Remove regulator notification handling Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-12-01 13:37 ` Mark Brown
2017-11-29 21:32 ` [PATCH v2 16/19] ASoC: tlv320aic31xx: Add short circuit detection support Andrew F. Davis
` (2 subsequent siblings)
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: devicetree, alsa-devel, linux-kernel, Andrew F . Davis
Add a reset function that toggles the reset line if available or uses
the software reset command otherwise. Use this in power up to ensure the
registers are in a sane state. This is useful when the driver module
is reloaded, or after Kexec, warm-reboots, etc..
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index b51c2777e8d1..77ae8f36a943 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1031,6 +1031,24 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return 0;
}
+static int aic31xx_reset(struct aic31xx_priv *aic31xx)
+{
+ int ret = 0;
+
+ if (aic31xx->gpio_reset) {
+ gpiod_set_value(aic31xx->gpio_reset, 1);
+ ndelay(10); /* At least 10ns */
+ gpiod_set_value(aic31xx->gpio_reset, 0);
+ } else {
+ ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
+ if (ret < 0)
+ dev_err(aic31xx->dev, "Could not reset device\n");
+ }
+ mdelay(1); /* At least 1ms */
+
+ return ret;
+}
+
static void aic31xx_clk_on(struct snd_soc_codec *codec)
{
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
@@ -1074,11 +1092,11 @@ static int aic31xx_power_on(struct snd_soc_codec *codec)
if (ret)
return ret;
- if (aic31xx->gpio_reset) {
- gpiod_set_value(aic31xx->gpio_reset, 0);
- udelay(100);
- }
regcache_cache_only(aic31xx->regmap, false);
+
+ /* Reset device registers for a consistent power-on like state */
+ aic31xx_reset(aic31xx);
+
ret = regcache_sync(aic31xx->regmap);
if (ret) {
dev_err(codec->dev,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* Re: [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
2017-11-29 21:32 ` [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up Andrew F. Davis
@ 2017-12-01 13:37 ` Mark Brown
2017-12-01 15:04 ` Andrew F. Davis
0 siblings, 1 reply; 63+ messages in thread
From: Mark Brown @ 2017-12-01 13:37 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
[-- Attachment #1.1: Type: text/plain, Size: 449 bytes --]
On Wed, Nov 29, 2017 at 03:32:56PM -0600, Andrew F. Davis wrote:
> + gpiod_set_value(aic31xx->gpio_reset, 1);
> + ndelay(10); /* At least 10ns */
> + gpiod_set_value(aic31xx->gpio_reset, 0);
_cansleep(), this isn't being done from interrupt context.
> + } else {
> + ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
> + if (ret < 0)
> + dev_err(aic31xx->dev, "Could not reset device\n");
Print the error to help people doing debug.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
2017-12-01 13:37 ` Mark Brown
@ 2017-12-01 15:04 ` Andrew F. Davis
2017-12-01 15:55 ` Mark Brown
0 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-12-01 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Rob Herring, Benoît Cousson
On 12/01/2017 07:37 AM, Mark Brown wrote:
> On Wed, Nov 29, 2017 at 03:32:56PM -0600, Andrew F. Davis wrote:
>
>> + gpiod_set_value(aic31xx->gpio_reset, 1);
>> + ndelay(10); /* At least 10ns */
>> + gpiod_set_value(aic31xx->gpio_reset, 0);
>
> _cansleep(), this isn't being done from interrupt context.
>
will fix
>> + } else {
>> + ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
>> + if (ret < 0)
>> + dev_err(aic31xx->dev, "Could not reset device\n");
>
> Print the error to help people doing debug.
>
Do you mean by adding the ret code to the print?
^ permalink raw reply [flat|nested] 63+ messages in thread
* Re: [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up
2017-12-01 15:04 ` Andrew F. Davis
@ 2017-12-01 15:55 ` Mark Brown
0 siblings, 0 replies; 63+ messages in thread
From: Mark Brown @ 2017-12-01 15:55 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Liam Girdwood, Rob Herring, Mark Rutland, Benoît Cousson,
Tony Lindgren, alsa-devel, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
On Fri, Dec 01, 2017 at 09:04:41AM -0600, Andrew F. Davis wrote:
> On 12/01/2017 07:37 AM, Mark Brown wrote:
> > On Wed, Nov 29, 2017 at 03:32:56PM -0600, Andrew F. Davis wrote:
> >> + } else {
> >> + ret = regmap_write(aic31xx->regmap, AIC31XX_RESET, 1);
> >> + if (ret < 0)
> >> + dev_err(aic31xx->dev, "Could not reset device\n");
> > Print the error to help people doing debug.
> Do you mean by adding the ret code to the print?
Yes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 63+ messages in thread
* [PATCH v2 16/19] ASoC: tlv320aic31xx: Add short circuit detection support
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (13 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 15/19] ASoC: tlv320aic31xx: Reset registers during power up Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
[not found] ` <20171129213300.20021-17-afd-l0cyMroinI0@public.gmane.org>
2017-11-29 21:32 ` [PATCH v2 17/19] ASoC: tlv320aic31xx: Add overflow " Andrew F. Davis
2017-11-29 21:33 ` [PATCH v2 19/19] ASoC: tlv320aic31xx: Add button press detection Andrew F. Davis
16 siblings, 1 reply; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
These devices support detecting and reporting short circuits across
the output stages. Add support for reporting these issue. Do this
by registering an interrupt if available and enabling this error
to trigger that interrupt in the device.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 42 ++++++++++++++++++++++++++++++++++++++++
sound/soc/codecs/tlv320aic31xx.h | 16 +++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 77ae8f36a943..fd3109366377 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -164,6 +164,7 @@ struct aic31xx_priv {
unsigned int sysclk;
u8 p_div;
int rate_div_line;
+ int irq;
};
struct aic31xx_rate_divs {
@@ -1258,6 +1259,27 @@ static const struct acpi_device_id aic31xx_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, aic31xx_acpi_match);
#endif
+static irqreturn_t aic31xx_irq(int irq, void *data)
+{
+ struct aic31xx_priv *aic31xx = (struct aic31xx_priv *)data;
+ struct device *dev = aic31xx->dev;
+ unsigned int value;
+ int ret;
+
+ ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG, &value);
+ if (ret) {
+ dev_err(dev, "Failed to read interrupt mask: %d\n", ret);
+ return IRQ_NONE;
+ }
+
+ if (value & AIC31XX_HPLSCDETECT)
+ dev_err(dev, "Short circuit on Left output is detected\n");
+ if (value & AIC31XX_HPRSCDETECT)
+ dev_err(dev, "Short circuit on Right output is detected\n");
+
+ return IRQ_HANDLED;
+}
+
static int aic31xx_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -1280,6 +1302,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
return ret;
}
aic31xx->dev = &i2c->dev;
+ aic31xx->irq = i2c->irq;
aic31xx->codec_type = id->driver_data;
@@ -1318,6 +1341,25 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
return ret;
}
+ if (aic31xx->irq > 0) {
+ regmap_update_bits(aic31xx->regmap, AIC31XX_GPIO1,
+ AIC31XX_GPIO1_FUNC_MASK,
+ AIC31XX_GPIO1_INT1 <<
+ AIC31XX_GPIO1_FUNC_SHIFT);
+
+ regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL,
+ AIC31XX_SC);
+
+ ret = devm_request_threaded_irq(aic31xx->dev, aic31xx->irq,
+ NULL, aic31xx_irq,
+ IRQF_ONESHOT, "aic31xx-irq",
+ aic31xx);
+ if (ret) {
+ dev_err(aic31xx->dev, "Unable to request IRQ\n");
+ return ret;
+ }
+ }
+
if (aic31xx->codec_type & DAC31XX_BIT)
return snd_soc_register_codec(&i2c->dev,
&soc_codec_driver_aic31xx,
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index ab94e6a0c742..9dc85b6f6ad3 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -184,6 +184,22 @@ enum aic31xx_type {
#define AIC31XX_SC BIT(3)
#define AIC31XX_ENGINE BIT(2)
+/* AIC31XX_GPIO1 */
+#define AIC31XX_GPIO1_FUNC_MASK GENMASK(5, 2)
+#define AIC31XX_GPIO1_FUNC_SHIFT 2
+#define AIC31XX_GPIO1_DISABLED 0x00
+#define AIC31XX_GPIO1_INPUT 0x01
+#define AIC31XX_GPIO1_GPI 0x02
+#define AIC31XX_GPIO1_GPO 0x03
+#define AIC31XX_GPIO1_CLKOUT 0x04
+#define AIC31XX_GPIO1_INT1 0x05
+#define AIC31XX_GPIO1_INT2 0x06
+#define AIC31XX_GPIO1_ADC_WCLK 0x07
+#define AIC31XX_GPIO1_SBCLK 0x08
+#define AIC31XX_GPIO1_SWCLK 0x09
+#define AIC31XX_GPIO1_ADC_MOD_CLK 0x10
+#define AIC31XX_GPIO1_SDOUT 0x11
+
/* AIC31XX_DACSETUP */
#define AIC31XX_SOFTSTEP_MASK GENMASK(1, 0)
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 17/19] ASoC: tlv320aic31xx: Add overflow detection support
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (14 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 16/19] ASoC: tlv320aic31xx: Add short circuit detection support Andrew F. Davis
@ 2017-11-29 21:32 ` Andrew F. Davis
2017-11-29 21:33 ` [PATCH v2 19/19] ASoC: tlv320aic31xx: Add button press detection Andrew F. Davis
16 siblings, 0 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
Similar to short circuit detection, when the ADC/DAC is saturated and
overflows poor audio quality can result and should be reported to the
user. This device support Automatic Dynamic Range Compression (DRC)
to reduce this but it is not enabled currently in this driver.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 20 +++++++++++++++++++-
sound/soc/codecs/tlv320aic31xx.h | 7 +++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index fd3109366377..094b1596f9cc 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1277,6 +1277,23 @@ static irqreturn_t aic31xx_irq(int irq, void *data)
if (value & AIC31XX_HPRSCDETECT)
dev_err(dev, "Short circuit on Right output is detected\n");
+ ret = regmap_read(aic31xx->regmap, AIC31XX_OFFLAG, &value);
+ if (ret) {
+ dev_err(dev, "Failed to read overflow flag: %d\n", ret);
+ return IRQ_NONE;
+ }
+
+ if (value & AIC31XX_DAC_OF_LEFT)
+ dev_err(dev, "Left-channel DAC overflow has occurred\n");
+ if (value & AIC31XX_DAC_OF_RIGHT)
+ dev_err(dev, "Right-channel DAC overflow has occurred\n");
+ if (value & AIC31XX_DAC_OF_SHIFTER)
+ dev_err(dev, "DAC barrel shifter overflow has occurred\n");
+ if (value & AIC31XX_ADC_OF)
+ dev_err(dev, "ADC overflow has occurred\n");
+ if (value & AIC31XX_ADC_OF_SHIFTER)
+ dev_err(dev, "ADC barrel shifter overflow has occurred\n");
+
return IRQ_HANDLED;
}
@@ -1348,7 +1365,8 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
AIC31XX_GPIO1_FUNC_SHIFT);
regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL,
- AIC31XX_SC);
+ AIC31XX_SC |
+ AIC31XX_ENGINE);
ret = devm_request_threaded_irq(aic31xx->dev, aic31xx->irq,
NULL, aic31xx_irq,
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 9dc85b6f6ad3..d062663f66b5 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -166,6 +166,13 @@ enum aic31xx_type {
#define AIC31XX_HPRDRVPWRSTATUS_MASK BIT(1)
#define AIC31XX_SPRDRVPWRSTATUS_MASK BIT(0)
+/* AIC31XX_OFFLAG */
+#define AIC31XX_DAC_OF_LEFT BIT(7)
+#define AIC31XX_DAC_OF_RIGHT BIT(6)
+#define AIC31XX_DAC_OF_SHIFTER BIT(5)
+#define AIC31XX_ADC_OF BIT(3)
+#define AIC31XX_ADC_OF_SHIFTER BIT(1)
+
/* AIC31XX_INTRDACFLAG */
#define AIC31XX_HPLSCDETECT BIT(7)
#define AIC31XX_HPRSCDETECT BIT(6)
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread
* [PATCH v2 19/19] ASoC: tlv320aic31xx: Add button press detection
2017-11-29 21:32 [PATCH v2 00/19] Add Headphone Detection to TLV320AIC31xx Driver Andrew F. Davis
` (15 preceding siblings ...)
2017-11-29 21:32 ` [PATCH v2 17/19] ASoC: tlv320aic31xx: Add overflow " Andrew F. Davis
@ 2017-11-29 21:33 ` Andrew F. Davis
16 siblings, 0 replies; 63+ messages in thread
From: Andrew F. Davis @ 2017-11-29 21:33 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren
Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
This device can optionally detect headset or microphone button presses.
Add support for this by passing this event to the jack layer.
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
sound/soc/codecs/tlv320aic31xx.c | 14 +++++++++++++-
sound/soc/codecs/tlv320aic31xx.h | 3 ++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 471b31be55d1..8cd27c99cb15 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1280,9 +1280,20 @@ static irqreturn_t aic31xx_irq(int irq, void *data)
if (value & AIC31XX_HPRSCDETECT)
dev_err(dev, "Short circuit on Right output is detected\n");
- if (value & AIC31XX_HSPLUG) {
+ if (value & (AIC31XX_HSPLUG | AIC31XX_BUTTONPRESS)) {
int status = 0;
+ ret = regmap_read(aic31xx->regmap, AIC31XX_INTRDACFLAG2,
+ &value);
+ if (ret) {
+ dev_err(dev, "Failed to read interrupt mask: %d\n",
+ ret);
+ return IRQ_NONE;
+ }
+
+ if (value & AIC31XX_BUTTONPRESS)
+ status |= SND_JACK_BTN_0;
+
ret = regmap_read(aic31xx->regmap, AIC31XX_HSDETECT, &value);
if (ret) {
dev_err(dev, "Failed to read headset type: %d\n", ret);
@@ -1395,6 +1406,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
regmap_write(aic31xx->regmap, AIC31XX_INT1CTRL,
AIC31XX_HSPLUGDET |
+ AIC31XX_BUTTONPRESSDET |
AIC31XX_SC |
AIC31XX_ENGINE);
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 66c85df4d5be..7fce278eadac 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -21,7 +21,8 @@
#define DAC31XX_BIT BIT(3)
#define AIC31XX_JACK_MASK (SND_JACK_HEADPHONE | \
- SND_JACK_HEADSET)
+ SND_JACK_HEADSET | \
+ SND_JACK_BTN_0)
enum aic31xx_type {
AIC3100 = 0,
--
2.15.0
^ permalink raw reply related [flat|nested] 63+ messages in thread