[RFC] ALSA: hda: Add workaround to adapt to Loongson 7A1000 controller

Takashi Iwai tiwai at suse.de
Fri Jul 31 08:29:35 CEST 2020


On Fri, 31 Jul 2020 04:41:54 +0200,
Kaige Li wrote:
> 
> There's some issues that cause palyback without a sound on Loongson
> platform (3A3000 + 7A1000) with a Realtek ALC269 codec. After lengthy
> debugging sessions, we solved it by adding workaround.
> 
> Signed-off-by: Kaige Li <likaige at loongson.cn>

Thanks for the patch.  But this can't be taken as is due to the design
problem.  Namely...

> --- a/sound/hda/hdac_controller.c
> +++ b/sound/hda/hdac_controller.c
> @@ -9,6 +9,7 @@
>  #include <sound/core.h>
>  #include <sound/hdaudio.h>
>  #include <sound/hda_register.h>
> +#include "../pci/hda/hda_controller.h"

... here already suspicious, and ...

>  #include "local.h"
>  
>  /* clear CORB read pointer properly */
> @@ -42,6 +43,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)
>   */
>  void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
>  {
> +	struct azx *chip = bus_to_azx(bus);

... here you cast the hdac_bus object to its child class.  This is
disallowed, as it's a layer violation and would break if another child
class like ASoC driver is used with this patch.

IOW, inside the code in sound/hda/*, you must not use the contents in
sound/pci/hda/* and include/sound/hda_codec.h.

If any new workaround is needed, introduce a new flag in struct
hdac_bus.


thanks,

Takashi


More information about the Alsa-devel mailing list