mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] add AT73C213 DAC support for AT91SAM9261
@ 2008-04-04 22:03 Conke Hu
  2008-04-20 23:01 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: Conke Hu @ 2008-04-04 22:03 UTC (permalink / raw)
  To: linux-kernel, hcegtvedt, rmk

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. */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] add AT73C213 DAC support for AT91SAM9261
  2008-04-04 22:03 [PATCH] add AT73C213 DAC support for AT91SAM9261 Conke Hu
@ 2008-04-20 23:01 ` Russell King
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2008-04-20 23:01 UTC (permalink / raw)
  To: Conke Hu; +Cc: linux-kernel, hcegtvedt

On Sat, Apr 05, 2008 at 06:03:32AM +0800, Conke Hu wrote:
> Many AT91SAM9261-based boards use AT73C213 as external audio DAC, this
> patch makes it work.

Please send AT91 patches to Andrew Victor.

> 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

This isn't an executable.

> diff --git a/arch/arm/mach-at91/board-sam9261ek.c
> b/arch/arm/mach-at91/board-sam9261ek.c
> old mode 100644
> new mode 100755

Neither is this.  Please don't change their modes.  The same goes
for the other two files that show up as this.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-20 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-04 22:03 [PATCH] add AT73C213 DAC support for AT91SAM9261 Conke Hu
2008-04-20 23:01 ` Russell King

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