From: Yoichi Yuasa <yuasa@linux-mips.org>
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, yuasa@linux-mips.org
Subject: [PATCH 06/19] ALSA: ymu831: add device interface driver
Date: Wed, 16 Jan 2013 17:32:04 +0900 [thread overview]
Message-ID: <20130116173204.978b7cba3c9b1a99038ac0b7@linux-mips.org> (raw)
In-Reply-To: <20130116172530.857b627ef3303fb6fe43f603@linux-mips.org>
Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
sound/soc/codecs/ymu831/Makefile | 3 +-
sound/soc/codecs/ymu831/mcdevif.c | 100 +++++++++++++++++++++++++++++++++++++
sound/soc/codecs/ymu831/mcdevif.h | 69 +++++++++++++++++++++++++
3 files changed, 171 insertions(+), 1 deletion(-)
create mode 100644 sound/soc/codecs/ymu831/mcdevif.c
create mode 100644 sound/soc/codecs/ymu831/mcdevif.h
diff --git a/sound/soc/codecs/ymu831/Makefile b/sound/soc/codecs/ymu831/Makefile
index b42881e..949640e 100644
--- a/sound/soc/codecs/ymu831/Makefile
+++ b/sound/soc/codecs/ymu831/Makefile
@@ -1,5 +1,6 @@
snd-soc-ymu831-objs := \
mcbdspdrv.o \
- mccdspdrv.o
+ mccdspdrv.o \
+ mcdevif.o
obj-$(CONFIG_SND_SOC_YMU831) += snd-soc-ymu831.o
diff --git a/sound/soc/codecs/ymu831/mcdevif.c b/sound/soc/codecs/ymu831/mcdevif.c
new file mode 100644
index 0000000..6909dc5
--- /dev/null
+++ b/sound/soc/codecs/ymu831/mcdevif.c
@@ -0,0 +1,100 @@
+/****************************************************************************
+ *
+ * Copyright(c) 2012 Yamaha Corporation. All rights reserved.
+ *
+ * Module : mcdevif.c
+ * Description : MC device interface driver
+ * Version : 1.0.0 Dec 13 2012
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ ****************************************************************************/
+/*
+ * changelog:
+ * - change in the Linux coding style
+ * - remove unnecessary comments
+ * - remove unused codes
+ * - mc_packet_*() functions move to mcpacking.c
+ */
+#include <linux/types.h>
+
+#include "mcdefs.h"
+#include "mcdevif.h"
+
+static struct mcdrv_bus_ops *mc_bus_ops;
+
+void mc_bus_register(struct mcdrv_bus_ops *ops)
+{
+ mc_bus_ops = ops;
+}
+
+void mc_read(enum mcdrv_slave_addr slave_addr, u8 addr, u8 *data, u32 size)
+{
+ if (mc_bus_ops && mc_bus_ops->read)
+ mc_bus_ops->read(mc_bus_ops->priv, slave_addr, addr, data,
+ size);
+}
+
+void mc_read_b(u8 addr, u8 *data, u32 size)
+{
+ u8 addr_cmd[2];
+
+ addr_cmd[0] = MCI_B_REG_A << 1;
+ addr_cmd[1] = addr;
+
+ mc_write_digital(addr_cmd, 2);
+ mc_read_digital(MCI_B_REG_D, data, size);
+}
+
+void mc_read_c(u8 addr, u8 *data, u32 size)
+{
+ u8 addr_cmd[2];
+
+ addr_cmd[0] = MCI_C_REG_A << 1;
+ addr_cmd[1] = addr;
+
+ mc_write_digital(addr_cmd, 2);
+ mc_read_digital(MCI_C_REG_D, data, size);
+}
+
+void mc_read_e(u8 addr, u8 *data, u32 size)
+{
+ u8 addr_cmd[2];
+
+ addr_cmd[0] = MCI_E_REG_A << 1;
+ addr_cmd[1] = addr;
+
+ mc_write_digital(addr_cmd, 2);
+ mc_read_digital(MCI_E_REG_D, data, size);
+}
+
+void mc_read_f(u8 addr, u8 *data, u32 size)
+{
+ u8 addr_cmd[2];
+
+ addr_cmd[0] = MCI_F_REG_A << 1;
+ addr_cmd[1] = addr;
+
+ mc_write_digital(addr_cmd, 2);
+ mc_read_digital(MCI_F_REG_D, data, size);
+}
+
+void mc_write(enum mcdrv_slave_addr slave_addr, u8 *data, u32 size)
+{
+ if (mc_bus_ops && mc_bus_ops->write)
+ mc_bus_ops->write(mc_bus_ops->priv, slave_addr, data, size);
+}
diff --git a/sound/soc/codecs/ymu831/mcdevif.h b/sound/soc/codecs/ymu831/mcdevif.h
new file mode 100644
index 0000000..af9f8c8
--- /dev/null
+++ b/sound/soc/codecs/ymu831/mcdevif.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+ *
+ * Copyright(c) 2012 Yamaha Corporation. All rights reserved.
+ *
+ * Module : mcdevif.h
+ * Description : MC device interface driver header
+ * Version : 1.0.0 Dec 13 2012
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ ****************************************************************************/
+/*
+ * changelog:
+ * - change in the Linux coding style
+ * - remove unnecessary comments
+ * - remove unused codes
+ * - mc_packet_*() functions move to mcpacking.h
+ */
+#ifndef _MCDEVIF_H
+#define _MCDEVIF_H
+
+#include <linux/types.h>
+
+enum mcdrv_slave_addr {
+ MCDRV_SLAVE_ADDR_ANALOG,
+ MCDRV_SLAVE_ADDR_DIGITAL,
+};
+
+struct mcdrv_bus_ops {
+ int (*read) (void *bus_priv, enum mcdrv_slave_addr slave_addr,
+ u8 addr, u8 *data, u32 size);
+ int (*write) (void *bus_priv, enum mcdrv_slave_addr slave_addr,
+ u8 *data, u32 size);
+ void *priv;
+};
+
+void mc_bus_register(struct mcdrv_bus_ops *ops);
+void mc_read(enum mcdrv_slave_addr slave_addr, u8 addr, u8 *data, u32 size);
+void mc_read_b(u8 addr, u8 *data, u32 size);
+void mc_read_c(u8 addr, u8 *data, u32 size);
+void mc_read_e(u8 addr, u8 *data, u32 size);
+void mc_read_f(u8 addr, u8 *data, u32 size);
+void mc_write(enum mcdrv_slave_addr slave_addr, u8 *data, u32 size);
+
+#define mc_read_analog(address, data, size) \
+ mc_read(MCDRV_SLAVE_ADDR_ANALOG, (address), (data), (size))
+#define mc_read_digital(address, data, size) \
+ mc_read(MCDRV_SLAVE_ADDR_DIGITAL, (address), (data), (size))
+
+#define mc_write_analog(data, size) \
+ mc_write(MCDRV_SLAVE_ADDR_ANALOG, (data), (size))
+#define mc_write_digital(data, size) \
+ mc_write(MCDRV_SLAVE_ADDR_DIGITAL, (data), (size))
+
+#endif /* _MCDEVIF_H */
--
1.7.9.5
next prev parent reply other threads:[~2013-01-16 8:32 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 8:25 [PATCH 01/19] ALSA: add Yamaha YMU831 codec support Yoichi Yuasa
2013-01-16 8:27 ` [PATCH 02/19] ALSA: ymu831: add device register definitions Yoichi Yuasa
2013-01-16 11:45 ` Takashi Iwai
2013-01-17 5:59 ` Yoichi Yuasa
2013-01-17 6:45 ` Takashi Iwai
2013-01-17 10:33 ` Yoichi Yuasa
2013-01-16 13:18 ` Mark Brown
2013-01-17 6:00 ` Yoichi Yuasa
2013-01-17 6:02 ` Mark Brown
2013-01-17 6:24 ` Yoichi Yuasa
2013-01-16 8:28 ` [PATCH 03/19] ALSA: ymu831: add B-DSP driver Yoichi Yuasa
2013-01-16 11:49 ` Takashi Iwai
2013-01-17 5:58 ` Yoichi Yuasa
2013-01-16 13:22 ` Mark Brown
2013-01-17 5:59 ` Yoichi Yuasa
2013-01-17 6:07 ` Mark Brown
2013-01-16 8:29 ` [PATCH 04/19] ALSA: ymu831: add C-DSP operating system data Yoichi Yuasa
2013-01-16 13:23 ` Mark Brown
2013-01-16 8:31 ` [PATCH 05/19] ALSA: ymu831: add C-DSP driver Yoichi Yuasa
2013-01-16 13:32 ` Mark Brown
2013-01-16 8:32 ` Yoichi Yuasa [this message]
2013-01-16 13:36 ` [PATCH 06/19] ALSA: ymu831: add device interface driver Mark Brown
2013-01-16 8:33 ` [PATCH 07/19] ALSA: ymu831: add base driver Yoichi Yuasa
2013-01-16 13:43 ` Mark Brown
2013-01-16 8:34 ` [PATCH 08/19] ALSA: ymu831: add E-DSP driver Yoichi Yuasa
2013-01-16 8:35 ` [PATCH 09/19] ALSA: ymu831: add F-DSP driver Yoichi Yuasa
2013-01-16 8:36 ` [PATCH 10/19] ALSA: ymu831: add device control packet packing driver Yoichi Yuasa
2013-01-16 8:37 ` [PATCH 11/19] ALSA: ymu831: add data parser Yoichi Yuasa
2013-01-16 8:38 ` [PATCH 12/19] ALSA: ymu831: add resource control driver Yoichi Yuasa
2013-01-16 8:39 ` [PATCH 13/19] ALSA: yum831: add configurations header Yoichi Yuasa
2013-01-16 8:40 ` [PATCH 14/19] ALSA: ymu831: add codec control definitions Yoichi Yuasa
2013-01-16 8:41 ` [PATCH 15/19] ALSA: ymu831: add path configurations header Yoichi Yuasa
2013-01-16 8:42 ` [PATCH 16/19] ALSA: ymu831: add volume map header Yoichi Yuasa
2013-01-16 8:43 ` [PATCH 17/19] ALSA: ymu831: add codec driver Yoichi Yuasa
2013-01-16 14:16 ` Mark Brown
2013-01-16 8:44 ` [PATCH 18/19] ALSA: ymu831: add hwdep ioctl Yoichi Yuasa
2013-01-16 11:53 ` Takashi Iwai
2013-01-16 13:53 ` Mark Brown
2013-01-16 8:46 ` [PATCH 19/19] ALSA: SoC Audio support for OMAP4 boards with Yamaha YMU831 codec Yoichi Yuasa
2013-01-16 13:48 ` Mark Brown
2013-01-16 11:38 ` [PATCH 01/19] ALSA: add Yamaha YMU831 codec support Takashi Iwai
2013-01-16 11:42 ` Mark Brown
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=20130116173204.978b7cba3c9b1a99038ac0b7@linux-mips.org \
--to=yuasa@linux-mips.org \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.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;
as well as URLs for NNTP newsgroup(s).