From: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: <perex@perex.cz>, <tiwai@suse.com>,
<pierre-louis.bossart@linux.intel.com>,
<zhangyiqun@phytium.com.cn>, <peter.ujfalusi@linux.intel.com>,
<broonie@kernel.org>, <chenhuacai@kernel.org>,
<cezary.rojewski@intel.com>, <siyanteng@loongson.cn>,
<amadeuszx.slawinski@linux.intel.com>, <evan.quan@amd.com>,
<jasontao@glenfly.com>, <kai.vehmanen@linux.intel.com>,
<ranjani.sridharan@linux.intel.com>, <mkumard@nvidia.com>,
<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
<CobeChen@zhaoxin.com>, <TimGuo@zhaoxin.com>,
<LeoLiu-oc@zhaoxin.com>
Subject: Re: [PATCH] ALSA: hda: Zhaoxin: Add HDAC PCI IDs and HDMI Codec Vendor IDs
Date: Mon, 31 Jul 2023 19:36:01 +0800 [thread overview]
Message-ID: <b2b5c3ef-cfda-ea22-b1d4-ad2865a53769@zhaoxin.com> (raw)
In-Reply-To: <87v8e0bjx4.wl-tiwai@suse.de>
On 7/31/23 15:48, Takashi Iwai wrote:
> On Mon, 31 Jul 2023 07:59:32 +0200,
> Tony W Wang-oc wrote:
>> @@ -1044,6 +1044,16 @@ void azx_stop_chip(struct azx *chip)
>> }
>> EXPORT_SYMBOL_GPL(azx_stop_chip);
>>
>> +static void azx_rirb_zxdelay(struct azx *chip, int enable)
>
> It'd be helpful to have a brief function description. It doesn't do
> any delaying but flip something instead, right?
Yes, you are right.
This function expects to implement two functions: Adjust the priority of
write cycles for KX-5000 and delay some time. Now its only implement the
first function.
>
>> +{
>> + if (chip->remap_diu_addr) {
>> + if (!enable)
>> + writel(0x0, (char *)chip->remap_diu_addr + 0x490a8);
>> + else
>> + writel(0x1000000, (char *)chip->remap_diu_addr + 0x490a8);
>
> Avoid magic numbers, but define them.
>
Got it.
This solution operate the register inside the GPU witch do not belong to
HDAC. So will evaluate this patch method again.
>> @@ -1103,9 +1113,14 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
>> azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
>> active = true;
>> if (status & RIRB_INT_RESPONSE) {
>> - if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND)
>> + if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) ||
>> + (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY)) {
>> + azx_rirb_zxdelay(chip, 1);
>> udelay(80);
>
> Calling it here looks a bit misleading, especially because it's paired
> with a later call. Better to put another if block that matches with
> both calls consistently.
>
Ok.
>> + }
>> snd_hdac_bus_update_rirb(bus);
>> + if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY)
>> + azx_rirb_zxdelay(chip, 0);
>
> I meant this one.
>
>> @@ -145,6 +146,7 @@ struct azx {
>>
>> /* GTS present */
>> unsigned int gts_present:1;
>> + void __iomem *remap_diu_addr;
>
> This is a completely different thing, give some comment.
>
Its belong to GPU MMIO.
>
>> +static int azx_init_pci_zx(struct azx *chip)
>> +{
>> + struct snd_card *card = chip->card;
>> + unsigned int diu_reg;
>> + struct pci_dev *diu_pci = NULL;
>> +
>> + diu_pci = pci_get_device(PCI_VENDOR_ID_ZHAOXIN, 0x3a03, NULL);
>> + if (!diu_pci) {
>> + dev_err(card->dev, "hda no KX-5000 device.\n");
>> + return -ENXIO;
>> + }
>> + pci_read_config_dword(diu_pci, PCI_BASE_ADDRESS_0, &diu_reg);
>> + chip->remap_diu_addr = ioremap(diu_reg, 0x50000);
>> + dev_info(card->dev, "hda %x %p\n", diu_reg, chip->remap_diu_addr);
>> + return 0;
>
> Missing pci_dev_put()?
>
Yes.
>> @@ -1360,6 +1385,10 @@ static void azx_free(struct azx *chip)
>> hda->init_failed = 1; /* to be sure */
>> complete_all(&hda->probe_wait);
>>
>> + if (chip->driver_type == AZX_DRIVER_ZHAOXINHDMI) {
>> + azx_free_pci_zx(chip);
>> + }
>
> Superfluous parentheses.
>
>> @@ -1876,6 +1906,10 @@ static int azx_first_init(struct azx *chip)
>> bus->access_sdnctl_in_dword = 1;
>> }
>>
>> + chip->remap_diu_addr = NULL;
>> + if (chip->driver_type == AZX_DRIVER_ZHAOXINHDMI)
>> + azx_init_pci_zx(chip);
>
> No error check? It doesn't look too serious even if the driver
> continues to load, though.
>
>> --- a/sound/pci/hda/patch_hdmi.c
>> +++ b/sound/pci/hda/patch_hdmi.c
>> @@ -4501,6 +4501,8 @@ static int patch_gf_hdmi(struct hda_codec *codec)
>> return 0;
>> }
>>
>> +static int patch_zx_hdmi(struct hda_codec *codec) { return patch_gf_hdmi(codec); }
>
> Don't put in a single line.
> Or, if it's the very same function, you can rather call patch_gf_hdmi
> directly in the table.
>
Ok.
>
> thanks,
>
> Takashi
next prev parent reply other threads:[~2023-07-31 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 5:59 [PATCH] ALSA: hda: Zhaoxin: Add HDAC PCI IDs and HDMI Codec Vendor IDs Tony W Wang-oc
2023-07-31 7:48 ` Takashi Iwai
2023-07-31 11:36 ` Tony W Wang-oc [this message]
2023-08-02 20:23 ` kernel test robot
2023-08-14 1:56 ` kernel test robot
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=b2b5c3ef-cfda-ea22-b1d4-ad2865a53769@zhaoxin.com \
--to=tonywwang-oc@zhaoxin.com \
--cc=CobeChen@zhaoxin.com \
--cc=LeoLiu-oc@zhaoxin.com \
--cc=TimGuo@zhaoxin.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=chenhuacai@kernel.org \
--cc=evan.quan@amd.com \
--cc=jasontao@glenfly.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mkumard@nvidia.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=siyanteng@loongson.cn \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=zhangyiqun@phytium.com.cn \
/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;
as well as URLs for NNTP newsgroup(s).