public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ivan Orlov <ivan.orlov0322@gmail.com>
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
Date: Tue, 19 Sep 2023 09:56:00 +0200	[thread overview]
Message-ID: <87y1h2y4tr.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230918181044.7257-2-ivan.orlov0322@gmail.com>

On Mon, 18 Sep 2023 20:10:44 +0200,
Ivan Orlov wrote:
> 
> +#include <sound/core.h>
> +#include <sound/control.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/initval.h>
> +#include <sound/info.h>
> +#include <linux/delay.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/interrupt.h>

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

  parent reply	other threads:[~2023-09-19  7:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 18:10 [PATCH v2 1/2] ALSA: docs: Add Marian M2 driver documentation Ivan Orlov
2023-09-18 18:10 ` [PATCH v2 2/2] ALSA: Add new driver for Marian M2 sound card Ivan Orlov
2023-09-19  3:41   ` kernel test robot
2023-09-19  7:56   ` Takashi Iwai [this message]
2023-09-19  8:35     ` Ivan Orlov
2023-09-19  8:04   ` Greg KH
2023-09-19  8:46     ` Ivan Orlov
2023-09-19  8:53       ` Greg KH
2023-09-19 17:23         ` Ivan Orlov
2023-11-05 20:44   ` kernel test robot
2023-09-19  7:57 ` [PATCH v2 1/2] ALSA: docs: Add Marian M2 driver documentation Jonathan Corbet
2023-09-19  8:49   ` Ivan Orlov
2023-09-19  8:03 ` Greg KH

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=87y1h2y4tr.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ivan.orlov0322@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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