From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB61CD549D for ; Tue, 19 Sep 2023 07:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbjISH4Q (ORCPT ); Tue, 19 Sep 2023 03:56:16 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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