Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4112391rwb; Mon, 31 Jul 2023 01:14:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlH5OxNUYbMCGXH5SPAgx+4hLjW/xUDViyCCuhk7nfNvxHGeq0kXRQOIsr1xvof7tY3QY6dl X-Received: by 2002:a05:6358:9315:b0:135:4003:7849 with SMTP id x21-20020a056358931500b0013540037849mr5330413rwa.4.1690791250547; Mon, 31 Jul 2023 01:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690791250; cv=none; d=google.com; s=arc-20160816; b=dicTp+E7byEBIOtHTmjOcRQlxySr9yAqDMs+eI/x+H7NNK/Fh5kLu2ErkuOZIQURTh 4P+AldRRNJz7RW7xt/UekcNljwj2ImKcrDYkLNSoaJb9j3/6Yr3DleB4Ago20Zxiz5aj P+rAmusFpEYllQRM4Ou/HYCOnmnK+HLanx48X6abLTW8/XkBR38tBQxo0XRV1/ZSfT+r xfccOz2mFbLiwtisCVrFK80MxF5AnMEdWA1USAJQYpyXPoKtR0PYsoYfeaUw19vh0U1v oIpjoKrW2yXsYDTnkX9+3RKZ4/X6wELgVw7aHlUohAmj34QRzHEAlejwrNvaTGNJP3u5 CeHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=HRb+iEVyNyN5bs1NAVsrke/3KjePmDp7FMxC2kJDGy0=; fh=KK5HwzX8pOKVWyfPAQZYb/sZXKLMC1Yh80z3og+9kOY=; b=oSngC9tfa4c4K9+dA8S9nlWQi+gLU/DbUmbpoGbRdZM3JE1mmRJ2CZkl8ZDvkCFrpD L3BVMDdpdJt180Gjd8UPx+rGz/yVJ5H60j8uyVDopqBzlOkOMdLN+v8bpJ7xmyIt2Hhl 2ZJ6y9S88lZ41Ny6DCbaawcWbnlSNf1cg5oGDJdP4Zz3Zr+pQkhlALwA+hupMNdzldEl xe1WPyzJUVm9fcdBVF6/V+vpj7+WPkl0YVK78WL2QR+OqRrgp+IrThOolGM3knQ1RW6i uaLRpYnDEZ2yIRvDMWVI1/6R1EiRNB6WLCSAf9vkPHAY2c8FCaB5Lu/NuwvCChesUl96 GnqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LqCeOtVp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h185-20020a6383c2000000b0055ace8caef7si6680070pge.610.2023.07.31.01.13.57; Mon, 31 Jul 2023 01:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=LqCeOtVp; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbjGaHtA (ORCPT + 99 others); Mon, 31 Jul 2023 03:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbjGaHtA (ORCPT ); Mon, 31 Jul 2023 03:49:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA1FA11A for ; Mon, 31 Jul 2023 00:48:58 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 644821F460; Mon, 31 Jul 2023 07:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690789737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HRb+iEVyNyN5bs1NAVsrke/3KjePmDp7FMxC2kJDGy0=; b=LqCeOtVpBwY1mFcCcfdNqT9AKJNRgsVG1Q9RhRWsjsINFRETefQqztpL39lrNwRtBwbUzH UcOMoV1OKMjdVdI9pii1HIK4Ptky4ZAZsbKsF3yNlsmGbck4gEhhEs2Ma5FklmDkqc2MiV grhjiUlOwnVoxYriTQBp4kXKmE0oTAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690789737; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HRb+iEVyNyN5bs1NAVsrke/3KjePmDp7FMxC2kJDGy0=; b=rQ0kmr9WQ7mFuVmPIMYQBEBQ75lPn12PZwvwygFI/CtSBwTVoQwaP7ZL3sg8RtPPuP0gQk SpmUPKosDcHfwADg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E8A67133F7; Mon, 31 Jul 2023 07:48:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QGHMN2hnx2R3DAAAMHmgww (envelope-from ); Mon, 31 Jul 2023 07:48:56 +0000 Date: Mon, 31 Jul 2023 09:48:55 +0200 Message-ID: <87v8e0bjx4.wl-tiwai@suse.de> From: Takashi Iwai To: Tony W Wang-oc Cc: , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH] ALSA: hda: Zhaoxin: Add HDAC PCI IDs and HDMI Codec Vendor IDs In-Reply-To: <20230731055932.4336-1-TonyWWang-oc@zhaoxin.com> References: <20230731055932.4336-1-TonyWWang-oc@zhaoxin.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > +{ > + 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. > @@ -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. > + } > 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. > +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()? > @@ -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. thanks, Takashi