lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 5 Apr 2008 06:03:32 +0800
From:	"Conke Hu" <conke.hu@...il.com>
To:	linux-kernel@...r.kernel.org, hcegtvedt@...el.com,
	rmk@....linux.org.uk
Subject: [PATCH] add AT73C213 DAC support for AT91SAM9261

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

Signed-off-by: Conke Hu <conke.hu@...il.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. */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists