All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: alsa-devel@alsa-project.org
Cc: linuxppc-dev@ozlabs.org, netstar@gatheringofgray.com
Subject: [RFC 08/12] snd-aoa: add toonie codec
Date: Wed, 07 Jun 2006 15:09:17 +0200	[thread overview]
Message-ID: <20060607130915.761442000@sipsolutions.net> (raw)
In-Reply-To: 20060607130909.584205000@sipsolutions.net

[-- Attachment #1: add-toonie-codec.patch --]
[-- Type: text/plain, Size: 3507 bytes --]

This adds support for the 'toonie' codec which is just a codec
without any mixer/volume control functionality and is used on
the mac mini.

--- /dev/null
+++ b/sound/aoa/codecs/snd-aoa-codec-toonie.c
@@ -0,0 +1,140 @@
+/*
+ * Apple Onboard Audio driver for Toonie codec
+ *
+ * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
+ *
+ * GPL v2, can be found in COPYING.
+ *
+ *
+ * This is a driver for the toonie codec chip. This chip is present
+ * on the Mac Mini and is nothing but a DAC.
+ */
+#include <linux/delay.h>
+#include <linux/module.h>
+MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("toonie codec driver for snd-aoa");
+
+#include "../aoa.h"
+#include "../soundbus/soundbus.h"
+
+
+#define PFX "snd-aoa-codec-toonie: "
+
+struct toonie {
+	struct aoa_codec	codec;
+};
+#define codec_to_toonie(c) container_of(c, struct toonie, codec)
+
+static int toonie_dev_register(struct snd_device *dev)
+{
+	return 0;
+}
+
+static struct snd_device_ops ops = {
+	.dev_register = toonie_dev_register,
+};
+
+static struct transfer_info toonie_transfers[] = {
+	/* This thing *only* has analog output,
+	 * the rates are taken from Info.plist
+	 * from Darwin. */
+	{
+		.formats = SNDRV_PCM_FMTBIT_S16_BE |
+			   SNDRV_PCM_FMTBIT_S24_BE,
+		.rates = SNDRV_PCM_RATE_32000 |
+			 SNDRV_PCM_RATE_44100 |
+			 SNDRV_PCM_RATE_48000 |
+			 SNDRV_PCM_RATE_88200 |
+			 SNDRV_PCM_RATE_96000,
+	},
+	{}
+};
+
+#ifdef CONFIG_PM
+static int toonie_suspend(struct codec_info_item *cii, pm_message_t state)
+{
+	/* can we turn it off somehow? */
+	return 0;
+}
+
+static int toonie_resume(struct codec_info_item *cii)
+{
+	return 0;
+}
+#endif /* CONFIG_PM */
+
+static struct codec_info toonie_codec_info = {
+	.transfers = toonie_transfers,
+	.sysclock_factor = 256,
+	.bus_factor = 64,
+	.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+	.suspend = toonie_suspend,
+	.resume = toonie_resume,
+#endif
+};
+
+static int toonie_init_codec(struct aoa_codec *codec)
+{
+	struct toonie *toonie = codec_to_toonie(codec);
+
+	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) {
+		printk(KERN_ERR PFX "failed to create toonie snd device!\n");
+		return -ENODEV;
+	}
+
+	/* nothing connected? what a joke! */
+	if (toonie->codec.connected != 1)
+		return -ENOTCONN;
+
+	if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev,
+						     aoa_get_card(),
+						     &toonie_codec_info, toonie)) {
+		printk(KERN_ERR PFX "error creating toonie pcm\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static void toonie_exit_codec(struct aoa_codec *codec)
+{
+	struct toonie *toonie = codec_to_toonie(codec);
+
+	if (!toonie->codec.soundbus_dev) {
+		printk(KERN_ERR PFX "toonie_exit_codec called without soundbus_dev!\n");
+		return;
+	}
+	toonie->codec.soundbus_dev->detach_codec(toonie->codec.soundbus_dev, toonie);
+}
+
+static struct toonie *toonie;
+
+static int __init toonie_init(void)
+{
+	toonie = kzalloc(sizeof(struct toonie), GFP_KERNEL);
+
+	if (!toonie)
+		return -ENOMEM;
+
+	strlcpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
+	toonie->codec.owner = THIS_MODULE;
+	toonie->codec.init = toonie_init_codec;
+	toonie->codec.exit = toonie_exit_codec;
+                                        
+	if (aoa_codec_register(&toonie->codec)) {
+		kfree(toonie);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void __exit toonie_exit(void)
+{
+	kfree(toonie);
+}
+
+module_init(toonie_init);
+module_exit(toonie_exit);

--

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes@sipsolutions.net>
To: alsa-devel@alsa-project.org
Cc: linuxppc-dev@ozlabs.org, netstar@gatheringofgray.com
Subject: [RFC 08/12] snd-aoa: add toonie codec
Date: Wed, 07 Jun 2006 15:09:17 +0200	[thread overview]
Message-ID: <20060607130915.761442000@sipsolutions.net> (raw)
In-Reply-To: 20060607130909.584205000@sipsolutions.net

This adds support for the 'toonie' codec which is just a codec
without any mixer/volume control functionality and is used on
the mac mini.

--- /dev/null
+++ b/sound/aoa/codecs/snd-aoa-codec-toonie.c
@@ -0,0 +1,140 @@
+/*
+ * Apple Onboard Audio driver for Toonie codec
+ *
+ * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
+ *
+ * GPL v2, can be found in COPYING.
+ *
+ *
+ * This is a driver for the toonie codec chip. This chip is present
+ * on the Mac Mini and is nothing but a DAC.
+ */
+#include <linux/delay.h>
+#include <linux/module.h>
+MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("toonie codec driver for snd-aoa");
+
+#include "../aoa.h"
+#include "../soundbus/soundbus.h"
+
+
+#define PFX "snd-aoa-codec-toonie: "
+
+struct toonie {
+	struct aoa_codec	codec;
+};
+#define codec_to_toonie(c) container_of(c, struct toonie, codec)
+
+static int toonie_dev_register(struct snd_device *dev)
+{
+	return 0;
+}
+
+static struct snd_device_ops ops = {
+	.dev_register = toonie_dev_register,
+};
+
+static struct transfer_info toonie_transfers[] = {
+	/* This thing *only* has analog output,
+	 * the rates are taken from Info.plist
+	 * from Darwin. */
+	{
+		.formats = SNDRV_PCM_FMTBIT_S16_BE |
+			   SNDRV_PCM_FMTBIT_S24_BE,
+		.rates = SNDRV_PCM_RATE_32000 |
+			 SNDRV_PCM_RATE_44100 |
+			 SNDRV_PCM_RATE_48000 |
+			 SNDRV_PCM_RATE_88200 |
+			 SNDRV_PCM_RATE_96000,
+	},
+	{}
+};
+
+#ifdef CONFIG_PM
+static int toonie_suspend(struct codec_info_item *cii, pm_message_t state)
+{
+	/* can we turn it off somehow? */
+	return 0;
+}
+
+static int toonie_resume(struct codec_info_item *cii)
+{
+	return 0;
+}
+#endif /* CONFIG_PM */
+
+static struct codec_info toonie_codec_info = {
+	.transfers = toonie_transfers,
+	.sysclock_factor = 256,
+	.bus_factor = 64,
+	.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+	.suspend = toonie_suspend,
+	.resume = toonie_resume,
+#endif
+};
+
+static int toonie_init_codec(struct aoa_codec *codec)
+{
+	struct toonie *toonie = codec_to_toonie(codec);
+
+	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) {
+		printk(KERN_ERR PFX "failed to create toonie snd device!\n");
+		return -ENODEV;
+	}
+
+	/* nothing connected? what a joke! */
+	if (toonie->codec.connected != 1)
+		return -ENOTCONN;
+
+	if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev,
+						     aoa_get_card(),
+						     &toonie_codec_info, toonie)) {
+		printk(KERN_ERR PFX "error creating toonie pcm\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static void toonie_exit_codec(struct aoa_codec *codec)
+{
+	struct toonie *toonie = codec_to_toonie(codec);
+
+	if (!toonie->codec.soundbus_dev) {
+		printk(KERN_ERR PFX "toonie_exit_codec called without soundbus_dev!\n");
+		return;
+	}
+	toonie->codec.soundbus_dev->detach_codec(toonie->codec.soundbus_dev, toonie);
+}
+
+static struct toonie *toonie;
+
+static int __init toonie_init(void)
+{
+	toonie = kzalloc(sizeof(struct toonie), GFP_KERNEL);
+
+	if (!toonie)
+		return -ENOMEM;
+
+	strlcpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name));
+	toonie->codec.owner = THIS_MODULE;
+	toonie->codec.init = toonie_init_codec;
+	toonie->codec.exit = toonie_exit_codec;
+                                        
+	if (aoa_codec_register(&toonie->codec)) {
+		kfree(toonie);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static void __exit toonie_exit(void)
+{
+	kfree(toonie);
+}
+
+module_init(toonie_init);
+module_exit(toonie_exit);

--

  parent reply	other threads:[~2006-06-07 13:11 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 13:09 [RFC 00/12] snd-aoa: add snd-aoa Johannes Berg
2006-06-07 13:09 ` [RFC 01/12] snd-powermac: no longer handle anything with a layout-id property Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-26 20:49   ` Andreas Schwab
2006-06-26 20:49     ` Andreas Schwab
2006-06-27 14:29     ` Takashi Iwai
2006-06-27 14:29       ` [Alsa-devel] " Takashi Iwai
2006-06-27 15:32       ` Andreas Schwab
2006-06-27 15:32         ` [Alsa-devel] " Andreas Schwab
2006-06-29 21:03         ` Andreas Schwab
2006-06-29 21:03           ` [Alsa-devel] " Andreas Schwab
2006-06-29 22:26           ` Lee Revell
2006-06-29 22:26             ` [Alsa-devel] " Lee Revell
2006-06-29 23:16             ` Andreas Schwab
2006-06-29 23:16               ` [Alsa-devel] " Andreas Schwab
2006-06-30  9:35               ` Takashi Iwai
2006-06-30  9:35                 ` [Alsa-devel] " Takashi Iwai
2006-07-07  5:38               ` Benjamin Herrenschmidt
2006-07-07  5:38                 ` [Alsa-devel] " Benjamin Herrenschmidt
2006-07-07  8:04                 ` Johannes Berg
2006-07-07  8:04                   ` [Alsa-devel] " Johannes Berg
2006-07-07  8:13                   ` Benjamin Herrenschmidt
2006-07-07  8:13                     ` [Alsa-devel] " Benjamin Herrenschmidt
2006-07-07  8:22                     ` Johannes Berg
2006-07-07  8:22                       ` [Alsa-devel] " Johannes Berg
2006-07-07  8:27                       ` Benjamin Herrenschmidt
2006-07-07  8:27                         ` [Alsa-devel] " Benjamin Herrenschmidt
2006-07-07  8:40                         ` Johannes Berg
2006-07-07  8:40                           ` [Alsa-devel] " Johannes Berg
2006-07-07  9:51                 ` Takashi Iwai
2006-07-07  9:51                   ` [Alsa-devel] " Takashi Iwai
2006-07-07  9:55                   ` Johannes Berg
2006-07-07  9:55                     ` [Alsa-devel] " Johannes Berg
2006-06-27 17:40       ` Johannes Berg
2006-06-27 17:40         ` [Alsa-devel] " Johannes Berg
2006-06-27 17:30     ` Johannes Berg
2006-06-27 17:30       ` Johannes Berg
2006-06-07 13:09 ` [RFC 02/12] snd-aoa: add aoa header files Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 13:09 ` [RFC 03/12] snd-aoa: add aoa core Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 18:13   ` Takashi Iwai
2006-06-07 18:13   ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:10     ` Johannes Berg
2006-06-09 12:10     ` Johannes Berg
2006-06-07 13:09 ` [RFC 04/12] snd-aoa: add soundbus Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 13:09 ` [RFC 05/12] snd-aoa: add i2sbus Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 18:44   ` Takashi Iwai
2006-06-07 18:44   ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:13     ` Johannes Berg
2006-06-09 12:23       ` Takashi Iwai
2006-06-09 12:23         ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:13     ` Johannes Berg
2006-06-07 13:09 ` [RFC 06/12] snd-aoa: add onyx codec Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 13:09 ` [RFC 07/12] snd-aoa: add tas codec Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 15:42   ` Johannes Berg
2006-06-07 15:42     ` Johannes Berg
2006-06-07 13:09 ` Johannes Berg [this message]
2006-06-07 13:09   ` [RFC 08/12] snd-aoa: add toonie codec Johannes Berg
2006-06-07 13:09 ` [RFC 09/12] snd-aoa: add build files for codecs Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 13:09 ` [RFC 10/12] snd-aoa: add layout-id fabric Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 13:09 ` [RFC 11/12] snd-aoa: add Kconfig and Makefile Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 18:50   ` Takashi Iwai
2006-06-07 18:50   ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:10     ` Johannes Berg
2006-06-09 12:10       ` [Alsa-devel] " Johannes Berg
2006-06-07 13:09 ` [RFC 12/12] snd-aoa: wire up aoa in sound/ Johannes Berg
2006-06-07 13:09   ` Johannes Berg
2006-06-07 18:22 ` [Alsa-devel] [RFC 00/12] snd-aoa: add snd-aoa Takashi Iwai
2006-06-09 12:22   ` Johannes Berg
2006-06-09 12:22     ` [Alsa-devel] " Johannes Berg
2006-06-09 12:34     ` Takashi Iwai
2006-06-09 12:34       ` [Alsa-devel] " Takashi Iwai
2006-06-07 18:22 ` 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=20060607130915.761442000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netstar@gatheringofgray.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.