[linux-sunxi] [PATCH] Add MK808C

2014-03-26 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a20/mk808c.fex | 1013 +
 1 file changed, 1013 insertions(+)
 create mode 100644 sys_config/a20/mk808c.fex

diff --git a/sys_config/a20/mk808c.fex b/sys_config/a20/mk808c.fex
new file mode 100644
index 000..8485a4a
--- /dev/null
+++ b/sys_config/a20/mk808c.fex
@@ -0,0 +1,1013 @@
+[product]
+version = 100
+machine = sugar-dongel_au8723
+
+[platform]
+eraseflag = 1
+
+[target]
+boot_clock = 912
+dcdc2_vol = 1400
+dcdc3_vol = 1250
+ldo2_vol = 3000
+ldo3_vol = 2800
+ldo4_vol = 2800
+power_start = 0
+storage_type = -1
+usb_recovery = 1
+
+[clock]
+pll3 = 297
+pll4 = 300
+pll6 = 600
+pll7 = 297
+pll8 = 336
+
+[card_boot]
+logical_start = 40960
+sprite_gpio0 = port:PH201defaultdefault0
+sprite_work_delay = 500
+sprite_err_delay = 200
+
+[card0_boot_para]
+card_ctrl = 0
+card_high_speed = 1
+card_line = 4
+sdc_d1 = port:PF0021defaultdefault
+sdc_d0 = port:PF0121defaultdefault
+sdc_clk = port:PF0221defaultdefault
+sdc_cmd = port:PF0321defaultdefault
+sdc_d3 = port:PF0421defaultdefault
+sdc_d2 = port:PF0521defaultdefault
+
+[card2_boot_para]
+card_ctrl = 2
+card_high_speed = 1
+card_line = 4
+sdc_cmd = port:PC0631defaultdefault
+sdc_clk = port:PC0731defaultdefault
+sdc_d0 = port:PC0831defaultdefault
+sdc_d1 = port:PC0931defaultdefault
+sdc_d2 = port:PC1031defaultdefault
+sdc_d3 = port:PC1131defaultdefault
+
+[twi_para]
+twi_port = 0
+twi_scl = port:PB002defaultdefaultdefault
+twi_sda = port:PB012defaultdefaultdefault
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx = port:PB2221defaultdefault
+uart_debug_rx = port:PB2321defaultdefault
+
+[uart_force_debug]
+uart_debug_port = 0
+uart_debug_tx = port:PF0241defaultdefault
+uart_debug_rx = port:PF0441defaultdefault
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PB143defaultdefaultdefault
+jtag_ck = port:PB153defaultdefaultdefault
+jtag_do = port:PB163defaultdefaultdefault
+jtag_di = port:PB173defaultdefaultdefault
+
+[pm_para]
+standby_mode = 0
+usbhid_wakeup_enable = 1
+
+[dram_para]
+dram_baseaddr = 0x4000
+dram_clk = 384
+dram_type = 3
+dram_rank_num = -1
+dram_chip_density = -1
+dram_io_width = -1
+dram_bus_width = -1
+dram_cas = 9
+dram_zq = 0x7f
+dram_odt_en = 0
+dram_size = -1
+dram_tpr0 = 0x42d899b7
+dram_tpr1 = 0xa090
+dram_tpr2 = 0x22a00
+dram_tpr3 = 0x0
+dram_tpr4 = 0x0
+dram_tpr5 = 0x0
+dram_emr1 = 0x4
+dram_emr2 = 0x10
+dram_emr3 = 0x0
+
+[mali_para]
+mali_used = 1
+mali_clkdiv = 1
+
+[emac_para]
+emac_used = 0
+emac_rxd3 = port:PA002defaultdefaultdefault
+emac_rxd2 = port:PA012defaultdefaultdefault
+emac_rxd1 = port:PA022defaultdefaultdefault
+emac_rxd0 = port:PA032defaultdefaultdefault
+emac_txd3 = port:PA042defaultdefaultdefault
+emac_txd2 = port:PA052defaultdefaultdefault
+emac_txd1 = port:PA062defaultdefaultdefault
+emac_txd0 = port:PA072defaultdefaultdefault
+emac_rxclk = port:PA082defaultdefaultdefault
+emac_rxerr = port:PA092defaultdefaultdefault
+emac_rxdV = port:PA102defaultdefaultdefault
+emac_mdc = port:PA112defaultdefaultdefault
+emac_mdio = port:PA122defaultdefaultdefault
+emac_txen = port:PA132defaultdefaultdefault
+emac_txclk = port:PA142defaultdefaultdefault
+emac_crs = port:PA152defaultdefaultdefault
+emac_col = port:PA162defaultdefaultdefault
+emac_reset = port:PA171defaultdefaultdefault
+emac_power =
+
+[twi0_para]
+twi0_used = 1
+twi0_scl = port:PB002defaultdefaultdefault
+twi0_sda = port:PB012defaultdefaultdefault
+
+[twi1_para]
+twi1_used = 1
+twi1_scl = port:PB182defaultdefaultdefault
+twi1_sda = port:PB192defaultdefaultdefault
+
+[twi2_para]
+twi2_used = 1
+twi2_scl = port:PB202defaultdefaultdefault
+twi2_sda = port:PB212defaultdefaultdefault
+
+[twi3_para]
+twi3_used = 1
+twi3_scl = port:PI003defaultdefaultdefault
+twi3_sda = port:PI013defaultdefaultdefault
+
+[twi4_para]
+twi4_used = 1
+twi4_scl = port:PI023defaultdefaultdefault
+twi4_sda = port:PI033defaultdefaultdefault
+
+[uart_para0]
+uart_used = 1
+uart_port = 0
+uart_type = 2
+uart_tx = port:PB2221defaultdefault
+uart_rx = port:PB2321defaultdefault
+
+[uart_para1]
+uart_used = 0
+uart_port = 1
+uart_type = 8
+uart_tx = port:PA1041defaultdefault
+uart_rx = port:PA1141defaultdefault
+uart_rts = port:PA1241defaultdefault
+uart_cts = port:PA1341defaultdefault
+uart_dtr = port:PA1441defaultdefault
+uart_dsr = port:PA1541defaultdefault
+uart_dcd = port:PA1641defaultdefault
+uart_ring = port:PA1741defaultdefault
+
+[uart_para2]
+uart_used = 1
+uart_port = 2
+uart_type = 4
+uart_tx = port:PI1831defaultdefault
+uart_rx = port:PI1931defaultdefault
+uart_rts = port:PI1631defaultdefault
+uart_cts = port:PI1731defaultdefault
+
+[uart_para3]
+uart_used = 0
+uart_port = 3
+uart_type = 4
+uart_tx = port:PH0041defaultdefault
+uart_rx = port:PH0141defaultdefault
+uart_rts = port:PH0241defaultdefault
+uart_cts = port:PH0341defaultdefault
+
+[uart_para4]
+uart_used = 0
+uart_port = 4
+uart_type = 2
+uart_tx = port:PH0441defaultdefault

[linux-sunxi] [PATCH 3/6] sunxi: hmdi: remove what looks like I2S leftovers

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c |   4 +-
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c   | 197 +---
 2 files changed, 5 insertions(+), 196 deletions(-)

diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
index ced8f47..c3b4beb 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
@@ -480,7 +480,7 @@ static int sunxi_hdmiaudio_resume(struct snd_soc_dai 
*cpu_dai)
return 0;
 }
 
-#define SUNXI_I2S_RATES (SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT)
+#define SUNXI_HDMI_RATES (SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT)
 static struct snd_soc_dai_ops sunxi_hdmiaudio_dai_ops = {
.trigger= sunxi_hdmiaudio_trigger,
.hw_params  = sunxi_hdmiaudio_hw_params,
@@ -496,7 +496,7 @@ static struct snd_soc_dai_driver sunxi_hdmiaudio_dai = {
.playback = {
.channels_min = 1,
.channels_max = 2,
-   .rates = SUNXI_I2S_RATES,
+   .rates = SUNXI_HDMI_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE
},
.symmetric_rates = 1,
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
index 2d29ad9..ee62f3c 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
@@ -26,169 +26,6 @@
 
 #include sunxi-hdmiaudio.h
 
-static struct clk *xtal;
-
-static int clk_users;
-static DEFINE_MUTEX(clk_lock);
-
-#ifdef ENFORCE_RATES
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
-   .count  = ARRAY_SIZE(rates),
-   .list   = rates,
-   .mask   = 0,
-};
-#endif
-
-static int sunxi_sndhdmi_startup(struct snd_pcm_substream *substream)
-{
-   int ret = 0;
-   #ifdef ENFORCE_RATES
-   struct snd_pcm_runtime *runtime = substream-runtime;;
-   #endif
-   mutex_lock(clk_lock);
-   mutex_unlock(clk_lock);
-   if (!ret) {
-   #ifdef ENFORCE_RATES
-   ret = snd_pcm_hw_constraint_list(runtime, 0,
-SNDRV_PCM_HW_PARAM_RATE,
-hw_constraints_rates);
-   if (ret  0)
-
-   #endif
-   }
-   return ret;
-}
-
-static void sunxi_sndhdmi_shutdown(struct snd_pcm_substream *substream)
-{
-   mutex_lock(clk_lock);
-   clk_users -= 1;
-   if (clk_users == 0) {
-   clk_put(xtal);
-   xtal = NULL;
-   }
-   mutex_unlock(clk_lock);
-}
-
-typedef struct __MCLK_SET_INF
-{
-__u32   samp_rate;  // sample rate
-__u16   mult_fs;// multiply of smaple rate
-
-__u8clk_div;// mpll division
-__u8mpll;   // select mpll, 0 - 24.576 Mhz, 1 - 22.5792 Mhz
-
-} __mclk_set_inf;
-
-typedef struct __BCLK_SET_INF
-{
-__u8bitpersamp; // bits per sample
-__u8clk_div;// clock division
-__u16   mult_fs;// multiplay of sample rate
-
-} __bclk_set_inf;
-
-//bclk divider table
-static __bclk_set_inf BCLK_INF[] =
-{
-// 16bits per sample
-{16,  4, 128}, {16,  6, 192}, {16,  8, 256},
-{16, 12, 384}, {16, 16, 512},
-
-//24 bits per sample
-{24,  4, 192}, {24,  8, 384}, {24, 16, 768},
-
-//32 bits per sample
-{32,  2, 128}, {32,  4, 256}, {32,  6, 384},
-{32,  8, 512}, {32, 12, 768},
-
-//end flag
-{0xff, 0, 0},
-};
-
-//mclk divider table
-static __mclk_set_inf  MCLK_INF[] =
-{
-// 8k bitrate
-{  8000, 128, 24, 0}, {  8000, 192, 16, 0}, {  8000, 256, 12, 0},
-{  8000, 384,  8, 0}, {  8000, 512,  6, 0}, {  8000, 768,  4, 0},
-
-// 16k bitrate
-{ 16000, 128, 12, 0}, { 16000, 192,  8, 0}, { 16000, 256,  6, 0},
-{ 16000, 384,  4, 0}, { 16000, 768,  2, 0},
-
-// 32k bitrate
-{ 32000, 128,  6, 0}, { 32000, 192,  4, 0}, { 32000, 384,  2, 0},
-{ 32000, 768,  1, 0},
-
-// 64k bitrate
-{ 64000, 192,  2, 0}, { 64000, 384,  1, 0},
-
-//128k bitrate
-{128000, 192,  1, 0},
-
-// 12k bitrate
-{ 12000, 128, 16, 0}, { 12000, 256, 8, 0}, { 12000, 512, 4, 0},
-
-// 24k bitrate
-{ 24000, 128,  8, 0}, { 24000, 256, 4, 0}, { 24000, 512, 2, 0},
-
-// 48K bitrate
-{ 48000, 128,  4, 0}, { 48000, 256,  2, 0}, { 48000, 512, 1, 0},
-
-// 96k bitrate
-{ 96000, 128 , 2, 0}, { 96000, 256,  1, 0},
-
-//192k bitrate
-{192000, 128,  1, 0},
-
-//11.025k bitrate
-{ 11025, 128, 16, 1}, { 11205, 256,  8, 1}, { 11205, 512,  4, 1},
-
-//22.05k bitrate
-{ 22050, 128,  8, 1}, { 22050, 256,  4, 1},
-{ 22050, 512,  2, 1},
-
-//44.1k bitrate
-{ 44100, 128,  4, 1}, { 44100, 256,  2, 1}, { 44100, 512,  1, 1},
-
-//88.2k bitrate
-{ 88200, 128, 

[linux-sunxi] [PATCH 4/6] sunxi: hdmi: strip out more unneeded code

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The HDMI driver has been copied from the I2S driver
and very little effort has been made to remove the
unneeded parts. Therefore the registers that are
used by the I2S hardware block are simply renamed
and they serve no purpose in providing a functioning
driver.
This patch removes the main header file and all of the
register accesses that are referenced.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c | 430 ++--
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.h | 303 
 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c   |   1 -
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c   |   2 -
 4 files changed, 18 insertions(+), 718 deletions(-)
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.h

diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
index c3b4beb..9951b63 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
@@ -34,11 +34,6 @@
 #include plat/sys_config.h
 #include plat/dma_compat.h
 
-#include sunxi-hdmiaudio.h
-
-//save the register value
-static int regsave[8];
-
 static struct sunxi_dma_params sunxi_hdmiaudio_pcm_stereo_out = {
.client.name=   HDMIAUDIO PCM Stereo out,
 #if defined CONFIG_ARCH_SUN4I || defined CONFIG_ARCH_SUN5I
@@ -47,219 +42,13 @@ static struct sunxi_dma_params 
sunxi_hdmiaudio_pcm_stereo_out = {
.dma_addr   =   0,
 };
 
-struct sunxi_hdmiaudio_info sunxi_hdmiaudio;
-
-//clock handle
-static struct clk *hdmiaudio_apbclk;
-static struct clk *hdmiaudio_pll2clk;
-static struct clk *hdmiaudio_pllx8;
-static struct clk *hdmiaudio_moduleclk;
-
 void sunxi_snd_txctrl_hdmiaudio(struct snd_pcm_substream *substream, int on)
 {
-   u32 reg_val;
-
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_TXCHSEL);
-   reg_val = ~0x7;
-   reg_val |= SUNXI_TXCHSEL_CHNUM(substream-runtime-channels);
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_TXCHSEL);
-
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_TXCHMAP);
-   reg_val = 0;
-   if(substream-runtime-channels == 1) {
-   reg_val = 0x76543200;
-   } else {
-   reg_val = 0x76543210;
-   }
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_TXCHMAP);
-
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val = ~SUNXI_HDMIAUDIOCTL_SDO3EN;
-   reg_val = ~SUNXI_HDMIAUDIOCTL_SDO2EN;
-   reg_val = ~SUNXI_HDMIAUDIOCTL_SDO1EN;
-   reg_val = ~SUNXI_HDMIAUDIOCTL_SDO0EN;
-   switch(substream-runtime-channels) {
-   case 1:
-   case 2:
-   reg_val |= SUNXI_HDMIAUDIOCTL_SDO0EN; break;
-   case 3:
-   case 4:
-   reg_val |= SUNXI_HDMIAUDIOCTL_SDO0EN | 
SUNXI_HDMIAUDIOCTL_SDO1EN; break;
-   case 5:
-   case 6:
-   reg_val |= SUNXI_HDMIAUDIOCTL_SDO0EN | 
SUNXI_HDMIAUDIOCTL_SDO1EN | SUNXI_HDMIAUDIOCTL_SDO2EN; break;
-   case 7:
-   case 8:
-   reg_val |= SUNXI_HDMIAUDIOCTL_SDO0EN | 
SUNXI_HDMIAUDIOCTL_SDO1EN | SUNXI_HDMIAUDIOCTL_SDO2EN | 
SUNXI_HDMIAUDIOCTL_SDO3EN; break;
-   default:
-   reg_val |= SUNXI_HDMIAUDIOCTL_SDO0EN; break;
-   }
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-
-   //flush TX FIFO
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOFCTL);
-   reg_val |= SUNXI_HDMIAUDIOFCTL_FTX;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOFCTL);
-
-   //clear TX counter
-   writel(0, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOTXCNT);
-
-   if (on) {
-   /* hdmiaudio TX ENABLE */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val |= SUNXI_HDMIAUDIOCTL_TXEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-
-   /* enable DMA DRQ mode for play */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-   reg_val |= SUNXI_HDMIAUDIOINT_TXDRQEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-
-   //Global Enable Digital Audio Interface
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val |= SUNXI_HDMIAUDIOCTL_GEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   }else{
-   /* HDMIAUDIO TX DISABLE */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val = ~SUNXI_HDMIAUDIOCTL_TXEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-
-   /* DISBALE dma DRQ mode */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-   reg_val = 

[linux-sunxi] [PATCH 1/6] sunxi: hdmi: Removal of unneeded headers

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

There is a lot of code in the HDMI driver that does
nothing. This patch removes all the headers which
are deemed unnecessary.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/hdmiaudio/sndhdmi.c |  3 +--
 sound/soc/sunxi/hdmiaudio/sndhdmi.h | 36 -
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c |  1 -
 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c   |  1 -
 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h   | 25 
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c   |  3 ---
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.h   | 26 -
 7 files changed, 1 insertion(+), 94 deletions(-)
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sndhdmi.h
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.h

diff --git a/sound/soc/sunxi/hdmiaudio/sndhdmi.c 
b/sound/soc/sunxi/hdmiaudio/sndhdmi.c
index f291c4b..87080bd 100644
--- a/sound/soc/sunxi/hdmiaudio/sndhdmi.c
+++ b/sound/soc/sunxi/hdmiaudio/sndhdmi.c
@@ -22,8 +22,7 @@
 #include sound/initval.h
 #include plat/sys_config.h
 #include linux/io.h
-
-#include sndhdmi.h
+#include linux/drv_hdmi.h
 
 struct sndhdmi_priv {
int sysclk;
diff --git a/sound/soc/sunxi/hdmiaudio/sndhdmi.h 
b/sound/soc/sunxi/hdmiaudio/sndhdmi.h
deleted file mode 100644
index 346e587..000
--- a/sound/soc/sunxi/hdmiaudio/sndhdmi.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * sound\soc\sunxi\hdmiaudio\sndhdmi.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-#ifndef SNDHDMI_H
-#define SNDHDMI_H
-#include linux/drv_hdmi.h
-
-struct sndhdmi_platform_data {
-   void (*power) (int);
-   int model;
-   /*
- ALSA SOC usually puts the device in standby mode when it's not used
- for sometime. If you unset is_powered_on_standby the driver will
- turn off the ADC/DAC when this callback is invoked and turn it back
- on when needed. Unfortunately this will result in a very light bump
- (it can be audible only with good earphones). If this bothers you
- set is_powered_on_standby, you will have slightly higher power
- consumption. Please note that sending the L3 command for ADC is
- enough to make the bump, so it doesn't make difference if you
- completely take off power from the codec.
-   */
-   int is_powered_on_standby;
-};
-
-#endif
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
index 5080f10..a678fb9 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
@@ -34,7 +34,6 @@
 #include plat/sys_config.h
 #include plat/dma_compat.h
 
-#include sunxi-hdmipcm.h
 #include sunxi-hdmiaudio.h
 
 //save the register value
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c
index 08221d2..d8e3298 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c
@@ -30,7 +30,6 @@
 #include plat/dma_compat.h
 
 #include sunxi-hdmiaudio.h
-#include sunxi-hdmipcm.h
 
 static volatile unsigned int dmasrc = 0;
 static volatile unsigned int dmadst = 0;
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h
deleted file mode 100644
index 0649177..000
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * sound\soc\sunxi\hdmiaudio\sunxi-hdmipcm.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-
-#ifndef SUNXI_HDMIPCM_H_
-#define SUNXI_HDMIPCM_H_
-
-enum sunxi_dma_buffresult {
-   SUNXI_RES_OK,
-   SUNXI_RES_ERR,
-   SUNXI_RES_ABORT
-};
-
-#endif //SUNXI_HDMIPCM_H_
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
index c89f760..2d29ad9 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c
@@ -25,9 +25,6 @@
 #include linux/io.h
 
 #include sunxi-hdmiaudio.h
-#include sunxi-hdmipcm.h
-
-#include sndhdmi.h
 
 static struct clk *xtal;
 
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.h 

[linux-sunxi] [PATCH 2/6] sunxi: hdmi: remove HDMI capture

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The A23 SDK does not mention HDMI capture and
this seems to be left over from when this driver
was copied from the I2S driver. Remove from
codebase.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c | 101 +---
 1 file changed, 18 insertions(+), 83 deletions(-)

diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
index a678fb9..ced8f47 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
@@ -47,14 +47,6 @@ static struct sunxi_dma_params 
sunxi_hdmiaudio_pcm_stereo_out = {
.dma_addr   =   0,
 };
 
-static struct sunxi_dma_params sunxi_hdmiaudio_pcm_stereo_in = {
-   .client.name=   HDMIAUDIO PCM Stereo in,
-#if defined CONFIG_ARCH_SUN4I || defined CONFIG_ARCH_SUN5I
-   .channel=   DMACH_HDMIAUDIO,
-#endif
-   .dma_addr   =   SUNXI_HDMIAUDIOBASE + SUNXI_HDMIAUDIORXFIFO,
-};
-
 struct sunxi_hdmiaudio_info sunxi_hdmiaudio;
 
 //clock handle
@@ -145,52 +137,8 @@ void sunxi_snd_txctrl_hdmiaudio(struct snd_pcm_substream 
*substream, int on)
}
 }
 
-void sunxi_snd_rxctrl_hdmiaudio(struct snd_pcm_substream *substream, int on)
-{
-   u32 reg_val;
-
-   //flush RX FIFO
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOFCTL);
-   reg_val |= SUNXI_HDMIAUDIOFCTL_FRX;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOFCTL);
-
-   //clear RX counter
-   writel(0, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIORXCNT);
-
-   if (on) {
-   /* HDMIAUDIO RX ENABLE */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val |= SUNXI_HDMIAUDIOCTL_RXEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-
-   /* enable DMA DRQ mode for record */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-   reg_val |= SUNXI_HDMIAUDIOINT_RXDRQEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-
-   //Global Enable Digital Audio Interface
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val |= SUNXI_HDMIAUDIOCTL_GEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   } else {
-   /* HDMIAUDIO RX DISABLE */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val = ~SUNXI_HDMIAUDIOCTL_RXEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-
-   /* DISBALE dma DRQ mode */
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-   reg_val = ~SUNXI_HDMIAUDIOINT_RXDRQEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOINT);
-
-   //Global disable Digital Audio Interface
-   reg_val = readl(sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   reg_val = ~SUNXI_HDMIAUDIOCTL_GEN;
-   writel(reg_val, sunxi_hdmiaudio.regs + SUNXI_HDMIAUDIOCTL);
-   }
-}
-
-static int sunxi_hdmiaudio_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int 
fmt)
+static int sunxi_hdmiaudio_set_fmt(struct snd_soc_dai *cpu_dai,
+   unsigned int fmt)
 {
u32 reg_val;
u32 reg_val1;
@@ -326,7 +274,8 @@ static int sunxi_hdmiaudio_hw_params(struct 
snd_pcm_substream *substream,
if(substream-stream == SNDRV_PCM_STREAM_PLAYBACK)
dma_data = sunxi_hdmiaudio_pcm_stereo_out;
else
-   dma_data = sunxi_hdmiaudio_pcm_stereo_in;
+   printk(error:hdmiaudio can't support capture:%s,line:%d\n,
+   __func__, __LINE__);
 
snd_soc_dai_set_dma_data(rtd-cpu_dai, substream, dma_data);
 
@@ -345,28 +294,20 @@ static int sunxi_hdmiaudio_trigger(struct 
snd_pcm_substream *substream,
return 0; /* No rx / tx control, etc. on sun7i() */
 
switch (cmd) {
-   case SNDRV_PCM_TRIGGER_START:
-   case SNDRV_PCM_TRIGGER_RESUME:
-   case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-   if (substream-stream == SNDRV_PCM_STREAM_CAPTURE) {
-   sunxi_snd_rxctrl_hdmiaudio(substream, 1);
-   } else {
-   sunxi_snd_txctrl_hdmiaudio(substream, 1);
-   }
-   sunxi_dma_started(dma_data);
-   break;
-   case SNDRV_PCM_TRIGGER_STOP:
-   case SNDRV_PCM_TRIGGER_SUSPEND:
-   case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-   if (substream-stream == SNDRV_PCM_STREAM_CAPTURE) {
-   sunxi_snd_rxctrl_hdmiaudio(substream, 0);
- 

[linux-sunxi] [PATCH 6/6] sunxi: hdmi: added parameter checks

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The A23 SDK has additional parameter checks to ensure that
null pointers are not being used.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/hdmiaudio/sndhdmi.c |  4 
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c | 10 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/hdmiaudio/sndhdmi.c 
b/sound/soc/sunxi/hdmiaudio/sndhdmi.c
index 90cbe87..1c306d2 100644
--- a/sound/soc/sunxi/hdmiaudio/sndhdmi.c
+++ b/sound/soc/sunxi/hdmiaudio/sndhdmi.c
@@ -68,6 +68,10 @@ static int sndhdmi_hw_params(struct snd_pcm_substream 
*substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
 {
+   if ((!substream) || (!params)) {
+   printk(error:%s,line:%d\n, __func__, __LINE__);
+   return -EAGAIN;
+   }
hdmi_para.sample_rate = params_rate(params);
hdmi_para.channel_num = params_channels(params);
switch (params_format(params)) {
diff --git a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c 
b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
index 4fc296d..12da1a6 100644
--- a/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
+++ b/sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c
@@ -56,10 +56,16 @@ static int sunxi_hdmiaudio_hw_params(struct 
snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
 {
-   struct snd_soc_pcm_runtime *rtd = substream-private_data;
+   struct snd_soc_pcm_runtime *rtd;
struct sunxi_dma_params *dma_data;
 
-   /* play or record */
+   if (!substream) {
+   printk(error:%s,line:%d\n, __func__, __LINE__);
+   return -EAGAIN;
+   }
+
+   rtd = substream-private_data;
+
if (substream-stream == SNDRV_PCM_STREAM_PLAYBACK)
dma_data = sunxi_hdmiaudio_pcm_stereo_out;
else
-- 
1.8.3.2

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 0/6] HDMI Driver Cleanup

2014-04-23 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Hi,

There is a lot of code in the HDMI driver that does
nothing. These patches removes all the unnecessary
code, provides a clean up and some parameter checks
which came from the comparing the drivers released
under the A23 SDK.

I have tested this on my A10 and A20 devices and
everything seems to work as it did before the patches
were applied.

Thanks,
Marcus

Marcus Cooper (6):
  sunxi: hdmi: Removal of unneeded headers
  sunxi: hdmi: remove HDMI capture
  sunxi: hmdi: remove what looks like I2S leftovers
  sunxi: hdmi: strip out more unneeded code
  sunxi: hdmi: audio tidy up
  sunxi: hdmi: added parameter checks

 sound/soc/sunxi/hdmiaudio/sndhdmi.c |  78 ++--
 sound/soc/sunxi/hdmiaudio/sndhdmi.h |  36 --
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.c | 603 
 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.h | 303 --
 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.c   | 141 ---
 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h   |  25 --
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.c   | 232 +--
 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.h   |  26 --
 8 files changed, 217 insertions(+), 1227 deletions(-)
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sndhdmi.h
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-hdmiaudio.h
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-hdmipcm.h
 delete mode 100644 sound/soc/sunxi/hdmiaudio/sunxi-sndhdmi.h

-- 
1.8.3.2

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 00/10] SPDIF Driver Cleanup

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This patch series removes all the unnecessary code,
provides a clean up and some parameter checks which
came from the comparing the drivers released
under the A23 SDK(However the A23 does not contain
the SPDIF block so it can only be assumed that this
comes from the A31 release).

I have tested this on my A10 device with PCM and RAW
data.

Thanks,
Marcus

Marcus Cooper (10):
  sunxi: spdif: Removal of unneeded headers
  sunxi: spdif: removed ccm from code
  sunxi: spdif: remove unused function
  sunxi: spdif: fix comment styling
  sunxi: spdif: Tidy up
  sunxi: spdif: reorganise for better backporting
  sunxi: spdif: left ident of probe
  sunxi: spdif: add clock checks
  sunxi: spdif: add stream format feature
  sunxi: spdif: remove magic numbers

 sound/soc/sunxi/spdif/sndspdif.c   |  26 +-
 sound/soc/sunxi/spdif/sndspdif.h   |  19 -
 sound/soc/sunxi/spdif/sunxi_sndspdif.c | 190 +-
 sound/soc/sunxi/spdif/sunxi_sndspdif.h |  18 -
 sound/soc/sunxi/spdif/sunxi_spdif.c| 621 ++---
 sound/soc/sunxi/spdif/sunxi_spdif.h| 178 --
 sound/soc/sunxi/spdif/sunxi_spdma.c| 128 +++
 sound/soc/sunxi/spdif/sunxi_spdma.h|  29 --
 8 files changed, 585 insertions(+), 624 deletions(-)
 delete mode 100644 sound/soc/sunxi/spdif/sndspdif.h
 delete mode 100644 sound/soc/sunxi/spdif/sunxi_sndspdif.h
 delete mode 100644 sound/soc/sunxi/spdif/sunxi_spdma.h

-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 01/10] sunxi: spdif: Removal of unneeded headers

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

There is a lot of code in the SPDIF driver that does
nothing. This patch removes all the headers which
are deemed unnecessary.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sndspdif.c   |  2 --
 sound/soc/sunxi/spdif/sndspdif.h   | 19 ---
 sound/soc/sunxi/spdif/sunxi_sndspdif.c |  3 ---
 sound/soc/sunxi/spdif/sunxi_sndspdif.h | 18 --
 sound/soc/sunxi/spdif/sunxi_spdif.c|  1 -
 sound/soc/sunxi/spdif/sunxi_spdma.c|  1 -
 sound/soc/sunxi/spdif/sunxi_spdma.h| 29 -
 7 files changed, 73 deletions(-)
 delete mode 100644 sound/soc/sunxi/spdif/sndspdif.h
 delete mode 100644 sound/soc/sunxi/spdif/sunxi_sndspdif.h
 delete mode 100644 sound/soc/sunxi/spdif/sunxi_spdma.h

diff --git a/sound/soc/sunxi/spdif/sndspdif.c b/sound/soc/sunxi/spdif/sndspdif.c
index 73e4a95..c41a06b 100644
--- a/sound/soc/sunxi/spdif/sndspdif.c
+++ b/sound/soc/sunxi/spdif/sndspdif.c
@@ -23,8 +23,6 @@
 #include plat/sys_config.h
 #include linux/io.h
 
-#include sndspdif.h
-
 #define SNDSPDIF_RATES  (SNDRV_PCM_RATE_8000_192000|SNDRV_PCM_RATE_KNOT)
 #define SNDSPDIF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
 
diff --git a/sound/soc/sunxi/spdif/sndspdif.h b/sound/soc/sunxi/spdif/sndspdif.h
deleted file mode 100644
index c47214b..000
--- a/sound/soc/sunxi/spdif/sndspdif.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * sound\soc\sunxi\spdif\sndspdif.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-
-#ifndef _SNDSPDIF_H
-#define _SNDSPDIF_H
-
-#endif
diff --git a/sound/soc/sunxi/spdif/sunxi_sndspdif.c 
b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
index 885e7ae..8a13fd6 100644
--- a/sound/soc/sunxi/spdif/sunxi_sndspdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
@@ -25,9 +25,6 @@
 #include linux/io.h
 
 #include sunxi_spdif.h
-#include sunxi_spdma.h
-
-#include sndspdif.h
 
 static struct clk *xtal;
 static int clk_users;
diff --git a/sound/soc/sunxi/spdif/sunxi_sndspdif.h 
b/sound/soc/sunxi/spdif/sunxi_sndspdif.h
deleted file mode 100644
index 5671f6f..000
--- a/sound/soc/sunxi/spdif/sunxi_sndspdif.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * sound\soc\sunxi\spdif\sunxi_sndspdif.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-#ifndef SUNXI_SNDSPDIF_H_
-#define SUNXI_SNDSPDIF_H_
-
-#endif
diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 88389ae..3066d24 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -34,7 +34,6 @@
 #include asm/dma.h
 #include plat/dma_compat.h
 
-#include sunxi_spdma.h
 #include sunxi_spdif.h
 
 static int regsave[6];
diff --git a/sound/soc/sunxi/spdif/sunxi_spdma.c 
b/sound/soc/sunxi/spdif/sunxi_spdma.c
index ec4ac99..67aa30e 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdma.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdma.c
@@ -32,7 +32,6 @@
 #include plat/sys_config.h
 
 #include sunxi_spdif.h
-#include sunxi_spdma.h
 
 static volatile unsigned int dmasrc = 0;
 static volatile unsigned int dmadst = 0;
diff --git a/sound/soc/sunxi/spdif/sunxi_spdma.h 
b/sound/soc/sunxi/spdif/sunxi_spdma.h
deleted file mode 100644
index 71bfc98..000
--- a/sound/soc/sunxi/spdif/sunxi_spdma.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * sound\soc\sunxi\spdif\sunxi_spdma.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-#ifndef SUNXI_SPDMA_H_
-#define SUNXI_SPDMA_H_
-
-#define ST_RUNNING(10)
-#define ST_OPENED (11)
-
-#define SUNXI_DAI_SPDIF1
-
-enum sunxidma_buffresult {
-   SUNXI_RES_OK,
-   SUNXI_RES_ERR,
-   SUNXI_RES_ABORT
-};
-
-#endif
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an 

[linux-sunxi] [PATCH 02/10] sunxi: spdif: removed ccm from code

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sunxi_spdif.c |  2 --
 sound/soc/sunxi/spdif/sunxi_spdif.h | 27 ---
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 3066d24..103113b 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -553,8 +553,6 @@ static int __devinit sunxi_spdif_dev_probe(struct 
platform_device *pdev)
 
ret = snd_soc_register_dai(pdev-dev, sunxi_spdif_dai);
 
-   iounmap(sunxi_spdif.ioregs);
-
return 0;
 }
 
diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.h 
b/sound/soc/sunxi/spdif/sunxi_spdif.h
index 67955d8..de1dc06 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.h
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.h
@@ -124,31 +124,12 @@
#define SUNXI_SPDIF_RXCHSTA1_SAMWORDLEN(v)  ((v)1)
#define SUNXI_SPDIF_RXCHSTA1_MAXWORDLEN (10)
 
-/*CCM register 
definition-*/
-#define SUNXI_CCMBASE (0x01C2)
-
-#define SUNXI_CCMBASE_AUDIOHOSCPLL (0x08)
-   #define SUNXI_CCMBASE_AUDIOHOSCPLL_EN   (131)
-   #define SUNXI_CCMBASE_AUDIOHOSCPLL_24576M   (127)
-   #define SUNXI_CCMBASE_AUDIOHOSCPLL_225792M  (027)
-
-#define SUNXI_CCMBASE_APBGATE  (0x68)
-   #define SUNXI_CCMBASE_APBGATE_SPDIFGATE (11)
-
-#define SUNXI_CCMBASE_AUDIOCLK (0xC0)
-   #define SUNXI_CCMBASE_AUDIOCLK_SPDIFSPEGATE (131)
-   #define SUNXI_CCMBASE_AUDIOCLK_DIV(v)   ((v)16)
-
-   /* Clock dividers */
-   #define SUNXI_DIV_MCLK  0
-   #define SUNXI_DIV_BCLK  1
-
+/* Clock dividers */
+#define SUNXI_DIV_MCLK 0
+#define SUNXI_DIV_BCLK 1
 
 struct sunxi_spdif_info {
-   void __iomem   *regs;/* IIS BASE */
-   void __iomem   *ccmregs;  //CCM BASE
-   void __iomem   *ioregs;   //IO BASE
-
+   void __iomem *regs; /* SPDIF BASE */
 };
 
 extern struct sunxi_spdif_info sunxi_spdif;
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 04/10] sunxi: spdif: fix comment styling

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

All comments have been corrected to the format required by
the kernel.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sunxi_sndspdif.c | 94 --
 sound/soc/sunxi/spdif/sunxi_spdif.c| 61 +++---
 sound/soc/sunxi/spdif/sunxi_spdma.c| 12 ++---
 3 files changed, 80 insertions(+), 87 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sunxi_sndspdif.c 
b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
index 8a13fd6..c5a8509 100644
--- a/sound/soc/sunxi/spdif/sunxi_sndspdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
@@ -65,77 +65,71 @@ static void sunxi_sndspdif_shutdown(struct 
snd_pcm_substream *substream)
mutex_unlock(clk_lock);
 }
 
-typedef struct __MCLK_SET_INF
-{
-__u32   samp_rate;  // sample rate
-   __u16   mult_fs;// multiply of smaple rate
-
-__u8clk_div;// mpll division
-__u8mpll;   // select mpll, 0 - 24.576 Mhz, 1 - 22.5792 Mhz
+typedef struct __MCLK_SET_INF {
+   __u32   samp_rate;  /* sample rate */
+   __u16   mult_fs;/* multiply of sample rate */
 
+   __u8clk_div;/* mpll division */
+   __u8mpll;   /* select mpll, 0:24.576 Mhz, 1:22.5792 Mhz */
 } __mclk_set_inf;
 
 
-typedef struct __BCLK_SET_INF
-{
-__u8bitpersamp; // bits per sample
-__u8clk_div;// clock division
-__u16   mult_fs;// multiplay of sample rate
-
+typedef struct __BCLK_SET_INF {
+   __u8bitpersamp; /* bits per sample */
+   __u8clk_div;/* clock division */
+   __u16   mult_fs;/* multiplay of sample rate */
 } __bclk_set_inf;
 
 
-static __bclk_set_inf BCLK_INF[] =
-{
-// 16bits per sample
-{16,  4, 128}, {16,  6, 192}, {16,  8, 256},
-{16, 12, 384}, {16, 16, 512},
+static __bclk_set_inf BCLK_INF[] = {
+   /* 16bits per sample */
+   {16, 4, 128}, {16, 6, 192}, {16, 8, 256},
+   {16, 12, 384}, {16, 16, 512},
 
-//24 bits per sample
-{24,  4, 192}, {24,  8, 384}, {24, 16, 768},
+   /* 24 bits per sample */
+   {24, 4, 192}, {24, 8, 384}, {24, 16, 768},
 
-//32 bits per sample
-{32,  2, 128}, {32,  4, 256}, {32,  6, 384},
-{32,  8, 512}, {32, 12, 768},
+   /* 32 bits per sample */
+   {32, 2, 128}, {32, 4, 256}, {32, 6, 384},
+   {32, 8, 512}, {32, 12, 768},
 
-//end flag
-{0xff, 0, 0},
+   /* end flag */
+   {0xff, 0, 0},
 };
 
-//TX RATIO value
-static __mclk_set_inf  MCLK_INF[] =
-{
-   //88.2k bitrate//2
-{ 88200, 128,  2, 1}, { 88200, 256,  2, 1},
+/* TX RATIO value */
+static __mclk_set_inf MCLK_INF[] = {
+   /* 88.2k bitrate //2 */
+   { 88200, 128, 2, 1}, { 88200, 256, 2, 1},
 
-//22.05k bitrate   //8
-{ 22050, 128,  8, 1}, { 22050, 256,  8, 1},
-{ 22050, 512,  8, 1},
+   /* 22.05k bitrate //8 */
+   { 22050, 128, 8, 1}, { 22050, 256, 8, 1},
+   { 22050, 512, 8, 1},
 
-   // 24k bitrate   //8
-{ 24000, 128,  8, 0}, { 24000, 256, 8, 0}, { 24000, 512, 8, 0},
+   /* 24k bitrate //8 */
+   { 24000, 128, 8, 0}, { 24000, 256, 8, 0}, { 24000, 512, 8, 0},
 
-// 32k bitrate   //2.048MHz   24/4 = 6
-{ 32000, 128,  6, 0}, { 32000, 192,  6, 0}, { 32000, 384,  6, 0},
-{ 32000, 768,  6, 0},
+   /* 32k bitrate //2.048MHz 24/4 = 6 */
+   { 32000, 128, 6, 0}, { 32000, 192, 6, 0}, { 32000, 384, 6, 0},
+   { 32000, 768, 6, 0},
 
- // 48K bitrate   3.072  Mbit/s   16/4 = 4
-{ 48000, 128,  4, 0}, { 48000, 256,  4, 0}, { 48000, 512, 4, 0},
+   /* 48K bitrate 3.072Mbit/s 16/4 = 4 */
+   { 48000, 128, 4, 0}, { 48000, 256, 4, 0}, { 48000, 512, 4, 0},
 
-// 96k bitrate  6.144MHZ   8/4 = 2
-{ 96000, 128 , 2, 0}, { 96000, 256,  2, 0},
+   /* 96k bitrate 6.144MHZ 8/4 = 2 */
+   { 96000, 128 , 2, 0}, { 96000, 256, 2, 0},
 
-//192k bitrate   12.288MHZ  4/4 = 1
-{192000, 128,  1, 0},
+   /* 192k bitrate 12.288MHZ 4/4 = 1 */
+   {192000, 128, 1, 0},
 
-//44.1k bitrate  2.8224MHz   16/4 = 4
-{ 44100, 128,  4, 1}, { 44100, 256,  4, 1}, { 44100, 512,  4, 1},
+   /* 44.1k bitrate 2.8224MHz 16/4 = 4 */
+   { 44100, 128, 4, 1}, { 44100, 256, 4, 1}, { 44100, 512, 4, 1},
 
- //176.4k bitrate  11.2896MHZ 4/4 = 1
-{176400, 128, 1, 1},
+   /* 176.4k bitrate 11.2896MHZ 4/4 = 1 */
+   {176400, 128, 1, 1},
 
-//end flag 0x
-{0x, 0, 0, 0},
+   /* end flag 0x */
+   {0x, 0, 0, 0},
 };
 
 static s32 get_clock_divder(u32 sample_rate, u32 sample_width, u32 * mclk_div, 
u32* mpll, u32* bclk_div, u32* mult_fs)
diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 29c9116..9cc6264 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -68,53 +68,53 @@ void sunxi_snd_txctrl(struct snd_pcm_substream 

[linux-sunxi] [PATCH 03/10] sunxi: spdif: remove unused function

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

sunxi_snd_is_clkmaster is not used anywhere and does nothing.
Also remove external declarations of functions that are only
used in the file that they are defined in.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sunxi_spdif.c | 11 ---
 sound/soc/sunxi/spdif/sunxi_spdif.h |  5 -
 2 files changed, 16 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 103113b..29c9116 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -125,11 +125,6 @@ void sunxi_snd_rxctrl(int on)
 {
 }
 
-static inline int sunxi_snd_is_clkmaster(void)
-{
-   return 0;
-}
-
 static int sunxi_spdif_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
u32 reg_val;
@@ -402,12 +397,6 @@ static int sunxi_spdif_set_clkdiv(struct snd_soc_dai 
*cpu_dai, int div_id, int d
return 0;
 }
 
-u32 sunxi_spdif_get_clockrate(void)
-{
-   return 0;
-}
-EXPORT_SYMBOL_GPL(sunxi_spdif_get_clockrate);
-
 static int sunxi_spdif_dai_probe(struct snd_soc_dai *dai)
 {
return 0;
diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.h 
b/sound/soc/sunxi/spdif/sunxi_spdif.h
index de1dc06..b4157f6 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.h
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.h
@@ -134,9 +134,4 @@ struct sunxi_spdif_info {
 
 extern struct sunxi_spdif_info sunxi_spdif;
 
-unsigned int sunxi_spdif_get_clockrate(void);
-
-extern void sunxi_snd_txctrl(struct snd_pcm_substream *substream, int on);
-extern void sunxi_snd_rxctrl(int on);
-
 #endif
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 05/10] sunxi: spdif: Tidy up

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Tidy up of the code so that it passes checkpatch. Misplaced
spaces, tabs etc have been removed and the column width
restricted where possible to  80 chars.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sndspdif.c   |  21 +-
 sound/soc/sunxi/spdif/sunxi_sndspdif.c |  78 +++---
 sound/soc/sunxi/spdif/sunxi_spdif.c| 491 ++---
 sound/soc/sunxi/spdif/sunxi_spdif.h| 146 +-
 sound/soc/sunxi/spdif/sunxi_spdma.c| 113 
 5 files changed, 455 insertions(+), 394 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sndspdif.c b/sound/soc/sunxi/spdif/sndspdif.c
index c41a06b..7bc5713 100644
--- a/sound/soc/sunxi/spdif/sndspdif.c
+++ b/sound/soc/sunxi/spdif/sndspdif.c
@@ -23,7 +23,7 @@
 #include plat/sys_config.h
 #include linux/io.h
 
-#define SNDSPDIF_RATES  (SNDRV_PCM_RATE_8000_192000|SNDRV_PCM_RATE_KNOT)
+#define SNDSPDIF_RATES (SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT)
 #define SNDSPDIF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
 
 struct sndspdif_priv {
@@ -58,18 +58,18 @@ static int sndspdif_hw_params(struct snd_pcm_substream 
*substream,
 }
 
 static int sndspdif_set_dai_sysclk(struct snd_soc_dai *codec_dai,
- int clk_id, unsigned int freq, int dir)
+   int clk_id, unsigned int freq, int dir)
 {
return 0;
 }
 
-static int sndspdif_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, 
int div)
+static int sndspdif_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id,
+   int div)
 {
return 0;
 }
 
-static int sndspdif_set_dai_fmt(struct snd_soc_dai *codec_dai,
-  unsigned int fmt)
+static int sndspdif_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int 
fmt)
 {
return 0;
 }
@@ -103,8 +103,8 @@ static int sndspdif_soc_probe(struct snd_soc_codec *codec)
struct sndspdif_priv *sndspdif;
 
sndspdif = kzalloc(sizeof(struct sndspdif_priv), GFP_KERNEL);
-   if(sndspdif == NULL){
-   printk(%s,%d\n,__func__,__LINE__);
+   if (sndspdif == NULL) {
+   printk(%s,%d\n, __func__, __LINE__);
return -ENOMEM;
}
snd_soc_codec_set_drvdata(codec, sndspdif);
@@ -123,13 +123,14 @@ static int sndspdif_soc_remove(struct snd_soc_codec 
*codec)
 }
 
 static struct snd_soc_codec_driver soc_codec_dev_sndspdif = {
-   .probe  =   sndspdif_soc_probe,
-   .remove =   sndspdif_soc_remove,
+   .probe  = sndspdif_soc_probe,
+   .remove = sndspdif_soc_remove,
 };
 
 static int __devinit sndspdif_codec_probe(struct platform_device *pdev)
 {
-   return snd_soc_register_codec(pdev-dev, soc_codec_dev_sndspdif, 
sndspdif_dai, 1);
+   return snd_soc_register_codec(pdev-dev, soc_codec_dev_sndspdif,
+   sndspdif_dai, 1);
 }
 
 static int __devexit sndspdif_codec_remove(struct platform_device *pdev)
diff --git a/sound/soc/sunxi/spdif/sunxi_sndspdif.c 
b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
index c5a8509..7cea365 100644
--- a/sound/soc/sunxi/spdif/sunxi_sndspdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_sndspdif.c
@@ -41,15 +41,17 @@ static struct snd_pcm_hw_constraint_list 
hw_constraints_rates = {
 static int sunxi_sndspdif_startup(struct snd_pcm_substream *substream)
 {
int ret = 0;
-   #ifdef ENFORCE_RATES
-   struct snd_pcm_runtime *runtime = substream-runtime;;
-   #endif
+#ifdef ENFORCE_RATES
+   struct snd_pcm_runtime *runtime = substream-runtime;
+#endif
if (!ret) {
-   #ifdef ENFORCE_RATES
-   ret = snd_pcm_hw_constraint_list(runtime, 0, 
SNDRV_PCM_HW_PARAM_RATE, hw_constraints_rates);
+#ifdef ENFORCE_RATES
+   ret = snd_pcm_hw_constraint_list(runtime, 0,
+   SNDRV_PCM_HW_PARAM_RATE,
+   hw_constraints_rates);
if (ret  0)
return ret;
-   #endif
+#endif
}
return ret;
 }
@@ -132,27 +134,29 @@ static __mclk_set_inf MCLK_INF[] = {
{0x, 0, 0, 0},
 };
 
-static s32 get_clock_divder(u32 sample_rate, u32 sample_width, u32 * mclk_div, 
u32* mpll, u32* bclk_div, u32* mult_fs)
+static s32 get_clock_divder(u32 sample_rate, u32 sample_width, u32 *mclk_div,
+   u32 *mpll, u32 *bclk_div, u32 *mult_fs)
 {
u32 i, j, ret = -EINVAL;
 
-   for(i=0; i 100; i++) {
-if((MCLK_INF[i].samp_rate == sample_rate) 
-   ((MCLK_INF[i].mult_fs == 256) || (MCLK_INF[i].mult_fs 
== 128))) {
- for(j=0; jARRAY_SIZE(BCLK_INF); j++) {
-   if((BCLK_INF[j].bitpersamp == 
sample_width) 
-   

[linux-sunxi] [PATCH 08/10] sunxi: spdif: add clock checks

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sunxi_spdif.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index 7e76276..fe99aa0 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -489,11 +489,18 @@ static int sunxi_spdif_suspend(struct snd_soc_dai 
*cpu_dai)
writel(reg_val, sunxi_spdif.regs + SUNXI_SPDIF_CTL);
 
spdifregsave();
-
-   /* disable the module clock */
-   clk_disable(spdif_moduleclk);
-
-   clk_disable(spdif_apbclk);
+   if ((NULL == spdif_moduleclk) || (IS_ERR(spdif_moduleclk))) {
+   printk(spdif_moduleclk handle is invalid, just return\n);
+   return -EFAULT;
+   } else
+   /* disable the module clock */
+   clk_disable(spdif_moduleclk);
+
+   if ((NULL == spdif_apbclk) || (IS_ERR(spdif_apbclk))) {
+   printk(spdif_apbclk handle is invalid, just return\n);
+   return -EFAULT;
+   } else
+   clk_disable(spdif_apbclk);
 
printk([SPDIF]SPECIAL CLK 0x01c20068 = %#x, line= %d\n,
*(volatile int *)0xF1C20068, __LINE__);
@@ -508,11 +515,15 @@ static int sunxi_spdif_resume(struct snd_soc_dai *cpu_dai)
u32 reg_val;
printk([SPDIF]Enter %s\n, __func__);
 
-   /* disable the module clock */
-   clk_enable(spdif_apbclk);
+   /* enable the module clock */
+   if (clk_enable(spdif_apbclk)) {
+   printk(try to enable spdif_apbclk output failed!\n);
+   }
 
/* enable the module clock */
-   clk_enable(spdif_moduleclk);
+   if (clk_enable(spdif_moduleclk)) {
+   printk(try to enable spdif_moduleclk output failed!\n);
+   }
 
spdifregrestore();
 
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 06/10] sunxi: spdif: reorganise for better backporting

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/spdif/sndspdif.c|  3 ++-
 sound/soc/sunxi/spdif/sunxi_spdif.c | 10 ++
 sound/soc/sunxi/spdif/sunxi_spdma.c |  6 +++---
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/spdif/sndspdif.c b/sound/soc/sunxi/spdif/sndspdif.c
index 7bc5713..2730e02 100644
--- a/sound/soc/sunxi/spdif/sndspdif.c
+++ b/sound/soc/sunxi/spdif/sndspdif.c
@@ -20,8 +20,9 @@
 #include sound/soc.h
 #include sound/soc-dapm.h
 #include sound/initval.h
-#include plat/sys_config.h
+
 #include linux/io.h
+#include plat/sys_config.h
 
 #define SNDSPDIF_RATES (SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT)
 #define SNDSPDIF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
diff --git a/sound/soc/sunxi/spdif/sunxi_spdif.c 
b/sound/soc/sunxi/spdif/sunxi_spdif.c
index df53666..a9f36d2 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdif.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdif.c
@@ -37,6 +37,12 @@
 #include sunxi_spdif.h
 
 static int regsave[6];
+struct sunxi_spdif_info sunxi_spdif;
+static u32 spdif_handle;
+static struct clk *spdif_apbclk;
+static struct clk *spdif_pll2clk;
+static struct clk *spdif_pllx8;
+static struct clk *spdif_moduleclk;
 
 static struct sunxi_dma_params sunxi_spdif_stereo_out = {
.client.name=   SPDIF out,
@@ -54,10 +60,6 @@ static struct sunxi_dma_params sunxi_spdif_stereo_in = {
.dma_addr   =   SUNXI_SPDIFBASE + SUNXI_SPDIF_RXFIFO,
 };
 
-struct sunxi_spdif_info sunxi_spdif;
-static u32 spdif_handle;
-static struct clk *spdif_apbclk, *spdif_pll2clk, *spdif_pllx8, 
*spdif_moduleclk;
-
 void sunxi_snd_txctrl(struct snd_pcm_substream *substream, int on)
 {
u32 reg_val;
diff --git a/sound/soc/sunxi/spdif/sunxi_spdma.c 
b/sound/soc/sunxi/spdif/sunxi_spdma.c
index 5db8f62..f5cc44c 100644
--- a/sound/soc/sunxi/spdif/sunxi_spdma.c
+++ b/sound/soc/sunxi/spdif/sunxi_spdma.c
@@ -33,9 +33,6 @@
 
 #include sunxi_spdif.h
 
-static volatile unsigned int dmasrc;
-static volatile unsigned int dmadst;
-
 static const struct snd_pcm_hardware sunxi_pcm_hardware = {
.info   = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -267,6 +264,9 @@ static int sunxi_pcm_trigger(struct snd_pcm_substream 
*substream, int cmd)
 
 static snd_pcm_uframes_t sunxi_pcm_pointer(struct snd_pcm_substream *substream)
 {
+   static volatile unsigned int dmasrc;
+   static volatile unsigned int dmadst;
+
struct snd_pcm_runtime *runtime = substream-runtime;
struct sunxi_runtime_data *prtd = runtime-private_data;
unsigned long res = 0;
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 7/8] sunxi: codec: remove duplicate settings

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The settings for snd_pcm_set_ops are set twice.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index 741ac72..fe61cd4 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -1500,9 +1500,6 @@ static int __init snd_card_sunxi_codec_pcm(struct 
sunxi_codec *sunxi_codec,
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
sunxi_pcm_capture_ops);
 
-   snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
-   sunxi_pcm_playback_ops);
-   snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, sunxi_pcm_capture_ops);
/* Set pcm- private_data specific data for the chip */
pcm-private_data = sunxi_codec;
pcm-info_flags = 0;
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 1/8] sunxi: codec: remove pointless state variable

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 3 ---
 sound/soc/sunxi/sunxi-codec.h | 2 --
 2 files changed, 5 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index 1b7f8f1..961efa7 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -1256,7 +1256,6 @@ static int snd_sunxi_codec_trigger(struct 
snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-   capture_prtd-state |= ST_RUNNING;
codec_capture_start();
mdelay(1);
codec_wr_control(SUNXI_ADC_FIFOC, 0x1, ADC_FIFO_FLUSH, 
0x1);
@@ -1266,12 +1265,10 @@ static int snd_sunxi_codec_trigger(struct 
snd_pcm_substream *substream, int cmd)
codec_capture_stop();
break;
case SNDRV_PCM_TRIGGER_STOP:
-   capture_prtd-state = ~ST_RUNNING;
codec_capture_stop();
sunxi_dma_stop(capture_prtd-params);
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-   capture_prtd-state = ~ST_RUNNING;
sunxi_dma_stop(capture_prtd-params);
break;
default:
diff --git a/sound/soc/sunxi/sunxi-codec.h b/sound/soc/sunxi/sunxi-codec.h
index 99bbd8e..4317f55 100644
--- a/sound/soc/sunxi/sunxi-codec.h
+++ b/sound/soc/sunxi/sunxi-codec.h
@@ -101,8 +101,6 @@ enum m1_codec_config {
 void  __iomem *baseaddr;
 
 #define AUDIO_RATE_DEFAULT 44100
-#define ST_RUNNING (10)
-#define ST_OPENED  (11)
 
 #define codec_rdreg(reg)   readl((baseaddr+(reg)))
 #define codec_wrreg(reg,val)  writel((val),(baseaddr+(reg)))
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 2/8] sunxi: codec: remove SCRIPT_AUDIO_OK

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index 961efa7..8c7d34c 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -34,7 +34,6 @@
 #include plat/sys_config.h
 #include mach/system.h
 
-#define SCRIPT_AUDIO_OK (0)
 static int has_playback, has_capture;
 static int gpio_pa_shutdown = 0;
 struct clk *codec_apbclk,*codec_pll2clk,*codec_moduleclk;
@@ -345,7 +344,7 @@ static  int codec_init(void)
}
rc = script_parser_fetch(audio_para, audio_lr_change,
 device_lr_change, 1);
-   if (rc != SCRIPT_AUDIO_OK) {
+   if (rc != 0) {
pr_err(No audio_lr_change in fex audio_para\n);
return -1;
}
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 6/8] sunxi: codec: replace fifo divides with defines.

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 88 +--
 sound/soc/sunxi/sunxi-codec.h |  9 +
 2 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index d351282..741ac72 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -982,8 +982,8 @@ static int snd_sunxi_codec_prepare(struct snd_pcm_substream 
*substream)
clk_set_rate(codec_pll2clk, 22579200);
clk_set_rate(codec_moduleclk, 22579200);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (029);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_48KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
 
break;
@@ -991,88 +991,88 @@ static int snd_sunxi_codec_prepare(struct 
snd_pcm_substream *substream)
clk_set_rate(codec_pll2clk, 22579200);
clk_set_rate(codec_moduleclk, 22579200);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (229);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_24KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 11025:
clk_set_rate(codec_pll2clk, 22579200);
clk_set_rate(codec_moduleclk, 22579200);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (429);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_12KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 48000:
clk_set_rate(codec_pll2clk, 24576000);
clk_set_rate(codec_moduleclk, 24576000);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (029);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_48KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 96000:
clk_set_rate(codec_pll2clk, 24576000);
clk_set_rate(codec_moduleclk, 24576000);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (729);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_96KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 192000:
clk_set_rate(codec_pll2clk, 24576000);
clk_set_rate(codec_moduleclk, 24576000);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (629);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_192KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 32000:
clk_set_rate(codec_pll2clk, 24576000);
clk_set_rate(codec_moduleclk, 24576000);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (129);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_32KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 24000:
clk_set_rate(codec_pll2clk, 24576000);
clk_set_rate(codec_moduleclk, 24576000);
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(729);
-   reg_val |= (229);
+   reg_val = ~SUNXI_DAC_FIFOC_SAMPLE_RATE_MASK;
+   reg_val |= SUNXI_DAC_FIFOC_SAMPLE_RATE_24KHZ;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 16000:
   

[linux-sunxi] [PATCH 5/8] sunxi: codec: restyle header and reg writes

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 20 +--
 sound/soc/sunxi/sunxi-codec.h | 81 +++
 2 files changed, 85 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index 76a7ba8..d351282 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -333,7 +333,7 @@ static int codec_init(void)
/* enable DAC */
codec_wr_control(SUNXI_DAC_DPC, 0x1, DAC_EN, 0x1);
 
-   codec_wr_control(SUNXI_DAC_FIFOC , 0x1, 28, 0x1);
+   codec_wr_control(SUNXI_DAC_FIFOC , 0x1, FIR_VERSION, 0x1);
/* set digital volume to maximum */
if (codec_chip_ver == SUNXI_VER_A10A)
codec_wr_control(SUNXI_DAC_DPC, 0x6, DIGITAL_VOL, 0x0);
@@ -377,9 +377,9 @@ static int codec_play_open(struct snd_pcm_substream 
*substream)
/* set TX FIFO send drq level */
codec_wr_control(SUNXI_DAC_FIFOC, 0x4, TX_TRI_LEVEL, 0xf);
if (substream-runtime-rate  32000)
-   codec_wr_control(SUNXI_DAC_FIFOC, 0x1, 28, 0x0);
+   codec_wr_control(SUNXI_DAC_FIFOC, 0x1, FIR_VERSION, 0x0);
else
-   codec_wr_control(SUNXI_DAC_FIFOC, 0x1, 28, 0x1);
+   codec_wr_control(SUNXI_DAC_FIFOC, 0x1, FIR_VERSION, 0x1);
/* set TX FIFO MODE */
codec_wr_control(SUNXI_DAC_FIFOC, 0x1, TX_FIFO_MODE, 0x1);
/* send last sample when DAC FIFO under runs */
@@ -397,7 +397,7 @@ static int codec_capture_open(void)
/* enable mic1 PA */
codec_wr_control(SUNXI_ADC_ACTL, 0x1, MIC1_EN, 0x1);
/* mic1 gain 32dB */
-   codec_wr_control(SUNXI_ADC_ACTL, 0x3, 25, 0x1);
+   codec_wr_control(SUNXI_ADC_ACTL, 0x3, MIC_GAIN, 0x1);
/* enable VMIC */
codec_wr_control(SUNXI_ADC_ACTL, 0x1, VMIC_EN, 0x1);
 
@@ -1080,17 +1080,17 @@ static int snd_sunxi_codec_prepare(struct 
snd_pcm_substream *substream)
switch (substream-runtime-channels) {
case 1:
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val |= (16);
+   reg_val |= SUNXI_DAC_FIFOC_DAC_MODE;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
case 2:
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(16);
+   reg_val = ~SUNXI_DAC_FIFOC_DAC_MODE;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
default:
reg_val = readl(baseaddr + SUNXI_DAC_FIFOC);
-   reg_val = ~(16);
+   reg_val = ~SUNXI_DAC_FIFOC_DAC_MODE;
writel(reg_val, baseaddr + SUNXI_DAC_FIFOC);
break;
}
@@ -1182,17 +1182,17 @@ static int snd_sunxi_codec_prepare(struct 
snd_pcm_substream *substream)
switch (substream-runtime-channels) {
case 1:
reg_val = readl(baseaddr + SUNXI_ADC_FIFOC);
-   reg_val |= (17);
+   reg_val |= SUNXI_ADC_FIFOC_ADC_MODE;
writel(reg_val, baseaddr + SUNXI_ADC_FIFOC);
break;
case 2:
reg_val = readl(baseaddr + SUNXI_ADC_FIFOC);
-   reg_val = ~(17);
+   reg_val = ~SUNXI_ADC_FIFOC_ADC_MODE;
writel(reg_val, baseaddr + SUNXI_ADC_FIFOC);
break;
default:
reg_val = readl(baseaddr + SUNXI_ADC_FIFOC);
-   reg_val = ~(17);
+   reg_val = ~SUNXI_ADC_FIFOC_ADC_MODE;
writel(reg_val, baseaddr + SUNXI_ADC_FIFOC);
break;
}
diff --git a/sound/soc/sunxi/sunxi-codec.h b/sound/soc/sunxi/sunxi-codec.h
index b32ae30..e714a6e 100644
--- a/sound/soc/sunxi/sunxi-codec.h
+++ b/sound/soc/sunxi/sunxi-codec.h
@@ -11,7 +11,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
@@ -27,21 +27,89 @@
 /* Codec Register */
 #define CODEC_BASEADDRESS  (0x01c22c00)
 #define SUNXI_DAC_DPC  (0x00)
+   #define SUNXI_DAC_DPC_DAC_EN(1  31)
+   #define SUNXI_DAC_DPC_DIGITAL_VOL   (1  12)
+
 #define SUNXI_DAC_FIFOC(0x04)
+   #define SUNXI_DAC_FIFOC_SAMPLE_RATE_96KHZ   (7  29)
+   

[linux-sunxi] [PATCH 8/8] sunxi: codec: fix for warning

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/sunxi-codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c
index fe61cd4..97ece44 100644
--- a/sound/soc/sunxi/sunxi-codec.c
+++ b/sound/soc/sunxi/sunxi-codec.c
@@ -1465,7 +1465,7 @@ static struct snd_pcm_ops sunxi_pcm_capture_ops = {
.pointer= snd_sunxi_codec_pointer,
 };
 
-static int __init snd_card_sunxi_codec_pcm(struct sunxi_codec *sunxi_codec,
+static int __devinit snd_card_sunxi_codec_pcm(struct sunxi_codec *sunxi_codec,
int device)
 {
struct snd_pcm *pcm;
@@ -1761,7 +1761,7 @@ static struct platform_device sunxi_device_codec = {
 
 static struct platform_driver sunxi_codec_driver = {
.probe  = sunxi_codec_probe,
-   .remove = sunxi_codec_remove,
+   .remove = __devexit_p(sunxi_codec_remove),
.shutdown   = sunxi_codec_shutdown,
 #ifdef CONFIG_PM
.suspend= snd_sunxi_codec_suspend,
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 00/12] sunxi: i2s: tidy up of i2s driver.

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This patch series removes all the unnecessary code,
provides a clean up and some parameter checks which
came from the comparing the drivers released
under the A23 SDK. The A20, A23 and A31 all have two
i2s blocks, however this code only supports the block
that is shared across all of the current supported
devices (i.e. iis/iis0 located at 0x01C22400).

I have not tested this at all and would be greatful of
some acks from the community.

Thanks,
Marcus

Marcus Cooper (12):
  sunxi: i2s: removal of pointless hdmi parameter
  sunxi: i2s: Removal of unneeded headers
  sunxi: i2s: Tidy up of code.
  sunxi: i2s: remove ccm and dma from header
  sunxi: i2s: reorganise for better backporting
  sunxi: i2s: incorrect declaration
  sunxi: i2s: add capture
  sunxi: i2s: Add debug message
  sunxi: i2s: remove unused function
  sunxi: i2s: change clock naming
  sunxi: i2s: remove compile warning
  sunxi: i2s: remove magic numbers

 arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c |  18 +-
 arch/arm/mach-sun4i/include/mach/aw_ccu.h|   2 +-
 drivers/video/sunxi/disp/OSAL_Clock.c|   2 +-
 drivers/video/sunxi/disp/OSAL_Clock.h|   2 +-
 sound/soc/sunxi/i2s/sndi2s.c |  99 ++---
 sound/soc/sunxi/i2s/sndi2s.h |  58 ---
 sound/soc/sunxi/i2s/sunxi-i2s.c  | 532 ++-
 sound/soc/sunxi/i2s/sunxi-i2s.h  | 451 ++-
 sound/soc/sunxi/i2s/sunxi-i2sdma.c   | 127 +++
 sound/soc/sunxi/i2s/sunxi-i2sdma.h   |  35 --
 sound/soc/sunxi/i2s/sunxi-sndi2s.c   | 210 +--
 sound/soc/sunxi/i2s/sunxi-sndi2s.h   |  25 --
 12 files changed, 686 insertions(+), 875 deletions(-)
 delete mode 100644 sound/soc/sunxi/i2s/sndi2s.h
 delete mode 100644 sound/soc/sunxi/i2s/sunxi-i2sdma.h
 delete mode 100644 sound/soc/sunxi/i2s/sunxi-sndi2s.h

-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 06/12] sunxi: i2s: incorrect declaration

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sndi2s.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sunxi/i2s/sndi2s.c b/sound/soc/sunxi/i2s/sndi2s.c
index b10b8a2..2570fef 100644
--- a/sound/soc/sunxi/i2s/sndi2s.c
+++ b/sound/soc/sunxi/i2s/sndi2s.c
@@ -119,7 +119,7 @@ static int sndi2s_soc_probe(struct snd_soc_codec *codec)
 /* power down chip */
 static int sndi2s_soc_remove(struct snd_soc_codec *codec)
 {
-   struct sndhdmi_priv *sndi2s = snd_soc_codec_get_drvdata(codec);
+   struct sndi2s_priv *sndi2s = snd_soc_codec_get_drvdata(codec);
 
kfree(sndi2s);
 
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 08/12] sunxi: i2s: Add debug message

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sunxi-i2s.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index c9ba71a..650e488 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -245,6 +245,7 @@ static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, 
unsigned int fmt)
reg_val = ~SUNXI_IISCTL_MS;
break;
default:
+   printk(unknown master/slave format\n);
return -EINVAL;
}
writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL);
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 05/12] sunxi: i2s: reorganise for better backporting

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sndi2s.c|  2 +-
 sound/soc/sunxi/i2s/sunxi-i2s.c | 14 +-
 sound/soc/sunxi/i2s/sunxi-i2s.h | 13 ++---
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sunxi/i2s/sndi2s.c b/sound/soc/sunxi/i2s/sndi2s.c
index f4ed8a9..b10b8a2 100644
--- a/sound/soc/sunxi/i2s/sndi2s.c
+++ b/sound/soc/sunxi/i2s/sndi2s.c
@@ -21,8 +21,8 @@
 #include sound/soc.h
 #include sound/soc-dapm.h
 #include sound/initval.h
-#include plat/sys_config.h
 #include linux/io.h
+#include plat/sys_config.h
 
 struct sndi2s_priv {
int sysclk;
diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index cdba4ca..c9ba71a 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -37,8 +37,17 @@
 
 #include sunxi-i2s.h
 
+struct sunxi_i2s_info sunxi_iis;
+
 static int regsave[8];
 static int i2s_used;
+static u32 i2s_handle;
+
+static struct clk *i2s_apbclk;
+static struct clk *i2s_pll2clk;
+static struct clk *i2s_pllx8;
+static struct clk *i2s_moduleclk;
+
 
 static struct sunxi_dma_params sunxi_i2s_pcm_stereo_out = {
.client.name=   I2S PCM Stereo out,
@@ -56,11 +65,6 @@ static struct sunxi_dma_params sunxi_i2s_pcm_stereo_in = {
.dma_addr   =   SUNXI_IISBASE + SUNXI_IISRXFIFO,
 };
 
-
-struct sunxi_i2s_info sunxi_iis;
-static u32 i2s_handle;
-static struct clk *i2s_apbclk, *i2s_pll2clk, *i2s_pllx8, *i2s_moduleclk;
-
 void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on)
 {
u32 reg_val;
diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.h b/sound/soc/sunxi/i2s/sunxi-i2s.h
index aed2dea..da62081 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.h
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.h
@@ -163,23 +163,14 @@
#define SUNXI_RXCHMAP_CH1(v)(((v)-1)  4)
#define SUNXI_RXCHMAP_CH0(v)(((v)-1)  0)
 
-/**/
-/* Clock dividers */
-#define SUNXI_DIV_MCLK 0
-#define SUNXI_DIV_BCLK 1
-
 #define SUNXI_IISCLKD_MCLK_MASK0x0f
 #define SUNXI_IISCLKD_MCLK_OFFS0
 #define SUNXI_IISCLKD_BCLK_MASK0x070
 #define SUNXI_IISCLKD_BCLK_OFFS4
 #define SUNXI_IISCLKD_MCLKEN_OFFS  7
 
-unsigned int sunxi_i2s_get_clockrate(void);
-extern struct sunxi_i2s_info sunxi_i2s;
-/* extern struct snd_soc_dai sunxi_iis_dai; */
-
-extern void sunxi_snd_txctrl_i2s(struct snd_pcm_substream *substream, int on);
-extern void sunxi_snd_rxctrl_i2s(int on);
+#define SUNXI_DIV_MCLK (0)
+#define SUNXI_DIV_BCLK (1)
 
 /*
  * struct sunxi_i2s_info {
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 04/12] sunxi: i2s: remove ccm and dma from header

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sunxi-i2s.c |  1 -
 sound/soc/sunxi/i2s/sunxi-i2s.h | 97 -
 2 files changed, 98 deletions(-)

diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index 4f741e8..cdba4ca 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -629,7 +629,6 @@ static int __devinit sunxi_i2s_dev_probe(struct 
platform_device *pdev)
reg_val |= SUNXI_IISCTL_GEN;
writel(reg_val, sunxi_iis.regs + SUNXI_IISCTL);
 
-   iounmap(sunxi_iis.ioregs);
ret = snd_soc_register_dai(pdev-dev, sunxi_iis_dai);
if (ret) {
dev_err(pdev-dev, Failed to register DAI\n);
diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.h b/sound/soc/sunxi/i2s/sunxi-i2s.h
index 8bdfb5b..aed2dea 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.h
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.h
@@ -163,101 +163,6 @@
#define SUNXI_RXCHMAP_CH1(v)(((v)-1)  4)
#define SUNXI_RXCHMAP_CH0(v)(((v)-1)  0)
 
-
-/* DMA REGISTER */
-#define SUNXI_DMABASE  (0x01C02000)
-
-#define SUNXI_DMAIRQEN (0x0)
-   #define SUNXI_DMAIRQEN_NDMA_FULLEN(v)   (1  ((v) * 2 + 1))
-   #define SUNXI_DMAIRQEN_NDMA_HALFEN(v)   (1  ((v) * 2))
-
-#define SUNXI_DMAIRQPENDING(0x4)
-   #define SUNXI_DMAIRQPENGDING_NDMA_FULLPEND(v)   (1  ((v) * 2 + 1))
-   #define SUNXI_DMAIRQPENGDING_NDMA_HALFPEND(v)   (1  ((v) * 2))
-
-#define SUNXI_NDMACFG(v)   ((v)*0x20 + 0x100)
-   #define SUNXI_NDMACFG_DMALOAD   (1  31)
-   #define SUNXI_NDMACFG_BUSY  (1  30)
-   #define SUNXI_NDMACFG_CONTINUOUS(1  29)
-   /* wait clock = 2^n  example: 8 clocks = 2^3 */
-   #define SUNXI_NDMACFG_WAIT(v)   (((v) - 1)  26)
-   #define SUNXI_NDMACFG_DSTDATAWIDTH_8BIT (0  24)
-   #define SUNXI_NDMACFG_DSTDATAWIDTH_16BIT(1  24)
-   #define SUNXI_NDMACFG_DSTDATAWIDTH_32BIT(2  24)
-   #define SUNXI_NDMACFG_DSTDATAWIDTH_RVD  (3  24)
-   #define SUNXI_NDMACFG_DSTBURST4 (1  23)
-   #define SUNXI_NDMACFG_DSTADDRTYPE_INC   (0  21)
-   #define SUNXI_NDMACFG_DSTADDRTYPE_CON   (1  21)
-   #define SUNXI_NDMACFG_DSTTYPE_IRTX  (0x0  16)
-   #define SUNXI_NDMACFG_DSTTYPE_SPDIFTX   (0x1  16)
-   #define SUNXI_NDMACFG_DSTTYPE_IISTX (0x2  16)
-   #define SUNXI_NDMACFG_DSTTYPE_AC97TX(0x3  16)
-   #define SUNXI_NDMACFG_DSTTYPE_SPI0TX(0x4  16)
-   #define SUNXI_NDMACFG_DSTTYPE_SPI1TX(0x5  16)
-   #define SUNXI_NDMACFG_DSTTYPE_SPI2TX(0x6  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART0TX   (0x8  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART1TX   (0x9  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART2TX   (0xA  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART3TX   (0xB  16)
-   #define SUNXI_NDMACFG_DSTTYPE_AUDIODA   (0xC  16)
-   #define SUNXI_NDMACFG_DSTTYPE_NFC   (0xF  16)
-   #define SUNXI_NDMACFG_DSTTYPE_SRAM  (0x10  16)
-   #define SUNXI_NDMACFG_DSTTYPE_DRAM  (0x11  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART4TX   (0x12  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART5TX   (0x13  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART6TX   (0x14  16)
-   #define SUNXI_NDMACFG_DSTTYPE_UART7TX   (0x15  16)
-   #define SUNXI_NDMACFG_SRCDATAWIDTH_8BIT (0  8)
-   #define SUNXI_NDMACFG_SRCDATAWIDTH_16BIT(1  8)
-   #define SUNXI_NDMACFG_SRCDATAWIDTH_32BIT(2  8)
-   #define SUNXI_NDMACFG_SRCDATAWIDTH_RVD  (3  8)
-   #define SUNXI_NDMACFG_SRCBURST4 (1  7)
-   #define SUNXI_NDMACFG_SRCADDRTYPE_INC   (0  5)
-   #define SUNXI_NDMACFG_SRCADDRTYPE_CON   (1  5)
-   #define SUNXI_NDMACFG_SRCTYPE_IRRX  (0x0  0)
-   #define SUNXI_NDMACFG_SRCTYPE_SPDIFRX   (0x1  0)
-   #define SUNXI_NDMACFG_SRCTYPE_IISRX (0x2  0)
-   #define SUNXI_NDMACFG_SRCTYPE_AC97RX(0x3  0)
-   #define SUNXI_NDMACFG_SRCTYPE_SPI0RX(0x4  0)
-   #define SUNXI_NDMACFG_SRCTYPE_SPI1RX(0x5  0)
-   #define SUNXI_NDMACFG_SRCTYPE_SPI2RX(0x6  0)
-   #define SUNXI_NDMACFG_SRCTYPE_UART0RX   (0x8  0)
-   #define SUNXI_NDMACFG_SRCTYPE_UART1RX   (0x9  0)
-   #define SUNXI_NDMACFG_SRCTYPE_UART2RX   (0xA  0)
-   #define SUNXI_NDMACFG_SRCTYPE_UART3RX   (0xB  0)
-   #define SUNXI_NDMACFG_SRCTYPE_AUDIOAD   (0xC  0)
-   #define SUNXI_NDMACFG_SRCTYPE_TPAD  (0xD  0)
-   #define 

[linux-sunxi] [PATCH 09/12] sunxi: i2s: remove unused function

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sunxi-i2s.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index 650e488..f0d2aa7 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -213,14 +213,6 @@ void sunxi_snd_rxctrl_i2s(int on)
}
 }
 
-static inline int sunxi_snd_is_clkmaster(void)
-{
-   if (readl(sunxi_iis.regs + SUNXI_IISCTL)  SUNXI_IISCTL_MS)
-   return 0;
-   else
-   return 1;
-}
-
 static int sunxi_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
u32 reg_val;
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 02/12] sunxi: i2s: Removal of unneeded headers

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sndi2s.c   |  2 --
 sound/soc/sunxi/i2s/sndi2s.h   | 58 --
 sound/soc/sunxi/i2s/sunxi-i2s.c|  1 -
 sound/soc/sunxi/i2s/sunxi-i2sdma.c |  1 -
 sound/soc/sunxi/i2s/sunxi-i2sdma.h | 35 ---
 sound/soc/sunxi/i2s/sunxi-sndi2s.c |  3 --
 sound/soc/sunxi/i2s/sunxi-sndi2s.h | 25 
 7 files changed, 125 deletions(-)
 delete mode 100644 sound/soc/sunxi/i2s/sndi2s.h
 delete mode 100644 sound/soc/sunxi/i2s/sunxi-i2sdma.h
 delete mode 100644 sound/soc/sunxi/i2s/sunxi-sndi2s.h

diff --git a/sound/soc/sunxi/i2s/sndi2s.c b/sound/soc/sunxi/i2s/sndi2s.c
index 194a869..f304422 100644
--- a/sound/soc/sunxi/i2s/sndi2s.c
+++ b/sound/soc/sunxi/i2s/sndi2s.c
@@ -24,8 +24,6 @@
 #include plat/sys_config.h
 #include linux/io.h
 
-#include sndi2s.h
-
 struct sndi2s_priv {
int sysclk;
int dai_fmt;
diff --git a/sound/soc/sunxi/i2s/sndi2s.h b/sound/soc/sunxi/i2s/sndi2s.h
deleted file mode 100644
index e5b95c8..000
--- a/sound/soc/sunxi/i2s/sndi2s.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * sound\soc\sunxi\i2s\sndi2s.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-
-#ifndef SNDI2S_H_
-#define SNDI2S_H_
-
-typedef struct hdmi_audio
-{
-   __u8hw_intf;/* 0:iis  1:spdif 2:pcm */
-   __u16   fs_between; /* fs */
-   __u32   sample_rate;/*sample rate*/
-   __u8clk_edge;   /* 0:*/
-   __u8ch0_en; /* 1 */
-   __u8ch1_en; /* 0 */
-   __u8ch2_en; /* 0 */
-   __u8ch3_en; /* 0 */
-   __u8word_length;/* 32 */
-   __u8shift_ctl;  /* 0 */
-   __u8dir_ctl;/* 0 */
-   __u8ws_pol;
-   __u8just_pol;
-}hdmi_audio_t;
-
-
-typedef struct
-{
-__s32 (*hdmi_audio_enable)(__u8 mode, __u8 channel);
-__s32 (*hdmi_set_audio_para)(hdmi_audio_t * audio_para);
-}__audio_hdmi_func;
-
-
-/*define display driver command*/
-typedef enum tag_HDMI_CMD
-{
-/* command cache on/off */
-   HDMI_CMD_SET_VIDEO_MOD,
-   HDMI_CMD_GET_VIDEO_MOD,
-   HDMI_CMD_SET_AUDIO_PARA,
-   HDMI_CMD_AUDIO_RESET_NOTIFY,/*iis reset finish 
notify*/
-   HDMI_CMD_CLOSE, /*iis reset finish 
notify*/
-   HDMI_CMD_MOD_SUPPORT,   /*判断某一种hdmi模式是否支持*/
-   HDMI_CMD_AUDIO_ENABLE,
-   HDMI_CMD_GET_HPD_STATUS,
-}__hdmi_cmd_t;
-
-#endif
diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index b4dd3ad..3ea4bf6 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -35,7 +35,6 @@
 #include asm/dma.h
 #include plat/dma_compat.h
 
-#include sunxi-i2sdma.h
 #include sunxi-i2s.h
 
 static int regsave[8];
diff --git a/sound/soc/sunxi/i2s/sunxi-i2sdma.c 
b/sound/soc/sunxi/i2s/sunxi-i2sdma.c
index 488ef4d..f239bda 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2sdma.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2sdma.c
@@ -30,7 +30,6 @@
 #include plat/dma_compat.h
 
 #include sunxi-i2s.h
-#include sunxi-i2sdma.h
 
 static volatile unsigned int dmasrc = 0;
 static volatile unsigned int dmadst = 0;
diff --git a/sound/soc/sunxi/i2s/sunxi-i2sdma.h 
b/sound/soc/sunxi/i2s/sunxi-i2sdma.h
deleted file mode 100644
index 50418a58..000
--- a/sound/soc/sunxi/i2s/sunxi-i2sdma.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * sound\soc\sunxi\i2s\sunxi-i2sdma.h
- * (C) Copyright 2007-2011
- * Allwinner Technology Co., Ltd. www.allwinnertech.com
- * chenpailin chenpai...@allwinnertech.com
- *
- * some simple description for this code
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- */
-
-
-#ifndef SUNXI_PCM_H_
-#define SUNXI_PCM_H_
-
-#define ST_RUNNING(10)
-#define ST_OPENED (11)
-
-#define SUNXI_DAI_I2S  1
-
-enum sunxi_dma_buffresult {
-   SUNXI_RES_OK,
-   SUNXI_RES_ERR,
-   SUNXI_RES_ABORT
-};
-
-/* platform data */
-extern struct snd_soc_platform sunxi_soc_platform_i2s;
-extern struct sunxi_i2s_info sunxi_iis;
-
-#endif //SUNXI_PCM_H_
diff --git a/sound/soc/sunxi/i2s/sunxi-sndi2s.c 
b/sound/soc/sunxi/i2s/sunxi-sndi2s.c
index 7c1a3d4..1d7a977 100644
--- a/sound/soc/sunxi/i2s/sunxi-sndi2s.c
+++ 

[linux-sunxi] [PATCH 10/12] sunxi: i2s: change clock naming

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c | 18 +-
 arch/arm/mach-sun4i/include/mach/aw_ccu.h|  2 +-
 drivers/video/sunxi/disp/OSAL_Clock.c|  2 +-
 drivers/video/sunxi/disp/OSAL_Clock.h|  2 +-
 sound/soc/sunxi/i2s/sunxi-i2s.c  |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c 
b/arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c
index a7cd6bf..2603754 100644
--- a/arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c
+++ b/arch/arm/mach-sun4i/clock/ccmu/ccm_mod_clk.c
@@ -49,7 +49,7 @@ static __aw_ccu_clk_t aw_ccu_mod_clk[] =
 make_mod_clk_inf(AW_MOD_CLK_PATA, pata),
 make_mod_clk_inf(AW_MOD_CLK_IR0 , ir0 ),
 make_mod_clk_inf(AW_MOD_CLK_IR1 , ir1 ),
-make_mod_clk_inf(AW_MOD_CLK_I2S , i2s ),
+make_mod_clk_inf(AW_MOD_CLK_I2S0, i2s0),
 make_mod_clk_inf(AW_MOD_CLK_AC97, ac97),
 make_mod_clk_inf(AW_MOD_CLK_SPDIF   , spdif   ),
 make_mod_clk_inf(AW_MOD_CLK_KEYPAD  , key_pad ),
@@ -367,7 +367,7 @@ static __aw_ccu_sys_clk_e 
mod_clk_get_parent(__aw_ccu_mod_clk_e id)
 return _parse_module0_clk_src(aw_ccu_reg-Ir0Clk);
 case AW_MOD_CLK_IR1:
 return _parse_module0_clk_src(aw_ccu_reg-Ir1Clk);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 return AW_SYS_CLK_PLL2;
 case AW_MOD_CLK_AC97:
 return AW_SYS_CLK_PLL2;
@@ -656,7 +656,7 @@ static __aw_ccu_clk_onff_e 
mod_clk_get_status(__aw_ccu_mod_clk_e id)
 return _get_module0_clk_status(aw_ccu_reg-Ir0Clk);
 case AW_MOD_CLK_IR1:
 return _get_module0_clk_status(aw_ccu_reg-Ir1Clk);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 return aw_ccu_reg-I2sClk.SpecClkGate? AW_CCU_CLK_ON : 
AW_CCU_CLK_OFF;
 case AW_MOD_CLK_AC97:
 return aw_ccu_reg-Ac97Clk.SpecClkGate? AW_CCU_CLK_ON : 
AW_CCU_CLK_OFF;
@@ -953,7 +953,7 @@ static __s64 mod_clk_get_rate(__aw_ccu_mod_clk_e id)
 return _get_module0_clk_rate(aw_ccu_reg-Ir0Clk);
 case AW_MOD_CLK_IR1:
 return _get_module0_clk_rate(aw_ccu_reg-Ir1Clk);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 return (1  aw_ccu_reg-I2sClk.ClkDiv);
 case AW_MOD_CLK_AC97:
 return (1  aw_ccu_reg-Ac97Clk.ClkDiv);
@@ -1054,7 +1054,7 @@ static __aw_ccu_clk_reset_e 
mod_clk_get_reset(__aw_ccu_mod_clk_e id)
 case AW_MOD_CLK_PATA:
 case AW_MOD_CLK_IR0:
 case AW_MOD_CLK_IR1:
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 case AW_MOD_CLK_AC97:
 case AW_MOD_CLK_SPDIF:
 case AW_MOD_CLK_KEYPAD:
@@ -1166,7 +1166,7 @@ static __s32 mod_clk_set_parent(__aw_ccu_mod_clk_e id, 
__aw_ccu_sys_clk_e parent
 return _set_module0_clk_src(aw_ccu_reg-Ir0Clk, parent);
 case AW_MOD_CLK_IR1:
 return _set_module0_clk_src(aw_ccu_reg-Ir1Clk, parent);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 return (parent == AW_SYS_CLK_PLL2)? 0 : -1;
 case AW_MOD_CLK_AC97:
 return (parent == AW_SYS_CLK_PLL2)? 0 : -1;
@@ -1539,7 +1539,7 @@ static __s32 mod_clk_set_status(__aw_ccu_mod_clk_e id, 
__aw_ccu_clk_onff_e statu
 return _set_module0_clk_status(aw_ccu_reg-Ir0Clk, status);
 case AW_MOD_CLK_IR1:
 return _set_module0_clk_status(aw_ccu_reg-Ir1Clk, status);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 aw_ccu_reg-I2sClk.SpecClkGate = (status == AW_CCU_CLK_OFF)? 0 : 1;
 return 0;
 case AW_MOD_CLK_AC97:
@@ -1962,7 +1962,7 @@ static __s32 mod_clk_set_rate(__aw_ccu_mod_clk_e id, 
__s64 rate)
 return _set_module0_clk_rate(aw_ccu_reg-Ir0Clk, rate);
 case AW_MOD_CLK_IR1:
 return _set_module0_clk_rate(aw_ccu_reg-Ir1Clk, rate);
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 {
 switch(rate)
 {
@@ -2272,7 +2272,7 @@ static __s32 mod_clk_set_reset(__aw_ccu_mod_clk_e id, 
__aw_ccu_clk_reset_e reset
 case AW_MOD_CLK_PATA:
 case AW_MOD_CLK_IR0:
 case AW_MOD_CLK_IR1:
-case AW_MOD_CLK_I2S:
+case AW_MOD_CLK_I2S0:
 case AW_MOD_CLK_AC97:
 case AW_MOD_CLK_SPDIF:
 case AW_MOD_CLK_KEYPAD:
diff --git a/arch/arm/mach-sun4i/include/mach/aw_ccu.h 
b/arch/arm/mach-sun4i/include/mach/aw_ccu.h
index 98bfe80..2e67703 100644
--- a/arch/arm/mach-sun4i/include/mach/aw_ccu.h
+++ b/arch/arm/mach-sun4i/include/mach/aw_ccu.h
@@ -117,7 +117,7 @@ typedef enum __AW_CCU_MOD_CLK
 AW_MOD_CLK_PATA,/* pata   */
 AW_MOD_CLK_IR0, /* ir0*/
 AW_MOD_CLK_IR1, /* ir1

[linux-sunxi] [PATCH 01/12] sunxi: i2s: removal of pointless hdmi parameter

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sndi2s.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/sound/soc/sunxi/i2s/sndi2s.c b/sound/soc/sunxi/i2s/sndi2s.c
index 68bad02..194a869 100644
--- a/sound/soc/sunxi/i2s/sndi2s.c
+++ b/sound/soc/sunxi/i2s/sndi2s.c
@@ -39,8 +39,6 @@ static int i2s_used = 0;
 #define sndi2s_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | \
 SNDRV_PCM_FMTBIT_S18_3LE | 
SNDRV_PCM_FMTBIT_S20_3LE)
 
-hdmi_audio_t hdmi_parameter;
-
 static int sndi2s_mute(struct snd_soc_dai *dai, int mute)
 {
return 0;
@@ -62,8 +60,6 @@ static int sndi2s_hw_params(struct snd_pcm_substream 
*substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
 {
-   hdmi_parameter.sample_rate = params_rate(params);
-
return 0;
 }
 
@@ -75,9 +71,6 @@ static int sndi2s_set_dai_sysclk(struct snd_soc_dai 
*codec_dai,
 
 static int sndi2s_set_dai_clkdiv(struct snd_soc_dai *codec_dai, int div_id, 
int div)
 {
-
-   hdmi_parameter.fs_between = div;
-
return 0;
 }
 
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH 11/12] sunxi: i2s: remove compile warning

2014-05-08 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sound/soc/sunxi/i2s/sunxi-i2s.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sunxi/i2s/sunxi-i2s.c b/sound/soc/sunxi/i2s/sunxi-i2s.c
index eb1b7bf..42b1931 100644
--- a/sound/soc/sunxi/i2s/sunxi-i2s.c
+++ b/sound/soc/sunxi/i2s/sunxi-i2s.c
@@ -394,7 +394,7 @@ static int sunxi_i2s_trigger(struct snd_pcm_substream 
*substream, int cmd,
 
 /* freq: 1: 22.5792MHz 0: 24.576MHz */
 static int sunxi_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
-   int freq, int dir)
+   unsigned int freq, int dir)
 {
if (!freq)
clk_set_rate(i2s_pll2clk, 24576000);
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH] a31: add Mele i7 meminfo

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 meminfo/a31/mele_i7.txt | 330 
 1 file changed, 330 insertions(+)
 create mode 100644 meminfo/a31/mele_i7.txt

diff --git a/meminfo/a31/mele_i7.txt b/meminfo/a31/mele_i7.txt
new file mode 100644
index 000..554fdaf
--- /dev/null
+++ b/meminfo/a31/mele_i7.txt
@@ -0,0 +1,330 @@
+DRAM Clock: 624MHz
+/*
+ * DRAM COM Registers
+ */
+SDR_COM_CR = 0x005b39d4;
+SDR_COM_000 = 0x005b39d4;
+SDR_COM_CCR = 0x0007;
+SDR_COM_004 = 0x0007;
+SDR_COM_008 = 0x00022040;
+SDR_COM_MFACR = 0x00800302;
+SDR_COM_010 = 0x00800302;
+SDR_COM_014 = 0x00400307;
+SDR_COM_018 = 0x00800302;
+SDR_COM_01C = 0x00400307;
+SDR_COM_020 = 0x01000307;
+SDR_COM_028 = 0x01000303;
+SDR_COM_MSACR = 0x01000303;
+SDR_COM_030 = 0x01000303;
+SDR_COM_034 = 0x00400310;
+SDR_COM_038 = 0x01000307;
+SDR_COM_03C = 0x01000303;
+SDR_COM_040 = 0x01800303;
+SDR_COM_044 = 0x01800303;
+SDR_COM_048 = 0x01800303;
+SDR_COM_04C = 0x01800303;
+SDR_COM_MBACR = 0x01000303;
+SDR_COM_050 = 0x01000303;
+SDR_COM_06C = 0x0001;
+SDR_COM_070 = 0x0310;
+SDR_COM_074 = 0x0310;
+SDR_COM_078 = 0x0310;
+SDR_COM_07C = 0x0307;
+SDR_COM_080 = 0x0310;
+SDR_COM_084 = 0x0307;
+SDR_COM_088 = 0x;
+SDR_COM_104 = 0x;
+SDR_COM_10C = 0x00c8;
+SDR_COM_110 = 0x00c8;
+SDR_COM_114 = 0x0400;
+SDR_COM_118 = 0x0010;
+
+/*
+ * DRAM CTL Registers
+ */
+SDR_CTL_000 = 0x0300;
+SDR_SCTL = 0x0002;
+SDR_CTL_004 = 0x0002;
+SDR_SSTAT = 0x0003;
+SDR_CTL_008 = 0x0003;
+SDR_MCMD = 0x0800;
+SDR_CTL_040 = 0x0800;
+SDR_CMDSTAT = 0x;
+SDR_CMDSTATEN = 0x;
+SDR_MRRCFG0 = 0x;
+SDR_MRRSTAT0 = 0x;
+SDR_MRRSTAT1 = 0x;
+SDR_MCFG1 = 0x;
+SDR_MCFG = 0x00070061;
+SDR_CTL_080 = 0x00070061;
+SDR_PPCFG = 0x;
+SDR_MSTAT = 0x;
+SDR_LP2ZQCFG = 0xab0a560a;
+SDR_CTL_08C = 0xab0a560a;
+SDR_DTUSTAT = 0x;
+SDR_DTUNA = 0x;
+SDR_DTUNE = 0x;
+SDR_DTUPRD0 = 0x;
+SDR_DTUPRD1 = 0x;
+SDR_DTUPRD2 = 0x;
+SDR_DTUPRD3 = 0x;
+SDR_DTUAWDT = 0x02cb;
+SDR_CTL_0B0 = 0x02cb;
+SDR_TOGCNT1U = 0x0138;
+SDR_CTL_0C0 = 0x0138;
+SDR_CTL_0C4 = 0x00c8;
+SDR_TOGCNT100N = 0x001f;
+SDR_CTL_0CC = 0x001f;
+SDR_TREFI = 0x004e;
+SDR_CTL_0D0 = 0x004e;
+SDR_TMRD = 0x0004;
+SDR_CTL_0D4 = 0x0004;
+SDR_TRFC = 0x0073;
+SDR_CTL_0D8 = 0x0073;
+SDR_TRP = 0x0009;
+SDR_CTL_0DC = 0x0009;
+SDR_TRTW = 0x0002;
+SDR_CTL_0E0 = 0x0002;
+SDR_TAL = 0x;
+SDR_TCL = 0x0009;
+SDR_CTL_0E8 = 0x0009;
+SDR_TCWL = 0x0008;
+SDR_CTL_0EC = 0x0008;
+SDR_TRAS = 0x0012;
+SDR_CTL_0F0 = 0x0012;
+SDR_TRC = 0x0017;
+SDR_CTL_0F4 = 0x0017;
+SDR_TRCD = 0x0009;
+SDR_CTL_0F8 = 0x0009;
+SDR_TRRD = 0x0004;
+SDR_CTL_0FC = 0x0004;
+SDR_TRTP = 0x0004;
+SDR_CTL_100 = 0x0004;
+SDR_TWR = 0x0008;
+SDR_CTL_104 = 0x0008;
+SDR_TWTR = 0x0004;
+SDR_CTL_108 = 0x0004;
+SDR_TEXSR = 0x0200;
+SDR_CTL_10C = 0x0200;
+SDR_TXP = 0x0004;
+SDR_CTL_110 = 0x0004;
+SDR_TXPDLL = 0x000e;
+SDR_CTL_114 = 0x000e;
+SDR_TZQCS = 0x0040;
+SDR_CTL_118 = 0x0040;
+SDR_TZQCSI = 0x;
+SDR_TDQS = 0x0001;
+SDR_CTL_120 = 0x0001;
+SDR_TCKSRE = 0x0005;
+SDR_CTL_124 = 0x0005;
+SDR_TCKSRX = 0x0005;
+SDR_CTL_128 = 0x0005;
+SDR_TCKE = 0x0004;
+SDR_CTL_12C = 0x0004;
+SDR_TMOD = 0x000c;
+SDR_CTL_130 = 0x000c;
+SDR_TRSTL = 0x0050;
+SDR_CTL_134 = 0x0050;
+SDR_TZQCL = 0x0200;
+SDR_CTL_138 = 0x0200;
+SDR_TMRR = 0x0002;
+SDR_CTL_13C = 0x0002;
+SDR_TCKESR = 0x0005;
+SDR_CTL_140 = 0x0005;
+SDR_TDPD = 0x;
+SDR_CTL_180 = 0x0004;
+SDR_DTUWACTL = 0x;
+SDR_DTURACTL = 0x;
+SDR_DTUCFG = 0x;
+SDR_DTUECTL = 0x;
+SDR_DTUWD0 = 0x;
+SDR_DTUWD1 = 0x;
+SDR_DTUWD2 = 0x;
+SDR_DTUWD3 = 0x;
+SDR_DTUWDM = 0x;
+SDR_DTURD0 = 0x;
+SDR_DTURD1 = 0x;
+SDR_DTURD2 = 0x;
+SDR_DTURD3 = 0x;
+SDR_DTULFSRWD = 0x;
+SDR_DTULFSRRD = 0x;
+SDR_DTUEAF = 0x;
+SDR_DFITCTLDLY = 0x0002;
+SDR_CTL_240 = 0x0002;
+SDR_DFIODTCFG = 0x0008;
+SDR_CTL_244 = 0x0008;
+SDR_DFIODTCFG1 = 0x0606;
+SDR_CTL_248 = 0x0606;
+SDR_DFIODTRMAP = 0x0021;
+SDR_CTL_24C = 0x0021;
+SDR_DFITPHYWRD = 0x0001;
+SDR_CTL_250 = 0x0001;
+SDR_DFITPHYWRL = 0x0008;
+SDR_CTL_254 = 0x0008;
+SDR_DFITRDDEN = 0x0008;
+SDR_CTL_260 = 0x0008;
+SDR_DFITPHYRDL = 0x000f;
+SDR_CTL_264 = 0x000f;
+SDR_DFITPHYUPDTYPE0 = 0x0001;
+SDR_CTL_270 = 0x0001;
+SDR_DFITPHYUPDTYPE1 = 0x0010;
+SDR_CTL_274 = 0x0010;
+SDR_DFITPHYUPDTYPE2 = 0x0010;
+SDR_CTL_278 = 0x0010;
+SDR_DFITPHYUPDTYPE3 = 0x0010;
+SDR_CTL_27C = 0x0010;

[linux-sunxi] [PATCH] fex: a31: update mele a1000g

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image
A1000G_SDK12_DDR2G_V3.1.7_20140717. It contains only
a few changes but has been commented to aid readabilty.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele-a1000g-quad.fex | 2178 ++-
 1 file changed, 1409 insertions(+), 769 deletions(-)

diff --git a/sys_config/a31/mele-a1000g-quad.fex 
b/sys_config/a31/mele-a1000g-quad.fex
index c1996f4..b161ad4 100644
--- a/sys_config/a31/mele-a1000g-quad.fex
+++ b/sys_config/a31/mele-a1000g-quad.fex
@@ -1,903 +1,1543 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
 [product]
 version = 100
 machine = evb
 
 [platform]
-eraseflag = 1
-
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
 [target]
-boot_clock = 1008
-storage_type = -1
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
 
 [power_sply]
-dcdc1_vol = 3300
-dcdc2_vol = 1200
-dcdc3_vol = 1260
-dcdc4_vol = 1200
-dcdc5_vol = 1500
-aldo2_vol = 1800
-aldo3_vol = 3000
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1240
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
 
 [card_boot]
-logical_start = 40960
-sprite_gpio0 = port:PH131defaultdefault0
-sprite_work_delay = 500
-sprite_err_delay = 200
+logical_start   = 40960
+sprite_gpio0= port:PH131defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[mele_uboot]
+blue_light  = port:PH131defaultdefault1
 
 [card0_boot_para]
-card_ctrl = 0
+card_ctrl   = 0
 card_high_speed = 1
-card_line = 4
-sdc_d1 = port:PF0021defaultdefault
-sdc_d0 = port:PF0121defaultdefault
-sdc_clk = port:PF0221defaultdefault
-sdc_cmd = port:PF0321defaultdefault
-sdc_d3 = port:PF0421defaultdefault
-sdc_d2 = port:PF0521defaultdefault
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
 
 [card2_boot_para]
-card_ctrl = 2
+card_ctrl   = 2
 card_high_speed = 1
-card_line = 4
-sdc_cmd = port:PC0631defaultdefault
-sdc_clk = port:PC0731defaultdefault
-sdc_d0 = port:PC0831defaultdefault
-sdc_d1 = port:PC0931defaultdefault
-sdc_d2 = port:PC1031defaultdefault
-sdc_d3 = port:PC1131defaultdefault
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
 
 [twi_para]
-twi_port = 0
-twi_scl = port:PH142defaultdefaultdefault
-twi_sda = port:PH152defaultdefaultdefault
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
 
 [uart_para]
 uart_debug_port = 0
-uart_debug_tx = port:PH2021defaultdefault
-uart_debug_rx = port:PH2121defaultdefault
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
 
 [jtag_para]
-jtag_enable = 1
-jtag_ms = port:PH093defaultdefaultdefault
-jtag_ck = port:PH103defaultdefaultdefault
-jtag_do = port:PH113defaultdefaultdefault
-jtag_di = port:PH123defaultdefaultdefault
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
 
 [clock]
-pll3 = 297
-pll4 = 300
-pll6 = 600
-pll7 = 297
-pll8 = 

[linux-sunxi] [PATCH] fex: a31: add mele m9

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image
M9_V3.1.4.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele_m9.fex | 1475 
 1 file changed, 1475 insertions(+)
 create mode 100644 sys_config/a31/mele_m9.fex

diff --git a/sys_config/a31/mele_m9.fex b/sys_config/a31/mele_m9.fex
new file mode 100644
index 000..110843e
--- /dev/null
+++ b/sys_config/a31/mele_m9.fex
@@ -0,0 +1,1475 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
+[product]
+version = 100
+machine = evb
+
+[platform]
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
+[target]
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
+
+[power_sply]
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1200
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
+
+[card_boot]
+logical_start   = 40960
+sprite_gpio0= port:PH131defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[card0_boot_para]
+card_ctrl   = 0
+card_high_speed = 1
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
+
+[card2_boot_para]
+card_ctrl   = 2
+card_high_speed = 1
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
+
+[twi_para]
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
+
+[clock]
+pll3= 297
+pll4= 300
+pll6= 600
+pll7= 297
+pll8= 360
+pll9= 297
+pll10   = 702
+
+;*
+;sdram configuration
+;
+;*
+[dram_para]
+dram_clk= 312
+dram_type   = 3
+dram_zq = 0x78
+dram_odt_en = 0
+dram_para1  = 0x10F40800
+dram_para2  = 0x1211
+dram_mr0= 0x1A50
+dram_mr1= 0x4
+dram_mr2= 0x18
+dram_mr3= 0
+dram_tpr0   = 0
+dram_tpr1   = 0x8800
+dram_tpr2   = 0x39a70140
+dram_tpr3   = 0xa092e74c
+dram_tpr4   = 0x2948c209
+dram_tpr5   = 0x8944422c
+dram_tpr6   = 0x30028480
+dram_tpr7   = 0x2a3297
+dram_tpr8   = 0x5034fa8
+dram_tpr9   = 0x36353d8
+dram_tpr10  = 0
+dram_tpr11  = 0
+dram_tpr12  = 0
+dram_tpr13  = 0
+
+;--
+;os life cycle para configuration
+;--
+
+;-
+; if 1 == standby_mode, then support super standby;
+; else, support normal standby.

[linux-sunxi] [PATCH] fex: a31: add mele m8

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image.
M8_V3.1.4_overseas_20140314.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele_m8.fex | 1482 
 1 file changed, 1482 insertions(+)
 create mode 100644 sys_config/a31/mele_m8.fex

diff --git a/sys_config/a31/mele_m8.fex b/sys_config/a31/mele_m8.fex
new file mode 100644
index 000..11794eb
--- /dev/null
+++ b/sys_config/a31/mele_m8.fex
@@ -0,0 +1,1482 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
+[product]
+version = 100
+machine = evb
+
+[platform]
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
+[target]
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
+
+[power_sply]
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1200
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
+
+[card_boot]
+logical_start   = 40960
+sprite_gpio0= port:PH091defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[card0_boot_para]
+card_ctrl   = 0
+card_high_speed = 1
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
+
+[card2_boot_para]
+card_ctrl   = 2
+card_high_speed = 1
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
+
+[twi_para]
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
+
+[clock]
+pll3= 297
+pll4= 300
+pll6= 600
+pll7= 297
+pll8= 360
+pll9= 297
+pll10   = 702
+
+;*
+;sdram configuration
+;
+;*
+[dram_para]
+dram_clk= 312
+dram_type   = 3
+dram_zq = 0xfb
+dram_odt_en = 0
+dram_para1  = 0x10F40800
+dram_para2  = 0x1211
+dram_mr0= 0x1A50
+dram_mr1= 0x4
+dram_mr2= 0x18
+dram_mr3= 0
+dram_tpr0   = 0
+dram_tpr1   = 0x8800
+dram_tpr2   = 0x39a70140
+dram_tpr3   = 0xa092e74c
+dram_tpr4   = 0x2948c209
+dram_tpr5   = 0x8944422c
+dram_tpr6   = 0x30028480
+dram_tpr7   = 0x2a3297
+dram_tpr8   = 0x5034fa8
+dram_tpr9   = 0x36353d8
+dram_tpr10  = 0
+dram_tpr11  = 0
+dram_tpr12  = 0
+dram_tpr13  = 0
+
+;--
+;os life cycle para configuration
+;--
+
+;-
+; if 1 == standby_mode, then support super standby;
+; else, support normal standby.

[linux-sunxi] [PATCH] fex: a31: update mele a1000g

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image
A1000G_SDK12_DDR2G_V3.1.7_20140717. It contains only
a few changes but has been commented to aid readabilty.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele-a1000g-quad.fex | 2178 ++-
 1 file changed, 1409 insertions(+), 769 deletions(-)

diff --git a/sys_config/a31/mele-a1000g-quad.fex 
b/sys_config/a31/mele-a1000g-quad.fex
index c1996f4..b161ad4 100644
--- a/sys_config/a31/mele-a1000g-quad.fex
+++ b/sys_config/a31/mele-a1000g-quad.fex
@@ -1,903 +1,1543 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
 [product]
 version = 100
 machine = evb
 
 [platform]
-eraseflag = 1
-
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
 [target]
-boot_clock = 1008
-storage_type = -1
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
 
 [power_sply]
-dcdc1_vol = 3300
-dcdc2_vol = 1200
-dcdc3_vol = 1260
-dcdc4_vol = 1200
-dcdc5_vol = 1500
-aldo2_vol = 1800
-aldo3_vol = 3000
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1240
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
 
 [card_boot]
-logical_start = 40960
-sprite_gpio0 = port:PH131defaultdefault0
-sprite_work_delay = 500
-sprite_err_delay = 200
+logical_start   = 40960
+sprite_gpio0= port:PH131defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[mele_uboot]
+blue_light  = port:PH131defaultdefault1
 
 [card0_boot_para]
-card_ctrl = 0
+card_ctrl   = 0
 card_high_speed = 1
-card_line = 4
-sdc_d1 = port:PF0021defaultdefault
-sdc_d0 = port:PF0121defaultdefault
-sdc_clk = port:PF0221defaultdefault
-sdc_cmd = port:PF0321defaultdefault
-sdc_d3 = port:PF0421defaultdefault
-sdc_d2 = port:PF0521defaultdefault
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
 
 [card2_boot_para]
-card_ctrl = 2
+card_ctrl   = 2
 card_high_speed = 1
-card_line = 4
-sdc_cmd = port:PC0631defaultdefault
-sdc_clk = port:PC0731defaultdefault
-sdc_d0 = port:PC0831defaultdefault
-sdc_d1 = port:PC0931defaultdefault
-sdc_d2 = port:PC1031defaultdefault
-sdc_d3 = port:PC1131defaultdefault
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
 
 [twi_para]
-twi_port = 0
-twi_scl = port:PH142defaultdefaultdefault
-twi_sda = port:PH152defaultdefaultdefault
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
 
 [uart_para]
 uart_debug_port = 0
-uart_debug_tx = port:PH2021defaultdefault
-uart_debug_rx = port:PH2121defaultdefault
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
 
 [jtag_para]
-jtag_enable = 1
-jtag_ms = port:PH093defaultdefaultdefault
-jtag_ck = port:PH103defaultdefaultdefault
-jtag_do = port:PH113defaultdefaultdefault
-jtag_di = port:PH123defaultdefaultdefault
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
 
 [clock]
-pll3 = 297
-pll4 = 300
-pll6 = 600
-pll7 = 297
-pll8 = 

[linux-sunxi] [PATCH] fex: a31: add mele m9

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image
M9_V3.1.4.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele_m9.fex | 1475 
 1 file changed, 1475 insertions(+)
 create mode 100644 sys_config/a31/mele_m9.fex

diff --git a/sys_config/a31/mele_m9.fex b/sys_config/a31/mele_m9.fex
new file mode 100644
index 000..110843e
--- /dev/null
+++ b/sys_config/a31/mele_m9.fex
@@ -0,0 +1,1475 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
+[product]
+version = 100
+machine = evb
+
+[platform]
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
+[target]
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
+
+[power_sply]
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1200
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
+
+[card_boot]
+logical_start   = 40960
+sprite_gpio0= port:PH131defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[card0_boot_para]
+card_ctrl   = 0
+card_high_speed = 1
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
+
+[card2_boot_para]
+card_ctrl   = 2
+card_high_speed = 1
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
+
+[twi_para]
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
+
+[clock]
+pll3= 297
+pll4= 300
+pll6= 600
+pll7= 297
+pll8= 360
+pll9= 297
+pll10   = 702
+
+;*
+;sdram configuration
+;
+;*
+[dram_para]
+dram_clk= 312
+dram_type   = 3
+dram_zq = 0x78
+dram_odt_en = 0
+dram_para1  = 0x10F40800
+dram_para2  = 0x1211
+dram_mr0= 0x1A50
+dram_mr1= 0x4
+dram_mr2= 0x18
+dram_mr3= 0
+dram_tpr0   = 0
+dram_tpr1   = 0x8800
+dram_tpr2   = 0x39a70140
+dram_tpr3   = 0xa092e74c
+dram_tpr4   = 0x2948c209
+dram_tpr5   = 0x8944422c
+dram_tpr6   = 0x30028480
+dram_tpr7   = 0x2a3297
+dram_tpr8   = 0x5034fa8
+dram_tpr9   = 0x36353d8
+dram_tpr10  = 0
+dram_tpr11  = 0
+dram_tpr12  = 0
+dram_tpr13  = 0
+
+;--
+;os life cycle para configuration
+;--
+
+;-
+; if 1 == standby_mode, then support super standby;
+; else, support normal standby.

[linux-sunxi] [PATCH] fex: a31: add mele m8

2014-09-16 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

This fex was extracted from the latest vendor image.
M8_V3.1.4_overseas_20140314.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 sys_config/a31/mele_m8.fex | 1482 
 1 file changed, 1482 insertions(+)
 create mode 100644 sys_config/a31/mele_m8.fex

diff --git a/sys_config/a31/mele_m8.fex b/sys_config/a31/mele_m8.fex
new file mode 100644
index 000..11794eb
--- /dev/null
+++ b/sys_config/a31/mele_m8.fex
@@ -0,0 +1,1482 @@
+;A31 PAD application
+;-
+; 说明: 脚本中的字符串区分大小写,用户可以修改=后面的数值,但是不要修改前面的字符串
+; 描述gpio的形式:Port:端口+组内序号功能分配内部电阻状态驱动能力输出电平状态
+;-
+
+[product]
+version = 100
+machine = evb
+
+[platform]
+eraseflag   = 1
+;--
+;   system configuration
+;   ?
+;dcdc1_vol ---set dcdc1 
voltage,mV,1600-3400,100mV/step
+;dcdc2_vol ---set dcdc2 
voltage,mV,600-1540,20mV/step
+;dcdc3_vol ---set dcdc3 
voltage,mV,600-1860,20mV/step
+;dcdc4_vol ---set dcdc4 
voltage,mV,600-1540,20mV/step
+;dcdc5_vol ---set dcdc5 
voltage,mV,1000-2550,50mV/step
+;aldo2_vol ---set aldo2 
voltage,mV,700-3300,100mV/step
+;aldo3_vol ---set aldo3 
voltage,mV,700-3300,100mV/step
+;--
+[target]
+boot_clock = 1008
+storage_type= -1
+
+[boot_init_gpio]
+use=   1
+
+[power_sply]
+dcdc1_vol  = 3300
+dcdc2_vol  = 1200
+dcdc3_vol  = 1260
+dcdc4_vol  = 1200
+dcdc5_vol  = 1500
+aldo2_vol  = 1800
+aldo3_vol  = 3000
+
+[card_boot]
+logical_start   = 40960
+sprite_gpio0= port:PH091defaultdefault0
+sprite_work_delay= 500
+sprite_err_delay = 200
+
+[card0_boot_para]
+card_ctrl   = 0
+card_high_speed = 1
+card_line   = 4
+sdc_d1  = port:PF021defaultdefault
+sdc_d0  = port:PF121defaultdefault
+sdc_clk = port:PF221defaultdefault
+sdc_cmd = port:PF321defaultdefault
+sdc_d3  = port:PF421defaultdefault
+sdc_d2  = port:PF521defaultdefault
+
+[card2_boot_para]
+card_ctrl   = 2
+card_high_speed = 1
+card_line   = 4
+sdc_cmd = port:PC631defaultdefault
+sdc_clk = port:PC731defaultdefault
+sdc_d0  = port:PC831defaultdefault
+sdc_d1  = port:PC931defaultdefault
+sdc_d2  = port:PC1031defaultdefault
+sdc_d3  = port:PC1131defaultdefault
+
+[twi_para]
+twi_port= 0
+twi_scl = port:PH142defaultdefaultdefault
+twi_sda = port:PH152defaultdefaultdefault
+
+[uart_para]
+uart_debug_port = 0
+uart_debug_tx   = port:PH2021defaultdefault
+uart_debug_rx   = port:PH2121defaultdefault
+
+[jtag_para]
+jtag_enable = 0
+jtag_ms = port:PH93defaultdefaultdefault
+jtag_ck = port:PH103defaultdefaultdefault
+jtag_do = port:PH113defaultdefaultdefault
+jtag_di = port:PH123defaultdefaultdefault
+
+[clock]
+pll3= 297
+pll4= 300
+pll6= 600
+pll7= 297
+pll8= 360
+pll9= 297
+pll10   = 702
+
+;*
+;sdram configuration
+;
+;*
+[dram_para]
+dram_clk= 312
+dram_type   = 3
+dram_zq = 0xfb
+dram_odt_en = 0
+dram_para1  = 0x10F40800
+dram_para2  = 0x1211
+dram_mr0= 0x1A50
+dram_mr1= 0x4
+dram_mr2= 0x18
+dram_mr3= 0
+dram_tpr0   = 0
+dram_tpr1   = 0x8800
+dram_tpr2   = 0x39a70140
+dram_tpr3   = 0xa092e74c
+dram_tpr4   = 0x2948c209
+dram_tpr5   = 0x8944422c
+dram_tpr6   = 0x30028480
+dram_tpr7   = 0x2a3297
+dram_tpr8   = 0x5034fa8
+dram_tpr9   = 0x36353d8
+dram_tpr10  = 0
+dram_tpr11  = 0
+dram_tpr12  = 0
+dram_tpr13  = 0
+
+;--
+;os life cycle para configuration
+;--
+
+;-
+; if 1 == standby_mode, then support super standby;
+; else, support normal standby.

[linux-sunxi] [PATCH] ARM: sun6i: dt: Add new Mele I7 device

2015-02-28 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The Mele I7 is a Allwinner A31 based Android TV box, with 1G RAM,
8GB NAND flash, a RTL8188etv wifi chip, 3 USB Host ports using
USB-A receptacles, a micro USB-B receptacle for USB OTG, HDMI out,
a TRS connector for A/V, SPDIF and IrDA.

This patch adds basic support for the device, more information can
be found here (http://linux-sunxi.org/Mele_I7).

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun6i-a31-i7.dts | 150 +
 2 files changed, 151 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun6i-a31-i7.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index eae7706..8d9d5ea 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -532,6 +532,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \
sun6i-a31-app4-evb1.dtb \
sun6i-a31-colombus.dtb \
sun6i-a31-hummingbird.dtb \
+   sun6i-a31-i7.dtb \
sun6i-a31-m9.dtb \
sun6i-a31s-cs908.dtb
 dtb-$(CONFIG_MACH_SUN7I) += \
diff --git a/arch/arm/boot/dts/sun6i-a31-i7.dts 
b/arch/arm/boot/dts/sun6i-a31-i7.dts
new file mode 100644
index 000..43fdcd5
--- /dev/null
+++ b/arch/arm/boot/dts/sun6i-a31-i7.dts
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2015 Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun6i-a31.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Mele I7 Quad top set box;
+   compatible = mele,i7, allwinner,sun6i-a31;
+
+   chosen {
+   bootargs = earlyprintk console=ttyS0,115200;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_i7;
+
+   blue {
+   label = i7:blue:usr;
+   gpios = pio 7 13 GPIO_ACTIVE_HIGH;
+   };
+   };
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_mii_a;
+   phy = phy1;
+   phy-mode = mii;
+   status = okay;
+
+   phy1: ethernet-phy@1 {
+   reg = 1;
+   };
+};
+
+ir {
+   pinctrl-names = default;
+   pinctrl-0 = ir_pins_a;
+   status = okay;
+};
+
+mmc0 {
+   pinctrl-names = default;
+   pinctrl-0 = mmc0_pins_a, mmc0_cd_pin_i7;
+   vmmc-supply = reg_vcc3v3;
+   bus-width = 4;
+   cd-gpios = pio 7 22 GPIO_ACTIVE_HIGH; /* PH22 */
+   cd-inverted;
+   status = okay;
+};
+
+pio {
+   led_pins_i7: led_pins@0 {
+   allwinner,pins = PH13;
+   allwinner,function = gpio_out;
+ 

[linux-sunxi] [PATCH] sun7i: Add support for the MK808C board

2015-02-28 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The MK808C is a Allwinner based Android TV dongle.

It features a A20 SOC, 1G RAM, 8GB NAND, HDMI out, A/V out,
1 USB A, 1 USB mini OTG, Bluetooth and Wireless LAN.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 board/sunxi/MAINTAINERS  | 5 +
 configs/MK808C_defconfig | 9 +
 2 files changed, 14 insertions(+)
 create mode 100644 configs/MK808C_defconfig

diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
index 9a287d3..ead09c9 100644
--- a/board/sunxi/MAINTAINERS
+++ b/board/sunxi/MAINTAINERS
@@ -105,6 +105,11 @@ M: Ian Campbell i...@hellion.org.uk
 S: Maintained
 F: configs/Mele_M5_defconfig
 
+MK808C BOARD
+M: Marcus Cooper codekip...@gmail.com
+S: Maintained
+F: configs/MK808C_defconfig
+
 MSI-PRIMO73 BOARD
 M: Siarhei Siamashka siarhei.siamas...@gmail.com
 S: Maintained
diff --git a/configs/MK808C_defconfig b/configs/MK808C_defconfig
new file mode 100644
index 000..9048b9e
--- /dev/null
+++ b/configs/MK808C_defconfig
@@ -0,0 +1,9 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,USB_EHCI
+CONFIG_FDTFILE=sun7i-a20-mk808c.dtb
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_SUNXI=y
++S:CONFIG_MACH_SUN7I=y
++S:CONFIG_DRAM_CLK=384
++S:CONFIG_DRAM_ZQ=127
++S:CONFIG_DRAM_EMR1=4
-- 
2.3.1

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH] ARM: sun7i: dt: Add new MK808C device

2015-02-28 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The MK808C is an A20 based android stick, with 1G RAM, 8G NAND flash,
a RTL8723au wifi + bt combo chip, a USB host ports using USB-A receptacles,
a mini USB-B receptacle for USB OTG, mini HDMI and a TRS connector for AV.

This patch adds basic support for the device, more information can be found
here (http://linux-sunxi.org/MK808C).

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-mk808c.dts | 146 +
 2 files changed, 147 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-mk808c.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 9544768..eae7706 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -542,6 +542,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-hummingbird.dtb \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
+   sun7i-a20-mk808c.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-mk808c.dts 
b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
new file mode 100644
index 000..5722a03
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2015 Marcus Cooper
+ *
+ * Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = mk808c;
+   compatible = mk808c, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   serial1 = uart2;
+   };
+
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+i2c0 {
+   pinctrl-names = default;
+   pinctrl-0 = i2c0_pins_a;
+   status = okay;
+
+   axp209: pmic@34 {
+   compatible = x-powers,axp209;
+   reg = 0x34;
+   interrupt-parent = nmi_intc;
+   interrupts = 0 IRQ_TYPE_LEVEL_LOW;
+   interrupt-controller;
+   #interrupt-cells = 1;
+   };
+};
+
+i2c1 {
+   pinctrl-names = default;
+   pinctrl-0 = i2c1_pins_a;
+   status = okay;
+};
+
+i2c2 {
+   pinctrl-names = default;
+   pinctrl-0 = i2c2_pins_a;
+   status = okay;
+};
+
+mmc0 {
+   pinctrl-names = default;
+   pinctrl-0 = mmc0_pins_a, mmc0_cd_pin_reference_design;
+   vmmc-supply = reg_vcc3v0;
+   bus-width = 4;
+   cd-gpios = pio 7 1 GPIO_ACTIVE_HIGH; /* PH1 */
+   cd-inverted;
+   status = okay;
+};
+
+ohci0 {
+   status = okay;
+};
+
+ohci1 {
+   

[linux-sunxi] ARM: sunxi: dts: split IR pins for A10 and A20

2015-05-02 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Currently none of the target boards nor the driver supports
IR TX. However this pin is used in a few instances as a GPIO.
Split the pin ctrl descriptions so that only the IR RX is
configured to be used.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 arch/arm/boot/dts/sun4i-a10-a1000.dts |  2 +-
 arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts|  2 +-
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts|  2 +-
 arch/arm/boot/dts/sun4i-a10-hackberry.dts |  2 +-
 arch/arm/boot/dts/sun4i-a10-jesurun-q5.dts|  2 +-
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts|  4 ++--
 arch/arm/boot/dts/sun4i-a10.dtsi  | 22 ++
 arch/arm/boot/dts/sun7i-a20-bananapi.dts  |  2 +-
 arch/arm/boot/dts/sun7i-a20-bananapro.dts |  2 +-
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts   |  2 +-
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts|  2 +-
 arch/arm/boot/dts/sun7i-a20-hummingbird.dts   |  2 +-
 arch/arm/boot/dts/sun7i-a20-i12-tvbox.dts |  2 +-
 arch/arm/boot/dts/sun7i-a20-m3.dts|  2 +-
 arch/arm/boot/dts/sun7i-a20-orangepi-mini.dts |  2 +-
 arch/arm/boot/dts/sun7i-a20-orangepi.dts  |  2 +-
 arch/arm/boot/dts/sun7i-a20-pcduino3-nano.dts |  2 +-
 arch/arm/boot/dts/sun7i-a20-pcduino3.dts  |  2 +-
 arch/arm/boot/dts/sun7i-a20.dtsi  | 22 ++
 19 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts 
b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index f032814..57970d0 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -130,7 +130,7 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
diff --git a/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts 
b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
index 1a3c7dd..62e4b36 100644
--- a/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
+++ b/arch/arm/boot/dts/sun4i-a10-ba10-tvbox.dts
@@ -96,7 +96,7 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts 
b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 0ba67d7..db204b1 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -126,7 +126,7 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts 
b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index f443788..835eb30 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -93,7 +93,7 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
diff --git a/arch/arm/boot/dts/sun4i-a10-jesurun-q5.dts 
b/arch/arm/boot/dts/sun4i-a10-jesurun-q5.dts
index 1b0452f..4281782 100644
--- a/arch/arm/boot/dts/sun4i-a10-jesurun-q5.dts
+++ b/arch/arm/boot/dts/sun4i-a10-jesurun-q5.dts
@@ -126,7 +126,7 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts 
b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index 0f24914..132ace5 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -92,11 +92,11 @@
 
 ir0 {
pinctrl-names = default;
-   pinctrl-0 = ir0_pins_a;
+   pinctrl-0 = ir0_rx_pins_a;
status = okay;
 };
 
-ir0_pins_a {
+ir0_rx_pins_a {
/* The ir receiver is not always populated */
allwinner,pull = SUN4I_PINCTRL_PULL_UP;
 };
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 1d7fd68..7529857 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -797,15 +797,29 @@
allwinner,pull = SUN4I_PINCTRL_PULL_UP;
};
 
-   ir0_pins_a: ir0@0 {
-   allwinner,pins = PB3,PB4;
+   ir0_rx_pins_a: ir0@0 {
+   allwinner,pins = PB4;
allwinner,function = ir0;
allwinner,drive = SUN4I_PINCTRL_10_MA;
allwinner,pull = SUN4I_PINCTRL_NO_PULL;
};
 
-   ir1_pins_a: ir1@0 {
-   allwinner,pins = PB22,PB23;
+   ir0_tx_pins_a: ir0@1 {
+   allwinner,pins = PB3;
+   allwinner,function = ir0;
+   allwinner,drive = SUN4I_PINCTRL_10_MA;
+   

[linux-sunxi] [PATCH] sunxi: Add support for the Olimex A20 EVB

2015-08-19 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

---
 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/sun7i-a20-olinuxino-evb.dts | 233 +++
 board/sunxi/MAINTAINERS  |   5 +
 configs/A20-OLinuXino-EVB_defconfig  |  17 +++
 4 files changed, 256 insertions(+)
 create mode 100644 arch/arm/dts/sun7i-a20-olinuxino-evb.dts
 create mode 100644 configs/A20-OLinuXino-EVB_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d9a2f5f..dc9a500 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -120,6 +120,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-m3.dtb \
sun7i-a20-m5.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olinuxino-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/dts/sun7i-a20-olinuxino-evb.dts 
b/arch/arm/dts/sun7i-a20-olinuxino-evb.dts
new file mode 100644
index 000..a0071fa
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-olinuxino-evb.dts
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2015 - Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Olimex A20-OLinuXino-EVB;
+   compatible = olimex,a20-olinuxino-evb, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   };
+
+   chosen {
+   stdout-path = serial0:115200n8;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_olinuxinoevb;
+
+   green {
+   label = a20-olinuxino-evb:green:usr;
+   gpios = pio 7 2 GPIO_ACTIVE_HIGH;
+   default-state = on;
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = regulator-fixed;
+   regulator-name = axp-ipsout;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   regulator-always-on;
+   };
+};
+
+ahci {
+   target-supply = reg_ahci_5v;
+   status = okay;
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_rgmii_a;
+   phy = phy1;
+   phy-mode = rgmii;
+   status = okay;
+
+   phy1: ethernet-phy@1 {
+   reg = 1;
+   };
+};
+
+i2c0 {
+   pinctrl-names = default;
+   pinctrl-0 = i2c0_pins_a;
+   status = okay;
+
+   axp209: pmic@34 {
+   compatible = x-powers,axp209;
+   reg = 0x34;
+   interrupt-parent = nmi_intc;
+   interrupts = 0 IRQ_TYPE_LEVEL_LOW;
+
+   interrupt-controller;
+   #interrupt-cells = 1;
+
+  

[linux-sunxi][PATCH] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-08-19 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

This patch adds basic support for the device
https://www.olimex.com/Products/SOM/A20/A20-SOM-EVB/

More information on the SOM can be found here
http://linux-sunxi.org/Olimex_A20-SOM.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 arch/arm/boot/dts/Makefile|   1 +
 arch/arm/boot/dts/sun7i-a20-olinuxino-evb.dts | 233 ++
 2 files changed, 234 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olinuxino-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 6d7cec1..fdbda9b 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -613,6 +613,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
+   sun7i-a20-olinuxino-evb.dtb \
sun7i-a20-orangepi.dtb \
sun7i-a20-orangepi-mini.dtb \
sun7i-a20-pcduino3.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olinuxino-evb.dts
new file mode 100644
index 000..a0071fa
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-evb.dts
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2015 - Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Olimex A20-OLinuXino-EVB;
+   compatible = olimex,a20-olinuxino-evb, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   };
+
+   chosen {
+   stdout-path = serial0:115200n8;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_olinuxinoevb;
+
+   green {
+   label = a20-olinuxino-evb:green:usr;
+   gpios = pio 7 2 GPIO_ACTIVE_HIGH;
+   default-state = on;
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = regulator-fixed;
+   regulator-name = axp-ipsout;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   regulator-always-on;
+   };
+};
+
+ahci {
+   target-supply = reg_ahci_5v;
+   status = okay;
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_rgmii_a;
+   phy = phy1;
+   phy-mode = rgmii;
+   status = okay;
+
+   phy1: ethernet-phy@1 {
+   reg = 1;
+   };
+};
+

[linux-sunxi] [PATCH v2] pinctrl: sun4i: add spdif to pin description.

2015-08-12 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c 
b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
index 7376a97..862a096 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
@@ -135,7 +135,14 @@ static const struct sunxi_desc_pin sun4i_a10_pins[] = {
SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 3),
  SUNXI_FUNCTION(0x0, gpio_in),
  SUNXI_FUNCTION(0x1, gpio_out),
- SUNXI_FUNCTION(0x2, ir0)),  /* TX */
+ SUNXI_FUNCTION(0x2, ir0),   /* TX */
+   /*
+* The SPDIF block is not referenced at all in the A10 user
+* manual. However it is described in the code leaked and the
+* pin descriptions are declared in the A20 user manual which
+* is pin compatible with this device.
+*/
+ SUNXI_FUNCTION(0x4, spdif)),/* SPDIF MCLK */
SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 4),
  SUNXI_FUNCTION(0x0, gpio_in),
  SUNXI_FUNCTION(0x1, gpio_out),
@@ -176,11 +183,15 @@ static const struct sunxi_desc_pin sun4i_a10_pins[] = {
  SUNXI_FUNCTION(0x0, gpio_in),
  SUNXI_FUNCTION(0x1, gpio_out),
  SUNXI_FUNCTION(0x2, i2s),   /* DI */
- SUNXI_FUNCTION(0x3, ac97)), /* DI */
+ SUNXI_FUNCTION(0x3, ac97),  /* DI */
+   /* Undocumented mux function - See SPDIF MCLK above */
+ SUNXI_FUNCTION(0x4, spdif)),/* SPDIF IN */
SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 13),
  SUNXI_FUNCTION(0x0, gpio_in),
  SUNXI_FUNCTION(0x1, gpio_out),
- SUNXI_FUNCTION(0x2, spi2)), /* CS1 */
+ SUNXI_FUNCTION(0x2, spi2),  /* CS1 */
+   /* Undocumented mux function - See SPDIF MCLK above */
+ SUNXI_FUNCTION(0x4, spdif)),/* SPDIF OUT */
SUNXI_PIN(SUNXI_PINCTRL_PIN(B, 14),
  SUNXI_FUNCTION(0x0, gpio_in),
  SUNXI_FUNCTION(0x1, gpio_out),
-- 
2.5.0

-- 
You received this message because you are subscribed to the Google Groups 
linux-sunxi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2] sunxi: Add support for the Olimex A20 EVB

2015-08-26 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
Changes since v1:
- modified dtb to reflect changes in the kernel
---
 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/sun7i-a20-olimex-som-evb.dts | 244 ++
 board/sunxi/MAINTAINERS   |   5 +
 configs/A20-Olimex-SOM-EVB_defconfig  |  17 +++
 4 files changed, 267 insertions(+)
 create mode 100644 arch/arm/dts/sun7i-a20-olimex-som-evb.dts
 create mode 100644 configs/A20-Olimex-SOM-EVB_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d9a2f5f..731d3c1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -120,6 +120,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-m3.dtb \
sun7i-a20-m5.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..6904dbd
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2015 - Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Olimex A20-Olimex-SOM-EVB;
+   compatible = olimex,a20-olimex-som-evb, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   };
+
+   chosen {
+   stdout-path = serial0:115200n8;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_olimex_som_evb;
+
+   green {
+   label = a20-olimex-som-evb:green:usr;
+   gpios = pio 7 2 GPIO_ACTIVE_HIGH;
+   default-state = on;
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = regulator-fixed;
+   regulator-name = axp-ipsout;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   regulator-always-on;
+   };
+};
+
+ahci {
+   target-supply = reg_ahci_5v;
+   status = okay;
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_rgmii_a;
+   phy = phy1;
+   phy-mode = rgmii;
+   status = okay;
+
+   phy1: ethernet-phy@1 {
+   reg = 1;
+   };
+};
+
+i2c0 {
+   pinctrl-names = default;
+   pinctrl-0 = i2c0_pins_a;
+   status = okay;
+
+   axp209: pmic@34 {
+   reg = 0x34;
+   interrupt-parent = nmi_intc;
+   interrupts = 0 IRQ_TYPE_LEVEL_LOW;
+  

[linux-sunxi] [linux-next][PATCH v2] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-08-26 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

This patch adds basic support for the device
https://www.olimex.com/Products/SOM/A20/A20-SOM-EVB/

More information on the SOM can be found here
http://linux-sunxi.org/Olimex_A20-SOM.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
Changes since v1:
- renamed dts from sun7i-a20-olinuxino-evb to sun7i-a20-olimex-som-evb
- added axp209 dtsi
- change regulator settings
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 216 +
 2 files changed, 217 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f830e1f..e4e1d29 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -588,6 +588,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..36d1e77
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2015 - Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Olimex A20-Olimex-SOM-EVB;
+   compatible = olimex,a20-olimex-som-evb, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   };
+
+   chosen {
+   stdout-path = serial0:115200n8;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_olimex_som_evb;
+
+   green {
+   label = a20-olimex-som-evb:green:usr;
+   gpios = pio 7 2 GPIO_ACTIVE_HIGH;
+   default-state = on;
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = regulator-fixed;
+   regulator-name = axp-ipsout;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   regulator-always-on;
+   };
+};
+
+ahci {
+   target-supply = reg_ahci_5v;
+   status = okay;
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_rgmii_a;
+   

[linux-sunxi][PATCH v5] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-09-30 Thread codekipper
From: Marcus Cooper 

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

Signed-off-by: Marcus Cooper 
---
Changes since v4:
- removed reg_usb0_vbus which will return when usb otg is added.
Changes since v3:
- removed i2c1 as it's not used
- removed axp_ipsout regulator
Changes since v2:
- changed dcdc2 to have max voltage of 1.4V
Changes since v1:
- renamed dts from sun7i-a20-olinuxino-evb to sun7i-a20-olimex-som-evb
- added "axp209 dtsi"
- change regulator settings
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 198 +
 2 files changed, 199 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cce5468..19d39a9 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -619,6 +619,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..f6c37cd
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   model = "Olimex A20-Olimex-SOM-EVB";
+   compatible = "olimex,a20-olimex-som-evb", "allwinner,sun7i-a20";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_olimex_som_evb>;
+
+   green {
+   label = "a20-olimex-som-evb:green:usr";
+   gpios = < 7 2 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+};
+
+ {
+   target-supply = <_ahci_5v>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_rgmii_a>;
+   phy = <>;
+   phy-mode = "rgmii";
+   status = "okay";
+
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   

[linux-sunxi] [PATCH v2 4/4] ASOC: sunxi: Add support for the spdif block

2015-09-30 Thread codekipper
From: Marcus Cooper 

The sun4i, sun6i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i and sun7i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |  12 +
 sound/soc/sunxi/Makefile  |   4 +
 sound/soc/sunxi/sun4i-spdif.c | 612 ++
 3 files changed, 628 insertions(+)
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..2ebf43d 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,16 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SOC_SUNXI_DAI_SPDIF
+tristate
+   depends on OF
+select SND_SOC_GENERIC_DMAENGINE_PCM
+select REGMAP_MMIO
+
+config SND_SOC_SUNXI_MACHINE_SPDIF
+tristate "APB on-chip sun4i/sun5i/sun7i SPDIF"
+   depends on OF
+select SND_SOC_SUNXI_DAI_SPDIF
+help
+  Say Y if you want to add support for SoC S/PDIF audio as simple 
audio card.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..c8c0a00 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,6 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+snd-soc-sunxi-dai-spdif-objs := sun4i-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_DAI_SPDIF) += snd-soc-sunxi-dai-spdif.o
+snd-soc-sunxi-machine-spdif-objs := sunxi-machine-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_MACHINE_SPDIF) += snd-soc-sunxi-machine-spdif.o
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
new file mode 100644
index 000..5fff6f6
--- /dev/null
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -0,0 +1,612 @@
+/*
+ * ALSA SoC SPDIF Audio Layer
+ *
+ * Copyright 2015 Andrea Venturi 
+ * Copyright 2015 Marcus Cooper 
+ *
+ * Based on the Allwinner SDK driver, released under the GPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * this is SPDIF sun4i simple audio card DAI driver that uses the codec
+ * "dummy driver" as per sound/soc/fsl/imx-spdif.c
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineSUN4I_SPDIF_CTL (0x00)
+   #define SUN4I_SPDIF_CTL_MCLKDIV(v)  ((v) << 4) /* v even */
+   #define SUN4I_SPDIF_CTL_MCLKOUTEN   BIT(2)
+   #define SUN4I_SPDIF_CTL_GEN BIT(1)
+   #define SUN4I_SPDIF_CTL_RESET   BIT(0)
+
+#define SUN4I_SPDIF_TXCFG  (0x04)
+   #define SUN4I_SPDIF_TXCFG_SINGLEMOD BIT(31)
+   #define SUN4I_SPDIF_TXCFG_ASS   BIT(17)
+   #define SUN4I_SPDIF_TXCFG_NONAUDIO  BIT(16)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO(v)((v) << 4)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO_MASK  GENMASK(8, 4)
+   #define SUN4I_SPDIF_TXCFG_FMTRVDGENMASK(3, 2)
+   #define SUN4I_SPDIF_TXCFG_FMT16BIT  (0 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT20BIT  (1 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT24BIT  (2 << 2)
+   #define SUN4I_SPDIF_TXCFG_CHSTMODE  BIT(1)
+   #define SUN4I_SPDIF_TXCFG_TXEN  BIT(0)
+
+#define SUN4I_SPDIF_RXCFG  (0x08)
+   #define SUN4I_SPDIF_RXCFG_LOCKFLAG  BIT(4)
+   #define SUN4I_SPDIF_RXCFG_CHSTSRC   BIT(3)
+   #define SUN4I_SPDIF_RXCFG_CHSTCPBIT(1)
+   #define SUN4I_SPDIF_RXCFG_RXEN  BIT(0)
+
+#define SUN4I_SPDIF_TXFIFO (0x0C)
+
+#define SUN4I_SPDIF_RXFIFO (0x10)
+
+#define SUN4I_SPDIF_FCTL   (0x14)
+   #define SUN4I_SPDIF_FCTL_FIFOSRCBIT(31)
+   #define SUN4I_SPDIF_FCTL_FTXBIT(17)
+   #define SUN4I_SPDIF_FCTL_FRXBIT(16)
+   #define SUN4I_SPDIF_FCTL_TXTL(v)((v) << 8)
+   #define SUN4I_SPDIF_FCTL_TXTL_MASK  GENMASK(12, 8)
+   #define SUN4I_SPDIF_FCTL_RXTL(v)((v) << 3)
+   #define SUN4I_SPDIF_FCTL_RXTL_MASK  GENMASK(7, 3)
+   #define SUN4I_SPDIF_FCTL_TXIM   BIT(2)
+   #define 

[linux-sunxi] [PATCH v2 3/4] ASoC: sunxi: Add S/PDIF machine driver.

2015-09-30 Thread codekipper
From: Marcus Cooper 

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/sunxi-machine-spdif.c | 108 ++
 1 file changed, 108 insertions(+)
 create mode 100644 sound/soc/sunxi/sunxi-machine-spdif.c

diff --git a/sound/soc/sunxi/sunxi-machine-spdif.c 
b/sound/soc/sunxi/sunxi-machine-spdif.c
new file mode 100644
index 000..2adb727
--- /dev/null
+++ b/sound/soc/sunxi/sunxi-machine-spdif.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2015 Andrea Venturi 
+ * From code by (C) 2013 Freescale Semiconductor, Inc.
+ * (sound/soc/fsl/imx-spdif.c)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+struct sunxi_machine_spdif_data {
+   struct snd_soc_dai_link dai;
+   struct snd_soc_card card;
+};
+
+static int sunxi_machine_spdif_audio_probe(struct platform_device *pdev)
+{
+   struct device_node *spdif_np, *np = pdev->dev.of_node;
+   struct sunxi_machine_spdif_data *data;
+   int ret = 0;
+
+   dev_dbg(>dev, "%s: Looking for spdif-controller\n", __func__);
+   spdif_np = of_parse_phandle(np, "spdif-controller", 0);
+   if (!spdif_np) {
+   dev_err(>dev, "failed to find spdif-controller\n");
+   ret = -EINVAL;
+   goto end;
+   }
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   ret = -ENOMEM;
+   goto end;
+   }
+
+   data->dai.name = "S/PDIF PCM";
+   data->dai.stream_name = "S/PDIF PCM";
+   data->dai.codec_dai_name = "snd-soc-dummy-dai";
+   data->dai.codec_name = "snd-soc-dummy";
+   data->dai.cpu_of_node = spdif_np;
+   data->dai.platform_of_node = spdif_np;
+   data->dai.playback_only = true;
+   data->dai.capture_only = true;
+
+   if (of_property_read_bool(np, "spdif-out"))
+   data->dai.capture_only = false;
+
+   if (of_property_read_bool(np, "spdif-in"))
+   data->dai.playback_only = false;
+
+   if (data->dai.playback_only && data->dai.capture_only) {
+   dev_err(>dev, "no enabled S/PDIF DAI link\n");
+   goto end;
+   }
+
+   data->card.dev = >dev;
+   data->card.dai_link = >dai;
+   data->card.num_links = 1;
+   data->card.owner = THIS_MODULE;
+
+   ret = snd_soc_of_parse_card_name(>card, "model");
+   if (ret)
+   goto end;
+
+   ret = devm_snd_soc_register_card(>dev, >card);
+   if (ret) {
+   dev_err(>dev, "snd_soc_register_card failed: %d\n", ret);
+   goto end;
+   }
+
+   platform_set_drvdata(pdev, data);
+
+end:
+   of_node_put(spdif_np);
+
+   return ret;
+}
+
+static const struct of_device_id sunxi_machine_spdif_dt_ids[] = {
+   { .compatible = "allwinner,sunxi-audio-spdif", },
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sunxi_machine_spdif_dt_ids);
+
+static struct platform_driver sunxi_machine_spdif_driver = {
+   .driver = {
+   .name = "sunxi-machine-spdif",
+   .of_match_table = sunxi_machine_spdif_dt_ids,
+   },
+   .probe = sunxi_machine_spdif_audio_probe,
+};
+
+module_platform_driver(sunxi_machine_spdif_driver);
+
+MODULE_AUTHOR("Marcus Cooper ");
+MODULE_AUTHOR("Andrea Venturi, ");
+MODULE_DESCRIPTION("Allwinner sunxi S/PDIF machine driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 2/4] dt-binding: Add sunxi S/PDIF machine driver

2015-09-30 Thread codekipper
From: Marcus Cooper 

Add device tree bindings for the SPDIF machine driver for Allwinner SoC
devices.

Signed-off-by: Marcus Cooper 
---
 .../bindings/sound/sunxi-audio-spdif.txt   | 36 ++
 1 file changed, 36 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
new file mode 100644
index 000..b9e8152
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
@@ -0,0 +1,36 @@
+Allwinner audio complex with S/PDIF transceiver
+
+Required properties:
+
+  - compatible : "Allwinner,sunxi-audio-spdif"
+
+  - model  : The user-visible name of this sound complex
+
+  - spdif-controller   : The phandle of the Allwinner S/PDIF controller
+
+
+Optional properties:
+
+  - spdif-out  : This is a boolean property. If present, the
+ transmitting function of S/PDIF will be enabled,
+ indicating there's a physical S/PDIF out connector
+ or jack on the board or it's connecting to some
+ other IP block, such as an HDMI encoder or
+ display-controller.
+
+  - spdif-in   : This is a boolean property. If present, the receiving
+ function of S/PDIF will be enabled, indicating there
+ is a physical S/PDIF in connector/jack on the board.
+
+* Note: At least one of these two properties should be set in the DT binding.
+
+
+Example:
+
+sound-spdif {
+   compatible = "allwinner,sunxi-audio-spdif";
+   model = "sunxi-spdif";
+   spdif-controller = <>;
+   spdif-out;
+   spdif-in;
+};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 1/4] dt-bindings: add sunxi SPDIF transceiver bindings

2015-09-30 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10, A20 and A31 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../devicetree/bindings/sound/sunxi,spdif.txt  | 49 ++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/sunxi,spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi,spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi,spdif.txt
new file mode 100644
index 000..1868722
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi,spdif.txt
@@ -0,0 +1,49 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+- "allwinner,sun7i-a20-spdif": for the Allwinner A20 SoC
+- "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "audio"   clock from the audio pll.
+   "spdif"   clock for spdif controller.
+
+Optional:
+
+  - spdif-in   : Enable block for capturing an SPDIF signal.
+
+  - spdif-out  : Enable block for transmitting an SPDIF signal.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, < 0>, <_clk>;
+   clock-names = "apb", "audio", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   spdif-in = "disabled";
+   spdif-out = "okay";
+   status = "okay";
+};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v4] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-09-27 Thread codekipper
From: Marcus Cooper 

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

Signed-off-by: Marcus Cooper 
---
Changes since v3:
- removed i2c1 as it's not used
- removed axp_ipsout regulator
Changes since v2:
- changed dcdc2 to have max voltage of 1.4V
Changes since v1:
- renamed dts from sun7i-a20-olinuxino-evb to sun7i-a20-olimex-som-evb
- added "axp209 dtsi"
- change regulator settings
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 202 +
 2 files changed, 203 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 1c5f225..0e87a54 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -618,6 +618,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..3317c22
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   model = "Olimex A20-Olimex-SOM-EVB";
+   compatible = "olimex,a20-olimex-som-evb", "allwinner,sun7i-a20";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_olimex_som_evb>;
+
+   green {
+   label = "a20-olimex-som-evb:green:usr";
+   gpios = < 7 2 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+};
+
+ {
+   target-supply = <_ahci_5v>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_rgmii_a>;
+   phy = <>;
+   phy-mode = "rgmii";
+   status = "okay";
+
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };

[linux-sunxi][alsa-devel][PATCH 0/3]Add SPDIF support for Allwinner SoCs

2015-09-23 Thread codekipper
From: Marcus Cooper <codekip...@gmail.com>

This patch set adds support for the Allwinner SPDIF transceiver as present
on the A10, A20 and A31 SoC boards.

For now just the SPDIF transmitter has been tested on a Mele A2000.

In order for this patch set to be functional we require audio clock patches
which will be delivered separately. For those that are interested I've pushed
the patches here with all the required changes to get SPDIF audio out of the
device.

https://github.com/codekipper/linux-sunxi/commits/spdif_delivery

Thanks in advance,
CK

Marcus Cooper (3):
  dt-bindings: add sunxi SPDIF transceiver bindings
  dt-binding: Add sunxi SPDIF machine driver
  ASOC: sunxi: Add support for the spdif block

 .../devicetree/bindings/sound/sunxi,spdif.txt  |  49 ++
 .../bindings/sound/sunxi-audio-spdif.txt   |  36 +
 sound/soc/sunxi/Kconfig|  10 +
 sound/soc/sunxi/Makefile   |   4 +
 sound/soc/sunxi/sunxi-machine-spdif.c  | 110 +++
 sound/soc/sunxi/sunxi-spdif.c  | 801 +
 6 files changed, 1010 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/sunxi,spdif.txt
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
 create mode 100644 sound/soc/sunxi/sunxi-machine-spdif.c
 create mode 100644 sound/soc/sunxi/sunxi-spdif.c

-- 
2.5.3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][alsa-devel][PATCH 1/3] dt-bindings: add sunxi SPDIF transceiver bindings

2015-09-23 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10, A20 and A31 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../devicetree/bindings/sound/sunxi,spdif.txt  | 49 ++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/sunxi,spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi,spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi,spdif.txt
new file mode 100644
index 000..1868722
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi,spdif.txt
@@ -0,0 +1,49 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+- "allwinner,sun7i-a20-spdif": for the Allwinner A20 SoC
+- "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "audio"   clock from the audio pll.
+   "spdif"   clock for spdif controller.
+
+Optional:
+
+  - spdif-in   : Enable block for capturing an SPDIF signal.
+
+  - spdif-out  : Enable block for transmitting an SPDIF signal.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, < 0>, <_clk>;
+   clock-names = "apb", "audio", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   spdif-in = "disabled";
+   spdif-out = "okay";
+   status = "okay";
+};
-- 
2.5.3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][alsa-devel][PATCH 2/3] dt-binding: Add sunxi SPDIF machine driver

2015-09-23 Thread codekipper
From: Marcus Cooper 

Add device tree bindings for the SPDIF machine driver for Allwinner SoC
devices.

Signed-off-by: Marcus Cooper 
---
 .../bindings/sound/sunxi-audio-spdif.txt   | 36 ++
 1 file changed, 36 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
new file mode 100644
index 000..b9e8152
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi-audio-spdif.txt
@@ -0,0 +1,36 @@
+Allwinner audio complex with S/PDIF transceiver
+
+Required properties:
+
+  - compatible : "Allwinner,sunxi-audio-spdif"
+
+  - model  : The user-visible name of this sound complex
+
+  - spdif-controller   : The phandle of the Allwinner S/PDIF controller
+
+
+Optional properties:
+
+  - spdif-out  : This is a boolean property. If present, the
+ transmitting function of S/PDIF will be enabled,
+ indicating there's a physical S/PDIF out connector
+ or jack on the board or it's connecting to some
+ other IP block, such as an HDMI encoder or
+ display-controller.
+
+  - spdif-in   : This is a boolean property. If present, the receiving
+ function of S/PDIF will be enabled, indicating there
+ is a physical S/PDIF in connector/jack on the board.
+
+* Note: At least one of these two properties should be set in the DT binding.
+
+
+Example:
+
+sound-spdif {
+   compatible = "allwinner,sunxi-audio-spdif";
+   model = "sunxi-spdif";
+   spdif-controller = <>;
+   spdif-out;
+   spdif-in;
+};
-- 
2.5.3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][alsa-devel][PATCH 3/3] ASOC: sunxi: Add support for the spdif block

2015-09-24 Thread codekipper
From: Marcus Cooper 

The sun4i, sun6i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i and sun7i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |  10 +
 sound/soc/sunxi/Makefile  |   4 +
 sound/soc/sunxi/sunxi-machine-spdif.c | 110 +
 sound/soc/sunxi/sunxi-spdif.c | 801 ++
 4 files changed, 925 insertions(+)
 create mode 100644 sound/soc/sunxi/sunxi-machine-spdif.c
 create mode 100644 sound/soc/sunxi/sunxi-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..053db02 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,14 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SOC_SUNXI_DAI_SPDIF
+tristate
+select SND_SOC_GENERIC_DMAENGINE_PCM
+select REGMAP_MMIO
+
+config SND_SOC_SUNXI_MACHINE_SPDIF
+tristate "APB on-chip sun4i/sun5i/sun7i SPDIF"
+select SND_SOC_SUNXI_DAI_SPDIF
+help
+  Say Y if you want to add support for SoC S/PDIF audio as simple 
audio card.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..7849a75 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,6 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+snd-soc-sunxi-dai-spdif-objs := sunxi-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_DAI_SPDIF) += snd-soc-sunxi-dai-spdif.o
+snd-soc-sunxi-machine-spdif-objs := sunxi-machine-spdif.o
+obj-$(CONFIG_SND_SOC_SUNXI_MACHINE_SPDIF) += snd-soc-sunxi-machine-spdif.o
diff --git a/sound/soc/sunxi/sunxi-machine-spdif.c 
b/sound/soc/sunxi/sunxi-machine-spdif.c
new file mode 100644
index 000..f8f6bd8
--- /dev/null
+++ b/sound/soc/sunxi/sunxi-machine-spdif.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2015 Andrea Venturi 
+ * From code by (C) 2013 Freescale Semiconductor, Inc.
+ * (sound/soc/fsl/imx-spdif.c)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+struct sunxi_machine_spdif_data {
+   struct snd_soc_dai_link dai;
+   struct snd_soc_card card;
+};
+
+static int sunxi_machine_spdif_audio_probe(struct platform_device *pdev)
+{
+   struct device_node *spdif_np, *np = pdev->dev.of_node;
+   struct sunxi_machine_spdif_data *data;
+   int ret = 0;
+
+   dev_dbg(>dev, "%s: Looking for spdif-controller\n", __func__);
+   spdif_np = of_parse_phandle(np, "spdif-controller", 0);
+   if (!spdif_np) {
+   dev_err(>dev, "failed to find spdif-controller\n");
+   ret = -EINVAL;
+   goto end;
+   }
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   ret = -ENOMEM;
+   goto end;
+   }
+
+   data->dai.name = "S/PDIF PCM";
+   data->dai.stream_name = "S/PDIF PCM";
+   data->dai.codec_dai_name = "snd-soc-dummy-dai";
+   data->dai.codec_name = "snd-soc-dummy";
+   data->dai.cpu_of_node = spdif_np;
+   data->dai.platform_of_node = spdif_np;
+   data->dai.playback_only = true;
+   data->dai.capture_only = true;
+
+   if (of_property_read_bool(np, "spdif-out"))
+   data->dai.capture_only = false;
+
+   if (of_property_read_bool(np, "spdif-in"))
+   data->dai.playback_only = false;
+
+   if (data->dai.playback_only && data->dai.capture_only) {
+   dev_err(>dev, "no enabled S/PDIF DAI link\n");
+   goto end;
+   }
+
+   data->card.dev = >dev;
+   data->card.dai_link = >dai;
+   data->card.num_links = 1;
+   data->card.owner = THIS_MODULE;
+
+   ret = snd_soc_of_parse_card_name(>card, "model");
+   if (ret)
+   goto end;
+
+   ret = devm_snd_soc_register_card(>dev, >card);
+   if (ret) {
+   dev_err(>dev, "snd_soc_register_card failed: %d\n", ret);
+   goto end;
+   }
+
+   platform_set_drvdata(pdev, data);
+
+end:
+   of_node_put(spdif_np);
+
+   return ret;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id sunxi_machine_spdif_dt_ids[] = {
+   { .compatible = "allwinner,sunxi-audio-spdif", },
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sunxi_machine_spdif_dt_ids);

[linux-sunxi][PATCH v3] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-09-23 Thread codekipper
From: Marcus Cooper 

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

Signed-off-by: Marcus Cooper 
---
Changes since v2:
- changed dcdc2 to have max voltage of 1.4V
Changes since v1:
- renamed dts from sun7i-a20-olinuxino-evb to sun7i-a20-olimex-som-evb
- added "axp209 dtsi"
- change regulator settings
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 216 +
 2 files changed, 217 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 359dcb5..8419a3e 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -617,6 +617,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..41b4b4a
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   model = "Olimex A20-Olimex-SOM-EVB";
+   compatible = "olimex,a20-olimex-som-evb", "allwinner,sun7i-a20";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_olimex_som_evb>;
+
+   green {
+   label = "a20-olimex-som-evb:green:usr";
+   gpios = < 7 2 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = "regulator-fixed";
+   regulator-name = "axp-ipsout";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+};
+
+ {
+   target-supply = <_ahci_5v>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_rgmii_a>;
+   phy = <>;
+   phy-mode = "rgmii";
+   status = "okay";
+
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 

[linux-sunxi][PATCH 2/2] ARM: dts: sun7i: Add audio codec to Itead Ibox

2015-12-08 Thread codekipper
From: Marcus Cooper 

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts 
b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
index 90ff677..0950b59 100644
--- a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
@@ -70,6 +70,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_mii_a>;
-- 
2.6.3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 1/2] ARM: dts: sun7i: Add Itead Ibox support

2015-12-08 Thread codekipper
From: Marcus Cooper 

The Itead Ibox is a multi board device based on the Allwinner A20 SoC.
It contains the A20 Itead Core module and a base board for the external
interfaces.

The core module comes with 4GB NAND and 1GB DDR RAM.

The base board to which the core board is connected provides 3 USB 2.0 Host
ports, 1 USB 2.0 OTG, 1 uSD slot, 10/100 Ethernet port, HDMI, IR receiver,
SPDIF and a 32-pin GPIO header. This header expands the features of core
board by exposing the VGA pins, audio In/Out pins, SATA, SPI, I2C, UARTS,
USB-OTG and power.

As there is an A10 version of the Itead Core Module and at least one other
base board to support then this patch partitions the device tree files with
some consideration that these variants may be added later.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi|  83 ++
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts |  98 ++
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi | 111 +
 4 files changed, 293 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
 create mode 100644 arch/arm/boot/dts/sunxi-itead-core-common.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cc7309b..ee8a1dc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -637,6 +637,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-cubieboard2.dtb \
sun7i-a20-cubietruck.dtb \
sun7i-a20-hummingbird.dtb \
+   sun7i-a20-itead-ibox.dtb \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-icnova-swac.dtb \
sun7i-a20-m3.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi 
b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
new file mode 100644
index 000..b50be89
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun7i-a20.dtsi"
+#include "sunxi-itead-core-common.dtsi"
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-int-dll";
+};
+
+_ldo1 {
+   regulator-name = "vdd-rtc";
+};
+
+_ldo2 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "avcc";

[linux-sunxi][PATCH 0/2] ARM: dts: sun4i: mk802 variant patches

2015-12-08 Thread codekipper
From: Marcus Cooper 

This patch series splits the mk802 dts into common include file which
can be shared with the mk802+ device. The only difference that I can
see between this and the original device is that it has an internal
microphone.

With that in mind we can either leave things as they are and enable
the capture to the original mk802 dts or apply this patch to distinguish
between the two devices.

CK

Marcus Cooper (2):
  ARM: dts: sun4i: Create common dtsi for mk802
  ARM: dts: sun4i: Add rikomagic mk802+ board

 arch/arm/boot/dts/Makefile|   1 +
 arch/arm/boot/dts/sun4i-a10-mk802-1gb.dts |  50 ++
 arch/arm/boot/dts/sun4i-a10-mk802.dts |  64 +-
 arch/arm/boot/dts/sun4i-a10-mk802.dtsi| 108 ++
 4 files changed, 160 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-mk802-1gb.dts
 create mode 100644 arch/arm/boot/dts/sun4i-a10-mk802.dtsi

-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 1/2] ARM: dts: sun4i: Create common dtsi for mk802

2015-12-08 Thread codekipper
From: Marcus Cooper 

There are a few variants of the mk802 boards. This commit adds a
dtsi for the mk802 and modifies the original dts to reference it.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-mk802.dts  |  64 +--
 arch/arm/boot/dts/sun4i-a10-mk802.dtsi | 108 +
 2 files changed, 109 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-mk802.dtsi

diff --git a/arch/arm/boot/dts/sun4i-a10-mk802.dts 
b/arch/arm/boot/dts/sun4i-a10-mk802.dts
index 3c7eebe..fd2f7fb 100644
--- a/arch/arm/boot/dts/sun4i-a10-mk802.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mk802.dts
@@ -41,72 +41,10 @@
  */
 
 /dts-v1/;
-#include "sun4i-a10.dtsi"
-#include "sunxi-common-regulators.dtsi"
-#include 
+#include "sun4i-a10-mk802.dtsi"
 
 / {
model = "MK802";
compatible = "allwinner,mk802", "allwinner,sun4i-a10";
 
-   aliases {
-   serial0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>;
-   vmmc-supply = <_vcc3v3>;
-   bus-width = <4>;
-   cd-gpios = < 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
-   cd-inverted;
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   usb2_vbus_pin_mk802: usb2_vbus_pin@0 {
-   allwinner,pins = "PH12";
-   allwinner,function = "gpio_out";
-   allwinner,drive = ;
-   allwinner,pull = ;
-   };
-};
-
-_usb1_vbus {
-   status = "okay";
-};
-
-_usb2_vbus {
-   pinctrl-0 = <_vbus_pin_mk802>;
-   gpio = < 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
-   status = "okay";
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>;
-   status = "okay";
-};
-
- {
-   usb1_vbus-supply = <_usb1_vbus>;
-   usb2_vbus-supply = <_usb2_vbus>;
-   status = "okay";
 };
diff --git a/arch/arm/boot/dts/sun4i-a10-mk802.dtsi 
b/arch/arm/boot/dts/sun4i-a10-mk802.dtsi
new file mode 100644
index 000..422ef9c
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-mk802.dtsi
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2015 Hans de Goede 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+#include 
+
+/ {
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
+   cd-inverted;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   usb2_vbus_pin_mk802: usb2_vbus_pin@0 {
+   

[linux-sunxi][PATCH v2] ARM: sunxi: dt: enable audio codec on mk802

2015-12-19 Thread codekipper
From: Marcus Cooper 

This commit enables the on-chip audio codec present on some variants
of the MK802.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-mk802.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-mk802.dts 
b/arch/arm/boot/dts/sun4i-a10-mk802.dts
index 3c7eebe..ddf0683 100644
--- a/arch/arm/boot/dts/sun4i-a10-mk802.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mk802.dts
@@ -58,6 +58,10 @@
};
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
-- 
2.6.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2] ARM: dt: sun7i: Enable audio codec on MK808C

2015-12-19 Thread codekipper
From: Marcus Cooper 

This commit enables the on-chip audio codec present on the MK808C.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-mk808c.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-mk808c.dts 
b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
index 4f432f8..c9e648d 100644
--- a/arch/arm/boot/dts/sun7i-a20-mk808c.dts
+++ b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
@@ -68,6 +68,10 @@
};
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
-- 
2.6.4

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2 0/5] ARM: dt: sunxi: Add Itead Ibox support

2015-12-19 Thread codekipper
From: Marcus Cooper 

Hi All,

this patch series is an extension of the initial patch delivery for the
Itead Ibox as found here
https://groups.google.com/d/msg/linux-sunxi/GR_co3ObW8s/0BTPQljmAAAJ.

There seems to be a few Itead variants out there based on their A10/A20
core module and this patch series attempts to organise the device tree
files with some consideration that these variants may be added later.

I've also converted the A10 Itead Iteaduino dts to use these common files.
As I don't have this board to verify the changes I simply compared the
output of the fdtdump before and after applying these patches. The only
difference was the addition of codec support and a reduction to the dcdc2
max voltage.

BR,
CK

---
Changes since v1:
- Added audio codec.
- Seperated into individual patches
- added Itead A10 core dtsi
- modified sun4i-a10-itead-iteaduino-plus.dts to use itead common core dtsi

Marcus Cooper (5):
  ARM: dts: sunxi: Add sunxi-itead-core-common.dtsi
  ARM: dts: sun7i: Add Itead A20 Core support
  ARM: dts: sun7i: Add Itead Ibox support
  ARM: dts: sun4i: Add Itead A10 Core support
  ARM: dts: sun4i: Itead Iteaduino to use common code

 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi|  86 
 .../boot/dts/sun4i-a10-itead-iteaduino-plus.dts| 102 +-
 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi|  87 
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 111 
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi | 114 +
 6 files changed, 401 insertions(+), 100 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
 create mode 100644 arch/arm/boot/dts/sunxi-itead-core-common.dtsi

-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2 4/5] ARM: dts: sun4i: Add Itead A10 Core support

2015-12-19 Thread codekipper
From: Marcus Cooper 

The A10 Itead Core module comes with 4GB NAND and 1GB DDR RAM. All of the
I/O interfaces are exposed via 4 groups of 2*30 1mm pitched female headers.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi | 86 +
 1 file changed, 86 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi

diff --git a/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi 
b/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
new file mode 100644
index 000..97f653a
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun4i-a10.dtsi"
+#include "sunxi-itead-core-common.dtsi"
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-int-dll";
+};
+
+_ldo1 {
+   regulator-name = "vdd-rtc";
+};
+
+_ldo2 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "avcc";
+};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2 1/5] ARM: dts: sunxi: Add sunxi-itead-core-common.dtsi

2015-12-19 Thread codekipper
From: Marcus Cooper 

Itead have a core module board that can be populated with either
an Allwinner A10 or A20 SoC. This patch creates a common dtsi
which these boards can use.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi | 114 +
 1 file changed, 114 insertions(+)
 create mode 100644 arch/arm/boot/dts/sunxi-itead-core-common.dtsi

diff --git a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi 
b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
new file mode 100644
index 000..41449fa
--- /dev/null
+++ b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   target-supply = <_ahci_5v>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_ahci_5v {
+   pinctrl-0 = <_pwr_pin_a>;
+   gpio = < 1 8 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+};
+
+_usb1_vbus {
+   status = "okay";
+};
+
+_usb2_vbus {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+};
+
+ {
+   usb1_vbus-supply = <_usb1_vbus>;
+   usb2_vbus-supply = <_usb2_vbus>;
+   status = "okay";
+};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2 2/5] ARM: dts: sun7i: Add Itead A20 Core support

2015-12-19 Thread codekipper
From: Marcus Cooper 

The A20 Itead Core module comes with 4GB NAND and 1GB DDR RAM. All of the
I/O interfaces are exposed via 4 groups of 2*30 1mm pitched female headers.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi | 87 +
 1 file changed, 87 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi 
b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
new file mode 100644
index 000..db8c0f9
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun7i-a20.dtsi"
+#include "sunxi-itead-core-common.dtsi"
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-int-dll";
+};
+
+_ldo1 {
+   regulator-name = "vdd-rtc";
+};
+
+_ldo2 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "avcc";
+};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2 5/5] ARM: dts: sun4i: Itead Iteaduino to use common code

2015-12-19 Thread codekipper
From: Marcus Cooper 

Convert the Itead Iteaduino A10 to use the new common itead core dtsi.

Signed-off-by: Marcus Cooper 
---
 .../boot/dts/sun4i-a10-itead-iteaduino-plus.dts| 102 +
 1 file changed, 2 insertions(+), 100 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts 
b/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
index 985e155..86d7b7a 100644
--- a/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 Josef Gajdusek 
+ * Copyright 2015 - Marcus Cooper 
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -41,40 +42,11 @@
  */
 
 /dts-v1/;
-#include "sun4i-a10.dtsi"
-#include "sunxi-common-regulators.dtsi"
-
-#include 
-#include 
+#include "sun4i-a10-itead-core.dtsi"
 
 / {
model = "Iteaduino Plus A10";
compatible = "itead,iteaduino-plus-a10", "allwinner,sun4i-a10";
-
-   aliases {
-   serial0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-};
-
- {
-   target-supply = <_ahci_5v>;
-   status = "okay";
-};
-
- {
-   cpu-supply = <_dcdc2>;
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
 };
 
  {
@@ -88,17 +60,6 @@
status = "okay";
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>;
-   status = "okay";
-
-   axp209: pmic@34 {
-   reg = <0x34>;
-   interrupts = <0>;
-   };
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>;
@@ -135,68 +96,9 @@
status = "okay";
 };
 
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
-_ahci_5v {
-   status = "okay";
-};
-
-#include "axp209.dtsi"
-
-_dcdc2 {
-   regulator-always-on;
-   regulator-min-microvolt = <100>;
-   regulator-max-microvolt = <145>;
-   regulator-name = "vdd-cpu";
-};
-
-_dcdc3 {
-   regulator-always-on;
-   regulator-min-microvolt = <100>;
-   regulator-max-microvolt = <140>;
-   regulator-name = "vdd-int-dll";
-};
-
-_ldo1 {
-   regulator-name = "vdd-rtc";
-};
-
-_ldo2 {
-   regulator-always-on;
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
-   regulator-name = "avcc";
-};
-
-_usb1_vbus {
-   status = "okay";
-};
-
-_usb2_vbus {
-   status = "okay";
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>,
<_cs0_pins_a>;
status = "okay";
 };
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>;
-   status = "okay";
-};
-
- {
-   usb1_vbus-supply = <_usb1_vbus>;
-   usb2_vbus-supply = <_usb2_vbus>;
-   status = "okay";
-};
-- 
1.9.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v3 3/5] ARM: dts: sun7i: Add Itead Ibox support

2016-01-14 Thread codekipper
From: Marcus Cooper 

The Itead Ibox is a multi board device based on the Allwinner A20 SoC.
It contains the A20 Itead Core module and a base board for the external
interfaces.

The core module comes with 4GB NAND and 1GB DDR RAM.

The base board to which the core board is connected provides 3 USB 2.0 Host
ports, 1 USB 2.0 OTG, 1 uSD slot, 10/100 Ethernet port, HDMI, IR receiver,
SPDIF and a 32-pin GPIO header. This header expands the features of core
board by exposing the VGA pins, audio In/Out pins, SATA, SPI, I2C, UARTS,
USB-OTG and power.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 124 +
 2 files changed, 125 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index da910b2..5c5e8f4 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -638,6 +638,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-cubieboard2.dtb \
sun7i-a20-cubietruck.dtb \
sun7i-a20-hummingbird.dtb \
+   sun7i-a20-itead-ibox.dtb \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-icnova-swac.dtb \
sun7i-a20-m3.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts 
b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
new file mode 100644
index 000..66b8dec
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun7i-a20-itead-core.dtsi"
+
+/ {
+   model = "Itead Ibox A20";
+   compatible = "itead,itead_ibox_a20", "allwinner,sun7i-a20";
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_itead_core>;
+
+   green {
+   label = "itead_core:green:usr";
+   gpios = < 7 20 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+
+   blue {
+   label = "itead_core:blue:usr";
+   gpios = < 7 21 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+};
+
+ {
+   target-supply = <_ahci_5v>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_mii_a>;
+   phy = <>;
+   phy-mode = "mii";
+   status = "okay";
+
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rx_pins_a>;
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
+   cd-inverted;
+   status = "okay";

[linux-sunxi][PATCH v3 4/5] ARM: dts: sun4i: Add Itead A10 Core support

2016-01-14 Thread codekipper
From: Marcus Cooper 

The A10 Itead Core module comes with 4GB NAND and 1GB DDR RAM. All of the
I/O interfaces are exposed via 4 groups of 2*30 1mm pitched female headers.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi | 86 +
 1 file changed, 86 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi

diff --git a/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi 
b/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
new file mode 100644
index 000..97f653a
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun4i-a10.dtsi"
+#include "sunxi-itead-core-common.dtsi"
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-int-dll";
+};
+
+_ldo1 {
+   regulator-name = "vdd-rtc";
+};
+
+_ldo2 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "avcc";
+};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v3 1/5] ARM: dts: sunxi: Add sunxi-itead-core-common.dtsi

2016-01-14 Thread codekipper
From: Marcus Cooper 

Itead have a core module board that can be populated with either
an Allwinner A10 or A20 SoC. This patch creates a common dtsi
which these boards can use.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi | 99 ++
 1 file changed, 99 insertions(+)
 create mode 100644 arch/arm/boot/dts/sunxi-itead-core-common.dtsi

diff --git a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi 
b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
new file mode 100644
index 000..0074f7b
--- /dev/null
+++ b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_usb1_vbus {
+   status = "okay";
+};
+
+_usb2_vbus {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+};
+
+ {
+   usb1_vbus-supply = <_usb1_vbus>;
+   usb2_vbus-supply = <_usb2_vbus>;
+   status = "okay";
+};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v3 0/5] ARM: dt: sunxi: Add Itead Ibox support

2016-01-14 Thread codekipper
From: Marcus Cooper 

Hi All,

this patch series is an extension of the initial patch delivery for the
Itead Ibox as found here
https://groups.google.com/d/msg/linux-sunxi/GR_co3ObW8s/0BTPQljmAAAJ.

There seems to be a few Itead variants out there based on their A10/A20
core module and this patch series attempts to organise the device tree
files with some consideration that these variants may be added later.

I've also converted the A10 Itead Iteaduino dts to use these common files.
As I don't have this board to verify the changes I simply compared the
output of the fdtdump before and after applying these patches. The only
difference was the addition of codec support and a reduction to the dcdc2
max voltage.

BR,
CK

---
Changes since v2:
- removed duplicate naming
- moved enabling of some peripherals to board level.

Changes since v1:
- Added audio codec.
- Seperated into individual patches
- added Itead A10 core dtsi
- modified sun4i-a10-itead-iteaduino-plus.dts to use itead common core dtsi


Marcus Cooper (5):
  ARM: dts: sunxi: Add sunxi-itead-core-common.dtsi
  ARM: dts: sun7i: Add Itead A20 Core support
  ARM: dts: sun7i: Add Itead Ibox support
  ARM: dts: sun4i: Add Itead A10 Core support
  ARM: dts: sun4i: Itead Iteaduino to use common code

 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi|  86 ++
 .../boot/dts/sun4i-a10-itead-iteaduino-plus.dts|  93 +---
 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi|  87 +++
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 124 +
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi |  99 
 6 files changed, 399 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-itead-core.dtsi
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
 create mode 100644 arch/arm/boot/dts/sunxi-itead-core-common.dtsi

-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v3 5/5] ARM: dts: sun4i: Itead Iteaduino to use common code

2016-01-14 Thread codekipper
From: Marcus Cooper 

Convert the Itead Iteaduino A10 to use the new common itead core dtsi.

Signed-off-by: Marcus Cooper 
---
 .../boot/dts/sun4i-a10-itead-iteaduino-plus.dts| 93 +-
 1 file changed, 2 insertions(+), 91 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts 
b/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
index 985e155..b84eca3 100644
--- a/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-itead-iteaduino-plus.dts
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 Josef Gajdusek 
+ * Copyright 2015 - Marcus Cooper 
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -41,23 +42,11 @@
  */
 
 /dts-v1/;
-#include "sun4i-a10.dtsi"
-#include "sunxi-common-regulators.dtsi"
-
-#include 
-#include 
+#include "sun4i-a10-itead-core.dtsi"
 
 / {
model = "Iteaduino Plus A10";
compatible = "itead,iteaduino-plus-a10", "allwinner,sun4i-a10";
-
-   aliases {
-   serial0 = 
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
 };
 
  {
@@ -65,18 +54,6 @@
status = "okay";
 };
 
- {
-   cpu-supply = <_dcdc2>;
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>;
@@ -88,17 +65,6 @@
status = "okay";
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>;
-   status = "okay";
-
-   axp209: pmic@34 {
-   reg = <0x34>;
-   interrupts = <0>;
-   };
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>;
@@ -135,68 +101,13 @@
status = "okay";
 };
 
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
 _ahci_5v {
status = "okay";
 };
 
-#include "axp209.dtsi"
-
-_dcdc2 {
-   regulator-always-on;
-   regulator-min-microvolt = <100>;
-   regulator-max-microvolt = <145>;
-   regulator-name = "vdd-cpu";
-};
-
-_dcdc3 {
-   regulator-always-on;
-   regulator-min-microvolt = <100>;
-   regulator-max-microvolt = <140>;
-   regulator-name = "vdd-int-dll";
-};
-
-_ldo1 {
-   regulator-name = "vdd-rtc";
-};
-
-_ldo2 {
-   regulator-always-on;
-   regulator-min-microvolt = <300>;
-   regulator-max-microvolt = <300>;
-   regulator-name = "avcc";
-};
-
-_usb1_vbus {
-   status = "okay";
-};
-
-_usb2_vbus {
-   status = "okay";
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>,
<_cs0_pins_a>;
status = "okay";
 };
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins_a>;
-   status = "okay";
-};
-
- {
-   usb1_vbus-supply = <_usb1_vbus>;
-   usb2_vbus-supply = <_usb2_vbus>;
-   status = "okay";
-};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v3 2/5] ARM: dts: sun7i: Add Itead A20 Core support

2016-01-14 Thread codekipper
From: Marcus Cooper 

The A20 Itead Core module comes with 4GB NAND and 1GB DDR RAM. All of the
I/O interfaces are exposed via 4 groups of 2*30 1mm pitched female headers.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi | 87 +
 1 file changed, 87 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-itead-core.dtsi

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi 
b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
new file mode 100644
index 000..db8c0f9
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-itead-core.dtsi
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2015 - Marcus Cooper 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun7i-a20.dtsi"
+#include "sunxi-itead-core-common.dtsi"
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupt-parent = <_intc>;
+   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-cpu";
+};
+
+_dcdc3 {
+   regulator-always-on;
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <140>;
+   regulator-name = "vdd-int-dll";
+};
+
+_ldo1 {
+   regulator-name = "vdd-rtc";
+};
+
+_ldo2 {
+   regulator-always-on;
+   regulator-min-microvolt = <300>;
+   regulator-max-microvolt = <300>;
+   regulator-name = "avcc";
+};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH] ARM: dts: sun7i: Enable USB DRC on Itead Ibox

2016-02-08 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the Itead Ibox device.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 14 ++
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi |  9 +
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts 
b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
index 661c21d..a512581 100644
--- a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
@@ -118,8 +118,22 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
status = "okay";
 };
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>;
+   usb0_id_det-gpio = < 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi 
b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
index 2565d51..d22eea3 100644
--- a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
+++ b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
@@ -88,6 +88,10 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
 #include "axp209.dtsi"
 
 _dcdc2 {
@@ -129,6 +133,11 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v4 1/2] dt-bindings: sunxi :add sun4i SPDIF transceiver

2016-02-04 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10 and A20 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../bindings/sound/sunxi,sun4i-spdif.txt   | 39 ++
 1 file changed, 39 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
new file mode 100644
index 000..13503aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
@@ -0,0 +1,39 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+For now only playback is supported.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "spdif"   clock for spdif controller.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   status = "okay";
+};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v4 0/2] ASoC: Add SPDIF support for Allwinner SoCs

2016-02-04 Thread codekipper
From: Marcus Cooper <codekip...@gmail.com>

This patch set adds support for the Allwinner SPDIF transceiver.

For now just the SPDIF transmitter has been tested on a Mele A2000(A10)
and a Itead Ibox(A20).

In order for this patch set to be functional we require an audio clock patch
which will be delivered separately. For those that are interested I've pushed
the patches here with all the required changes to get SPDIF audio out of the
device.

https://github.com/codekipper/linux-sunxi/commits/spdif_delivery

Thanks in advance,
CK

---
Changes since v3:
- removed code required for spdif capture
- added disable/enable of apb clk to suspend/resume.
- removed unnecessary dt checks in probe
- fixed error conditions in probe/resume
- modified pm_runtime functionality(confirmed driver worked with PM disabled).
- removed .owner from platform driver
- renamed bindings file
 
Changes since v2:
- removed sunxi-machine-spdif and replaced with simple audio card
- removed untested compatibilities from device tree documentation
- added pm_runtime and remove shutdown
- removed pll2 as it's the parent of the spdif clock
- rename clk to spdif_clk
- removed enabling of mclk output
- removed interrupts status being cleared as it's not being used
- use default fifo settings for now
- fixed alignments for wrapped lines

Changes since v1:
- Moved sunxi-machine-spdif.c to separate patch
- replaced sunxi in naming scheme with sun4i in the sun4i-spdif driver.
- split tx controller into separate enable/disable functions
- moved setclk and setfmt functionality into hw params
- added support for mono signals.
- cleaned up probe clock set up.
- removed all writes to transmit status registers.
- removed of_id
- removed power management code.
- Added support for more rates.

Marcus Cooper (2):
  dt-bindings: sunxi :add sun4i SPDIF transceiver
  ASoC: sunxi: Add support for the SPDIF block

 .../bindings/sound/sunxi,sun4i-spdif.txt   |  39 ++
 sound/soc/sunxi/Kconfig|   8 +
 sound/soc/sunxi/Makefile   |   1 +
 sound/soc/sunxi/sun4i-spdif.c  | 561 +
 4 files changed, 609 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v4 2/2] ASoC: sunxi: Add support for the SPDIF block

2016-02-04 Thread codekipper
From: Marcus Cooper 

The sun4i, sun5i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |   8 +
 sound/soc/sunxi/Makefile  |   1 +
 sound/soc/sunxi/sun4i-spdif.c | 561 ++
 3 files changed, 570 insertions(+)
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..6af7224 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,12 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SUN4I_SPDIF
+tristate "Allwinner A10 SPDIF Support"
+   depends on OF
+select SND_SOC_GENERIC_DMAENGINE_PCM
+select REGMAP_MMIO
+help
+  Say Y or M to add support for the S/PDIF audio block in the Allwinner
+ A10 and affiliated SoCs.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..8f5e889 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
new file mode 100644
index 000..bb32344
--- /dev/null
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -0,0 +1,561 @@
+/*
+ * ALSA SoC SPDIF Audio Layer
+ *
+ * Copyright 2015 Andrea Venturi 
+ * Copyright 2015 Marcus Cooper 
+ *
+ * Based on the Allwinner SDK driver, released under the GPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineSUN4I_SPDIF_CTL (0x00)
+   #define SUN4I_SPDIF_CTL_MCLKDIV(v)  ((v) << 4) /* v even */
+   #define SUN4I_SPDIF_CTL_MCLKOUTEN   BIT(2)
+   #define SUN4I_SPDIF_CTL_GEN BIT(1)
+   #define SUN4I_SPDIF_CTL_RESET   BIT(0)
+
+#define SUN4I_SPDIF_TXCFG  (0x04)
+   #define SUN4I_SPDIF_TXCFG_SINGLEMOD BIT(31)
+   #define SUN4I_SPDIF_TXCFG_ASS   BIT(17)
+   #define SUN4I_SPDIF_TXCFG_NONAUDIO  BIT(16)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO(v)((v) << 4)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO_MASK  GENMASK(8, 4)
+   #define SUN4I_SPDIF_TXCFG_FMTRVDGENMASK(3, 2)
+   #define SUN4I_SPDIF_TXCFG_FMT16BIT  (0 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT20BIT  (1 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT24BIT  (2 << 2)
+   #define SUN4I_SPDIF_TXCFG_CHSTMODE  BIT(1)
+   #define SUN4I_SPDIF_TXCFG_TXEN  BIT(0)
+
+#define SUN4I_SPDIF_RXCFG  (0x08)
+   #define SUN4I_SPDIF_RXCFG_LOCKFLAG  BIT(4)
+   #define SUN4I_SPDIF_RXCFG_CHSTSRC   BIT(3)
+   #define SUN4I_SPDIF_RXCFG_CHSTCPBIT(1)
+   #define SUN4I_SPDIF_RXCFG_RXEN  BIT(0)
+
+#define SUN4I_SPDIF_TXFIFO (0x0C)
+
+#define SUN4I_SPDIF_RXFIFO (0x10)
+
+#define SUN4I_SPDIF_FCTL   (0x14)
+   #define SUN4I_SPDIF_FCTL_FIFOSRCBIT(31)
+   #define SUN4I_SPDIF_FCTL_FTXBIT(17)
+   #define SUN4I_SPDIF_FCTL_FRXBIT(16)
+   #define SUN4I_SPDIF_FCTL_TXTL(v)((v) << 8)
+   #define SUN4I_SPDIF_FCTL_TXTL_MASK  GENMASK(12, 8)
+   #define SUN4I_SPDIF_FCTL_RXTL(v)((v) << 3)
+   #define SUN4I_SPDIF_FCTL_RXTL_MASK  GENMASK(7, 3)
+   #define SUN4I_SPDIF_FCTL_TXIM   BIT(2)
+   #define SUN4I_SPDIF_FCTL_RXOM(v)((v) << 0)
+   #define SUN4I_SPDIF_FCTL_RXOM_MASK  GENMASK(1, 0)
+
+#define SUN4I_SPDIF_FSTA   (0x18)
+   #define SUN4I_SPDIF_FSTA_TXEBIT(14)
+   #define SUN4I_SPDIF_FSTA_TXECNTSHT  (8)
+   #define SUN4I_SPDIF_FSTA_RXABIT(6)
+   #define SUN4I_SPDIF_FSTA_RXACNTSHT  (0)
+
+#define SUN4I_SPDIF_INT(0x1C)

[linux-sunxi][PATCH] ARM: dts: sun7i: Enable USB DRC on Olimex A20 EVB

2016-02-08 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the Olimex A20 EVB.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
index c3c626b..93bbf26 100644
--- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -198,6 +198,10 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
  {
ahci_pwr_pin_olimex_som_evb: ahci_pwr_pin@1 {
allwinner,pins = "PC3";
@@ -219,6 +223,13 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
@@ -254,6 +265,10 @@
regulator-name = "avcc";
 };
 
+_usb0_vbus {
+   status = "okay";
+};
+
 _usb1_vbus {
status = "okay";
 };
@@ -268,7 +283,16 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>;
+   usb0_id_det-gpios = < 7 4 GPIO_ACTIVE_HIGH>; /* PH04 */
+   usb0_vbus-supply = <_usb0_vbus>;
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
status = "okay";
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v5 2/2] ASoC: sunxi: Add support for the SPDIF block

2016-02-08 Thread codekipper
From: Marcus Cooper 

The sun4i, sun5i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |   8 +
 sound/soc/sunxi/Makefile  |   1 +
 sound/soc/sunxi/sun4i-spdif.c | 549 ++
 3 files changed, 558 insertions(+)
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..ae42294 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,12 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SUN4I_SPDIF
+   tristate "Allwinner A10 SPDIF Support"
+   depends on OF
+   select SND_SOC_GENERIC_DMAENGINE_PCM
+   select REGMAP_MMIO
+   help
+ Say Y or M to add support for the S/PDIF audio block in the Allwinner
+ A10 and affiliated SoCs.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..8f5e889 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
new file mode 100644
index 000..85a58a7
--- /dev/null
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -0,0 +1,549 @@
+/*
+ * ALSA SoC SPDIF Audio Layer
+ *
+ * Copyright 2015 Andrea Venturi 
+ * Copyright 2015 Marcus Cooper 
+ *
+ * Based on the Allwinner SDK driver, released under the GPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineSUN4I_SPDIF_CTL (0x00)
+   #define SUN4I_SPDIF_CTL_MCLKDIV(v)  ((v) << 4) /* v even */
+   #define SUN4I_SPDIF_CTL_MCLKOUTEN   BIT(2)
+   #define SUN4I_SPDIF_CTL_GEN BIT(1)
+   #define SUN4I_SPDIF_CTL_RESET   BIT(0)
+
+#define SUN4I_SPDIF_TXCFG  (0x04)
+   #define SUN4I_SPDIF_TXCFG_SINGLEMOD BIT(31)
+   #define SUN4I_SPDIF_TXCFG_ASS   BIT(17)
+   #define SUN4I_SPDIF_TXCFG_NONAUDIO  BIT(16)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO(v)((v) << 4)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO_MASK  GENMASK(8, 4)
+   #define SUN4I_SPDIF_TXCFG_FMTRVDGENMASK(3, 2)
+   #define SUN4I_SPDIF_TXCFG_FMT16BIT  (0 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT20BIT  (1 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT24BIT  (2 << 2)
+   #define SUN4I_SPDIF_TXCFG_CHSTMODE  BIT(1)
+   #define SUN4I_SPDIF_TXCFG_TXEN  BIT(0)
+
+#define SUN4I_SPDIF_RXCFG  (0x08)
+   #define SUN4I_SPDIF_RXCFG_LOCKFLAG  BIT(4)
+   #define SUN4I_SPDIF_RXCFG_CHSTSRC   BIT(3)
+   #define SUN4I_SPDIF_RXCFG_CHSTCPBIT(1)
+   #define SUN4I_SPDIF_RXCFG_RXEN  BIT(0)
+
+#define SUN4I_SPDIF_TXFIFO (0x0C)
+
+#define SUN4I_SPDIF_RXFIFO (0x10)
+
+#define SUN4I_SPDIF_FCTL   (0x14)
+   #define SUN4I_SPDIF_FCTL_FIFOSRCBIT(31)
+   #define SUN4I_SPDIF_FCTL_FTXBIT(17)
+   #define SUN4I_SPDIF_FCTL_FRXBIT(16)
+   #define SUN4I_SPDIF_FCTL_TXTL(v)((v) << 8)
+   #define SUN4I_SPDIF_FCTL_TXTL_MASK  GENMASK(12, 8)
+   #define SUN4I_SPDIF_FCTL_RXTL(v)((v) << 3)
+   #define SUN4I_SPDIF_FCTL_RXTL_MASK  GENMASK(7, 3)
+   #define SUN4I_SPDIF_FCTL_TXIM   BIT(2)
+   #define SUN4I_SPDIF_FCTL_RXOM(v)((v) << 0)
+   #define SUN4I_SPDIF_FCTL_RXOM_MASK  GENMASK(1, 0)
+
+#define SUN4I_SPDIF_FSTA   (0x18)
+   #define SUN4I_SPDIF_FSTA_TXEBIT(14)
+   #define SUN4I_SPDIF_FSTA_TXECNTSHT  (8)
+   #define SUN4I_SPDIF_FSTA_RXABIT(6)
+   #define SUN4I_SPDIF_FSTA_RXACNTSHT  (0)
+
+#define SUN4I_SPDIF_INT(0x1C)
+

[linux-sunxi] [PATCH v5 0/2] ASoC: Add SPDIF support for Allwinner SoCs

2016-02-08 Thread codekipper
From: Marcus Cooper <codekip...@gmail.com>

This patch set adds support for the Allwinner SPDIF transceiver.

For now just the SPDIF transmitter has been tested on a Mele A2000(A10)
and a Itead Ibox(A20).

In order for this patch set to be functional we require an audio clock patch
which will be delivered separately. For those that are interested I've pushed
the patches here with all the required changes to get SPDIF audio out of the
device.

https://github.com/codekipper/linux-sunxi/commits/spdif_delivery

Thanks in advance,
CK

---
Changes since v4:
- corrected indentation issues
- removed old macros
- removed unnecessary enabling of apb clock

Changes since v3:
- removed code required for spdif capture
- added disable/enable of apb clk to suspend/resume.
- removed unnecessary dt checks in probe
- fixed error conditions in probe/resume
- modified pm_runtime functionality and confirmed that driver worked when PM 
was disabled.
- removed .owner from platform driver
- renamed bindings file

Changes since v2:
- removed sunxi-machine-spdif and replaced with simple audio card
- removed untested compatibilities from device tree documentation
- added pm_runtime and remove shutdown
- removed pll2 as it's the parent of the spdif clock
- rename clk to spdif_clk
- removed enabling of mclk output
- removed interrupts status being cleared as it's not being used
- use default fifo settings for now
- fixed alignments for wrapped lines

Changes since v1:
- Moved sunxi-machine-spdif.c to separate patch
- replaced sunxi in naming scheme with sun4i in the sun4i-spdif driver.
- split tx controller into separate enable/disable functions
- moved setclk and setfmt functionality into hw params
- added support for mono signals.
- cleaned up probe clock set up.
- removed all writes to transmit status registers.
- removed of_id
- removed power management code.
- Added support for more rates.

Marcus Cooper (2):
  dt-bindings: sunxi :add sun4i SPDIF transceiver
  ASoC: sunxi: Add support for the SPDIF block

 .../bindings/sound/sunxi,sun4i-spdif.txt   |  39 ++
 sound/soc/sunxi/Kconfig|   8 +
 sound/soc/sunxi/Makefile   |   1 +
 sound/soc/sunxi/sun4i-spdif.c  | 549 +
 4 files changed, 597 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v5 1/2] dt-bindings: sunxi :add sun4i SPDIF transceiver

2016-02-08 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10 and A20 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../bindings/sound/sunxi,sun4i-spdif.txt   | 39 ++
 1 file changed, 39 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
new file mode 100644
index 000..13503aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
@@ -0,0 +1,39 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+For now only playback is supported.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "spdif"   clock for spdif controller.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   status = "okay";
+};
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2] ARM: dts: sun7i: Enable USB DRC on Itead Ibox

2016-02-09 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the Itead Ibox device.

Note this board has the otg-vbus connected directly to the 5v-dcc of
the board, so there is no vbus0 regulator, nor vbus0-det.

Signed-off-by: Marcus Cooper 
---
Changes since v1:
- Added comment concerning vbus0 regulator and detection to commit message

---
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 14 ++
 arch/arm/boot/dts/sunxi-itead-core-common.dtsi |  9 +
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts 
b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
index 661c21d..a512581 100644
--- a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
@@ -118,8 +118,22 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
status = "okay";
 };
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>;
+   usb0_id_det-gpio = < 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi 
b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
index 2565d51..d22eea3 100644
--- a/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
+++ b/arch/arm/boot/dts/sunxi-itead-core-common.dtsi
@@ -88,6 +88,10 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
 #include "axp209.dtsi"
 
 _dcdc2 {
@@ -129,6 +133,11 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH] ARM: dts: sun7i: Enable USB DRC on MK808C

2016-02-09 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the MK808C.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-mk808c.dts | 35 ++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-mk808c.dts 
b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
index c9e648d..90ff4a2 100644
--- a/arch/arm/boot/dts/sun7i-a20-mk808c.dts
+++ b/arch/arm/boot/dts/sun7i-a20-mk808c.dts
@@ -53,6 +53,7 @@
 
 #include 
 #include 
+#include 
 
 / {
model = "mk808c";
@@ -125,6 +126,30 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
+ {
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
+   allwinner,pins = "PH5";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+};
+
+_usb0_vbus {
+   status = "okay";
+};
+
 _usb1_vbus {
status = "okay";
 };
@@ -145,7 +170,17 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>, <_vbus_detect_pin>;
+   usb0_id_det-gpios = < 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+   usb0_vbus_det-gpios = < 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+   usb0_vbus-supply = <_usb0_vbus>;
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
status = "okay";
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2] ARM: dts: sun7i: Enable USB DRC on Olimex A20 EVB

2016-02-09 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the Olimex A20 EVB.

Signed-off-by: Marcus Cooper 
---
Changes since v1:
- Added vbus0 regulator and vbus0 detection to dts 

---
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 32 ++
 1 file changed, 32 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
index c3c626b..23aacce 100644
--- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -198,6 +198,10 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
  {
ahci_pwr_pin_olimex_som_evb: ahci_pwr_pin@1 {
allwinner,pins = "PC3";
@@ -219,6 +223,20 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
+   allwinner,pins = "PH5";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
 };
 
 _ahci_5v {
@@ -254,6 +272,10 @@
regulator-name = "avcc";
 };
 
+_usb0_vbus {
+   status = "okay";
+};
+
 _usb1_vbus {
status = "okay";
 };
@@ -268,7 +290,17 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>, <_vbus_detect_pin>;
+   usb0_id_det-gpios = < 7 4 GPIO_ACTIVE_HIGH>; /* PH04 */
+   usb0_vbus_det-gpios = < 7 5 GPIO_ACTIVE_HIGH>; /* PH05 */
+   usb0_vbus-supply = <_usb0_vbus>;
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
status = "okay";
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v6 2/2] ASoC: sunxi: Add support for the SPDIF block

2016-02-08 Thread codekipper
From: Marcus Cooper 

The sun4i, sun5i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |   8 +
 sound/soc/sunxi/Makefile  |   1 +
 sound/soc/sunxi/sun4i-spdif.c | 550 ++
 3 files changed, 559 insertions(+)
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..ae42294 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,12 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SUN4I_SPDIF
+   tristate "Allwinner A10 SPDIF Support"
+   depends on OF
+   select SND_SOC_GENERIC_DMAENGINE_PCM
+   select REGMAP_MMIO
+   help
+ Say Y or M to add support for the S/PDIF audio block in the Allwinner
+ A10 and affiliated SoCs.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..8f5e889 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
new file mode 100644
index 000..0b04fb0
--- /dev/null
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -0,0 +1,550 @@
+/*
+ * ALSA SoC SPDIF Audio Layer
+ *
+ * Copyright 2015 Andrea Venturi 
+ * Copyright 2015 Marcus Cooper 
+ *
+ * Based on the Allwinner SDK driver, released under the GPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineSUN4I_SPDIF_CTL (0x00)
+   #define SUN4I_SPDIF_CTL_MCLKDIV(v)  ((v) << 4) /* v even */
+   #define SUN4I_SPDIF_CTL_MCLKOUTEN   BIT(2)
+   #define SUN4I_SPDIF_CTL_GEN BIT(1)
+   #define SUN4I_SPDIF_CTL_RESET   BIT(0)
+
+#define SUN4I_SPDIF_TXCFG  (0x04)
+   #define SUN4I_SPDIF_TXCFG_SINGLEMOD BIT(31)
+   #define SUN4I_SPDIF_TXCFG_ASS   BIT(17)
+   #define SUN4I_SPDIF_TXCFG_NONAUDIO  BIT(16)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO(v)((v) << 4)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO_MASK  GENMASK(8, 4)
+   #define SUN4I_SPDIF_TXCFG_FMTRVDGENMASK(3, 2)
+   #define SUN4I_SPDIF_TXCFG_FMT16BIT  (0 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT20BIT  (1 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT24BIT  (2 << 2)
+   #define SUN4I_SPDIF_TXCFG_CHSTMODE  BIT(1)
+   #define SUN4I_SPDIF_TXCFG_TXEN  BIT(0)
+
+#define SUN4I_SPDIF_RXCFG  (0x08)
+   #define SUN4I_SPDIF_RXCFG_LOCKFLAG  BIT(4)
+   #define SUN4I_SPDIF_RXCFG_CHSTSRC   BIT(3)
+   #define SUN4I_SPDIF_RXCFG_CHSTCPBIT(1)
+   #define SUN4I_SPDIF_RXCFG_RXEN  BIT(0)
+
+#define SUN4I_SPDIF_TXFIFO (0x0C)
+
+#define SUN4I_SPDIF_RXFIFO (0x10)
+
+#define SUN4I_SPDIF_FCTL   (0x14)
+   #define SUN4I_SPDIF_FCTL_FIFOSRCBIT(31)
+   #define SUN4I_SPDIF_FCTL_FTXBIT(17)
+   #define SUN4I_SPDIF_FCTL_FRXBIT(16)
+   #define SUN4I_SPDIF_FCTL_TXTL(v)((v) << 8)
+   #define SUN4I_SPDIF_FCTL_TXTL_MASK  GENMASK(12, 8)
+   #define SUN4I_SPDIF_FCTL_RXTL(v)((v) << 3)
+   #define SUN4I_SPDIF_FCTL_RXTL_MASK  GENMASK(7, 3)
+   #define SUN4I_SPDIF_FCTL_TXIM   BIT(2)
+   #define SUN4I_SPDIF_FCTL_RXOM(v)((v) << 0)
+   #define SUN4I_SPDIF_FCTL_RXOM_MASK  GENMASK(1, 0)
+
+#define SUN4I_SPDIF_FSTA   (0x18)
+   #define SUN4I_SPDIF_FSTA_TXEBIT(14)
+   #define SUN4I_SPDIF_FSTA_TXECNTSHT  (8)
+   #define SUN4I_SPDIF_FSTA_RXABIT(6)
+   #define SUN4I_SPDIF_FSTA_RXACNTSHT  (0)
+
+#define SUN4I_SPDIF_INT(0x1C)
+

[linux-sunxi] [PATCH v6 0/2] ASoC: Add SPDIF support for Allwinner SoCs

2016-02-08 Thread codekipper
From: Marcus Cooper <codekip...@gmail.com>

This patch set adds support for the Allwinner SPDIF transceiver.

For now just the SPDIF transmitter has been tested on a Mele A2000(A10)
and a Itead Ibox(A20).

In order for this patch set to be functional we require an audio clock patch
which will be delivered separately. For those that are interested I've pushed
the patches here with all the required changes to get SPDIF audio out of the
device.

https://github.com/codekipper/linux-sunxi/commits/spdif_delivery

Thanks in advance,
CK

---
Changes since v5:
- fixed warning that had sneaked in.'

Changes since v4:
- corrected indentation issues
- removed old macros
- removed unnecessary enabling of apb clock

Changes since v3:
- removed code required for spdif capture
- added disable/enable of apb clk to suspend/resume.
- removed unnecessary dt checks in probe
- fixed error conditions in probe/resume
- modified pm_runtime functionality and confirmed that driver worked when PM 
was disabled.
- removed .owner from platform driver
- renamed bindings file

Changes since v2:
- removed sunxi-machine-spdif and replaced with simple audio card
- removed untested compatibilities from device tree documentation
- added pm_runtime and remove shutdown
- removed pll2 as it's the parent of the spdif clock
- rename clk to spdif_clk
- removed enabling of mclk output
- removed interrupts status being cleared as it's not being used
- use default fifo settings for now
- fixed alignments for wrapped lines

Changes since v1:
- Moved sunxi-machine-spdif.c to separate patch
- replaced sunxi in naming scheme with sun4i in the sun4i-spdif driver.
- split tx controller into separate enable/disable functions
- moved setclk and setfmt functionality into hw params
- added support for mono signals.
- cleaned up probe clock set up.
- removed all writes to transmit status registers.
- removed of_id
- removed power management code.
- Added support for more rates.


Marcus Cooper (2):
  dt-bindings: sunxi :add sun4i SPDIF transceiver
  ASoC: sunxi: Add support for the SPDIF block

 .../bindings/sound/sunxi,sun4i-spdif.txt   |  39 ++
 sound/soc/sunxi/Kconfig|   8 +
 sound/soc/sunxi/Makefile   |   1 +
 sound/soc/sunxi/sun4i-spdif.c  | 550 +
 4 files changed, 598 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v6 1/2] dt-bindings: sunxi :add sun4i SPDIF transceiver

2016-02-08 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10 and A20 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../bindings/sound/sunxi,sun4i-spdif.txt   | 39 ++
 1 file changed, 39 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt 
b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
new file mode 100644
index 000..13503aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt
@@ -0,0 +1,39 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+For now only playback is supported.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "spdif"   clock for spdif controller.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   status = "okay";
+};
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH] ARM: dts: sun4i: Enable USB DRC on the MK8082

2016-02-12 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the MK8082.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-mk802.dts | 33 +
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-mk802.dts 
b/arch/arm/boot/dts/sun4i-a10-mk802.dts
index ddf0683..ee46ea8 100644
--- a/arch/arm/boot/dts/sun4i-a10-mk802.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mk802.dts
@@ -44,6 +44,7 @@
 #include "sun4i-a10.dtsi"
 #include "sunxi-common-regulators.dtsi"
 #include 
+#include 
 
 / {
model = "MK802";
@@ -84,7 +85,25 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
  {
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
+   allwinner,pins = "PH5";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
usb2_vbus_pin_mk802: usb2_vbus_pin@0 {
allwinner,pins = "PH12";
allwinner,function = "gpio_out";
@@ -93,6 +112,10 @@
};
 };
 
+_usb0_vbus {
+   status = "okay";
+};
+
 _usb1_vbus {
status = "okay";
 };
@@ -109,7 +132,17 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>, <_vbus_detect_pin>;
+   usb0_id_det-gpios = < 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+   usb0_vbus_det-gpios = < 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+   usb0_vbus-supply = <_usb0_vbus>;
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
status = "okay";
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH v2] ARM: dts: sun4i: Enable USB DRC on the MK802

2016-02-12 Thread codekipper
From: Marcus Cooper 

Enable the otg/drc usb controller on the MK802.

Signed-off-by: Marcus Cooper 
---
Changes since v1:
- Corrected name of the device in subject & description.
---
 arch/arm/boot/dts/sun4i-a10-mk802.dts | 33 +
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-mk802.dts 
b/arch/arm/boot/dts/sun4i-a10-mk802.dts
index ddf0683..ee46ea8 100644
--- a/arch/arm/boot/dts/sun4i-a10-mk802.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mk802.dts
@@ -44,6 +44,7 @@
 #include "sun4i-a10.dtsi"
 #include "sunxi-common-regulators.dtsi"
 #include 
+#include 
 
 / {
model = "MK802";
@@ -84,7 +85,25 @@
status = "okay";
 };
 
+_sram {
+   status = "okay";
+};
+
  {
+   usb0_id_detect_pin: usb0_id_detect_pin@0 {
+   allwinner,pins = "PH4";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
+   allwinner,pins = "PH5";
+   allwinner,function = "gpio_in";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
usb2_vbus_pin_mk802: usb2_vbus_pin@0 {
allwinner,pins = "PH12";
allwinner,function = "gpio_out";
@@ -93,6 +112,10 @@
};
 };
 
+_usb0_vbus {
+   status = "okay";
+};
+
 _usb1_vbus {
status = "okay";
 };
@@ -109,7 +132,17 @@
status = "okay";
 };
 
+_otg {
+   dr_mode = "otg";
+   status = "okay";
+};
+
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_id_detect_pin>, <_vbus_detect_pin>;
+   usb0_id_det-gpios = < 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+   usb0_vbus_det-gpios = < 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+   usb0_vbus-supply = <_usb0_vbus>;
usb1_vbus-supply = <_usb1_vbus>;
usb2_vbus-supply = <_usb2_vbus>;
status = "okay";
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 2/2] ASOC: sunxi: Add support for the SPDIF block

2016-02-02 Thread codekipper
From: Marcus Cooper 

The sun4i, sun5i and sun7i SoC families have an SPDIF
block which is capable of playback and capture.

This patch enables the playback of this block for
the sun4i families.

Signed-off-by: Marcus Cooper 
---
 sound/soc/sunxi/Kconfig   |   8 +
 sound/soc/sunxi/Makefile  |   1 +
 sound/soc/sunxi/sun4i-spdif.c | 586 ++
 3 files changed, 595 insertions(+)
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 84c72ec..6af7224 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -8,4 +8,12 @@ config SND_SUN4I_CODEC
  Select Y or M to add support for the Codec embedded in the Allwinner
  A10 and affiliated SoCs.
 
+config SND_SUN4I_SPDIF
+tristate "Allwinner A10 SPDIF Support"
+   depends on OF
+select SND_SOC_GENERIC_DMAENGINE_PCM
+select REGMAP_MMIO
+help
+  Say Y or M to add support for the S/PDIF audio block in the Allwinner
+ A10 and affiliated SoCs.
 endmenu
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index ea8a08c..8f5e889 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
 
+obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
new file mode 100644
index 000..16265b3
--- /dev/null
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -0,0 +1,586 @@
+/*
+ * ALSA SoC SPDIF Audio Layer
+ *
+ * Copyright 2015 Andrea Venturi 
+ * Copyright 2015 Marcus Cooper 
+ *
+ * Based on the Allwinner SDK driver, released under the GPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#defineSUN4I_SPDIF_CTL (0x00)
+   #define SUN4I_SPDIF_CTL_MCLKDIV(v)  ((v) << 4) /* v even */
+   #define SUN4I_SPDIF_CTL_MCLKOUTEN   BIT(2)
+   #define SUN4I_SPDIF_CTL_GEN BIT(1)
+   #define SUN4I_SPDIF_CTL_RESET   BIT(0)
+
+#define SUN4I_SPDIF_TXCFG  (0x04)
+   #define SUN4I_SPDIF_TXCFG_SINGLEMOD BIT(31)
+   #define SUN4I_SPDIF_TXCFG_ASS   BIT(17)
+   #define SUN4I_SPDIF_TXCFG_NONAUDIO  BIT(16)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO(v)((v) << 4)
+   #define SUN4I_SPDIF_TXCFG_TXRATIO_MASK  GENMASK(8, 4)
+   #define SUN4I_SPDIF_TXCFG_FMTRVDGENMASK(3, 2)
+   #define SUN4I_SPDIF_TXCFG_FMT16BIT  (0 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT20BIT  (1 << 2)
+   #define SUN4I_SPDIF_TXCFG_FMT24BIT  (2 << 2)
+   #define SUN4I_SPDIF_TXCFG_CHSTMODE  BIT(1)
+   #define SUN4I_SPDIF_TXCFG_TXEN  BIT(0)
+
+#define SUN4I_SPDIF_RXCFG  (0x08)
+   #define SUN4I_SPDIF_RXCFG_LOCKFLAG  BIT(4)
+   #define SUN4I_SPDIF_RXCFG_CHSTSRC   BIT(3)
+   #define SUN4I_SPDIF_RXCFG_CHSTCPBIT(1)
+   #define SUN4I_SPDIF_RXCFG_RXEN  BIT(0)
+
+#define SUN4I_SPDIF_TXFIFO (0x0C)
+
+#define SUN4I_SPDIF_RXFIFO (0x10)
+
+#define SUN4I_SPDIF_FCTL   (0x14)
+   #define SUN4I_SPDIF_FCTL_FIFOSRCBIT(31)
+   #define SUN4I_SPDIF_FCTL_FTXBIT(17)
+   #define SUN4I_SPDIF_FCTL_FRXBIT(16)
+   #define SUN4I_SPDIF_FCTL_TXTL(v)((v) << 8)
+   #define SUN4I_SPDIF_FCTL_TXTL_MASK  GENMASK(12, 8)
+   #define SUN4I_SPDIF_FCTL_RXTL(v)((v) << 3)
+   #define SUN4I_SPDIF_FCTL_RXTL_MASK  GENMASK(7, 3)
+   #define SUN4I_SPDIF_FCTL_TXIM   BIT(2)
+   #define SUN4I_SPDIF_FCTL_RXOM(v)((v) << 0)
+   #define SUN4I_SPDIF_FCTL_RXOM_MASK  GENMASK(1, 0)
+
+#define SUN4I_SPDIF_FSTA   (0x18)
+   #define SUN4I_SPDIF_FSTA_TXEBIT(14)
+   #define SUN4I_SPDIF_FSTA_TXECNTSHT  (8)
+   #define SUN4I_SPDIF_FSTA_RXABIT(6)
+   #define SUN4I_SPDIF_FSTA_RXACNTSHT  (0)
+
+#define SUN4I_SPDIF_INT(0x1C)

[linux-sunxi] [PATCH v3 1/2] dt-bindings: add sun4i SPDIF transceiver bindings

2016-02-02 Thread codekipper
From: Marcus Cooper 

Add devicetree bindings for the SPDIF transceiver found on
found on Allwinners A10 and A20 SoCs.

Signed-off-by: Marcus Cooper 
---
 .../devicetree/bindings/sound/sun4i,spdif.txt  | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/sun4i,spdif.txt

diff --git a/Documentation/devicetree/bindings/sound/sun4i,spdif.txt 
b/Documentation/devicetree/bindings/sound/sun4i,spdif.txt
new file mode 100644
index 000..55ed2f6
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sun4i,spdif.txt
@@ -0,0 +1,46 @@
+Allwinner Sony/Philips Digital Interface Format (S/PDIF) Controller
+
+The Allwinner S/PDIF audio block is a transceiver that allows the
+processor to receive and transmit digital audio via an coaxial cable or
+a fibre cable.
+
+Required properties:
+
+  - compatible : should be one of the following:
+- "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC
+
+  - reg: Offset and length of the register set for the 
device.
+
+  - interrupts : Contains the spdif interrupt.
+
+  - dmas   : Generic dma devicetree binding as described in
+ Documentation/devicetree/bindings/dma/dma.txt.
+
+  - dma-names  : Two dmas have to be defined, "tx" and "rx".
+
+  - clocks : Contains an entry for each entry in clock-names.
+
+  - clock-names: Includes the following entries:
+   "apb" clock for the spdif bus.
+   "spdif"   clock for spdif controller.
+
+Optional:
+
+  - spdif-in   : Enable block for capturing an SPDIF signal.
+
+  - spdif-out  : Enable block for transmitting an SPDIF signal.
+
+Example:
+
+spdif: spdif@01c21000 {
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   spdif-in = "disabled";
+   spdif-out = "okay";
+   status = "okay";
+};
-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 0/2] Add SPDIF support for Allwinner SoCs

2016-02-02 Thread codekipper
From: Marcus Cooper <codekip...@gmail.com>

This patch set adds support for the Allwinner SPDIF transceiver.

For now just the SPDIF transmitter has been tested on a Mele A2000(A10)
and a Itead Ibox(A20).

In order for this patch set to be functional we require an audio clock patch
which will be delivered separately. For those that are interested I've pushed
the patches here with all the required changes to get SPDIF audio out of the
device.

https://github.com/codekipper/linux-sunxi/commits/spdif_delivery

This is version 3 of the patch series. It's been quite a while since v2 and I'm
hoping now that all the previous comments have been acted on.

Thanks in advance,
CK

---
Changes since v2:
- removed sunxi-machine-spdif and replaced with simple audio card
- removed untested compatibilities from device tree documentation
- added pm_runtime and remove shutdown
- removed pll2 as it's the parent of the spdif clock
- rename clk to spdif_clk
- removed enabling of mclk output
- removed interrupts status being cleared as it's not being used
- use default fifo settings for now
- fixed alignments for wrapped lines

Changes since v1:
- Moved sunxi-machine-spdif.c to separate patch
- replaced sunxi in naming scheme with sun4i in the sun4i-spdif driver.
- split tx controller into separate enable/disable functions
- moved setclk and setfmt functionality into hw params
- added support for mono signals.
- cleaned up probe clock set up.
- removed all writes to transmit status registers.
- removed of_id
- removed power management code.
- Added support for more rates.

Marcus Cooper (2):
  dt-bindings: add sun4i SPDIF transceiver bindings
  ASOC: sunxi: Add support for the SPDIF block

 .../devicetree/bindings/sound/sun4i,spdif.txt  |  46 ++
 sound/soc/sunxi/Kconfig|   8 +
 sound/soc/sunxi/Makefile   |   1 +
 sound/soc/sunxi/sun4i-spdif.c  | 586 +
 4 files changed, 641 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/sun4i,spdif.txt
 create mode 100644 sound/soc/sunxi/sun4i-spdif.c

-- 
2.7.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 4/5] ARM: dts: sun4i: Add SPDIF to the Mele A1000

2016-02-27 Thread codekipper
From: Marcus Cooper 

Enable the S/PDIF transmitter that is present on the A1000.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10-a1000.dts | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts 
b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index 97570cb..aaf5605 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -87,6 +87,23 @@
enable-active-high;
gpio = < 7 15 GPIO_ACTIVE_HIGH>;
};
+
+   sound {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "On-board SPDIF";
+   simple-audio-card,cpu {
+   sound-dai = <>;
+   };
+
+   simple-audio-card,codec {
+   sound-dai = <_out>;
+   };
+   };
+
+   spdif_out: spdif-out {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   };
 };
 
  {
@@ -188,6 +205,12 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_tx_pins_a>;
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_a>;
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 1/5] clk: sunxi: mod1 clock should modify it's parent

2016-02-27 Thread codekipper
From: Andrea Venturi 

add CLK_SET_RATE_PARENT to modify the rate on clk upstream

Signed-off-by: Marcus Cooper 
---
 drivers/clk/sunxi/clk-a10-mod1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-a10-mod1.c b/drivers/clk/sunxi/clk-a10-mod1.c
index e9d870d..e2819fa 100644
--- a/drivers/clk/sunxi/clk-a10-mod1.c
+++ b/drivers/clk/sunxi/clk-a10-mod1.c
@@ -62,7 +62,7 @@ static void __init sun4i_mod1_clk_setup(struct device_node 
*node)
clk = clk_register_composite(NULL, clk_name, parents, i,
 >hw, _mux_ops,
 NULL, NULL,
->hw, _gate_ops, 0);
+>hw, _gate_ops, 
CLK_SET_RATE_PARENT);
if (IS_ERR(clk))
goto err_free_gate;
 
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 5/5] ARM: dts: sun7i: Add SPDIF to Itead Ibox

2016-02-27 Thread codekipper
From: Marcus Cooper 

Enable the S/PDIF transmitter that is present on the Itead Ibox.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts 
b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
index a512581..df76b74 100644
--- a/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
+++ b/arch/arm/boot/dts/sun7i-a20-itead-ibox.dts
@@ -65,6 +65,23 @@
default-state = "on";
};
};
+
+   sound {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "On-board SPDIF";
+   simple-audio-card,cpu {
+   sound-dai = <>;
+   };
+
+   simple-audio-card,codec {
+   sound-dai = <_out>;
+   };
+   };
+
+   spdif_out: spdif-out {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   };
 };
 
  {
@@ -131,6 +148,13 @@
status = "okay";
 };
 
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_tx_pins_a>;
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_id_detect_pin>;
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 3/5] ARM: dts: sunxi: Add the SPDIF to the A10 and A20

2016-02-27 Thread codekipper
From: Marcus Cooper 

Add the SPDIF transceiver controller and clock to the A10 and
A20 dtsi.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10.dtsi | 23 +++
 arch/arm/boot/dts/sun7i-a20.dtsi | 23 +++
 2 files changed, 46 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 0483640..83d46b2 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -477,6 +477,17 @@
clock-output-names = "ir1";
};
 
+   spdif_clk: clk@01c200c0 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-a10-mod1-clk";
+   reg = <0x01c200c0 0x4>;
+   clocks = < SUN4I_A10_PLL2_8X>,
+< SUN4I_A10_PLL2_4X>,
+< SUN4I_A10_PLL2_2X>,
+< SUN4I_A10_PLL2_1X>;
+   clock-output-names = "spdif";
+   };
+
usb_clk: clk@01c200cc {
#clock-cells = <1>;
#reset-cells = <1>;
@@ -1055,6 +1066,18 @@
status = "disabled";
};
 
+   spdif: spdif@01c21000 {
+   #sound-dai-cells = <0>;
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = <13>;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   status = "disabled";
+   };
+
ir0: ir@01c21800 {
compatible = "allwinner,sun4i-a10-ir";
clocks = <_gates 6>, <_clk>;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 7264d5e..4631660 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -476,6 +476,17 @@
clock-output-names = "ir1";
};
 
+   spdif_clk: clk@01c200c0 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-a10-mod1-clk";
+   reg = <0x01c200c0 0x4>;
+   clocks = < SUN4I_A10_PLL2_8X>,
+< SUN4I_A10_PLL2_4X>,
+< SUN4I_A10_PLL2_2X>,
+< SUN4I_A10_PLL2_1X>;
+   clock-output-names = "spdif";
+   };
+
keypad_clk: clk@01c200c4 {
#clock-cells = <0>;
compatible = "allwinner,sun4i-a10-mod0-clk";
@@ -1247,6 +1258,18 @@
status = "disabled";
};
 
+   spdif: spdif@01c21000 {
+   #sound-dai-cells = <0>;
+   compatible = "allwinner,sun4i-a10-spdif";
+   reg = <0x01c21000 0x40>;
+   interrupts = ;
+   clocks = <_gates 1>, <_clk>;
+   clock-names = "apb", "spdif";
+   dmas = < 0 2>, < 0 2>;
+   dma-names = "rx", "tx";
+   status = "disabled";
+   };
+
ir0: ir@01c21800 {
compatible = "allwinner,sun4i-a10-ir";
clocks = <_gates 6>, <_clk>;
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 2/5] ARM: dts :sunxi: Add SPDIF pins to A10 and A20

2016-02-27 Thread codekipper
From: Marcus Cooper 

Add the SPDIF pins to the A10 and A20 dtsi.

Signed-off-by: Marcus Cooper 
---
 arch/arm/boot/dts/sun4i-a10.dtsi | 21 +
 arch/arm/boot/dts/sun7i-a20.dtsi | 21 +
 2 files changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 2c8f5e6..0483640 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -1006,6 +1006,27 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   spdif_tx_pins_a: spdif@0 {
+   allwinner,pins = "PB13";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spdif_rx_pins_a: spdif@1 {
+   allwinner,pins = "PB12";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spdif_mclk_pins_a: spdif@2 {
+   allwinner,pins = "PB3";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
};
 
timer@01c20c00 {
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 0940a78..7264d5e 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1193,6 +1193,27 @@
allwinner,drive = ;
allwinner,pull = ;
};
+
+   spdif_tx_pins_a: spdif@0 {
+   allwinner,pins = "PB13";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spdif_rx_pins_a: spdif@1 {
+   allwinner,pins = "PB12";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
+
+   spdif_mclk_pins_a: spdif@2 {
+   allwinner,pins = "PB3";
+   allwinner,function = "spdif";
+   allwinner,drive = ;
+   allwinner,pull = ;
+   };
};
 
timer@01c20c00 {
-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi][PATCH 0/5] ARM: sunxi: Add SPDIF playback support

2016-02-27 Thread codekipper
From: Marcus Cooper 

Hi All,

now that the sun4i-spdif driver has made it into linux-next then this patch
series completes what is needed to have SPDIF working on both A10 and A20
devices.

Enjoy,
CK

Andrea Venturi (1):
  clk: sunxi: mod1 clock should modify it's parent

Marcus Cooper (4):
  ARM: dts :sunxi: Add SPDIF pins to A10 and A20
  ARM: dts: sunxi: Add the SPDIF to the A10 and A20
  ARM: dts: sun4i: Add SPDIF to the Mele A1000
  ARM: dts: sun7i: Add SPDIF to Itead Ibox

 arch/arm/boot/dts/sun4i-a10-a1000.dts  | 23 
 arch/arm/boot/dts/sun4i-a10.dtsi   | 44 ++
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 24 
 arch/arm/boot/dts/sun7i-a20.dtsi   | 44 ++
 drivers/clk/sunxi/clk-a10-mod1.c   |  2 +-
 5 files changed, 136 insertions(+), 1 deletion(-)

-- 
2.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   >