All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org,
	linux1394-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/3] Add handling CMP output connection
Date: Sun, 28 Apr 2013 14:52:25 +0200	[thread overview]
Message-ID: <517D1B89.506@ladisch.de> (raw)
In-Reply-To: <1367125189-377-4-git-send-email-o-takashi@sakamocchi.jp>

Takashi Sakamoto wrote:
> To handle CMP output connection, this patch adds some macros, codes with
> condition of direction and new functions. Once cmp_connection_init() is
> executed with its direction, CMP input and output connection can be
> handled by the same way.

> +++ b/sound/firewire/cmp.c

> +	if (c->direction == CMP_INPUT)
> +		offset = CSR_REGISTER_BASE + CSR_IPCR(c->pcr_index);
> +	else
> +		offset = CSR_REGISTER_BASE + CSR_OPCR(c->pcr_index);

This code is used twice and could be moved into a helper function.

> +static int get_overhead_id(struct cmp_connection *c)

> +	/*
> +	 * apply "oPCR overhead ID encoding"
> +	 * the encoding table can convert up to 512.
> +	 * here the value over 512 is converted as the same way as 512.
> +	 */

	/*
	 * Apply "oPCR overhead ID encoding":
	 * The encoding table can convert up to 512.
	 * Here any value over 512 is converted in the same way as 512.
	 */

> +	for (id = 1; id < 16; id += 1) {
> +		if (c->resources.bandwidth_overhead < (id << 5))
> +			break;
> +	}
> +	if (id == 16)
> +		id = 0;

	id = DIV_ROUND_UP(c->resources.bandwidth_overhead, 32);
	if (id >= 16)
		id = 0;

> +static __be32 opcr_set_modify(struct cmp_connection *c, __be32 opcr)

> +	/* generate speed and extended speed field value */

This comment is superfluous; it does not tell anything non-obvious about
the code.

> +	/*
> +	 * here zero is applied to payload field.
> +	 * it means the maximum number of quadlets in an isochronous packet is
> +	 * 1024 when spd is less than three, 1024 * 2 * xspd + 1 when spd is
> +	 * equal to three. An arbitrary value can be set here but 0 is enough
> +	 * for our purpose.
> +	 */
> +	opcr |= cpu_to_be32(0 << OPCR_PAYLOAD_SHIFT);

In an oPCR, the payload field is changed only by the device.


Regards,
Clemens

  reply	other threads:[~2013-04-28 12:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28  4:59 [PATCH 0/3] snd-firewire-lib: add handling CMP output connection Takashi Sakamoto
2013-04-28  4:59 ` [PATCH 1/3] rename macros, variables and functions related to CMP plug Takashi Sakamoto
2013-04-28  4:59 ` [PATCH 2/3] Add "direction" member to cmp_connection structure Takashi Sakamoto
2013-04-28  4:59 ` [PATCH 3/3] Add handling CMP output connection Takashi Sakamoto
2013-04-28 12:52   ` Clemens Ladisch [this message]
2013-04-29  4:18     ` Takashi Sakamoto
2013-04-29  6:30       ` Clemens Ladisch
2013-04-29  9:25         ` Takashi Sakamoto
2013-04-29 12:38           ` Takashi Sakamoto
2013-04-29  9:44 ` [PATCH v2 0/3] snd-firewire-lib: add " Takashi Sakamoto
2013-04-29  9:44   ` [PATCH 1/3] rename macros, variables and functions related to CMP plug Takashi Sakamoto
2013-04-29  9:44   ` [PATCH 2/3] Add "direction" member to cmp_connection structure Takashi Sakamoto
2013-04-29  9:44   ` [PATCH 3/3] Add handling CMP output connection Takashi Sakamoto

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=517D1B89.506@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=o-takashi@sakamocchi.jp \
    --cc=tiwai@suse.de \
    /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.