All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ian Minett <ian_minett@creativelabs.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/1] Added patch file and Makefile entry for CA0132 HDA codec
Date: Fri, 03 Jun 2011 18:20:13 +0200	[thread overview]
Message-ID: <s5h39jq3n0i.wl%tiwai@suse.de> (raw)
In-Reply-To: <1307045665-8084-1-git-send-email-ian_minett@creativelabs.com>

At Thu, 2 Jun 2011 13:14:25 -0700,
Ian Minett wrote:
> 
> Attached is a patch that adds support for the CA0132 HDA codec,
> creating patch_ca0132.c in pci/hda.

Thanks for the patch!

>  It also adds an entry to the pci/hda makefile that builds the codec
>  when SND_HDA_CODEC_CA0132 is defined. However, we are not sure
>  where to add the KConfig entry for SND_HDA_CODEC_CA0132, which is
>  below, or if we should even create such an entry for this
>  submission.

Yes, at best, please include Kconfig change into the same patch.

But I see now you are patching alsa-driver code instead of kernel tree,
so it's not too trivial indeed.  I recommend you to patch your driver
in the kernel tree first, check it works, then submit the patch, instead
of modifying alsa-driver tree.  We can change alsa-driver tree later for
the new stuff.

About the code, see some quick reviews below.

> +/*
> + * CA0132 chip access stuffs
> + */
> +static int chipio_acquire_mutex(struct hda_codec *codec)
> +{
> +	struct ca0132_spec *spec = codec->spec;
> +
> +	mutex_lock(&spec->chipio_mutex);
> +	return 0;
> +}
> +
> +static int chipio_release_mutex(struct hda_codec *codec)
> +{
> +	struct ca0132_spec *spec = codec->spec;
> +
> +	mutex_unlock(&spec->chipio_mutex);
> +	return 0;
> +}

Avoid to introduce such wrappers.  It's more readable to get spec in
the function and call mutex_lock/unlock appropriately, in general.


> +/*
> + * Write chip address through the vendor widget -- NOT protected by the Mutex!
> + */
> +static int chipio_write_address(struct hda_codec *codec,
> +				unsigned int chip_addx)
> +{
> +	unsigned int res = 0;
> +	int retry = 100;
> +
> +	/* send low 16 bits of the address */
> +	do {
> +		res = snd_hda_codec_read(codec, WIDGET_CHIP_CTRL, 0,
> +				HDA_SHORT_CMD_VENDOR_CHIP_IO_ADDRESS_LOW,
> +				chip_addx & 0xffff);
> +		retry--;
> +	} while (res != HDA_STATUS_VENDOR_CHIP_IO_OK && retry);

100 retries look fairly much.  Do we really need so long access?


thanks,

Takashi

  reply	other threads:[~2011-06-03 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 20:14 [PATCH 1/1] Added patch file and Makefile entry for CA0132 HDA codec Ian Minett
2011-06-03 16:20 ` Takashi Iwai [this message]
2011-06-03 16:11 [PATCH 0/6] HDMI: Implement pcm-per-pin Takashi Iwai
2011-06-08  0:06 ` [PATCH 1/1] Added patch file and Makefile entry for CA0132 HDA codec Ian Minett
2011-06-08  6:04   ` Takashi Iwai

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=s5h39jq3n0i.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ian_minett@creativelabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.