Add Headphone Detection to TLV320AIC31xx Driver
cover Add Headphone Detection to TLV320AIC31xx Driver
Hello all,
This series has the end goal of adding headphone detection to the tlv320aic31xx driver. The first few patches are mostly cleanups. Then a couple bug fixes I noticed. Followed by adding interrupt handling and finally headphone detection.
The last two, as their commit name recommends, should not be taken and are included in-case someone wants to evaluate headphone detection using the EVM for this device wired to a Beaglebone Black.
This series (or at least patch #5) depend on this DT fix[0].
Thanks,
Andrew
[0]https://www.spinics.net/lists/kernel/msg2644651.html
Andrew F. Davis (17):
ASoC: tlv320aic31xx: General source formatting cleanup
ASoC: tlv320aic31xx: Reformat header file using GENMASK and BIT macros
ASoC: tlv320aic31xx: Fix GPIO1 register definition
ASoC: tlv320aic31xx: Merge init function into probe
ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
ASoC: tlv320aic31xx: Remove platform data
ASoC: tlv320aic31xx: Add MICBIAS off setting
ASoC: tlv320aic31xx: Check clock and divider before division
ASoC: tlv320aic31xx: Add CODEC clock slave support
ASoC: tlv320aic31xx: Fix inverted BCLK handling
ASoC: tlv320aic31xx: Reset registers during probe
ASoC: tlv320aic31xx: Add short circuit detection support
ASoC: tlv320aic31xx: Add overflow detection support
ASoC: tlv320aic31xx: Add headphone/headset detection
ASoC: tlv320aic31xx: Add button press detection
NOT FOR MERGING: Add TLV320DAC3101 to BBB for testing
NOT FOR MERGING: Add demo jack detection policy for testing
.../devicetree/bindings/sound/tlv320aic31xx.txt | 1 + arch/arm/boot/dts/am335x-boneblack.dts | 106 +++++ include/dt-bindings/sound/tlv320aic31xx-micbias.h | 1 + sound/soc/codecs/tlv320aic31xx.c | 400 +++++++++++----- sound/soc/codecs/tlv320aic31xx.h | 504 ++++++++++----------- 5 files changed, 623 insertions(+), 389 deletions(-)
rewrite sound/soc/codecs/tlv320aic31xx.h (83%)
Signature · 1 line
2.15.0
PATCH 1/17 ASoC: tlv320aic31xx: General source formatting cleanup
Simple non-functional changes including:
* Fix header copyright tags
* Fix spelling errors
* Reformat code for easier reading
* Move some code blocks to a more natural ordering
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return paths
--- sound/soc/codecs/tlv320aic31xx.c | 93 ++++++++++++++++++++++------------------ sound/soc/codecs/tlv320aic31xx.h | 4 +- 2 files changed, 54 insertions(+), 43 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +52 -41
@@ -1,7 +1,7 @@/* * ALSA SoC TLV320AIC31XX codec driver * -* Copyright (C) 2014 Texas Instruments, Inc. +* Copyright (C) 2014-2017 Texas Instruments Incorporated - http://www.ti.com/ * * Author: Jyri Sarha <[email protected]> *
@@ -144,8 +144,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" ,
@@ -154,6 +153,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;
@@ -185,7 +186,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 */
@@ -840,11 +841,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 ; }
@@ -981,8 +988,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);
@@ -990,9 +998,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);
@@ -1004,6 +1012,7 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai, clk_id << AIC31XX_PLL_CLKIN_SHIFT); aic31xx->sysclk = freq; +return 0 ; }
@@ -1065,7 +1074,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);
@@ -1078,7 +1087,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);
@@ -1086,19 +1095,24 @@ static int aic31xx_power_on(struct snd_soc_codec *codec) aic31xx->supplies);return ret; } +return 0 ; }static int aic31xx_power_off (struct snd_soc_codec *codec) {struct aic31xx_priv *aic31xx =snd_soc_codec_get_drvdata (codec); -int ret =0 ; +int ret;regcache_cache_only (aic31xx->regmap, true); ret =regulator_bulk_disable (ARRAY_SIZE (aic31xx->supplies), aic31xx->supplies); +if (ret) { +dev_err (aic31xx->dev,"Failed to disable regulators\n" ); +return ret; + } -return ret; +return 0 ; } static int aic31xx_set_bias_level(struct snd_soc_codec *codec,
@@ -1137,14 +1151,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++) {
@@ -1169,8 +1180,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)
@@ -1289,6 +1302,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;
@@ -1318,10 +1339,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,
@@ -1329,18 +1352,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",
@@ -1386,14 +1406,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" ,
@@ -1404,9 +1416,8 @@ static struct i2c_driver aic31xx_i2c_driver = { .remove = aic31xx_i2c_remove, .id_table = aic31xx_i2c_id, }; -module_i2c_driver (aic31xx_i2c_driver);MODULE_DESCRIPTION ("ASoC TLV320AIC3111 codec driver" ); -MODULE_AUTHOR ("Jyri Sarha" ); -MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Jyri Sarha <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
sound/soc/codecs/tlv320aic31xx.h +2 -2
@@ -1,7 +1,7 @@/* * ALSA SoC TLV320AIC31XX codec driver * -* Copyright (C) 2013 Texas Instruments, Inc. +* Copyright (C) 2013-2017 Texas Instruments Incorporated - http://www.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
@@ -10,8 +10,8 @@* 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. -* */ +#ifndef _TLV320AIC31XX_H#define _TLV320AIC31XX_H
Signature · 6 lines
2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerRe: [PATCH 01/17] ASoC: tlv320aic31xx: General source formatting cleanup
Quoted 11 lines · Andrew F. Davis
Simple non-functional changes including:
* Fix header copyright tags
* Fix spelling errors
* Reformat code for easier reading
* Move some code blocks to a more natural ordering
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return pathsSigned-off-by Andrew F. Davis <[email protected]>
There's other things in here like adding error reporting... please don't send changes like this, if you want to do cleanups you should split them up in the same way you would other changes. Bigger patches are harder to review especially if they're not repetitive examples of the same pattern.
Re: [PATCH 01/17] ASoC: tlv320aic31xx: General source formatting cleanup
Quoted 11 lines · Mark Brown
Quoted 10 lines · Andrew F. Davis
Simple non-functional changes including:
* Fix header copyright tags
* Fix spelling errors
* Reformat code for easier reading
* Move some code blocks to a more natural ordering
* Remove unneeded code
* Remove assignments that are always overridden
* Normalize function return paths
Quoted 8 lines
Quoted 1 line
Signed-off-by Andrew F. Davis <[email protected]>There's other things in here like adding error reporting... please don't send changes like this, if you want to do cleanups you should split them up in the same way you would other changes. Bigger patches are harder to review especially if they're not repetitive examples of the same pattern.
I'm never really sure with these where the split point should be, almost every change in here could be its own patch if I really wanted to pad my kernel patch count, but this series is already 17 patches long and I usually see these all as the same logical action: non-functional cleanups.
I agree the added error message isn't purely non-functional and so should be broken out, I'll break out a couple other changes for v2.
Mark Brown
maintainerRe: [PATCH 01/17] ASoC: tlv320aic31xx: General source formatting cleanup
Quoted 8 lines · Andrew F. Davis
Quoted 5 lines · Mark Brown
There's other things in here like adding error reporting... please don't send changes like this, if you want to do cleanups you should split them up in the same way you would other changes. Bigger patches are harder to review especially if they're not repetitive examples of the same pattern.
Quoted 7 lines
I'm never really sure with these where the split point should be, almost every change in here could be its own patch if I really wanted to pad my kernel patch count, but this series is already 17 patches long and I usually see these all as the same logical action: non-functional cleanups.
I agree the added error message isn't purely non-functional and so should be broken out, I'll break out a couple other changes for v2.
This is why cleanups don't happen :)
A separate cleanup series would probably cover it, when they're split up well they're quick and easy to review.
PATCH 2/17 ASoC: tlv320aic31xx: Reformat header file using GENMASK and BIT macros
In reply to Andrew F. DavisWe 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 and allowed me to find the errors that are corrected in follow-up patches.
--- sound/soc/codecs/tlv320aic31xx.c | 14 +- sound/soc/codecs/tlv320aic31xx.h | 475 +++++++++++++++++---------------------- 2 files changed, 218 insertions(+), 271 deletions(-)
rewrite sound/soc/codecs/tlv320aic31xx.h (81%)
sound/soc/codecs/tlv320aic31xx.c +7 -7
@@ -360,25 +360,25 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,switch (WIDGET_BIT (w->reg, w->shift)) {case WIDGET_BIT (AIC31XX_DACSETUP ,7 ): - mask =AIC31XX_LDACPWRSTATUS_MASK ; + mask =AIC31XX_LDACPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_DACSETUP ,6 ): - mask =AIC31XX_RDACPWRSTATUS_MASK ; + mask =AIC31XX_RDACPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_HPDRIVER ,7 ): - mask =AIC31XX_HPLDRVPWRSTATUS_MASK ; + mask =AIC31XX_HPLDRVPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_HPDRIVER ,6 ): - mask =AIC31XX_HPRDRVPWRSTATUS_MASK ; + mask =AIC31XX_HPRDRVPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_SPKAMP ,7 ): - mask =AIC31XX_SPLDRVPWRSTATUS_MASK ; + mask =AIC31XX_SPLDRVPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_SPKAMP ,6 ): - mask =AIC31XX_SPRDRVPWRSTATUS_MASK ; + mask =AIC31XX_SPRDRVPWRSTATUS ;break ;case WIDGET_BIT (AIC31XX_ADCSETUP ,7 ): - mask =AIC31XX_ADCPWRSTATUS_MASK ; + mask =AIC31XX_ADCPWRSTATUS ; reg =AIC31XX_ADCFLAG ;break ;default :
sound/soc/codecs/tlv320aic31xx.h +211 -264
475 lines not on this page · raw message
Signature · 1 line
2.15.0
PATCH 3/17 ASoC: tlv320aic31xx: Fix GPIO1 register definition
In reply to Andrew F. DavisGPIO1 control register is number 51, fix this here.
--- sound/soc/codecs/tlv320aic31xx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tlv320aic31xx.h +1 -1
@@ -82,7 +82,7 @@ struct aic31xx_pdata {#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, 50)/* GPIO1 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 */
Signature · 1 line
2.15.0
Mark Brown
maintainerRe: [PATCH 03/17] ASoC: tlv320aic31xx: Fix GPIO1 register definition
Quoted 5 lines · 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 <[email protected]>---
We should send this as a bug fix to stable but this depends on your reformatting :(
Re: [PATCH 03/17] ASoC: tlv320aic31xx: Fix GPIO1 register definition
Quoted 10 lines · Mark Brown
Quoted 5 lines · 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 <[email protected]>---
We should send this as a bug fix to stable but this depends on your reformatting :(
I put it after the reformatting as an example of its value, now that you have seen it, I'll move it before the reformatting so it can be taken independently.
PATCH 4/17 ASoC: tlv320aic31xx: Merge init function into probe
In reply to Andrew F. DavisThe 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.
--- sound/soc/codecs/tlv320aic31xx.c | 55 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 33 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +22 -33
@@ -1310,9 +1310,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);
@@ -1344,37 +1364,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,
Signature · 6 lines
2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerApplied "ASoC: tlv320aic31xx: Merge init function into probe" to the asoc tree
The patch
ASoC: tlv320aic31xx: Merge init function into probe
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
Quoted 1 line
From
e88c3881361cee9b778bf4e4ded43da7a0917ce1Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <[email protected]>
Date: Wed, 29 Nov 2017 15:32:48 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Merge init function into probe
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.
--- sound/soc/codecs/tlv320aic31xx.c | 55 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 33 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +22 -33
@@ -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,
Signature · 1 line
2.15.0
PATCH 5/17 ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
In reply to Andrew F. DavisMove 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.
--- sound/soc/codecs/tlv320aic31xx.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +10 -13
@@ -165,6 +165,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 ];
@@ -1028,8 +1029,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__);
@@ -1081,8 +1082,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);
@@ -1342,15 +1343,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++)
Signature · 1 line
2.15.0
Mark Brown
maintainerApplied "ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API" to the asoc tree
The patch
ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
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
Quoted 1 line
From
b6b247cd5e37560e410c88b108e7408dafe60c15Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <[email protected]>
Date: Wed, 29 Nov 2017 15:32:49 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API
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.
--- sound/soc/codecs/tlv320aic31xx.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +10 -13
@@ -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++)
Signature · 1 line
2.15.0
PATCH 6/17 ASoC: tlv320aic31xx: Remove platform data
In reply to Andrew F. DavisPlatform data is not used by anyone (at least in upstream) so drop this data and switch to using fwnode(DT/ACPI) only.
--- sound/soc/codecs/tlv320aic31xx.c | 65 ++++++++++++++-------------------------- sound/soc/codecs/tlv320aic31xx.h | 6 ---- 2 files changed, 23 insertions(+), 48 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +23 -42
@@ -165,8 +165,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;
@@ -458,7 +459,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 ;
@@ -681,14 +682,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));
@@ -706,7 +707,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));
@@ -730,7 +731,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));
@@ -1272,35 +1273,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-gpio" ,0 ); -if (ret >0 ) - aic31xx->pdata.gpio_reset = ret; -} -#else /* CONFIG_OF */ -static void aic31xx_pdata_from_of (struct aic31xx_priv *aic31xx) -{ -}#endif /* CONFIG_OF */ #ifdef CONFIG_ACPI
@@ -1315,6 +1287,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__,
@@ -1333,15 +1306,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 );
@@ -1361,7 +1342,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,
sound/soc/codecs/tlv320aic31xx.h +0 -6
@@ -36,12 +36,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 */
Signature · 1 line
2.15.0
PATCH 7/17 ASoC: tlv320aic31xx: Add MICBIAS off setting
In reply to Andrew F. DavisLeaving microphone bias off is a valid setting and even used in the DT binding document example. Add this setting here and document the same.
--- 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(+)
Documentation/devicetree/bindings/sound/tlv320aic31xx.txt +1 -0
@@ -24,6 +24,7 @@ Optional properties: - reset-gpio - 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
include/dt-bindings/sound/tlv320aic31xx-micbias.h +1 -0
@@ -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
sound/soc/codecs/tlv320aic31xx.c +1 -0
@@ -1313,6 +1313,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 :
Signature · 1 line
2.15.0
Re: [PATCH 07/17] ASoC: tlv320aic31xx: Add MICBIAS off setting
Quoted 9 lines · 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 <[email protected]>--- 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(+)
PATCH 8/17 ASoC: tlv320aic31xx: Check clock and divider before division
In reply to Andrew F. DavisIf 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.
--- sound/soc/codecs/tlv320aic31xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/tlv320aic31xx.c +7 -1
@@ -763,11 +763,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 );
Signature · 1 line
2.15.0
Mark Brown
maintainerApplied "ASoC: tlv320aic31xx: Check clock and divider before division" to the asoc tree
The patch
ASoC: tlv320aic31xx: Check clock and divider before division
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
Quoted 1 line
From
c6b8c779213dfe2a31e12400b1a2cf2a9a843236Mon Sep 17 00:00:00 2001
From: "Andrew F. Davis" <[email protected]>
Date: Wed, 29 Nov 2017 15:32:52 -0600
Subject: [PATCH] ASoC: tlv320aic31xx: Check clock and divider before division
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.
--- sound/soc/codecs/tlv320aic31xx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/tlv320aic31xx.c +7 -1
@@ -754,11 +754,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 );
Signature · 1 line
2.15.0
PATCH 9/17 ASoC: tlv320aic31xx: Add CODEC clock slave support
In reply to Andrew F. DavisThis CODEC supports being the WCLK and/or BCLK slave, add support for this here.
--- sound/soc/codecs/tlv320aic31xx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/codecs/tlv320aic31xx.c +8 -1
@@ -934,8 +934,15 @@ 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" );return -EINVAL ; }
Signature · 1 line
2.15.0
PATCH 10/17 ASoC: tlv320aic31xx: Fix inverted BCLK handling
In reply to Andrew F. DavisCurrently 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.
--- sound/soc/codecs/tlv320aic31xx.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +16 -10
@@ -946,6 +946,16 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,return -EINVAL ; } +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 : +return -EINVAL ; + } +/* interface format */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :
@@ -953,16 +963,12 @@ static int aic31xx_set_dai_fmt(struct snd_soc_dai *codec_dai,case SND_SOC_DAIFMT_DSP_A : dsp_a_val =0x1 ;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 ;
Signature · 1 line
2.15.0
PATCH 11/17 ASoC: tlv320aic31xx: Reset registers during probe
In reply to Andrew F. DavisAdd a reset function that toggles the reset line if available or uses the software reset command otherwise. Use this in probe to ensure the registers are in a sane state. This is useful when the driver module is reloaded, or after Kexec, warm-reboots, etc..
--- sound/soc/codecs/tlv320aic31xx.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
sound/soc/codecs/tlv320aic31xx.c +21 -0
@@ -1037,6 +1037,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 int aic31xx_regulator_event (struct notifier_block *nb,unsigned long event,void *data) {
@@ -1362,6 +1380,9 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,return ret; } +/* Reset device registers for a consistent power-on like state */ +aic31xx_reset (aic31xx); +if (aic31xx->codec_type &DAC31XX_BIT ) return snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
Signature · 1 line
2.15.0
PATCH 12/17 ASoC: tlv320aic31xx: Add short circuit detection support
In reply to Andrew F. DavisThese 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.
--- sound/soc/codecs/tlv320aic31xx.c | 42 ++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tlv320aic31xx.h | 16 +++++++++++++++ 2 files changed, 58 insertions(+)
sound/soc/codecs/tlv320aic31xx.c +42 -0
@@ -173,6 +173,7 @@ struct aic31xx_priv {unsigned int sysclk;u8 p_div;int rate_div_line; +int irq; };struct aic31xx_rate_divs {
@@ -1320,6 +1321,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) {
@@ -1342,6 +1364,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;
@@ -1383,6 +1406,25 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,/* Reset device registers for a consistent power-on like state */ aic31xx_reset (aic31xx); +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,
sound/soc/codecs/tlv320aic31xx.h +16 -0
@@ -192,6 +192,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 0 +#define AIC31XX_GPIO1_INPUT 1 +#define AIC31XX_GPIO1_GPI 2 +#define AIC31XX_GPIO1_GPO 3 +#define AIC31XX_GPIO1_CLKOUT 4 +#define AIC31XX_GPIO1_INT1 5 +#define AIC31XX_GPIO1_INT2 6 +#define AIC31XX_GPIO1_ADC_WCLK 7 +#define AIC31XX_GPIO1_SBCLK 8 +#define AIC31XX_GPIO1_SWCLK 9 +#define AIC31XX_GPIO1_ADC_MOD_CLK 10 +#define AIC31XX_GPIO1_SDOUT 11 +/* AIC31XX_DACSETUP */ #define AIC31XX_SOFTSTEP_MASK GENMASK(1, 0)
Signature · 1 line
2.15.0
PATCH 13/17 ASoC: tlv320aic31xx: Add overflow detection support
In reply to Andrew F. DavisSimilar 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.
--- sound/soc/codecs/tlv320aic31xx.c | 20 +++++++++++++++++++- sound/soc/codecs/tlv320aic31xx.h | 7 +++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
sound/soc/codecs/tlv320aic31xx.c +19 -1
@@ -1339,6 +1339,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 ; }
@@ -1413,7 +1430,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,
sound/soc/codecs/tlv320aic31xx.h +7 -0
@@ -174,6 +174,13 @@ enum aic31xx_type {#define AIC31XX_HPRDRVPWRSTATUS BIT(1)#define AIC31XX_SPRDRVPWRSTATUS 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)
Signature · 1 line
2.15.0
PATCH 14/17 ASoC: tlv320aic31xx: Add headphone/headset detection
In reply to Andrew F. DavisThis 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.
--- sound/soc/codecs/tlv320aic31xx.c | 33 +++++++++++++++++++++++++++++++++ sound/soc/codecs/tlv320aic31xx.h | 11 +++++++++++ 2 files changed, 44 insertions(+)
sound/soc/codecs/tlv320aic31xx.c +33 -0
@@ -33,6 +33,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>
@@ -97,6 +98,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;
@@ -170,6 +172,7 @@ struct aic31xx_priv {int micbias_vg;struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES ];struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES ]; +struct snd_soc_jack *jack;unsigned int sysclk;u8 p_div;int rate_div_line;
@@ -1339,6 +1342,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);
@@ -1430,9 +1459,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",
sound/soc/codecs/tlv320aic31xx.h +11 -0
@@ -27,6 +27,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 ,
@@ -221,6 +224,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 0 +#define AIC31XX_HSD_HP 1 +#define AIC31XX_HSD_HS 3 +/* AIC31XX_MICBIAS */ #define AIC31XX_MICBIAS_MASK GENMASK(1, 0)#define AIC31XX_MICBIAS_SHIFT 0
Signature · 1 line
2.15.0
PATCH 15/17 ASoC: tlv320aic31xx: Add button press detection
In reply to Andrew F. DavisThis device can optionally detect headset or microphone button presses. Add support for this by passing this event to the jack layer.
--- sound/soc/codecs/tlv320aic31xx.c | 14 +++++++++++++- sound/soc/codecs/tlv320aic31xx.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-)
sound/soc/codecs/tlv320aic31xx.c +13 -1
@@ -1342,9 +1342,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);
@@ -1460,6 +1471,7 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,regmap_write (aic31xx->regmap,AIC31XX_INT1CTRL ,AIC31XX_HSPLUGDET | +AIC31XX_BUTTONPRESSDET |AIC31XX_SC |AIC31XX_ENGINE );
sound/soc/codecs/tlv320aic31xx.h +2 -1
@@ -28,7 +28,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 ,
Signature · 1 line
2.15.0
PATCH 16/17 NOT FOR MERGING: Add TLV320DAC3101 to BBB for testing
In reply to Andrew F. Davis--- arch/arm/boot/dts/am335x-boneblack.dts | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+)
arch/arm/boot/dts/am335x-boneblack.dts +106 -0
@@ -11,9 +11,115 @@ #include "am335x-bone-common.dtsi" #include "am335x-boneblack-common.dtsi" +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/sound/tlv320aic31xx-micbias.h> + / { model = "TI AM335x BeagleBone Black"; compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; + + sound { + status = "disabled"; /* Disable default HDMI sound card */ + }; + + sound0: sound0 { + compatible = "simple-audio-card"; + simple-audio-card,name = "BeagleBone-Black-TLV320DAC3101"; + simple-audio-card,widgets = + "Headphone", "Headphone Jack", + "Speaker", "Speaker External"; + simple-audio-card,routing = + "Headphone Jack", "HPL", + "Headphone Jack", "HPR", + "Speaker External", "SPL", + "Speaker External", "SPR"; + simple-audio-card,format = "i2s"; /* Change this to try out different DAI formats */ + simple-audio-card,bitclock-master = <&sound0_codec>; /* Change these to switch clock masters */ + simple-audio-card,frame-master = <&sound0_codec>; + + sound0_cpu: simple-audio-card,cpu { + sound-dai = <&mcasp0>; + clocks = <&clk_mcasp0>; + }; + + sound0_codec: simple-audio-card,codec { + sound-dai = <&tlv320dac3101>; + clocks = <&clkout2_ck>; + }; + }; +}; + +&tda19988 { + status = "disabled"; +}; + +&am33xx_pinmux { + mcasp0_pins: mcasp0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x9ac, PIN_INPUT | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */ + AM33XX_IOPAD(0x990, PIN_INPUT | MUX_MODE0 ) /* mcasp0_aclkx.mcasp0_aclkx */ + AM33XX_IOPAD(0x994, PIN_INPUT | MUX_MODE0 ) /* mcasp0_fsx.mcasp0_fsx */ + AM33XX_IOPAD(0x998, PIN_INPUT | MUX_MODE0 ) /* mcasp0_axr0.mcasp0_axr0 */ + AM33XX_IOPAD(0x9a4, PIN_INPUT | MUX_MODE2 ) /* mcasp0_fsr.mcasp0_axr3 */ + AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.gpio1_27 */ + >; + }; + + tlv320dac3101_default: tlv320dac3101_default { + pinctrl-single,pins = < + AM33XX_IOPAD(0x844, PIN_OUTPUT_PULLUP | MUX_MODE7 ) /* gpmc_a1.gpio1_17 */ + AM33XX_IOPAD(0x878, PIN_INPUT | MUX_MODE7 ) /* gpmc_ben1.gpio1_28 */ + >; + }; +}; + +&sysclkout_pre_ck { + /* + * Switch to a higher-speed clock as a base for clkout2_div_ck other than + * the 32.768Hz default clock that is unusable for a CODEC. Possible + * options are clk_32768_ck, l3_gclk, dpll_ddr_m2_ck, dpll_per_m2_ck, and + * lcd_gclk. See am33xx-clocks.dtsi for more info. + */ + assigned-clocks = <&sysclkout_pre_ck>; + assigned-clock-parents = <&lcd_gclk>; +}; + +&clkout2_div_ck { + assigned-clocks = <&clkout2_div_ck>; + assigned-clock-rates = <12000000>; /* Change this to try different CODEC MCLK speeds */ +}; + +&mcasp0 { + #sound-dai-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&mcasp0_pins>; + + status = "okay"; + + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + serial-dir = < 1 0 0 0 >; /* 0: INACTIVE, 1: TX, 2: RX */ + tx-num-evt = <32>; + rx-num-evt = <32>; +}; + +&i2c2 { + tlv320dac3101: tlv320dac3101@18 { + #sound-dai-cells = <0>; + compatible = "ti,tlv320dac3101"; + reg = <0x18>; + + pinctrl-names = "default"; + pinctrl-0 = <&tlv320dac3101_default>; + + interrupt-parent = <&gpio1>; + interrupts = <28 IRQ_TYPE_LEVEL_HIGH>; + + reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; + + ai31xx-micbias-vg = <MICBIAS_2_0V>; + }; }; &cpu0_opp_table {
Signature · 6 lines
2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 17/17 NOT FOR MERGING: Add demo jack detection policy for testing
In reply to Andrew F. Davis--- sound/soc/codecs/tlv320aic31xx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
sound/soc/codecs/tlv320aic31xx.c +26 -0
@@ -1192,9 +1192,24 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec,return 0 ; } +/* On a headphone jack event (headphones are inserted or removed from the +* the headphone jack) we disable the "Speaker External" widget and enable +* the "Headphone Jack" widget, on removal the opposite will occur. These +* widgets should be defined by, and their audio policy determined by, the +* parent sound card as only it can know how this CODEC is integrated into +* the bigger picture sound card device. Unfortunately the generic +* "simple-card" used to instantiate many of these CODECs on boards does +* not support this yet, so we do it here in the CODEC as an example. +*/ +static struct snd_soc_jack_pin aic31xx_jack_pins[] = { + { .pin ="Speaker External" , .mask =SND_JACK_HEADPHONE , .invert = true, }, + { .pin ="Headphone Jack" , .mask =SND_JACK_HEADPHONE , }, +}; +static int aic31xx_codec_probe (struct snd_soc_codec *codec) {struct aic31xx_priv *aic31xx =snd_soc_codec_get_drvdata (codec); +struct snd_soc_card *card = codec->component.card;int i, ret;dev_dbg (aic31xx->dev,"## %s\n" , __func__);
@@ -1226,6 +1241,17 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec)if (ret)return ret; + aic31xx->jack =devm_kzalloc (aic31xx->dev,sizeof (*aic31xx->jack),GFP_KERNEL ); +if (!aic31xx->jack) +return -ENOMEM ; + ret =snd_soc_card_jack_new (card,"Headphone Jack" ,AIC31XX_JACK_MASK , + aic31xx->jack, aic31xx_jack_pins, +ARRAY_SIZE (aic31xx_jack_pins)); +if (ret) { +dev_err (codec->dev,"Cannot create jack\n" ); +return ret; + } +return 0 ; }
Signature · 1 line
2.15.0