Re: [PATCH 2/4] ALSA: hda/cirrus: Add support for CS8409 HDA bridge and CS42L42 companion codec.

From: Vitaly Rodionov
Date: Thu Mar 04 2021 - 13:40:07 EST


On 04/03/2021 1:39 pm, Takashi Iwai wrote:
Thank you very much for quick response!
On Wed, 03 Mar 2021 19:29:57 +0100,
Vitaly Rodionov wrote:
+static const struct hda_verb cs8409_cs42l42_init_verbs[] = {
+ { 0x01, AC_VERB_SET_POWER_STATE, 0x0000 }, /* AFG: D0 */
I guess this power state change is superfluous. The AFG node is
already powered up when the codec probe or init is called.
Yes, This should be removed

+ { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0020 }, /* GPIO 5 out, 3,4 in */
+ { 0x01, AC_VERB_SET_GPIO_DATA, 0x0000 }, /* GPIO data 0 */
+ { 0x01, AC_VERB_SET_GPIO_MASK, 0x003f }, /* Enable GPIO */
Those are handled in spec->gpio_dir, gpio->data and gpio->mask
fields.
Will handle via spec fields.

+ { 0x01, AC_VERB_SET_GPIO_WAKE_MASK, 0x0018 }, /* WAKE from GPIO 3,4 */
+ { 0x47, AC_VERB_SET_PROC_STATE, 0x0001 }, /* Enable VPW processing */
+ { 0x47, AC_VERB_SET_COEF_INDEX, 0x0002 }, /* Configure GPIO 6,7 */
+ { 0x47, AC_VERB_SET_PROC_COEF, 0x0080 }, /* I2C mode */
+ { 0x47, AC_VERB_SET_COEF_INDEX, 0x005b }, /* Set I2C bus speed */
+ { 0x47, AC_VERB_SET_PROC_COEF, 0x0200 }, /* 100kHz I2C_STO = 2 */
Those remaining verbs are good in the init verbs. But I suppose they
have to be applied at the resume as well? But...
This was added in the next patch, but you are right we should handle it here.

+static int cs8409_cs42l42_fixup(struct hda_codec *codec)
+{
+ int err = 0;
+ struct cs_spec *spec = codec->spec;
+ unsigned int pincap = 0;
+
+ /* Basic initial sequence for specific hw configuration */
+ snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs);
... it seems applied only at the fixup call at parsing?

Ditto about cs8409_cs42l42_hw_init(codec).
Yes, needs to be fixed. I will make v2 patch set.


thanks,

Takashi