Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp507518rdb; Tue, 19 Sep 2023 01:58:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENzxHMKUizjxcCX+yYoj2I/r4uEIOpU2WD70+m1VW2vkp+gDcGApT8SjSQDkoz3juyOBnB X-Received: by 2002:a05:6808:2014:b0:3a4:35bb:edae with SMTP id q20-20020a056808201400b003a435bbedaemr15275729oiw.29.1695113886215; Tue, 19 Sep 2023 01:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695113886; cv=none; d=google.com; s=arc-20160816; b=sSch4LBwzqzvx2YjyKGzHpcn5RYbKpHuewkrthBYE7I4xrOMZWlNTxmS1rEIn10a/6 y5ZcIHDsXMq6/ZAx08zPCbCxCvQnd9whVoFM5oqr/BxV0khzEJtzPpIKluly14Vt0QTG nzTI07v+SOoCG36wrnS7JIyg6vwmBGvYwAHH+hUehSIEur6BDtfAeulXQ7GSwgcy1Cku V9OKhVWyePtjIRdcPMXHJ8+pRvbD7x2gZSMTtnjJf6fdsqjRuAJn8xUYyj6rAcSHKxgf udjByPXx3QKwZp8SoA1NiARufNXInHRuSShtmWLxha2tk2bSFGQHSeGnYkEyo6B+CbAL crqg== 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=CFaGFhIaTzpbZC4A9IwfPNn/AnZpNzT/vtySOR34fG8=; fh=K2CAt8qEaykTSp0eiYIY7rKVbc8tzvtjBdSqZxlLlyE=; b=goCL5bR4zeduJA+9OuApDTERoncwhK7hfqCwgZOzdKOy/Nh0S/eP43rG7FeXWo22x+ /5jWNATgvRo/2e0ia1HjQSoN2KZnvnrbEFeWr1HRx9lJiT+LoA7eLKNZlzKTEzL0FGwy EfClkUhbTuw5ikq1WbnWJaVWYVw+Wk2U1eJelZtiPGnGTveYXQrumJrA8rgHxhEKn4b3 GCncnowFNqbPP17L8nBRPFKlIA504NnZOR6HZpqZEtj1XBSQufHpuR3hnTQUAgksIHhm 9wN31bQXI1aViToYtB/iuk129O2F579IDsHKypdet86AWVkeJXdPsNbwaGNcMjs6s3D/ pRNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mQwQtjKd; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=+CMRTs0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id cj15-20020a056a00298f00b00690c1e51cdfsi1009088pfb.188.2023.09.19.01.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 01:58:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mQwQtjKd; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=+CMRTs0O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C1243807C565; Tue, 19 Sep 2023 00:56:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbjISH4O (ORCPT + 99 others); Tue, 19 Sep 2023 03:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjISH4M (ORCPT ); Tue, 19 Sep 2023 03:56:12 -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 245BB100; Tue, 19 Sep 2023 00:56:03 -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 A7BCE1FE09; Tue, 19 Sep 2023 07:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695110161; 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=CFaGFhIaTzpbZC4A9IwfPNn/AnZpNzT/vtySOR34fG8=; b=mQwQtjKdLG9NCVrXx66GnkR6xyZ1eLSfswc/ztDLE2Xy5UBtBpInHjSgUG0Kn9KMpgaXxb NSIJsInCQ0at1qJqF8KNH6S7jMryeHguIlyALXneqJW2uJ99w1bZjfH6R8IS+sKCEDeueK zWxc6bBt/egQBB/A2VN79qvV64g0Q/s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695110161; 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=CFaGFhIaTzpbZC4A9IwfPNn/AnZpNzT/vtySOR34fG8=; b=+CMRTs0O4Z5kJUVbYpXCNfWOze9kIThOHpQVT6O6/2PVARStWVM8gzWTO3b9Yc5isOp4Vv XNGdRU3dudrKvpDA== 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 6EA0113458; Tue, 19 Sep 2023 07:56:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zvARGhFUCWU1ewAAMHmgww (envelope-from ); Tue, 19 Sep 2023 07:56:01 +0000 Date: Tue, 19 Sep 2023 09:56:00 +0200 Message-ID: <87y1h2y4tr.wl-tiwai@suse.de> From: Takashi Iwai To: Ivan Orlov Cc: perex@perex.cz, tiwai@suse.com, corbet@lwn.net, alsa-devel@alsa-project.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH v2 2/2] ALSA: Add new driver for Marian M2 sound card In-Reply-To: <20230918181044.7257-2-ivan.orlov0322@gmail.com> References: <20230918181044.7257-1-ivan.orlov0322@gmail.com> <20230918181044.7257-2-ivan.orlov0322@gmail.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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:56:23 -0700 (PDT) On Mon, 18 Sep 2023 20:10:44 +0200, Ivan Orlov wrote: > > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include We usually include linux/* at first, followed by sound/*. > +#define DEBUG Any need to define this for the production system? > +struct marian_card_descriptor; > +struct marian_card; > + > +struct marian_card_descriptor { > + char *name; > + char *port_names; > + unsigned int speedmode_max; > + unsigned int ch_in; > + unsigned int ch_out; > + unsigned int midi_in; > + unsigned int midi_out; > + unsigned int serial_in; > + unsigned int serial_out; > + unsigned int wck_in; > + unsigned int wck_out; > + > + unsigned int dma_bufsize; > + > + void (*hw_constraints_func)(struct marian_card *marian, > + struct snd_pcm_substream *substream, > + struct snd_pcm_hw_params *params); > + /* custom function to set up ALSA controls */ > + void (*create_controls)(struct marian_card *marian); > + /* init is called after probing the card */ > + int (*init_card)(struct marian_card *marian); > + void (*free_card)(struct marian_card *marian); > + /* prepare is called when ALSA is opening the card */ > + void (*prepare)(struct marian_card *marian); > + void (*set_speedmode)(struct marian_card *marian, unsigned int speedmode); > + void (*proc_status)(struct marian_card *marian, struct snd_info_buffer *buffer); > + void (*proc_ports)(struct marian_card *marian, struct snd_info_buffer *buffer, > + unsigned int type); > + > + struct snd_pcm_hardware info_playback; > + struct snd_pcm_hardware info_capture; Do we need this kind of abstraction inside the driver? As far as I see, the driver supports only a single model, hence there is no real merit of abstracted / indirect function calls. So I stop reading at this point. thanks, Takashi