mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Conke Hu" <conke.hu@gmail.com>
To: linux-kernel@vger.kernel.org, hcegtvedt@atmel.com, rmk@arm.linux.org.uk
Subject: [PATCH] add AT73C213 DAC support for AT91SAM9261
Date: Sat, 5 Apr 2008 06:03:32 +0800	[thread overview]
Message-ID: <5767b9100804041503o7395ff34nd13002c111e11c8a@mail.gmail.com> (raw)

Many AT91SAM9261-based boards use AT73C213 as external audio DAC, this
patch makes it work.

Signed-off-by: Conke Hu <conke.hu@gmail.com>
---------------------------------------
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c
b/arch/arm/mach-at91/at91sam9261_devices.c
old mode 100644
new mode 100755
diff --git a/arch/arm/mach-at91/board-sam9261ek.c
b/arch/arm/mach-at91/board-sam9261ek.c
old mode 100644
new mode 100755
index 0ce38df..a739cfe
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -30,6 +30,8 @@
 #include <linux/fb.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
+#include <linux/clk.h>
+#include <linux/spi/at73c213.h>

 #include <video/atmel_lcdc.h>

@@ -239,6 +241,45 @@ static void __init ek_add_device_ts(void) {}
 #endif

 /*
+ * AT73C213 Audio
+ */
+#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
+static struct at73c213_board_info at73c213_info = {
+	.ssc_id    = 1,
+	.shortname = "at72c213",
+};
+
+static void __init at91_setup_at73c213(void)
+{
+	struct clk *mclk;
+	struct clk *plla;
+
+	mclk = clk_get(NULL, "pck2");
+	if (IS_ERR(mclk))
+		goto err_mclk;
+
+	plla = clk_get(NULL, "plla");
+	if (IS_ERR(plla))
+		goto err_plla;
+
+	if (clk_set_parent(mclk, plla))
+		goto err_clk;
+
+	at91_set_B_periph(AT91_PIN_PB31, 0);
+	at73c213_info.dac_clk = mclk;
+
+err_clk:
+	clk_put(plla);
+err_plla:
+	clk_put(mclk);
+err_mclk:
+	return;
+}
+#else
+static void __init at91_setup_at73c213(void) {}
+#endif
+
+/*
  * SPI devices
  */
 static struct spi_board_info ek_spi_devices[] = {
@@ -271,6 +312,8 @@ static struct spi_board_info ek_spi_devices[] = {
 		.chip_select	= 3,
 		.max_speed_hz	= 10 * 1000 * 1000,
 		.bus_num	= 0,
+		.platform_data = &at73c213_info,
+		.controller_data = (void*)AT91_PIN_PA29,
 	},
 #endif
 };
@@ -477,6 +520,8 @@ static void __init ek_board_init(void)

 	/* spi0 and mmc/sd share the same PIO pins */
 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
+	/* Audio */
+	at91_setup_at73c213();
 	/* SPI */
 	at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
 	/* Touchscreen */
@@ -489,6 +534,10 @@ static void __init ek_board_init(void)
 	at91_add_device_lcdc(&ek_lcdc_data);
 	/* Push Buttons */
 	ek_add_device_buttons();
+	/* SSC */
+#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
+	at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
+#endif
 }

 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
diff --git a/sound/core/control.c b/sound/core/control.c
old mode 100644
new mode 100755
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
old mode 100644
new mode 100755
index 89d6e9c..b8e43fe
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -114,7 +114,11 @@ snd_at73c213_write_reg(struct snd_at73c213 *chip,
u8 reg, u8 val)
 static struct snd_pcm_hardware snd_at73c213_playback_hw = {
 	.info		= SNDRV_PCM_INFO_INTERLEAVED |
 			  SNDRV_PCM_INFO_BLOCK_TRANSFER,
+#ifdef __BIG_ENDIAN
 	.formats	= SNDRV_PCM_FMTBIT_S16_BE,
+#else
+	.formats	= SNDRV_PCM_FMTBIT_S16_LE,
+#endif
 	.rates		= SNDRV_PCM_RATE_CONTINUOUS,
 	.rate_min	= 8000,  /* Replaced by chip->bitrate later. */
 	.rate_max	= 50000, /* Replaced by chip->bitrate later. */

             reply	other threads:[~2008-04-04 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04 22:03 Conke Hu [this message]
2008-04-20 23:01 ` Russell King

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=5767b9100804041503o7395ff34nd13002c111e11c8a@mail.gmail.com \
    --to=conke.hu@gmail.com \
    --cc=hcegtvedt@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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

Powered by JetHome