Cirrus Logic CS35L41 Amplifier
Subsystems (4)
v2 cover Cirrus Logic CS35L41 Amplifier
ASoC driver and devicetree documentation for a new Cirrus Logic amplifier CS35L41
v2 changes:
Reduced regmap defaults to avoid collisions with patched registers Fixed SPI setup for OTP read to avoid setting freq higher than original Fixed entry to device_property parsing function for ACPI systems Replaced ASP Slot Position controls with set_channel_map callback
David Rhodes (2):
ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
ASoC: cs35l41: Add bindings for CS35L41
.../devicetree/bindings/sound/cs35l41.yaml | 395 ++++ include/sound/cs35l41.h | 83 + sound/soc/codecs/Kconfig | 12 + sound/soc/codecs/Makefile | 4 + sound/soc/codecs/cs35l41-i2c.c | 126 ++ sound/soc/codecs/cs35l41-spi.c | 152 ++ sound/soc/codecs/cs35l41-tables.c | 617 ++++++ sound/soc/codecs/cs35l41.c | 1770 +++++++++++++++++ sound/soc/codecs/cs35l41.h | 755 +++++++ 9 files changed, 3914 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/cs35l41.yaml create mode 100644 include/sound/cs35l41.h create mode 100644 sound/soc/codecs/cs35l41-i2c.c create mode 100644 sound/soc/codecs/cs35l41-spi.c create mode 100644 sound/soc/codecs/cs35l41-tables.c create mode 100644 sound/soc/codecs/cs35l41.c create mode 100644 sound/soc/codecs/cs35l41.h
Signature · 1 line
2.25.1
PATCH v2 1/2 ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
SoC Audio driver for the Cirrus Logic CS35L41 amplifier
--- include/sound/cs35l41.h | 83 ++ sound/soc/codecs/Kconfig | 12 + sound/soc/codecs/Makefile | 4 + sound/soc/codecs/cs35l41-i2c.c | 126 ++ sound/soc/codecs/cs35l41-spi.c | 152 +++ sound/soc/codecs/cs35l41-tables.c | 617 ++++++++++ sound/soc/codecs/cs35l41.c | 1770 +++++++++++++++++++++++++++++ sound/soc/codecs/cs35l41.h | 755 ++++++++++++ 8 files changed, 3519 insertions(+) create mode 100644 include/sound/cs35l41.h create mode 100644 sound/soc/codecs/cs35l41-i2c.c create mode 100644 sound/soc/codecs/cs35l41-spi.c create mode 100644 sound/soc/codecs/cs35l41-tables.c create mode 100644 sound/soc/codecs/cs35l41.c create mode 100644 sound/soc/codecs/cs35l41.h
include/sound/cs35l41.h new file +83 -0
@@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* +* linux/sound/cs35l41.h -- Platform data for CS35L41 +* +* Copyright (c) 2017-2021 Cirrus Logic Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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. +*/ + +#ifndef __CS35L41_H +#define __CS35L41_H + +enum cs35l41_clk_ids { +CS35L41_CLKID_SCLK =0 , +CS35L41_CLKID_LRCLK =1 , +CS35L41_CLKID_MCLK =4 , +}; + +struct cs35l41_classh_cfg { +bool classh_bst_override; +bool classh_algo_enable; +int classh_bst_max_limit; +int classh_mem_depth; +int classh_release_rate; +int classh_headroom; +int classh_wk_fet_delay; +int classh_wk_fet_thld; +}; + +struct cs35l41_irq_cfg { +bool irq_pol_inv; +bool irq_out_en; +int irq_src_sel; +}; + +struct cs35l41_platform_data { +bool sclk_frc; +bool lrclk_frc; +bool right_channel; +bool amp_gain_zc; +bool dsp_ng_enable; +bool invert_pcm; +int bst_ind; +int bst_vctrl; +int bst_ipk; +int bst_cap; +int temp_warn_thld; +int dsp_ng_pcm_thld; +int dsp_ng_delay; +unsigned int hw_ng_sel; +unsigned int hw_ng_delay; +unsigned int hw_ng_thld; +int dout_hiz; +struct cs35l41_irq_cfg irq_config1; +struct cs35l41_irq_cfg irq_config2; +struct cs35l41_classh_cfg classh_config; +}; + +struct cs35l41_private { +struct snd_soc_codec *codec; +struct cs35l41_platform_data pdata; +struct device *dev; +struct regmap *regmap; +struct regulator_bulk_data supplies[2 ]; +int num_supplies; +int irq; +bool i2s_mode; +/* GPIO for /RST */ +struct gpio_desc *reset_gpio; +void (*otp_setup)(struct cs35l41_private *cs35l41,bool is_pre_setup, +unsigned int *freq); +}; + +int cs35l41_probe (struct cs35l41_private *cs35l41, +struct cs35l41_platform_data *pdata); +int cs35l41_remove (struct cs35l41_private *cs35l41); + +#endif /* __CS35L41_H */
sound/soc/codecs/Kconfig +12 -0
@@ -61,6 +61,8 @@ config SND_SOC_ALL_CODECS imply SND_SOC_CS35L34 imply SND_SOC_CS35L35 imply SND_SOC_CS35L36 + imply SND_SOC_CS35L41_SPI + imply SND_SOC_CS35L41_I2C imply SND_SOC_CS42L42 imply SND_SOC_CS42L51_I2C imply SND_SOC_CS42L52
@@ -597,6 +599,16 @@ config SND_SOC_CS35L36 tristate "Cirrus Logic CS35L36 CODEC" depends on I2C +config SND_SOC_CS35L41_SPI + tristate "Cirrus Logic CS35L41 CODEC (SPI)" + depends on SPI_MASTER + select REGMAP_SPI + +config SND_SOC_CS35L41_I2C + tristate "Cirrus Logic CS35L41 CODEC (I2C)" + depends on I2C + select REGMAP_I2C + config SND_SOC_CS42L42 tristate "Cirrus Logic CS42L42 CODEC" depends on I2C
sound/soc/codecs/Makefile +4 -0
@@ -54,6 +54,8 @@ snd-soc-cs35l33-objs := cs35l33.o snd-soc-cs35l34-objs := cs35l34.o snd-soc-cs35l35-objs := cs35l35.o snd-soc-cs35l36-objs := cs35l36.o +snd-soc-cs35l41-spi-objs := cs35l41-spi.o cs35l41.o cs35l41-tables.o +snd-soc-cs35l41-i2c-objs := cs35l41-i2c.o cs35l41.o cs35l41-tables.o snd-soc-cs42l42-objs := cs42l42.o snd-soc-cs42l51-objs := cs42l51.o snd-soc-cs42l51-i2c-objs := cs42l51-i2c.o
@@ -379,6 +381,8 @@ obj-$(CONFIG_SND_SOC_CS35L33) += snd-soc-cs35l33.o obj-$(CONFIG_SND_SOC_CS35L34) += snd-soc-cs35l34.o obj-$(CONFIG_SND_SOC_CS35L35) += snd-soc-cs35l35.o obj-$(CONFIG_SND_SOC_CS35L36) += snd-soc-cs35l36.o +obj-$(CONFIG_SND_SOC_CS35L41_SPI) += snd-soc-cs35l41-spi.o +obj-$(CONFIG_SND_SOC_CS35L41_I2C) += snd-soc-cs35l41-i2c.o obj-$(CONFIG_SND_SOC_CS42L42) += snd-soc-cs42l42.o obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o obj-$(CONFIG_SND_SOC_CS42L51_I2C) += snd-soc-cs42l51-i2c.o
sound/soc/codecs/cs35l41-i2c.c new file +126 -0
126 lines not on this page · raw message
sound/soc/codecs/cs35l41-spi.c new file +152 -0
152 lines not on this page · raw message
sound/soc/codecs/cs35l41-tables.c new file +617 -0
617 lines not on this page · raw message
sound/soc/codecs/cs35l41.c new file +1770 -0
1,770 lines not on this page · raw message
sound/soc/codecs/cs35l41.h new file +755 -0
212 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 11 lines
include/sound/cs35l41.h new file +2
-0@@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +
include/sound/cs35l41.h line 12
Quoted 10 lines
include/sound/cs35l41.h new file +10
-0+/* +* linux/sound/cs35l41.h -- Platform data for CS35L41 +* +* Copyright (c) 2017-2021 Cirrus Logic Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
Aren't those 3 lines redundant, you've already added the SPDX statement above?
[...]
Quoted 8 lines
sound/soc/codecs/cs35l41-i2c.c new file +2
-0@@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 +
sound/soc/codecs/cs35l41-i2c.c line 12
Quoted 10 lines
sound/soc/codecs/cs35l41-i2c.c new file +10
-0+/* +* cs35l41-i2c.c -- CS35l41 I2C driver +* +* Copyright 2017-2021 Cirrus Logic, Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
same here, the SPDX tag gives the info already?
Quoted 7 lines
sound/soc/codecs/cs35l41-i2c.c new file +7
-0+* +*/ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/version.h> +#include <linux/kernel.h>
sound/soc/codecs/cs35l41-i2c.c line 29
Quoted 10 lines
sound/soc/codecs/cs35l41-i2c.c new file +10
-0+#include <linux/init.h> +#include <linux/delay.h> +#include <linux/i2c.h> +#include <linux/slab.h> +#include <linux/platform_device.h> +#include <linux/of_device.h> +#include <linux/regmap.h> +#include <linux/gpio/consumer.h> +#include <linux/regulator/consumer.h> +#include <linux/acpi.h>
Alphabetical order?
Quoted 29 lines
sound/soc/codecs/cs35l41-i2c.c new file +29
-0+ +#include "cs35l41.h" +#include <sound/cs35l41.h> + +static struct regmap_config cs35l41_regmap_i2c = { + .reg_bits =32 , + .val_bits =32 , + .reg_stride =CS35L41_REGSTRIDE , + .reg_format_endian =REGMAP_ENDIAN_BIG , + .val_format_endian =REGMAP_ENDIAN_BIG , + .max_register =CS35L41_LASTREG , + .reg_defaults = cs35l41_reg, + .num_reg_defaults =ARRAY_SIZE (cs35l41_reg), + .volatile_reg = cs35l41_volatile_reg, + .readable_reg = cs35l41_readable_reg, + .precious_reg = cs35l41_precious_reg, + .cache_type =REGCACHE_RBTREE , +}; + +static const struct i2c_device_id cs35l41_id_i2c[] = { + {"cs35l40" ,0 }, + {"cs35l41" ,0 }, + {} +}; + +MODULE_DEVICE_TABLE (i2c, cs35l41_id_i2c); + +static int cs35l41_i2c_probe (struct i2c_client *client, +const struct i2c_device_id *id)
sound/soc/codecs/cs35l41-i2c.c line 68
Quoted 10 lines
sound/soc/codecs/cs35l41-i2c.c new file +10
-0+{ +struct cs35l41_private *cs35l41; +struct device *dev = &client->dev; +struct cs35l41_platform_data *pdata =dev_get_platdata (dev); +const struct regmap_config *regmap_config = &cs35l41_regmap_i2c; +int ret; + + cs35l41 =devm_kzalloc (dev,sizeof (struct cs35l41_private ),GFP_KERNEL ); + +if (cs35l41 ==NULL )
if (!cs35l41)
sound/soc/codecs/cs35l41-i2c.c line 73
Quoted 5 lines
sound/soc/codecs/cs35l41-i2c.c new file +5
-0+return -ENOMEM ; + + cs35l41->dev = dev; + cs35l41->irq = client->irq; + cs35l41->otp_setup =NULL ;
already done with the kzalloc?
Quoted 22 lines
sound/soc/codecs/cs35l41-i2c.c new file +22
-0+ +i2c_set_clientdata (client, cs35l41); + cs35l41->regmap =devm_regmap_init_i2c (client, regmap_config); +if (IS_ERR (cs35l41->regmap)) { + ret =PTR_ERR (cs35l41->regmap); +dev_err (cs35l41->dev,"Failed to allocate register map: %d\n" , + ret); +return ret; + } + +return cs35l41_probe (cs35l41, pdata); +} + +static int cs35l41_i2c_remove (struct i2c_client *client) +{ +struct cs35l41_private *cs35l41 =i2c_get_clientdata (client); + +return cs35l41_remove (cs35l41); +} + +#ifdef CONFIG_OF +static const struct of_device_id cs35l41_of_match[] = {
sound/soc/codecs/cs35l41-i2c.c line 105
Quoted 10 lines
sound/soc/codecs/cs35l41-i2c.c new file +10
-0+ {.compatible = "cirrus,cs35l40"}, + {.compatible = "cirrus,cs35l41"}, + {}, +}; +MODULE_DEVICE_TABLE (of, cs35l41_of_match); +#endif + +#ifdef CONFIG_ACPI +static const struct acpi_device_id cs35l41_acpi_match[] = { + { "CSC3541", 0 },
Where does this "CSC" come from? it's not an ACPI ID listed here: https://uefi.org/acpi_id_list
why not use the 1013 PCI ID, e.g. as done for CS42L42?
Quoted 29 lines
sound/soc/codecs/cs35l41-i2c.c new file +21
-0+ {}, +}; +MODULE_DEVICE_TABLE (acpi, cs35l41_acpi_match); +#endif + +static struct i2c_driver cs35l41_i2c_driver = { + .driver = { + .name ="cs35l41" , + .of_match_table =of_match_ptr (cs35l41_of_match), + .acpi_match_table =ACPI_PTR (cs35l41_acpi_match), + }, + .id_table = cs35l41_id_i2c, + .probe = cs35l41_i2c_probe, + .remove = cs35l41_i2c_remove, +}; + +module_i2c_driver (cs35l41_i2c_driver); + +MODULE_DESCRIPTION ("I2C CS35L41 driver" ); +MODULE_AUTHOR ("David Rhodes, Cirrus Logic Inc, <[email protected]>" ); +MODULE_LICENSE ("GPL" );sound/soc/codecs/cs35l41-spi.c new file +2
-0@@ -0,0 +1,152 @@ +// SPDX-License-Identifier: GPL-2.0 +
sound/soc/codecs/cs35l41-spi.c line 12
Quoted 10 lines
sound/soc/codecs/cs35l41-spi.c new file +10
-0+/* +* cs35l41-spi.c -- CS35l41 SPI driver +* +* Copyright 2017-2021 Cirrus Logic, Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
redundant?
Quoted 4 lines
sound/soc/codecs/cs35l41-spi.c new file +4
-0+*/ + +#include <linux/module.h> +#include <linux/moduleparam.h>
sound/soc/codecs/cs35l41-spi.c line 27
Quoted 10 lines
sound/soc/codecs/cs35l41-spi.c new file +10
-0+#include <linux/version.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/gpio/consumer.h> +#include <linux/spi/spi.h> +#include <linux/regulator/consumer.h> +#include <linux/acpi.h>
alphabetical order?
Quoted 22 lines
sound/soc/codecs/cs35l41-spi.c new file +22
-0+ +#include "cs35l41.h" +#include <sound/cs35l41.h> + +static struct regmap_config cs35l41_regmap_spi = { + .reg_bits =32 , + .val_bits =32 , + .pad_bits =16 , + .reg_stride =CS35L41_REGSTRIDE , + .reg_format_endian =REGMAP_ENDIAN_BIG , + .val_format_endian =REGMAP_ENDIAN_BIG , + .max_register =CS35L41_LASTREG , + .reg_defaults = cs35l41_reg, + .num_reg_defaults =ARRAY_SIZE (cs35l41_reg), + .volatile_reg = cs35l41_volatile_reg, + .readable_reg = cs35l41_readable_reg, + .precious_reg = cs35l41_precious_reg, + .cache_type =REGCACHE_RBTREE , +}; + +static const struct spi_device_id cs35l41_id_spi[] = { + {"cs35l40" ,0 },
sound/soc/codecs/cs35l41-spi.c line 59
Quoted 10 lines
sound/soc/codecs/cs35l41-spi.c new file +10
-0+ {"cs35l41", 0}, + {} +}; + +MODULE_DEVICE_TABLE (spi, cs35l41_id_spi); + +static void cs35l41_spi_otp_setup (struct cs35l41_private *cs35l41, +bool is_pre_setup,unsigned int *freq) +{ +struct spi_device *spi =NULL ;
unnecessary init
Quoted 24 lines
sound/soc/codecs/cs35l41-spi.c new file +24
-0+u32 orig_spi_freq; + + spi =to_spi_device (cs35l41->dev); + +if (!spi) +return ; + +if (is_pre_setup) { + orig_spi_freq = spi->max_speed_hz; +if (orig_spi_freq >CS35L41_SPI_MAX_FREQ_OTP ) { + spi->max_speed_hz =CS35L41_SPI_MAX_FREQ_OTP ; +spi_setup (spi); + } + *freq = orig_spi_freq; + }else { +if (spi->max_speed_hz != *freq) { + spi->max_speed_hz = *freq; +spi_setup (spi); + } + } +} + +static int cs35l41_spi_probe (struct spi_device *spi) +{
sound/soc/codecs/cs35l41-spi.c line 93
Quoted 10 lines
sound/soc/codecs/cs35l41-spi.c new file +10
-0+const struct regmap_config *regmap_config = &cs35l41_regmap_spi; +struct cs35l41_platform_data *pdata = +dev_get_platdata (&spi->dev); +struct cs35l41_private *cs35l41; +int ret; + + cs35l41 =devm_kzalloc (&spi->dev, +sizeof (struct cs35l41_private ), +GFP_KERNEL ); +if (cs35l41 ==NULL )
if (!cs35l41)
Quoted 28 lines
sound/soc/codecs/cs35l41-spi.c new file +28
-0+return -ENOMEM ; + + +spi_set_drvdata (spi, cs35l41); + cs35l41->regmap =devm_regmap_init_spi (spi, regmap_config); +if (IS_ERR (cs35l41->regmap)) { + ret =PTR_ERR (cs35l41->regmap); +dev_err (&spi->dev,"Failed to allocate register map: %d\n" , + ret); +return ret; + } + + cs35l41->dev = &spi->dev; + cs35l41->irq = spi->irq; + cs35l41->otp_setup = cs35l41_spi_otp_setup; + +return cs35l41_probe (cs35l41, pdata); +} + +static int cs35l41_spi_remove (struct spi_device *spi) +{ +struct cs35l41_private *cs35l41 =spi_get_drvdata (spi); + +return cs35l41_remove (cs35l41); +} + +#ifdef CONFIG_OF +static const struct of_device_id cs35l41_of_match[] = {
sound/soc/codecs/cs35l41-spi.c line 131
Quoted 10 lines
sound/soc/codecs/cs35l41-spi.c new file +10
-0+ {.compatible = "cirrus,cs35l40"}, + {.compatible = "cirrus,cs35l41"}, + {}, +}; +MODULE_DEVICE_TABLE (of, cs35l41_of_match); +#endif + +#ifdef CONFIG_ACPI +static const struct acpi_device_id cs35l41_acpi_match[] = { + { "CSC3541", 0 }, /* Cirrus Logic PCI ID + part ID */
Wrong comment or wrong ID, "CSC" is clearly not a PCI ID?
Quoted 29 lines
sound/soc/codecs/cs35l41-spi.c new file +21
-0+ {}, +}; +MODULE_DEVICE_TABLE (acpi, cs35l41_acpi_match); +#endif + +static struct spi_driver cs35l41_spi_driver = { + .driver = { + .name ="cs35l41" , + .of_match_table =of_match_ptr (cs35l41_of_match), + .acpi_match_table =ACPI_PTR (cs35l41_acpi_match), + }, + .id_table = cs35l41_id_spi, + .probe = cs35l41_spi_probe, + .remove = cs35l41_spi_remove, +}; + +module_spi_driver (cs35l41_spi_driver); + +MODULE_DESCRIPTION ("SPI CS35L41 driver" ); +MODULE_AUTHOR ("David Rhodes, Cirrus Logic Inc, <[email protected]>" ); +MODULE_LICENSE ("GPL" );sound/soc/codecs/cs35l41-tables.c new file +2
-0@@ -0,0 +1,617 @@ +// SPDX-License-Identifier: GPL-2.0 +
sound/soc/codecs/cs35l41-tables.c line 12
Quoted 10 lines
sound/soc/codecs/cs35l41-tables.c new file +10
-0+/* +* cs35l41-tables.c -- CS35L41 ALSA SoC audio driver +* +* Copyright 2017-2021 Cirrus Logic, Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
ditto, redundant.
Quoted 8 lines
sound/soc/codecs/cs35l41.c new file +2
-0@@ -0,0 +1,1770 @@ +// SPDX-License-Identifier: GPL-2.0 +
sound/soc/codecs/cs35l41.c line 12
Quoted 10 lines
sound/soc/codecs/cs35l41.c new file +10
-0+/* +* cs35l41.c -- CS35l41 ALSA SoC audio driver +* +* Copyright 2017-2021 Cirrus Logic, Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
ditto, redundant.
Quoted 13 lines
sound/soc/codecs/cs35l41.c new file +13
-0+* +*/ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/version.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/slab.h> +#include <linux/regulator/consumer.h> +#include <linux/gpio/consumer.h> +#include <linux/regmap.h>
sound/soc/codecs/cs35l41.c line 35
Quoted 10 lines
sound/soc/codecs/cs35l41.c new file +10
-0+#include <linux/property.h> +#include <linux/of_device.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/initval.h> +#include <sound/tlv.h> +#include <linux/err.h>
alphabetical order?
sound/soc/codecs/cs35l41.c line 424
Quoted 5 lines
sound/soc/codecs/cs35l41.c new file +5
-0+static irqreturn_t cs35l41_irq (int irq,void *data) +{ +struct cs35l41_private *cs35l41 = data; +unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 };
are those inits necessary, you override them below with the regmap reads?
Quoted 18 lines
sound/soc/codecs/cs35l41.c new file +18
-0+unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (status); i++) { +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_STATUS1 + (i *CS35L41_REGSTRIDE ), + &status[i]); +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_MASK1 + (i *CS35L41_REGSTRIDE ), + &masks[i]); + } + +/* Check to see if unmasked bits are active */ +if (!(status[0 ] & ~masks[0 ]) && !(status[1 ] & ~masks[1 ]) && + !(status[2 ] & ~masks[2 ]) && !(status[3 ] & ~masks[3 ])) +return IRQ_NONE ; + +if (status[3 ] &CS35L41_OTP_BOOT_DONE ) { + regmap_update_bits(cs35l41->regmap, CS35L41_IRQ1_MASK4,
sound/soc/codecs/cs35l41.c line 452
Quoted 10 lines
sound/soc/codecs/cs35l41.c new file +10
-0+ CS35L41_OTP_BOOT_DONE, CS35L41_OTP_BOOT_DONE); + } + +/* +* The following interrupts require a +* protection release cycle to get the +* speaker out of Safe-Mode. +*/ +if (status[0 ] &CS35L41_AMP_SHORT_ERR ) { +dev_crit (cs35l41->dev,"Amp short error\n" );
dev_crit_ratelimited? This is in an interrupt routine and can flood the console. same in the rest of the routine.
Quoted 90 lines
sound/soc/codecs/cs35l41.c new file +90
-0+regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_AMP_SHORT_ERR ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_AMP_SHORT_ERR_RLS , +CS35L41_AMP_SHORT_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_AMP_SHORT_ERR_RLS ,0 ); + } + +if (status[0 ] &CS35L41_TEMP_WARN ) { +dev_crit (cs35l41->dev,"Over temperature warning\n" ); +regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_TEMP_WARN ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_TEMP_WARN_ERR_RLS , +CS35L41_TEMP_WARN_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_TEMP_WARN_ERR_RLS ,0 ); + } + +if (status[0 ] &CS35L41_TEMP_ERR ) { +dev_crit (cs35l41->dev,"Over temperature error\n" ); +regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_TEMP_ERR ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_TEMP_ERR_RLS , +CS35L41_TEMP_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_TEMP_ERR_RLS ,0 ); + } + +if (status[0 ] &CS35L41_BST_OVP_ERR ) { +dev_crit (cs35l41->dev,"VBST Over Voltage error\n" ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK ,0 ); +regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_BST_OVP_ERR ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_OVP_ERR_RLS , +CS35L41_BST_OVP_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_OVP_ERR_RLS ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK , +CS35L41_BST_EN_DEFAULT << +CS35L41_BST_EN_SHIFT ); + } + +if (status[0 ] &CS35L41_BST_DCM_UVP_ERR ) { +dev_crit (cs35l41->dev,"DCM VBST Under Voltage Error\n" ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK ,0 ); +regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_BST_DCM_UVP_ERR ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_UVP_ERR_RLS , +CS35L41_BST_UVP_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_UVP_ERR_RLS ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK , +CS35L41_BST_EN_DEFAULT << +CS35L41_BST_EN_SHIFT ); + } + +if (status[0 ] &CS35L41_BST_SHORT_ERR ) { +dev_crit (cs35l41->dev,"LBST error: powering off!\n" ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK ,0 ); +regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 , +CS35L41_BST_SHORT_ERR ); +regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_SHORT_ERR_RLS , +CS35L41_BST_SHORT_ERR_RLS ); +regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN , +CS35L41_BST_SHORT_ERR_RLS ,0 ); +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , +CS35L41_BST_EN_MASK , +CS35L41_BST_EN_DEFAULT << +CS35L41_BST_EN_SHIFT ); + } + +return IRQ_HANDLED ; +}
[...]
Quoted 8 lines
sound/soc/codecs/cs35l41.h new file +2
-0@@ -0,0 +1,755 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +
sound/soc/codecs/cs35l41.h line 12
Quoted 10 lines
sound/soc/codecs/cs35l41.h new file +10
-0+/* +* cs35l41.h -- CS35L41 ALSA SoC audio driver +* +* Copyright 2017-2021 Cirrus Logic, Inc. +* +* Author: David Rhodes <[email protected]> +* +* This program 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.
redundant?
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 7 lines · Pierre-Louis Bossart
sound/soc/codecs/cs35l41-spi.c line 131
Quoted 4 lines
sound/soc/codecs/cs35l41-spi.c new file +3
-0+#ifdef CONFIG_ACPI +static const struct acpi_device_id cs35l41_acpi_match[] = { + { "CSC3541", 0 }, /* Cirrus Logic PCI ID + part ID */Wrong comment or wrong ID, "CSC" is clearly not a PCI ID?
CSC is a PnP ID, not a PCI ID. I will change the comment to reflect this.
Thanks for the review. I will fix the license headers, NULL checks, includes, dev_crit, and inits in the next revision as well.
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 10 lines · David Rhodes
Quoted 7 lines · Pierre-Louis Bossart
sound/soc/codecs/cs35l41-spi.c line 131
Quoted 4 lines
sound/soc/codecs/cs35l41-spi.c new file +3
-0+#ifdef CONFIG_ACPI +static const struct acpi_device_id cs35l41_acpi_match[] = { + { "CSC3541", 0 }, /* Cirrus Logic PCI ID + part ID */Wrong comment or wrong ID, "CSC" is clearly not a PCI ID?
CSC is a PnP ID, not a PCI ID. I will change the comment to reflect this.
Funny to see how Crystal Semiconductor still shows in PNP IDs, 30 years after being acquired by Cirrus Logic...
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
In reply to Pierre-Louis BossartQuoted 7 lines · Pierre-Louis Bossart
sound/soc/codecs/cs35l41.c line 424
Quoted 5 lines
sound/soc/codecs/cs35l41.c new file +5
-0+static irqreturn_t cs35l41_irq (int irq,void *data) +{ +struct cs35l41_private *cs35l41 = data; +unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 };are those inits necessary, you override them below with the regmap reads?
This one gets flagged by static analyzers so I'd like to keep the inits
Mark Brown
maintainerRe: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 10 lines · David Rhodes
Quoted 7 lines · Pierre-Louis Bossart
sound/soc/codecs/cs35l41.c line 424
Quoted 5 lines
sound/soc/codecs/cs35l41.c new file +5
-0+static irqreturn_t cs35l41_irq (int irq,void *data) +{ +struct cs35l41_private *cs35l41 = data; +unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 };are those inits necessary, you override them below with the regmap reads?
This one gets flagged by static analyzers so I'd like to keep the inits
That sounds like you have an actual issue and you're just shutting up the static analysers, not fixing whatever they were telling you.
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 15 lines · Mark Brown
Quoted 10 lines · David Rhodes
Quoted 7 lines · Pierre-Louis Bossart
sound/soc/codecs/cs35l41.c line 424
Quoted 5 lines
sound/soc/codecs/cs35l41.c new file +5
-0+static irqreturn_t cs35l41_irq (int irq,void *data) +{ +struct cs35l41_private *cs35l41 = data; +unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 };are those inits necessary, you override them below with the regmap reads?
This one gets flagged by static analyzers so I'd like to keep the inits
That sounds like you have an actual issue and you're just shutting up the static analysers, not fixing whatever they were telling you.
sound/soc/codecs/cs35l41.c line 434
Quoted 12 lines · David Rhodes
sound/soc/codecs/cs35l41.c new file +12
-0+unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 }; +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (status); i++) { +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_STATUS1 + (i *CS35L41_REGSTRIDE ), + &status[i]); +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_MASK1 + (i *CS35L41_REGSTRIDE ), + &masks[i]); + }
Pierre is correct that both arrays will always be fully initialized with regmap reads in the loop before any other access. Without the explicit initialization, an analyzer that is not as smart as Pierre will tell me that the array values can be used uninitialized later on. Presumably the tool does not unroll the loop to see that every array value is assigned.
So I don't think I have an actual issue, but I am just shutting up the static analyzers, although I do think I fixed what they were telling me.
Mark Brown
maintainerRe: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 2 lines · David Rhodes
So I don't think I have an actual issue, but I am just shutting up the static analyzers, although I do think I fixed what they were telling me.
In that case you should get the static analyzers fixed, they clearly have a false positives problem here in what is a relatively common pattern.
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
Quoted 9 lines · Mark Brown
Quoted 2 lines · David Rhodes
So I don't think I have an actual issue, but I am just shutting up the static analyzers, although I do think I fixed what they were telling me.
In that case you should get the static analyzers fixed, they clearly have a false positives problem here in what is a relatively common pattern.
OK Thanks Mark. Will make Pierre's recommended change in the next revision.
Re: [PATCH v2 1/2] ASoC: cs35l41: CS35L41 Boosted Smart Amplifier
In reply to David RhodesQuoted 25 lines · David Rhodes
Quoted 2 lines · Mark Brown
Quoted 1 line · David Rhodes
On 6/29/21 6:51 PM, Pierre-Louis Bossart wrote:
sound/soc/codecs/cs35l41.c line 434
Quoted 12 lines · David Rhodes
sound/soc/codecs/cs35l41.c new file +12
-0+unsigned int status[4 ] = {0 ,0 ,0 ,0 }; +unsigned int masks[4 ] = {0 ,0 ,0 ,0 }; +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (status); i++) { +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_STATUS1 + (i *CS35L41_REGSTRIDE ), + &status[i]); +regmap_read (cs35l41->regmap, +CS35L41_IRQ1_MASK1 + (i *CS35L41_REGSTRIDE ), + &masks[i]); + }Pierre is correct that both arrays will always be fully initialized with regmap reads in the loop before any other access. Without the explicit initialization, an analyzer that is not as smart as Pierre will tell me that the array values can be used uninitialized later on.
Presumably the tool does not unroll the loop to see that every array value is assigned.
Quoted 3 lines
So I don't think I have an actual issue, but I am just shutting up the static analyzers, although I do think I fixed what they were telling me.
This isn't quite correct the static analyser is flagging a real issue here. The issue is because the return values from the regmap_reads are not checked, if regmap_read fails then that index in the array would not be initialised and then gets used later. Now if the read failing isn't a situation the drive is bothered about initalising to zero is probably fine. So I guess it doesn't feel to me that the code particularly needs changed here, but certainly the warning if you remove the initialisations is real.
Thanks,
Charles
PATCH v2 2/2 ASoC: cs35l41: Add bindings for CS35L41
In reply to David RhodesDevicetree binding documentation for CS35L41 driver
CS35L41 is a 11-V Boosted Mono Class D Amplifier with DSP Speaker Protection and Equalization
--- .../devicetree/bindings/sound/cs35l41.yaml | 395 ++++++++++++++++++ 1 file changed, 395 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/cs35l41.yaml
Documentation/devicetree/bindings/sound/cs35l41.yaml new file +395 -0
@@ -0,0 +1,395 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/cs35l41.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cirrus Logic CS35L41 Speaker Amplifier + +maintainers: + - [email protected] + +description: | + CS35L41 is a boosted mono Class D amplifier with DSP + speaker protection and equalization + +properties: + compatible: + enum: + - cirrus,cs35l40 + - cirrus,cs35l41 + + reg: + maxItems: 1 + + '#sound-dai-cells': + description: + The first cell indicating the audio interface. + const: 1 + + cirrus,boost-peak-milliamp: + description: + Boost-converter peak current limit in mA. + Configures the peak current by monitoring the current through the boost FET. + Range starts at 1600 mA and goes to a maximum of 4500 mA with increments + of 50 mA. See section 4.3.6 of the datasheet for details. + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 1600 + maximum: 4500 + default: 4500 + + cirrus,boost-ind-nanohenry: + description: + Boost inductor value, expressed in nH. Valid + values include 1000, 1200, 1500 and 2200. + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 1000 + maximum: 2200 + + cirrus,boost-cap-microfarad: + description: + Total equivalent boost capacitance on the VBST + and VAMP pins, derated at 11 volts DC. The value must be rounded to the + nearest integer and expressed in uF. + $ref: "/schemas/types.yaml#/definitions/uint32" + + + cirrus,sclk-force-output: + description: + Audio serial port SCLK force + output control. Forces the SCLK to continue to drive even + if no ASP_TXn channels are enabled. + type: boolean + + cirrus,lrclk-force-output: + description: + Audio serial port LRCLK force + output control. Forces the LRCLK to continue to drive even + if no ASP_TXn channels are enabled. + type: boolean + + cirrus,right-channel-amp: + description: + Boolean to determine which channel + the amplifier is to receive the audio data on. If present the + amplifier receives data on the right channel of I2S data. + If not present the amplifier receives data on the left + channel of I2S data + type: boolean + + cirrus,boost-ctl-millivolt: + description: + Boost Voltage Value. Configures the + boost converter's output voltage in mV. The range is from 2550 mV to + 11000 mV with increments of 50 mV. This will be the maximum voltage + in Class-H mode if 'classh-bst-max-limit' is set to 1, or the fixed + boost voltage if 'classh-bst-overide' is set to true. + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 2550 + maximum: 11000 + + cirrus,amp-gain-zc: + description: + Boolean to determine whether to use the amplifier + gain-change zero-crossing feature. If the feature is enabled, any + user-controlled amplifier gain change will occur on a zero-crossing point. + (Default) Disabled + type: boolean + + cirrus,asp-sdout-hiz: + description: + Audio serial port SDOUT Hi-Z control. Sets the Hi-Z + configuration for SDOUT pin of amplifier. + 0 = Logic 0 during unused slots, and while all transmit channels disabled + 1 = Hi-Z during unused slots but logic 0 while all transmit channels disabled + 2 = (Default) Logic 0 during unused slots, but Hi-Z while all transmit channels disabled + 3 = Hi-Z during unused slots and while all transmit channels disabled + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 3 + default: 2 + + cirrus,temp-warn-threshold: + description: + Amplifier overtemperature warning threshold. + Configures the threshold at which the overtemperature warning condition occurs. + When the threshold is met, the ovetemperature warning attenuation is applied + and the TEMP_WARN_EINT interrupt status bit is set. + If TEMP_WARN_MASK = 0, INTb is asserted. + 0 = 105C + 1 = 115C + 2 = 125C (Default) + 3 = 135C + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 3 + default: 2 + + cirrus,hw-noise-gate-select: + description: Hardware Noise Gate feature. Each bit selects + a different block for detection. + 000000 - All noise gating functionality disabled + xxxxx1 - Amplifier noise gating detection enabled + xxxx1x - Boost converter DCM detection enabled + xxx1xx - VMON low power mode detection enabled + xx1xxx - IMON low power mode detection enabled + x1xxxx - VP brownout prevention detection enabled + 1xxxxx - VBST brownout prevention detection enabled + type: boolean + + cirrus,hw-noise-gate-delay: + description: Time that the incoming audio signal must be + below the noise gate threshold prior to entering a noise gated state + 0 = 5 ms + 1 = 10 ms + 2 = 25 ms + 3 = 50 ms (default) + 4 = 100 ms + 5 = 250 ms + 6 = 500 ms + 7 = 1 s + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 7 + default: 3 + + cirrus,hw-noise-gate-threshold: + description: Threshold of audio signal input which the + noise gate considers the input audio to be at a low enough level to be + valid to enter a noise gating state of operation. + 0 = 0.654 mVpk + 1 = 0.328 mVpk + 2 = 0.164 mVpk + 3 = 0.082 mVpk (default) + 4 = 0.041 mVpk + 5 = 0.021 mVpk + 6 = 0.010 mVpk + 7 = True zero data (no LSB dither) + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 7 + default: 3 + + cirrus,dsp-noise-gate-enable: + description: + DSP Noise Gate feature. If present, noise gate feature will be enabled. + type: boolean + + cirrus,dsp-noise-gate-threshold: + description: + Threshold of audio signal input which the + noise gate considers the input audio to be at a low enough level to be + valid to enter a noise gating state of operation. + 0 = -66 dBFS + 1 = -72 dBFS + 2 = -78 dBFS + 3 = -84 dBFS (default) + 4 = -90 dBFS + 5 = -96 dBFS + 6 = -102 dBFS + 7 = -108 dBFS + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 7 + default: 3 + + cirrus,dsp-noise-gate-delay: + description: + Time that the incoming audio signal must be + below the noise gate threshold prior to entering a noise gated state + 0 = 5 ms + 1 = 10 ms + 2 = 25 ms + 3 = 50 ms (default) + 4 = 100 ms + 5 = 250 ms + 6 = 500 ms + 7 = 1 s + 8 = 5 s + 9 = 10 s + 10 = 20 s + 11 = 30 s + 12 = 40 s + 13 = 50 s + 14 = 60 s + 15 = 120 s + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 15 + default: 3 + + cirrus,invert-pcm: + description: + Inverts the polarity of the audio signal output from + the Class-D amplifier. + type: boolean + + classh-internal-algo: + description: + Sub-node for the Internal Class H Algorithm + See Section 4.4 Internal Class H Algorithm in the Datasheet. + If not used, the device manages the ClassH Algorithm internally. + It is strongly recommended that the Datasheet be referenced when adjusting + or using these Class H Algorithm controls over the internal Algorithm. + Serious damage can occur to the Device and surrounding components. + Unavailable for cs35l41l. + type: + boolean + cirrus,classh-bst-overide: + description: + Boolean which will disable Class H tracking and + set Boost voltage to the value in the 'boost-ctl-millivolt' property + type: boolean + cirrus,classh-bst-max-limit: + description: + Value set to the BST_CTL_LIM_EN field. + A value of 1 will limit the Class-H voltage to the value in the + 'boost-ctl-millivolt' property. + 0 = No Class-H limit (default) + 1 = Class-H limited to 'boost-ctl-millivolt' value + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 1 + cirrus,classh-headroom: + description: + Class H algorithm headroom. Controls VBST headroom + in the max detection path of the Class H algorithm. Step size is 0.1 V. + Range is from -6.4V to +6.3V with 7-bit 2's complement representation. + 0 = 0V + 1 = 0.1V + 2 = 0.2V + === + 11 = 1.1V (Default) + === + 62 = 6.2V + 63 = 6.3V + 64 = -6.4V + 65 = -6.3V + === + 126 = -0.2V + 127 = -0.1V + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 127 + cirrus,classh-release-rate: + description: + Class H release rate. Controls the amount of + time required before allowing consecutive release condition VBST supply + tracking updates. Step size is 5us with range from 20us to 1275us. + 4 = 20us (Default) + 5 = 25us + === + 254 = 1270us + 255 = 1275us + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 4 + maximum: 255 + cirrus,classh-mem-depth: + description: + Class H memory depth. Controls the memory depth + used in the Class H algorithm for audio data buffering and analysis. + 0 = 20.83 - 23.4 us + 1 = 41.67 - 46.88 us + 2 = 83.33 - 85.94 us + 3 = 166.67 - 171.88 us + 4 = 250.00 - 255.10 us + 5 = 333.33 - 335.93 us (Default) + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 5 + cirrus,classh-wk-fet-thld: + description: + Weak-FET amplifier driver threshold. + Configures the signal threshold at which the PWM output stage enters weak-FET + operation. Step size is 0.05V. Range is from 0.05V to 0.7V. + 1 = 0.05V + 2 = 0.1V + 3 = 0.15V + === + 13 = 0.65V + 14 = 0.7V + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 1 + maximum: 14 + cirrus,classh-wk-fet-delay: + description: + Weak-Fet entry . Controls the delay in ms + before the Class H algorithm switches to the weak-FET voltage after the audio + falls and remains below the value specified in 'classh-wk-fet-thld'. + 0 = 0ms + 1 = 5ms + 2 = 10ms + 3 = 50ms + 4 = 100ms (Default) + 5 = 200ms + 6 = 500ms + 7 = 1000ms + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 7 + cirrus,gpio1-polarity-invert: + description: + Boolean which specifies whether the GPIO1 + level is inverted. If this property is not present the level is not inverted. + type: boolean + cirrus,gpio1-output-enable: + description: + Boolean which specifies whether the GPIO1 pin + is configured as an output. If this property is not present the + pin will be configured as an input. + type: boolean + cirrus,gpio1-src-select: + description: + Configures the function of the GPIO1 pin. + Note that the options are different from the GPIO2 pin + 0 = High Impedance (Default) + 1 = GPIO + 2 = Sync + 3 = MCLK input + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 3 + cirrus,gpio2-polarity-invert: + description: + Boolean which specifies whether the GPIO2 + level is inverted. If this property is not present the level is not inverted. + type: boolean + cirrus,gpio2-output-enable: + description: + Boolean which specifies whether the GPIO2 pin + is configured as an output. If this property is not present the + pin will be configured as an input. + type: boolean + cirrus,gpio2-src-select: + description: + Configures the function of the GPIO2 pin. + Note that the options are different from the GPIO1 pin. + 0 = High Impedance (Default) + 1 = GPIO + 2 = Open Drain INTB + 3 = MCLK input + 4 = Push-pull INTB (active low) + 5 = Push-pull INT (active high) + $ref: "/schemas/types.yaml#/definitions/uint32" + minimum: 0 + maximum: 5 + +required: + - compatible + - cirrus,boost-peak-milliamp + - cirrus,boost-ind-nanohenry + - cirrus,boost-cap-microfarad + +unevaluatedProperties: false + +examples: + - | + cs35l41: cs35l41@2 { + compatible = "cirrus,cs35l41"; + reg = <2>; + VA-supply = <&dummy_vreg>; + VP-supply = <&dummy_vreg>; + cirrus,boost-peak-milliamp = <4500>; + cirrus,boost-ind-nanohenry = <1000>; + cirrus,boost-cap-microfarad = <15>; + };
Signature · 1 line
2.25.1