Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: codecs: add support for ES8375
@ 2025-05-21 10:42 Zhang Yi
  2025-05-21 10:42 ` [PATCH 1/2] ASoC: dt-bindings: Add Everest ES8375 audio CODEC Zhang Yi
  2025-05-21 10:42 ` [PATCH 2/2] ASoC: codecs: add support for ES8375 Zhang Yi
  0 siblings, 2 replies; 11+ messages in thread
From: Zhang Yi @ 2025-05-21 10:42 UTC (permalink / raw)
  To: broonie, robh, tiwai, devicetree, conor+dt, lgirdwood,
	linux-kernel, linux-sound, perex, krzk+dt
  Cc: amadeuszx.slawinski, krzk, Zhang Yi

The driver is for codec ES8375 of everest-semi.


Zhang Yi (2):
  ASoC: dt-bindings: Add Everest ES8375 audio CODEC
  ASoC: codecs: add support for ES8375

 .../bindings/sound/everest,es8375.yaml        |  62 ++
 sound/soc/codecs/Kconfig                      |   5 +
 sound/soc/codecs/Makefile                     |   2 +
 sound/soc/codecs/es8375.c                     | 845 ++++++++++++++++++
 sound/soc/codecs/es8375.h                     | 118 +++
 5 files changed, 1032 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/everest,es8375.yaml
 create mode 100644 sound/soc/codecs/es8375.c
 create mode 100644 sound/soc/codecs/es8375.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] ASoC: codecs: add support for ES8375
