Skip to content

Commit 81cb291

Browse files
committed
ASoC: Merge dropped fixes from v5.18
These fixes were queued for v5.18 but due to me changing my scripting they never actually got merged - pulling them up now.
2 parents db8f91d + 19c5bda commit 81cb291

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

sound/soc/codecs/tlv320adc3xxx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <dt-bindings/sound/tlv320adc3xxx.h>
1616
#include <linux/clk.h>
17+
#include <linux/gpio/consumer.h>
1718
#include <linux/module.h>
1819
#include <linux/moduleparam.h>
1920
#include <linux/io.h>
@@ -1025,7 +1026,9 @@ static const struct gpio_chip adc3xxx_gpio_chip = {
10251026

10261027
static void adc3xxx_free_gpio(struct adc3xxx *adc3xxx)
10271028
{
1029+
#ifdef CONFIG_GPIOLIB
10281030
gpiochip_remove(&adc3xxx->gpio_chip);
1031+
#endif
10291032
}
10301033

10311034
static void adc3xxx_init_gpio(struct adc3xxx *adc3xxx)

sound/soc/fsl/fsl_micfil.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,25 @@ static int fsl_micfil_reset(struct device *dev)
194194
if (ret)
195195
return ret;
196196

197+
/*
198+
* SRES is self-cleared bit, but REG_MICFIL_CTRL1 is defined
199+
* as non-volatile register, so SRES still remain in regmap
200+
* cache after set, that every update of REG_MICFIL_CTRL1,
201+
* software reset happens. so clear it explicitly.
202+
*/
203+
ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
204+
MICFIL_CTRL1_SRES);
205+
if (ret)
206+
return ret;
207+
208+
/*
209+
* Set SRES should clear CHnF flags, But even add delay here
210+
* the CHnF may not be cleared sometimes, so clear CHnF explicitly.
211+
*/
212+
ret = regmap_write_bits(micfil->regmap, REG_MICFIL_STAT, 0xFF, 0xFF);
213+
if (ret)
214+
return ret;
215+
197216
return 0;
198217
}
199218

sound/soc/soc-ops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
452452
val = ucontrol->value.integer.value[0];
453453
if (mc->platform_max && val > mc->platform_max)
454454
return -EINVAL;
455-
if (val > max - min)
455+
if (val > max)
456456
return -EINVAL;
457457
val_mask = mask << shift;
458458
val = (val + min) & mask;
@@ -468,6 +468,12 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
468468

469469
val_mask = mask << rshift;
470470
val2 = (ucontrol->value.integer.value[1] + min) & mask;
471+
472+
if (mc->platform_max && val2 > mc->platform_max)
473+
return -EINVAL;
474+
if (val2 > max)
475+
return -EINVAL;
476+
471477
val2 = val2 << rshift;
472478

473479
err = snd_soc_component_update_bits(component, reg2, val_mask,

0 commit comments

Comments
 (0)