Re: [PATCH v3 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver

Mark Brown <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-sound
Message-ID <[email protected]>
On Fri, Sep 18, 2026 at 06:13:25AM +0300, Karl Asseily wrote:
> The ES9039Q2M is a 32-bit two-channel audio DAC with an asynchronous
> sample rate converter. It selects between two control personalities with
> its MODE pin: hardware mode, strapped by HW0/HW1/HW2 with no control bus
> at all, and software mode over I2C or SPI. This driver implements
> software mode over I2C, which MODE = GND selects.

> +static int es9039_fir_put(struct snd_kcontrol *kcontrol,
> +			  const unsigned int __user *bytes, unsigned int size)
> +{
> +	struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
> +	struct es9039q2m_priv *priv = snd_soc_component_get_drvdata(c);
> +	struct soc_bytes_ext *be = (void *)kcontrol->private_value;
> +	struct es9039_fir_ctl *p = container_of(be, struct es9039_fir_ctl, be);
> +	u8 *buf;
> +	int ret, i;
> +
> +	if (size != p->taps * ES9039_COEFF_BYTES)
> +		return -EINVAL;
> +
> +	buf = memdup_user(bytes, size);
> +	if (IS_ERR(buf))
> +		return PTR_ERR(buf);
> +
> +	/*
> +	 * PROG_COEFF_WE is a per-coefficient strobe, not a gate held open
> +	 * across the upload. The datasheet's sequence is address, data, raise
> +	 * WE, lower WE, once per coefficient. Holding it high for the whole
> +	 * loop also appears to work on ES9039Q2M silicon, but "appears to
> +	 * work" is not a specification.
> +	 */
> +	for (i = 0; i < p->taps; i++) {
> +		ret = regmap_write(priv->regmap, ES9039_PROG_RAM_ADDR,
> +				   (p->stage_4x ? ES9039_PROG_STAGE_4X : 0) |
> +				   FIELD_PREP(ES9039_PROG_ADDR_MASK, i));
> +		if (ret)
> +			goto out;

...

> +out:
> +	regmap_update_bits(priv->regmap, ES9039_PROG_RAM_CTRL,
> +			   ES9039_PROG_COEFF_WE, 0);
> +	kfree(buf);
> +	if (ret)
> +		return ret;

How does this work with suspend and resume if the device is powered down
in suspend?  It looks like this is doing some windowing stuff and needs
a specific write sequence.
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmqtFoAACgkQJNaLcl1U
h9AwSwf6AgqtCsZuhWCr32RHSRWAIjArx/ghEUPhLAH7hWwJjQDv94auZK7yV4Po
aE8XHqW358yHkReIHXBgJauskKyGAGruKVzN5uW5PbtTjkZed1iefh//0LfujnW4
ieJZpwnEvRl/3yOk1DCQt/rED6PG+bRwPjddFto17B21vBppT1G/O7mDULnNS5Ma
Z5EjWTnQ2cA2NHvo/G+YGvCB5u1zebR6K7U/xGK8v/JBHwH+P1ik9xl57kF5S3g3
r5FbAW3b0csIIGOhBuRcFYgAIFjO3JeRIeg69NhhNqqsIs+SLQYFFBkz5qAXNgeF
l1T71tBjDHRt5OpHbDhJfmIuzgVkbQ==
=p7If
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.