@ 2025-05-22  5:46 Zhang Yi
  2025-05-22  9:45 ` Mark Brown
  0 siblings, 1 reply; 11+ messages in thread
From: Zhang Yi @ 2025-05-22  5:46 UTC (permalink / raw)
  To: broonie
  Cc: robh, tiwai, devicetree, conor+dt, lgirdwood, linux-kernel,
	linux-sound, perex, krzk+dt, amadeuszx.slawinski, krzk

> > +static int es8375_dmic_set(struct snd_kcontrol *kcontrol,
> > +	struct snd_ctl_elem_value *ucontrol)
> > +{
> 
> > +	if (val) {
> > +		regmap_update_bits_check(es8375->regmap, ES8375_ADC1, 0x80, 0x80, &changed1);
> > +		es8375->dmic_enable = 0x01;
> > +	} else {
> > +		regmap_update_bits_check(es8375->regmap, ES8375_ADC1, 0x80, 0x00, &changed1);
> > +		es8375->dmic_enable = 0x00;
> > +	}
> 
> Instead of overriding this you could just read the register value when
> you need it, you've got a register cache so it should be fast enough and
> it's a lot less code.

I'll read the ES8375_ADC1 when I need the dmic_enable.
So I can replace SOC_DAPM_ENUM_EXT with SOC_DAPM_ENUM
which is used for ADC MUX.

> > +static const struct snd_kcontrol_new es8375_snd_controls[] = {
> > +	/* Capture Path */
> > +	SOC_SINGLE_TLV("ADC OSR GAIN", ES8375_ADC_OSR_GAIN,
> > +			ADC_OSR_GAIN_SHIFT_0, ES8375_ADC_OSR_GAIN_MAX, 0,
> > +			es8375_adc_osr_gain_tlv),
> 
> Gain/volume controls should end in Volume as covered in control-names.rst.
> 
> > +	SOC_SINGLE("ADC Invert", ES8375_ADC1, ADC_INV_SHIFT_6, 1, 0),
> 
> On/off switches should end in Switch.

Thanks for reminding. I'll modify it.

> > +	ret = regulator_get_voltage(es8375->core_supply[0].consumer);
> 
> Might be nicer to have something better than a magic number to ensure
> that the supplies are in order, or use a specific variable.

I think I got your point.

> > +	case SND_SOC_DAIFMT_CBC_CFP:    /* MASTER MODE */
> > +		es8375->mastermode = 1;
> > +		regmap_update_bits(es8375->regmap, ES8375_RESET1,
> > +				0x80, 0x80);
> > +		break;
> > +	case SND_SOC_DAIFMT_CBC_CFC:    /* SLAVE MODE */
> 
> Please avoid using outdated terminologoy for clock provider and
> consumer.

I'll delete it.

> > +static void es8375_init(struct snd_soc_component *component)
> > +{
> 
> > +	regmap_write(es8375->regmap, ES8375_ADC_VOLUME, 0xBF);
> > +	regmap_write(es8375->regmap, ES8375_DAC_VOLUME, 0xBF);
> 
> Some of these settings look like they are (or should be) user
> controllable and should be left at the chip defaults, the volumes above
> really stand out.  We use chip defaults to avoid having to decide which
> use cases to configure for.

Because the default value of the chip's volume register is 0x00,
initializing the device without setting it to 0xbf will
cause the device to mute until the customer sets the volume.

> > +static struct regmap_config es8375_regmap_config = {
> > +	.reg_bits = 8,
> > +	.val_bits = 8,
> > +	.max_register = ES8375_REG_MAX,
> > +	.cache_type = REGCACHE_RBTREE,
> 
> Unless you've got a really strong reason for using _RBTREE new drivers
> should use _MAPLE, it's a more modern underlying data structure and
> makes choices more suitable for current systems.

ok

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] ASoC: codecs: add support for ES8375
@ 2025-05-22  5:47 Zhang Yi
  0 siblings, 0 replies; 11+ messages in thread
From: Zhang Yi @ 2025-05-22  5:47 UTC (permalink / raw)
  To: krzk
  Cc: robh, tiwai, devicetree, conor+dt, lgirdwood, linux-kernel,
	linux-sound, perex, krzk+dt, amadeuszx.slawinski, broonie

> > +static int es8375_read_device_properities(struct device *dev, struct es8375_priv *es8375)
> > +{
> > +	int ret;
> > +
> > +	ret = device_property_read_u8(dev, "everest,mclk-src", &es8375->mclk_src);
> 
> These are not documented for DT, but you have here other interfaces. We
> do not have such case nicely solved, so please add explicit comment that
> usage of this and dmic-pol in DT based platforms is not allowed and this
> is not considered ABI.

I'll add the description of everest,mclk-src.
But I noticed that es8375->dmic_pol is not used inside the driver,
so I'll remove it.

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] ASoC: codecs: add support for ES8375
@ 2025-05-22  9:55 Zhang Yi
  0 siblings, 0 replies; 11+ messages in thread
From: Zhang Yi @ 2025-05-22  9:55 UTC (permalink / raw)
  To: broonie
  Cc: robh, tiwai, devicetree, conor+dt, lgirdwood, linux-kernel,
	linux-sound, perex, krzk+dt, amadeuszx.slawinski, krzk

> > Because the default value of the chip's volume register is 0x00,
> > initializing the device without setting it to 0xbf will
> > cause the device to mute until the customer sets the volume.
> 
> That's normal and expected, it's totally fine and normal for the user to
> have to do some configuration.

I got it. Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-05-22  9:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 10:42 [PATCH 0/2] ASoC: codecs: add support for ES8375 Zhang Yi
2025-05-21 10:42 ` [PATCH 1/2] ASoC: dt-bindings: Add Everest ES8375 audio CODEC Zhang Yi
2025-05-21 11:31   ` Rob Herring (Arm)
2025-05-21 10:42 ` [PATCH 2/2] ASoC: codecs: add support for ES8375 Zhang Yi
2025-05-21 11:42   ` Mark Brown
2025-05-21 11:59   ` Krzysztof Kozlowski
2025-05-22  7:36   ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-05-22  5:46 Zhang Yi
2025-05-22  9:45 ` Mark Brown
2025-05-22  5:47 Zhang Yi
2025-05-22  9:55 Zhang Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox