ASoC: nau8824: Fix NAU8824_JACK_LOGIC define
Subsystems (3)
PATCH 1/4 ASoC: nau8824: Fix NAU8824_JACK_LOGIC define
The NAU8824_JACK_LOGIC define was wrong, for active high jack-detect to work bit 1 needs to be set, rather then bit 0.
The correct bit was found in the Android kernel source dump for a Cyberbook T116 tablet; and this was also tested on that same tablet.
--- sound/soc/codecs/nau8824.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/nau8824.h +1 -1
@@ -197,7 +197,7 @@/* JACK_DET_CTRL (0x0D) */ #define NAU8824_JACK_EJECT_DT_SFT 2#define NAU8824_JACK_EJECT_DT_MASK (0x3 << NAU8824_JACK_EJECT_DT_SFT) -#define NAU8824_JACK_LOGIC 0x1 +#define NAU8824_JACK_LOGIC (0x1 << 1)/* INTERRUPT_SETTING_1 (0x0F) */
Signature · 1 line
2.31.1
PATCH 2/4 ASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect
Add a quirk mechanism to allow specifying that active-high jack-detection should be used on platforms where this info is not available in devicetree.
And add an entry for the Cyberbook T116 tablet to the DMI table, so that jack-detection will work properly on this tablet.
--- sound/soc/codecs/nau8824.c | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
sound/soc/codecs/nau8824.c +40 -0
@@ -8,6 +8,7 @@#include <linux/module.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/init.h> #include <linux/i2c.h> #include <linux/regmap.h>
@@ -27,6 +28,12 @@#include "nau8824.h" +#define NAU8824_JD_ACTIVE_HIGH BIT(0) + +static int nau8824_quirk; +static int quirk_override =-1 ; +module_param_named (quirk, quirk_override, uint,0444 ); +MODULE_PARM_DESC (quirk,"Board-specific quirk override" );static int nau8824_config_sysclk (struct nau8824 *nau8824,int clk_id,unsigned int freq);
@@ -1845,6 +1852,34 @@ static int nau8824_read_device_properties(struct device *dev,return 0 ; } +/* Please keep this list alphabetically sorted */ +static const struct dmi_system_id nau8824_quirk_table[] = { + { +/* Cyberbook T116 rugged tablet */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Default string" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"Cherry Trail CR" ), +DMI_EXACT_MATCH (DMI_PRODUCT_SKU ,"20170531" ), + }, + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH ), + }, + {} +}; + +static void nau8824_check_quirks (void ) +{ +const struct dmi_system_id *dmi_id; + +if (quirk_override !=-1 ) { + nau8824_quirk = quirk_override; +return ; + } + + dmi_id =dmi_first_match (nau8824_quirk_table); +if (dmi_id) + nau8824_quirk = (unsigned long )dmi_id->driver_data; +} +static int nau8824_i2c_probe (struct i2c_client *i2c,const struct i2c_device_id *id) {
@@ -1869,6 +1904,11 @@ static int nau8824_i2c_probe(struct i2c_client *i2c, nau8824->irq = i2c->irq;sema_init (&nau8824->jd_sem,1 ); +nau8824_check_quirks (); + +if (nau8824_quirk &NAU8824_JD_ACTIVE_HIGH ) + nau8824->jkdet_polarity =0 ; +nau8824_print_device_properties (nau8824); ret =regmap_read (nau8824->regmap,NAU8824_REG_I2C_DEVICE_ID , &value);
Signature · 1 line
2.31.1
PATCH 3/4 ASoC: nau8824: Add a nau8824_components() helper
In reply to Hans de GoedeSome devices using the NAU8824 have only one speaker. To still have things working properly this requires the left + right channels to both be mixed to the left speaker output.
This mixer setup is done by userspace based on UCM profiles. But this requires userspace to know that there is a mono-speaker. Add a helper function (for the machine driver) to get a components string providing this info.
This is done inside the codec driver because the codec driver already has a DMI quirk table.
--- sound/soc/codecs/nau8824.c | 32 +++++++++++++++++++++++++++++++- sound/soc/codecs/nau8824.h | 1 + 2 files changed, 32 insertions(+), 1 deletion(-)
sound/soc/codecs/nau8824.c +31 -1
@@ -29,6 +29,7 @@#include "nau8824.h" #define NAU8824_JD_ACTIVE_HIGH BIT(0) +#define NAU8824_MONO_SPEAKER BIT(1)static int nau8824_quirk;static int quirk_override =-1 ;
@@ -1861,7 +1862,25 @@ static const struct dmi_system_id nau8824_quirk_table[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), }, - .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH), + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH | + NAU8824_MONO_SPEAKER), + }, + { + /* CUBE iwork8 Air */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "cube"), + DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"), + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + }, + .driver_data = (void *)(NAU8824_MONO_SPEAKER), + }, + { + /* Pipo W2S */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "PIPO"), + DMI_MATCH(DMI_PRODUCT_NAME, "W2S"), + }, + .driver_data = (void *)(NAU8824_MONO_SPEAKER), }, {} };
@@ -1880,6 +1899,17 @@ static void nau8824_check_quirks(void) nau8824_quirk = (unsigned long )dmi_id->driver_data; } +const char *nau8824_components (void ) +{ +nau8824_check_quirks (); + +if (nau8824_quirk &NAU8824_MONO_SPEAKER ) +return "cfg-spk:1" ; +else +return "cfg-spk:2" ; +} +EXPORT_SYMBOL_GPL (nau8824_components); +static int nau8824_i2c_probe (struct i2c_client *i2c,const struct i2c_device_id *id) {
sound/soc/codecs/nau8824.h +1 -0
@@ -470,6 +470,7 @@ struct nau8824_osr_attr {int nau8824_enable_jack_detect (struct snd_soc_component *component,struct snd_soc_jack *jack); +const char *nau8824_components (void );#endif /* _NAU8824_H */
Signature · 1 line
2.31.1
PATCH 4/4 ASoC: Intel: cht_bsw_nau8824: Set card.components string
In reply to Hans de GoedeSet the card.components string using the new nau8824_components() helper which returns a components string based on the DMI quirks inside the nau8824 codec driver.
--- sound/soc/intel/boards/cht_bsw_nau8824.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/boards/cht_bsw_nau8824.c +2 -0
@@ -278,6 +278,8 @@ static int snd_cht_mc_probe(struct platform_device *pdev) snd_soc_card_cht.driver_name =DRIVER_NAME ; } + snd_soc_card_cht.components =nau8824_components (); +/* set pm ops */ if (sof_parent) pdev->dev.driver->pm = &snd_soc_pm_ops;
Signature · 1 line
2.31.1
Quoted 5 lines · Hans de Goede
The
NAU8824_JACK_LOGICdefine was wrong, for active high jack-detect to work bit 1 needs to be set, rather then bit 0.The correct bit was found in the Android kernel source dump for a Cyberbook T116 tablet; and this was also tested on that same tablet.
For the series
Quoted 20 lines
Signed-off-by Hans de Goede <[email protected]>--- sound/soc/codecs/nau8824.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/codecs/nau8824.h +1
-1@@ -197,7 +197,7 @@/* JACK_DET_CTRL (0x0D) */ #define NAU8824_JACK_EJECT_DT_SFT 2#define NAU8824_JACK_EJECT_DT_MASK (0x3 << NAU8824_JACK_EJECT_DT_SFT) -#define NAU8824_JACK_LOGIC 0x1 +#define NAU8824_JACK_LOGIC (0x1 << 1)/* INTERRUPT_SETTING_1 (0x0F) */
Mark Brown
maintainerQuoted 8 lines · Hans de Goede
The
NAU8824_JACK_LOGICdefine was wrong, for active high jack-detect to work bit 1 needs to be set, rather then bit 0.The correct bit was found in the Android kernel source dump for a Cyberbook T116 tablet; and this was also tested on that same tablet.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: nau8824: Fix NAU8824_JACK_LOGIC define
commit: d316597c538abd110ff32761fc79f7adff8d619a
[2/4] ASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect
commit: 92d3360108f1839ca40451bad20ff67dd24a1964
[3/4] ASoC: nau8824: Add a nau8824_components() helper
commit: efee0fca19cbc9a0946a2d7dab2d5546aee2098f
[4/4] ASoC: Intel: cht_bsw_nau8824: Set card.components string
commit: 7924f1bc94041a3d512f2922065b196ca8e1210eAll 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