From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@bombadil.infradead.org
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 5/6] tm6000: Add a callback code for buffer fill
Date: Fri, 4 Jun 2010 21:21:05 -0300 [thread overview]
Message-ID: <20100604212105.12f43b08@pedra> (raw)
In-Reply-To: <cover.1275696910.git.mchehab@redhat.com>
Implements a callback to be used by tm6000-alsa, in order to allow filling
audio data packets.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index db1eef9..e71579e 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -199,6 +199,21 @@ static int snd_tm6000_close(struct snd_pcm_substream *substream)
return 0;
}
+static int tm6000_fillbuf(struct tm6000_core *core, char *buf, int size)
+{
+ int i;
+
+ /* Need to add a real code to copy audio buffer */
+ printk("Audio (%i bytes): ", size);
+ for (i = 0; i < size - 3; i +=4)
+ printk("(0x%04x, 0x%04x), ",
+ *(u16 *)(buf + i), *(u16 *)(buf + i + 2));
+
+ printk("\n");
+
+ return 0;
+}
+
/*
* hw_params callback
*/
@@ -395,6 +410,7 @@ struct tm6000_ops audio_ops = {
.name = "TM6000 Audio Extension",
.init = tm6000_audio_init,
.fini = tm6000_audio_fini,
+ .fillbuf = tm6000_fillbuf,
};
static int __init tm6000_alsa_register(void)
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 1f2765c..626b85e 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -652,6 +652,23 @@ void tm6000_add_into_devlist(struct tm6000_core *dev)
static LIST_HEAD(tm6000_extension_devlist);
static DEFINE_MUTEX(tm6000_extension_devlist_lock);
+int tm6000_call_fillbuf(struct tm6000_core *dev, enum tm6000_ops_type type,
+ char *buf, int size)
+{
+ struct tm6000_ops *ops = NULL;
+
+ /* FIXME: tm6000_extension_devlist_lock should be a spinlock */
+
+ if (!list_empty(&tm6000_extension_devlist)) {
+ list_for_each_entry(ops, &tm6000_extension_devlist, next) {
+ if (ops->fillbuf && ops->type == type)
+ ops->fillbuf(dev, buf, size);
+ }
+ }
+
+ return 0;
+}
+
int tm6000_register_extension(struct tm6000_ops *ops)
{
struct tm6000_core *dev = NULL;
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index 1e348ac..c0d6f6a 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -301,7 +301,7 @@ static int copy_streams(u8 *data, unsigned long len,
memcpy (&voutp[pos], ptr, cpysize);
break;
case TM6000_URB_MSG_AUDIO:
- /* Need some code to copy audio buffer */
+ tm6000_call_fillbuf(dev, TM6000_AUDIO, ptr, cpysize);
break;
case TM6000_URB_MSG_VBI:
/* Need some code to copy vbi buffer */
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index 8fccf3e..db99959 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -229,6 +229,7 @@ struct tm6000_ops {
enum tm6000_ops_type type;
int (*init)(struct tm6000_core *);
int (*fini)(struct tm6000_core *);
+ int (*fillbuf)(struct tm6000_core *, char *buf, int size);
};
struct tm6000_fh {
@@ -278,6 +279,9 @@ int tm6000_register_extension(struct tm6000_ops *ops);
void tm6000_unregister_extension(struct tm6000_ops *ops);
void tm6000_init_extension(struct tm6000_core *dev);
void tm6000_close_extension(struct tm6000_core *dev);
+int tm6000_call_fillbuf(struct tm6000_core *dev, enum tm6000_ops_type type,
+ char *buf, int size);
+
/* In tm6000-stds.c */
void tm6000_get_std_res(struct tm6000_core *dev);
--
1.7.1
next prev parent reply other threads:[~2010-06-05 0:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1275696910.git.mchehab@redhat.com>
2010-06-05 0:21 ` [PATCH 6/6] tm6000: avoid unknown symbol tm6000_debug Mauro Carvalho Chehab
2010-06-05 0:21 ` Mauro Carvalho Chehab [this message]
2010-06-05 0:21 ` [PATCH 4/6] tm6000: Use an emum for extension type Mauro Carvalho Chehab
2010-06-05 0:21 ` [PATCH 3/6] tm6000-alsa: rework audio buffer allocation/deallocation Mauro Carvalho Chehab
2010-06-05 0:21 ` [PATCH 1/6] tm6000: Fix compilation breakages Mauro Carvalho Chehab
2010-06-05 0:21 ` [PATCH 2/6] tm6000: Avoid OOPS when loading tm6000-alsa module Mauro Carvalho Chehab
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=20100604212105.12f43b08@pedra \
--to=mchehab@redhat.com \
--cc=linux-media@vger.kernel.org \
/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