From: Terry Sanders <linux@vertone.co.uk>
To: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>
Cc: alsa-devel@alsa-project.org
Subject: Bug in tlv320adc3101 driver
Date: Wed, 31 Jul 2024 08:44:53 +0100 [thread overview]
Message-ID: <5652371.ZASKD2KPVS@jupiter> (raw)
Hi,
There is a bug in the code for the tlv320adc3101 driver when setting up the D value for PLL.
The D value is set via I2C using page 0 registers 7 (MSB) and 8 (LSB). The data sheet has the following information for the registers:
"Page 0 / Register 7 will be updated when Page 0 / Register 8 is written immediately after Page 0 / Register 7 is written"
and:
"Page 0 / Register 8 must be written immediately after writing to Page 0 / Register 7"
The function that implements this is adc3xxx_setup_pll() in file soc/codecs/tlv320adc3xxx.c line 1172 - 1189. The function is shown below:
static void adc3xxx_setup_pll(struct snd_soc_component *component,
int div_entry)
{
int i = div_entry;
/* P & R values */
snd_soc_component_write(component, ADC3XXX_PLL_PROG_PR,
(adc3xxx_divs[i].pll_p << ADC3XXX_PLLP_SHIFT) |
(adc3xxx_divs[i].pll_r << ADC3XXX_PLLR_SHIFT));
/* J value */
snd_soc_component_write(component, ADC3XXX_PLL_PROG_J,
adc3xxx_divs[i].pll_j & ADC3XXX_PLLJ_MASK);
/* D value */
snd_soc_component_write(component, ADC3XXX_PLL_PROG_D_LSB,
adc3xxx_divs[i].pll_d & ADC3XXX_PLLD_LSB_MASK);
snd_soc_component_write(component, ADC3XXX_PLL_PROG_D_MSB,
(adc3xxx_divs[i].pll_d >> 8) & ADC3XXX_PLLD_MSB_MASK);
}
In the function the LSB (register 8) is written first followed by the MSB (register 7). This is the wrong way around and should be swapped so that the MSB is written first.
Regards
Terry Sanders
next reply other threads:[~2024-07-31 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 7:44 Terry Sanders [this message]
2024-07-31 7:48 ` [EXTERNAL] Bug in tlv320adc3101 driver Ding, Shenghao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5652371.ZASKD2KPVS@jupiter \
--to=linux@vertone.co.uk \
--cc=alsa-devel@alsa-project.org \
--cc=baojun.xu@ti.com \
--cc=kevin-lu@ti.com \
--cc=shenghao-ding@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox