Commit f086ba9d authored by Peter Rosin's avatar Peter Rosin Committed by Mark Brown

ASoC: pcm512x: Support mastering BCLK/LRCLK using the PLL

Using the PLL in master mode requires using an external connection
between one of the GPIO pins (configured as PLL/4 output) and the
SCK pin. It also requires the external clock to be fed to some other
GPIO pin instead of the SCK pin.

This is described for the PCM5122 chip in the answers to the forum post
"PCM5122 DAC as I2S master troubles with PLL mode" at the TI E2E
community pages (1). The clocking functionality is also much better
described in the datasheet for the chip PCM5242, which seems to be
register compatible with PCM512x and PCM514x (which both have severely
lacking datasheets).

(1) http://e2e.ti.com/support/data_converters/audio_converters/f/64/t/267830Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 81249307
...@@ -17,9 +17,16 @@ Required properties: ...@@ -17,9 +17,16 @@ Required properties:
Optional properties: Optional properties:
- clocks : A clock specifier for the clock connected as SCLK. If this - clocks : A clock specifier for the clock connected as SCLK. If this
is absent the device will be configured to clock from BCLK. is absent the device will be configured to clock from BCLK. If pll-in
and pll-out are specified in addition to a clock, the device is
configured to accept clock input on a specified gpio pin.
Example: - pll-in, pll-out : gpio pins used to connect the pll using <1>
through <6>. The device will be configured for clock input on the
given pll-in pin and PLL output on the given pll-out pin. An
external connection from the pll-out pin to the SCLK pin is assumed.
Examples:
pcm5122: pcm5122@4c { pcm5122: pcm5122@4c {
compatible = "ti,pcm5122"; compatible = "ti,pcm5122";
...@@ -29,3 +36,17 @@ Example: ...@@ -29,3 +36,17 @@ Example:
DVDD-supply = <&reg_1v8>; DVDD-supply = <&reg_1v8>;
CPVDD-supply = <&reg_3v3>; CPVDD-supply = <&reg_3v3>;
}; };
pcm5142: pcm5142@4c {
compatible = "ti,pcm5142";
reg = <0x4c>;
AVDD-supply = <&reg_3v3_analog>;
DVDD-supply = <&reg_1v8>;
CPVDD-supply = <&reg_3v3>;
clocks = <&sck>;
pll-in = <3>;
pll-out = <6>;
};
This diff is collapsed.
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define PCM512x_MASTER_MODE (PCM512x_PAGE_BASE(0) + 12) #define PCM512x_MASTER_MODE (PCM512x_PAGE_BASE(0) + 12)
#define PCM512x_PLL_REF (PCM512x_PAGE_BASE(0) + 13) #define PCM512x_PLL_REF (PCM512x_PAGE_BASE(0) + 13)
#define PCM512x_DAC_REF (PCM512x_PAGE_BASE(0) + 14) #define PCM512x_DAC_REF (PCM512x_PAGE_BASE(0) + 14)
#define PCM512x_GPIO_PLLIN (PCM512x_PAGE_BASE(0) + 18)
#define PCM512x_SYNCHRONIZE (PCM512x_PAGE_BASE(0) + 19) #define PCM512x_SYNCHRONIZE (PCM512x_PAGE_BASE(0) + 19)
#define PCM512x_PLL_COEFF_0 (PCM512x_PAGE_BASE(0) + 20) #define PCM512x_PLL_COEFF_0 (PCM512x_PAGE_BASE(0) + 20)
#define PCM512x_PLL_COEFF_1 (PCM512x_PAGE_BASE(0) + 21) #define PCM512x_PLL_COEFF_1 (PCM512x_PAGE_BASE(0) + 21)
...@@ -79,6 +80,7 @@ ...@@ -79,6 +80,7 @@
#define PCM512x_RATE_DET_2 (PCM512x_PAGE_BASE(0) + 92) #define PCM512x_RATE_DET_2 (PCM512x_PAGE_BASE(0) + 92)
#define PCM512x_RATE_DET_3 (PCM512x_PAGE_BASE(0) + 93) #define PCM512x_RATE_DET_3 (PCM512x_PAGE_BASE(0) + 93)
#define PCM512x_RATE_DET_4 (PCM512x_PAGE_BASE(0) + 94) #define PCM512x_RATE_DET_4 (PCM512x_PAGE_BASE(0) + 94)
#define PCM512x_CLOCK_STATUS (PCM512x_PAGE_BASE(0) + 95)
#define PCM512x_ANALOG_MUTE_DET (PCM512x_PAGE_BASE(0) + 108) #define PCM512x_ANALOG_MUTE_DET (PCM512x_PAGE_BASE(0) + 108)
#define PCM512x_GPIN (PCM512x_PAGE_BASE(0) + 119) #define PCM512x_GPIN (PCM512x_PAGE_BASE(0) + 119)
#define PCM512x_DIGITAL_MUTE_DET (PCM512x_PAGE_BASE(0) + 120) #define PCM512x_DIGITAL_MUTE_DET (PCM512x_PAGE_BASE(0) + 120)
...@@ -93,7 +95,10 @@ ...@@ -93,7 +95,10 @@
#define PCM512x_CRAM_CTRL (PCM512x_PAGE_BASE(44) + 1) #define PCM512x_CRAM_CTRL (PCM512x_PAGE_BASE(44) + 1)
#define PCM512x_MAX_REGISTER (PCM512x_PAGE_BASE(44) + 1) #define PCM512x_FLEX_A (PCM512x_PAGE_BASE(253) + 63)
#define PCM512x_FLEX_B (PCM512x_PAGE_BASE(253) + 64)
#define PCM512x_MAX_REGISTER (PCM512x_PAGE_BASE(253) + 64)
/* Page 0, Register 1 - reset */ /* Page 0, Register 1 - reset */
#define PCM512x_RSTR (1 << 0) #define PCM512x_RSTR (1 << 0)
...@@ -121,6 +126,14 @@ ...@@ -121,6 +126,14 @@
#define PCM512x_DEMP (1 << 4) #define PCM512x_DEMP (1 << 4)
#define PCM512x_DEMP_SHIFT 4 #define PCM512x_DEMP_SHIFT 4
/* Page 0, Register 8 - GPIO output enable */
#define PCM512x_G1OE (1 << 0)
#define PCM512x_G2OE (1 << 1)
#define PCM512x_G3OE (1 << 2)
#define PCM512x_G4OE (1 << 3)
#define PCM512x_G5OE (1 << 4)
#define PCM512x_G6OE (1 << 5)
/* Page 0, Register 9 - BCK, LRCLK configuration */ /* Page 0, Register 9 - BCK, LRCLK configuration */
#define PCM512x_LRKO (1 << 0) #define PCM512x_LRKO (1 << 0)
#define PCM512x_LRKO_SHIFT 0 #define PCM512x_LRKO_SHIFT 0
...@@ -150,6 +163,16 @@ ...@@ -150,6 +163,16 @@
#define PCM512x_SDAC_SCK (3 << 4) #define PCM512x_SDAC_SCK (3 << 4)
#define PCM512x_SDAC_BCK (4 << 4) #define PCM512x_SDAC_BCK (4 << 4)
/* Page 0, Register 18 - GPIO source for PLL */
#define PCM512x_GREF (7 << 0)
#define PCM512x_GREF_SHIFT 0
#define PCM512x_GREF_GPIO1 (0 << 0)
#define PCM512x_GREF_GPIO2 (1 << 0)
#define PCM512x_GREF_GPIO3 (2 << 0)
#define PCM512x_GREF_GPIO4 (3 << 0)
#define PCM512x_GREF_GPIO5 (4 << 0)
#define PCM512x_GREF_GPIO6 (5 << 0)
/* Page 0, Register 19 - synchronize */ /* Page 0, Register 19 - synchronize */
#define PCM512x_RQSY (1 << 0) #define PCM512x_RQSY (1 << 0)
#define PCM512x_RQSY_RESUME (0 << 0) #define PCM512x_RQSY_RESUME (0 << 0)
...@@ -209,6 +232,25 @@ ...@@ -209,6 +232,25 @@
#define PCM512x_AMLE_SHIFT 1 #define PCM512x_AMLE_SHIFT 1
#define PCM512x_AMRE_SHIFT 0 #define PCM512x_AMRE_SHIFT 0
/* Page 0, Register 80-85, GPIO output selection */
#define PCM512x_GxSL (31 << 0)
#define PCM512x_GxSL_SHIFT 0
#define PCM512x_GxSL_OFF (0 << 0)
#define PCM512x_GxSL_DSP (1 << 0)
#define PCM512x_GxSL_REG (2 << 0)
#define PCM512x_GxSL_AMUTB (3 << 0)
#define PCM512x_GxSL_AMUTL (4 << 0)
#define PCM512x_GxSL_AMUTR (5 << 0)
#define PCM512x_GxSL_CLKI (6 << 0)
#define PCM512x_GxSL_SDOUT (7 << 0)
#define PCM512x_GxSL_ANMUL (8 << 0)
#define PCM512x_GxSL_ANMUR (9 << 0)
#define PCM512x_GxSL_PLLLK (10 << 0)
#define PCM512x_GxSL_CPCLK (11 << 0)
#define PCM512x_GxSL_UV0_7 (14 << 0)
#define PCM512x_GxSL_UV0_3 (15 << 0)
#define PCM512x_GxSL_PLLCK (16 << 0)
/* Page 1, Register 2 - analog volume control */ /* Page 1, Register 2 - analog volume control */
#define PCM512x_RAGN_SHIFT 0 #define PCM512x_RAGN_SHIFT 0
#define PCM512x_LAGN_SHIFT 4 #define PCM512x_LAGN_SHIFT 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment