Add Chameleon v3 ASoC audio
Subsystems (4)
cover Add Chameleon v3 ASoC audio
The Google Chameleon v3 is a device made for testing audio and video paths of other devices. This patchset adds support for ASoC audio on this device. It has two audio sources: HDMI audio from the it68051 chip (RX only), and analog audio from the ssm2603 chip (RX and TX).
The patchset adds the ASoC platform and machine drivers, as well as some changes to the existing ssm2602 codec driver.
Paweł Anikiel (9):
ASoC: Add Chameleon v3 audio
dt-bindings: ASoC: Add chv3-i2s
dt-bindings: ASoC: Add chv3-audio
dt-bindings: ASoC: Add it68051
ASoC: ssm2602: Add workaround for playback with external MCLK
ASoC: ssm2602: Add support for CLKDIV2
ASoC: ssm2602: Add mute gpio
dt-bindings: ASoC: Add mute-gpio to ssm2602
ARM: dts: chameleonv3: Add ssm2603 mute gpio
.../devicetree/bindings/sound/adi,ssm2602.txt | 4 + .../bindings/sound/google,chv3-audio.yaml | 49 +++ .../bindings/sound/google,chv3-i2s.yaml | 42 +++ .../bindings/sound/ite,it68051.yaml | 23 ++ .../boot/dts/socfpga_arria10_chameleonv3.dts | 30 ++ sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++ sound/soc/codecs/ssm2602.c | 37 +- 13 files changed, 692 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yaml create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml create mode 100644 Documentation/devicetree/bindings/sound/ite,it68051.yaml create mode 100644 sound/soc/chameleonv3/Kconfig create mode 100644 sound/soc/chameleonv3/Makefile create mode 100644 sound/soc/chameleonv3/chv3-audio.c create mode 100644 sound/soc/chameleonv3/chv3-i2s.c create mode 100644 sound/soc/chameleonv3/chv3-it68051.c
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 1/9 ASoC: Add Chameleon v3 audio
Add machine and platform drivers for ASoC audio on Chameleon v3.
The board has two audio sources: HDMI audio from the it68051 chip (RX only), and analog audio from the ssm2603 chip (RX and TX).
--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++ sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++ 8 files changed, 538 insertions(+) create mode 100644 sound/soc/chameleonv3/Kconfig create mode 100644 sound/soc/chameleonv3/Makefile create mode 100644 sound/soc/chameleonv3/chv3-audio.c create mode 100644 sound/soc/chameleonv3/chv3-i2s.c create mode 100644 sound/soc/chameleonv3/chv3-it68051.c
arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +28 -0
@@ -15,6 +15,34 @@ aliases { i2c0 = &i2c0; i2c1 = &i2c1; }; + + soc { + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>; + }; + + i2s1: i2s@c0060400 { + compatible = "google,chv3-i2s"; + reg = <0xc0060400 0x100>, + <0xc0060f10 0x10>; + interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + sound { + compatible = "google,chv3-audio"; + google,audio-cpu0 = <&i2s1>; + google,audio-codec0 = <&ssm2603>; + google,audio-cpu1 = <&i2s0>; + google,audio-codec1 = <&it68051>; + }; + + it68051: audio-codec { + compatible = "ite,it68051"; + }; }; &gmac0 {
sound/soc/Kconfig +1 -0
@@ -72,6 +72,7 @@ source "sound/soc/apple/Kconfig" source "sound/soc/atmel/Kconfig" source "sound/soc/au1x/Kconfig" source "sound/soc/bcm/Kconfig" +source "sound/soc/chameleonv3/Kconfig" source "sound/soc/cirrus/Kconfig" source "sound/soc/dwc/Kconfig" source "sound/soc/fsl/Kconfig"
sound/soc/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_SND_SOC) += amd/ obj-$(CONFIG_SND_SOC) += atmel/ obj-$(CONFIG_SND_SOC) += au1x/ obj-$(CONFIG_SND_SOC) += bcm/ +obj-$(CONFIG_SND_SOC) += chameleonv3/ obj-$(CONFIG_SND_SOC) += cirrus/ obj-$(CONFIG_SND_SOC) += dwc/ obj-$(CONFIG_SND_SOC) += fsl/
sound/soc/chameleonv3/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.
sound/soc/chameleonv3/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_SND_SOC_CHV3) += chv3-i2s.o chv3-audio.o chv3-it68051.o
sound/soc/chameleonv3/chv3-audio.c new file +111 -0
111 lines not on this page · raw message
sound/soc/chameleonv3/chv3-i2s.c new file +347 -0
347 lines not on this page · raw message
sound/soc/chameleonv3/chv3-it68051.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Re: [PATCH 1/9] ASoC: Add Chameleon v3 audio
Quoted 8 lines · Paweł Anikiel
Add machine and platform drivers for ASoC audio on Chameleon v3.
The board has two audio sources: HDMI audio from the it68051 chip (RX only), and analog audio from the ssm2603 chip (RX and TX).
Signed-off-by Paweł Anikiel <[email protected]>--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++
No way. DTS is always, always separate.
Best regards,
Krzysztof
Mark Brown
maintainerRe: [PATCH 1/9] ASoC: Add Chameleon v3 audio
In reply to Paweł AnikielQuoted 2 lines · Paweł Anikiel
--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++
Updates to the DT should be in a separate patch.
Quoted 3 lines
sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++
The machine driver and board drivers (if needed) should also be separate patches - one patch per driver.
sound/soc/chameleonv3/Kconfig line 7
Quoted 6 lines
sound/soc/chameleonv3/Kconfig new file +6
-0+config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.
It woudl be better to have a separate selectable symbol for each drier.
sound/soc/chameleonv3/chv3-audio.c line 15
Quoted 8 lines
sound/soc/chameleonv3/chv3-audio.c new file +8
-0+static int chv3_ssm2603_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct snd_soc_dai *dai =asoc_rtd_to_codec (rtd,0 ); + +return snd_soc_dai_set_sysclk (dai,0 ,22579200 ,SND_SOC_CLOCK_IN ); +}
This could be done once at init, though in general I can't tell why this isn't audio-graph-card.
Quoted 4 lines
+ * Because of the two pointer design, the ring buffer can never be full. With
+ * capture this isn't a problem, because the hardware being the producer
+ * will wait for the consumer index to move out of the way. With playback,
+ * however, this is problematic, because ALSA wants to fill up the buffer
Quoted 8 lines
+ * completely when waiting for hardware. In the .ack callback, the driver
+ * would have to wait for the consumer index to move out of the way by
+ * busy-waiting, which would keep stalling the kernel for quite a long time.
+ *
+ * The workaround to this problem is to "lie" to ALSA that thehw_pointer
+ * is one period behind what it actually is (seechv3_dma_pointer). This
+ * way, ALSA will not try to fill up the entire buffer, and all callbacks
+ * are wait-free.
Would it not be better to just lag by one (or some small number of) sample instead?
Quoted 12 lines
sound/soc/chameleonv3/chv3-i2s.c new file +12
-0+static irqreturn_t chv3_i2s_isr (int irq,void *data) +{ +struct chv3_i2s_dev *i2s = data; +u32 reg; + + reg =readl (i2s->iobase_irq +I2S_IRQ_CLR ); +if (!reg) +return IRQ_NONE ; + +if (reg &I2S_IRQ_RX_BIT ) +snd_pcm_period_elapsed (i2s->rx_substream); +
sound/soc/chameleonv3/chv3-i2s.c line 133
Quoted 10 lines
sound/soc/chameleonv3/chv3-i2s.c new file +10
-0+if (reg &I2S_IRQ_TX_BIT ) { +if (i2s->tx_ready) +snd_pcm_period_elapsed (i2s->tx_substream); + i2s->tx_ready =1 ; + } + +writel (reg, i2s->iobase_irq +I2S_IRQ_CLR ); + +return IRQ_HANDLED ; +}
Really we should only ack things that were handled here and report appropriately, that's defensive against bugs causing interrupts to scream and shared interrupts.
sound/soc/chameleonv3/chv3-i2s.c line 325
Quoted 1 line
sound/soc/chameleonv3/chv3-i2s.c new file +1
-0+dev_info (&pdev->dev,"probed\n" );
This is just noise, remove it.
Quoted 9 lines
+++
b/sound/soc/chameleonv3/chv3-it68051.csound/soc/chameleonv3/chv3-it68051.c new file +7
-0@@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/module.h> +#include <sound/soc.h> + +static struct snd_soc_dai_driver it68051_dai = { + .name ="it68051-hifi" , + .capture = {
sound/soc/chameleonv3/chv3-it68051.c line 17
Quoted 10 lines
sound/soc/chameleonv3/chv3-it68051.c new file +10
-0+ .stream_name = "Capture", + .channels_min = 8, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + }, +}; + +static const struct snd_soc_component_driver soc_component_dev_it68051 = { +};
This looks awfully like it's a generic CODEC driver for a device with no control available, why is it not being added as a CODEC?
Re: [PATCH 1/9] ASoC: Add Chameleon v3 audio
Thank you for all the comments, I'm sorry for taking long to respond.
Quoted 7 lines · Mark Brown
Quoted 2 lines · Paweł Anikiel
--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++Updates to the DT should be in a separate patch.
Ok, I'll fix in next patchset
Quoted 7 lines
Quoted 4 lines
sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++The machine driver and board drivers (if needed) should also be separate patches - one patch per driver.
Ok, I'll fix in next patchset
Quoted 9 lines
sound/soc/chameleonv3/Kconfig line 7
Quoted 7 lines
sound/soc/chameleonv3/Kconfig new file +6
-0+config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.It woudl be better to have a separate selectable symbol for each drier.
I'm not sure about this. If I disable just one driver, the entire card fails to probe (even if some audio device doesn't need that driver). Does it then make sense to be able to deselect some drivers? Please correct me if I'm misunderstanding.
Quoted 12 lines
sound/soc/chameleonv3/chv3-audio.c line 15
Quoted 9 lines
sound/soc/chameleonv3/chv3-audio.c new file +8
-0+static int chv3_ssm2603_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct snd_soc_dai *dai =asoc_rtd_to_codec (rtd,0 ); + +return snd_soc_dai_set_sysclk (dai,0 ,22579200 ,SND_SOC_CLOCK_IN ); +}This could be done once at init, though in general I can't tell why this isn't audio-graph-card.
I will read up on audio-graph-card and see if it's possible to use here
Quoted 14 lines
Quoted 13 lines
+ * Because of the two pointer design, the ring buffer can never be full. With
+ * capture this isn't a problem, because the hardware being the producer
+ * will wait for the consumer index to move out of the way. With playback,
+ * however, this is problematic, because ALSA wants to fill up the buffer
+ * completely when waiting for hardware. In the .ack callback, the driver
+ * would have to wait for the consumer index to move out of the way by
+ * busy-waiting, which would keep stalling the kernel for quite a long time.
+ *
+ * The workaround to this problem is to "lie" to ALSA that thehw_pointer
+ * is one period behind what it actually is (seechv3_dma_pointer). This
+ * way, ALSA will not try to fill up the entire buffer, and all callbacks
+ * are wait-free.
Quoted 2 lines
Would it not be better to just lag by one (or some small number of) sample instead?
The benefit of lagging by an entire period is that we get an IRQ when the first period is processed, which means we can drop the first call to snd_pcm_period_elapsed() and have everything be coherent.
Having said that, I did try to remove that logic and simply delay hw_pointer by one frame, and it appears to work (the playback seems fine and without glitches). However, I'm worried about calling snd_pcm_period_elapsed() and then reporting that the hw_pointer hasn't actually reached the end of the period. Is that ok to do?
Quoted 19 lines
Quoted 19 lines
sound/soc/chameleonv3/chv3-i2s.c new file +18
-0+static irqreturn_t chv3_i2s_isr (int irq,void *data) +{ +struct chv3_i2s_dev *i2s = data; +u32 reg; + + reg =readl (i2s->iobase_irq +I2S_IRQ_CLR ); +if (!reg) +return IRQ_NONE ; + +if (reg &I2S_IRQ_RX_BIT ) +snd_pcm_period_elapsed (i2s->rx_substream); + +if (reg &I2S_IRQ_TX_BIT ) { +if (i2s->tx_ready) +snd_pcm_period_elapsed (i2s->tx_substream); + i2s->tx_ready =1 ; + } +
Quoted 8 lines
sound/soc/chameleonv3/chv3-i2s.c line 133
Quoted 4 lines
sound/soc/chameleonv3/chv3-i2s.c new file +4
-0+writel (reg, i2s->iobase_irq +I2S_IRQ_CLR ); + +return IRQ_HANDLED ; +}Really we should only ack things that were handled here and report appropriately, that's defensive against bugs causing interrupts to scream and shared interrupts.
What do you mean by handled? Should I check the hardware pointer and check if a period really has elapsed?
Quoted 4 lines
Quoted 2 lines
+
dev_info(&pdev->dev, "probed\n");This is just noise, remove it.
Ok
Quoted 15 lines
Quoted 15 lines
+++
b/sound/soc/chameleonv3/chv3-it68051.csound/soc/chameleonv3/chv3-it68051.c new file +12
-0@@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/module.h> +#include <sound/soc.h> + +static struct snd_soc_dai_driver it68051_dai = { + .name ="it68051-hifi" , + .capture = { + .stream_name ="Capture" , + .channels_min =8 , + .channels_max =8 , + .rates =SNDRV_PCM_RATE_CONTINUOUS , + .formats =SNDRV_PCM_FMTBIT_S32_LE ,
Quoted 8 lines
sound/soc/chameleonv3/chv3-it68051.c line 17
Quoted 5 lines
sound/soc/chameleonv3/chv3-it68051.c new file +5
-0+ }, +}; + +static const struct snd_soc_component_driver soc_component_dev_it68051 = { +};This looks awfully like it's a generic CODEC driver for a device with no control available,
Yes, it's a dummy capture-only codec with fixed 8 channels, arbitrary rate, and S32_LE format.
Quoted 1 line
why is it not being added as a CODEC?
Do you mean I should put it in sound/soc/codecs/?
Also, I used the name of the HDMI receiver chip (IT68051), but really this goes through some extra processing in an FPGA, so the result has little in common with the chip itself. Do you have any advice on how it should be named?
Regards,
Paweł
Mark Brown
maintainerRe: [PATCH 1/9] ASoC: Add Chameleon v3 audio
Quoted 7 lines · Paweł Anikiel
Quoted 6 lines
Quoted 6 lines
sound/soc/chameleonv3/Kconfig new file +6
-0+config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.
Quoted 6 lines
Quoted 1 line
It woudl be better to have a separate selectable symbol for each drier.
I'm not sure about this. If I disable just one driver, the entire card fails to probe (even if some audio device doesn't need that driver). Does it then make sense to be able to deselect some drivers? Please correct me if I'm misunderstanding.
Consider what happens if someone for example reuses the I2S controller in a different board.
Quoted 5 lines
Having said that, I did try to remove that logic and simply delay
hw_pointerby one frame, and it appears to work (the playback seems fine and without glitches). However, I'm worried about callingsnd_pcm_period_elapsed()and then reporting that thehw_pointerhasn't actually reached the end of the period. Is that ok to do?
It should be fine, things should be working off the hw_pointer.
Quoted 17 lines
Quoted 8 lines
Quoted 7 lines
sound/soc/chameleonv3/chv3-i2s.c new file +6
-0+ reg =readl (i2s->iobase_irq +I2S_IRQ_CLR ); +if (!reg) +return IRQ_NONE ; +if (reg &I2S_IRQ_RX_BIT ) + +if (reg &I2S_IRQ_TX_BIT ) {Quoted 8 lines
sound/soc/chameleonv3/chv3-i2s.c line 133
Quoted 4 lines
sound/soc/chameleonv3/chv3-i2s.c new file +4
-0+writel (reg, i2s->iobase_irq +I2S_IRQ_CLR ); + +return IRQ_HANDLED ; +}Really we should only ack things that were handled here and report appropriately, that's defensive against bugs causing interrupts to scream and shared interrupts.
Quoted 2 lines
What do you mean by handled? Should I check the hardware pointer and check if a period really has elapsed?
The driver is checking for specific bits in the status register but blindly acknowledging all bits that are set, and reporting IRQ_HANDLED even if none are set.
Quoted 3 lines
Quoted 1 line
why is it not being added as a CODEC?
Do you mean I should put it in
sound/soc/codecs/?
Yes.
Quoted 4 lines
Also, I used the name of the HDMI receiver chip (IT68051), but really this goes through some extra processing in an FPGA, so the result has little in common with the chip itself. Do you have any advice on how it should be named?
If it's genuinely unrelated to the capabilities of the actual chip then just putting a standalone driver in the platform directory is fine, but the code should be clear about that otherwise it looks like the code for the device could be shared.
Re: [PATCH 1/9] ASoC: Add Chameleon v3 audio
In reply to Mark BrownThank you for all the comments, I'm sorry for taking long to respond.
Quoted 7 lines · Mark Brown
Quoted 2 lines · Paweł Anikiel
--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++Updates to the DT should be in a separate patch.
Ok, I'll fix in next patchset
Quoted 7 lines
Quoted 4 lines
sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++The machine driver and board drivers (if needed) should also be separate patches - one patch per driver.
Ok, I'll fix in next patchset
Quoted 9 lines
sound/soc/chameleonv3/Kconfig line 7
Quoted 7 lines
sound/soc/chameleonv3/Kconfig new file +6
-0+config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.It woudl be better to have a separate selectable symbol for each drier.
I'm not sure about this. If I disable just one driver, the entire card fails to probe (even if some audio device doesn't need that driver). Does it then make sense to be able to deselect some drivers? Please correct me if I'm misunderstanding.
Quoted 12 lines
sound/soc/chameleonv3/chv3-audio.c line 15
Quoted 9 lines
sound/soc/chameleonv3/chv3-audio.c new file +8
-0+static int chv3_ssm2603_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct snd_soc_dai *dai =asoc_rtd_to_codec (rtd,0 ); + +return snd_soc_dai_set_sysclk (dai,0 ,22579200 ,SND_SOC_CLOCK_IN ); +}This could be done once at init, though in general I can't tell why this isn't audio-graph-card.
I will read up on audio-graph-card and see if it's possible to use here
Quoted 14 lines
Quoted 13 lines
+ * Because of the two pointer design, the ring buffer can never be full. With
+ * capture this isn't a problem, because the hardware being the producer
+ * will wait for the consumer index to move out of the way. With playback,
+ * however, this is problematic, because ALSA wants to fill up the buffer
+ * completely when waiting for hardware. In the .ack callback, the driver
+ * would have to wait for the consumer index to move out of the way by
+ * busy-waiting, which would keep stalling the kernel for quite a long time.
+ *
+ * The workaround to this problem is to "lie" to ALSA that thehw_pointer
+ * is one period behind what it actually is (seechv3_dma_pointer). This
+ * way, ALSA will not try to fill up the entire buffer, and all callbacks
+ * are wait-free.
Quoted 2 lines
Would it not be better to just lag by one (or some small number of) sample instead?
The benefit of lagging by an entire period is that we get an IRQ when the first period is processed, which means we can drop the first call to snd_pcm_period_elapsed() and have everything be coherent.
Having said that, I did try to remove that logic and simply delay hw_pointer by one frame, and it appears to work (the playback seems fine and without glitches). However, I'm worried about calling snd_pcm_period_elapsed() and then reporting that the hw_pointer hasn't actually reached the end of the period. Is that ok to do?
Quoted 19 lines
Quoted 19 lines
sound/soc/chameleonv3/chv3-i2s.c new file +18
-0+static irqreturn_t chv3_i2s_isr (int irq,void *data) +{ +struct chv3_i2s_dev *i2s = data; +u32 reg; + + reg =readl (i2s->iobase_irq +I2S_IRQ_CLR ); +if (!reg) +return IRQ_NONE ; + +if (reg &I2S_IRQ_RX_BIT ) +snd_pcm_period_elapsed (i2s->rx_substream); + +if (reg &I2S_IRQ_TX_BIT ) { +if (i2s->tx_ready) +snd_pcm_period_elapsed (i2s->tx_substream); + i2s->tx_ready =1 ; + } +
Quoted 8 lines
sound/soc/chameleonv3/chv3-i2s.c line 133
Quoted 4 lines
sound/soc/chameleonv3/chv3-i2s.c new file +4
-0+writel (reg, i2s->iobase_irq +I2S_IRQ_CLR ); + +return IRQ_HANDLED ; +}Really we should only ack things that were handled here and report appropriately, that's defensive against bugs causing interrupts to scream and shared interrupts.
What do you mean by handled? Should I check the hardware pointer and check if a period really has elapsed?
Quoted 4 lines
Quoted 2 lines
+
dev_info(&pdev->dev, "probed\n");This is just noise, remove it.
Ok
Quoted 15 lines
Quoted 15 lines
+++
b/sound/soc/chameleonv3/chv3-it68051.csound/soc/chameleonv3/chv3-it68051.c new file +12
-0@@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include <linux/module.h> +#include <sound/soc.h> + +static struct snd_soc_dai_driver it68051_dai = { + .name ="it68051-hifi" , + .capture = { + .stream_name ="Capture" , + .channels_min =8 , + .channels_max =8 , + .rates =SNDRV_PCM_RATE_CONTINUOUS , + .formats =SNDRV_PCM_FMTBIT_S32_LE ,
Quoted 8 lines
sound/soc/chameleonv3/chv3-it68051.c line 17
Quoted 5 lines
sound/soc/chameleonv3/chv3-it68051.c new file +5
-0+ }, +}; + +static const struct snd_soc_component_driver soc_component_dev_it68051 = { +};This looks awfully like it's a generic CODEC driver for a device with no control available,
Yes, it's a dummy capture-only codec with fixed 8 channels, arbitrary rate, and S32_LE format.
Quoted 1 line
why is it not being added as a CODEC?
Do you mean I should put it in sound/soc/codecs/?
Also, I used the name of the HDMI receiver chip (IT68051), but really this goes through some extra processing in an FPGA, so the result has little in common with the chip itself. Do you have any advice on how it should be named?
Regards,
Paweł
PATCH 2/9 dt-bindings: ASoC: Add chv3-i2s
In reply to Paweł AnikielAdd binding for chv3-i2s device.
--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +42 -0
@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device + +maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2s + reg: + items: + - description: core registers + - description: irq registers + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Re: [PATCH 2/9] dt-bindings: ASoC: Add chv3-i2s
Quoted 1 line · Paweł Anikiel
Add binding for chv3-i2s device.
Your subject needs improvements:
1. ASoC goes before bindings
2. You miss some meaningful title of device. "chv3-i2s" can be anything, so add Google or Google Chameleon. Or use entire compatible.
Quoted 21 lines
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yamlDocumentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +8
-0@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device +
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +10
-0+maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2s
Missing blank line.
Is chv3 the name of your SoC? Where are the SoC bindings? What's exactly the versioning scheme for it (compatibles must be specific, not generic).
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 22
Quoted 4 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +4
-0+ reg: + items: + - description: core registers + - description: irq registers
As well...
Quoted 9 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +9
-0+ interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 41
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +10
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;
Isn't 0 also a known define?
Best regards,
Krzysztof
Re: [PATCH 2/9] dt-bindings: ASoC: Add chv3-i2s
Quoted 8 lines · Krzysztof Kozlowski
Quoted 1 line · Paweł Anikiel
Add binding for chv3-i2s device.
Your subject needs improvements:
1. ASoC goes before bindings
2. You miss some meaningful title of device. "chv3-i2s" can be anything, so add Google or Google Chameleon. Or use entire compatible.
Would "ASoC: dt-bindings: Add Google Chameleon v3 I2S device" be better?
Quoted 36 lines
Quoted 23 lines
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yamlDocumentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +8
-0@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device +Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +10
-0+maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2sMissing blank line.
Quoted 2 lines
Is chv3 the name of your SoC? Where are the SoC bindings? What's exactly the versioning scheme for it (compatibles must be specific, not generic).
The Chameleon v3 is based around an Intel Arria 10 SoC FPGA. The i2s device is implemented inside the FPGA. Does this case require SoC bindings?
Quoted 21 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 22
Quoted 5 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +4
-0+ reg: + items: + - description: core registers + - description: irq registersAs well...
Quoted 13 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +13
-0+ interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h>
Quoted 8 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 41
Quoted 6 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +6
-0+ + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;Isn't 0 also a known define?
Do you mean this?
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
Regards,
Paweł
Re: [PATCH 2/9] dt-bindings: ASoC: Add chv3-i2s
Quoted 4 lines · Paweł Anikiel
Quoted 2 lines · Krzysztof Kozlowski
On 14/04/2023 16:01, Paweł Anikiel wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Add binding for chv3-i2s device.
Your subject needs improvements:
1. ASoC goes before bindings
2. You miss some meaningful title of device. "chv3-i2s" can be anything, so add Google or Google Chameleon. Or use entire compatible.Would "ASoC: dt-bindings: Add Google Chameleon v3 I2S device" be better?
Yes, thanks.
Quoted 37 lines
Quoted 37 lines
Quoted 24 lines
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yamlDocumentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +8
-0@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device +Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +10
-0+maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2sMissing blank line.
Quoted 6 lines
Quoted 2 lines
Is chv3 the name of your SoC? Where are the SoC bindings? What's exactly the versioning scheme for it (compatibles must be specific, not generic).
The Chameleon v3 is based around an Intel Arria 10 SoC FPGA. The i2s device is implemented inside the FPGA. Does this case require SoC bindings?
No, I was mistaken. I somehow get impression that's for Pixel... Sorry for the noise.
Quoted 31 lines
Quoted 22 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 22
Quoted 6 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +4
-0+ reg: + items: + - description: core registers + - description: irq registersAs well...
Quoted 13 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +13
-0+ interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h>Quoted 8 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 41
Quoted 6 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +6
-0+ + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;Isn't 0 also a known define?
Quoted 2 lines
Do you mean this?
interrupts = <GIC_SPI20IRQ_TYPE_LEVEL_HIGH>;
Yes, please.
Best regards,
Krzysztof
Re: [PATCH 2/9] dt-bindings: ASoC: Add chv3-i2s
In reply to Krzysztof KozlowskiQuoted 8 lines · Krzysztof Kozlowski
Quoted 1 line · Paweł Anikiel
Add binding for chv3-i2s device.
Your subject needs improvements:
1. ASoC goes before bindings
2. You miss some meaningful title of device. "chv3-i2s" can be anything, so add Google or Google Chameleon. Or use entire compatible.
Would "ASoC: dt-bindings: Add Google Chameleon v3 I2S device" be better?
Quoted 36 lines
Quoted 23 lines
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yamlDocumentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +8
-0@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device +Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +10
-0+maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2sMissing blank line.
Quoted 2 lines
Is chv3 the name of your SoC? Where are the SoC bindings? What's exactly the versioning scheme for it (compatibles must be specific, not generic).
The Chameleon v3 is based around an Intel Arria 10 SoC FPGA. The i2s device is implemented inside the FPGA. Does this case require SoC bindings?
Quoted 21 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 22
Quoted 5 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +4
-0+ reg: + items: + - description: core registers + - description: irq registersAs well...
Quoted 13 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +13
-0+ interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h>
Quoted 8 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml line 41
Quoted 6 lines
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +6
-0+ + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;Isn't 0 also a known define?
Do you mean this?
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
Regards,
Paweł
PATCH 3/9 dt-bindings: ASoC: Add chv3-audio
In reply to Paweł AnikielAdd binding for chv3-audio device.
--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yaml
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-audio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: google,chv3-audio + + google,audio-cpu0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #0 + + google,audio-codec0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #0 + + google,audio-cpu1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #1 + + google,audio-codec1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #1 + +required: + - compatible + - google,audio-cpu0: + - google,audio-codec0: + - google,audio-cpu1: + - google,audio-codec1: + +additionalProperties: false + +examples: + - | + sound { + compatible = "google,chv3-audio"; + google,audio-cpu0 = <&i2s1>; + google,audio-codec0 = <&ssm2603>; + google,audio-cpu1 = <&i2s0>; + google,audio-codec1 = <&it68051>; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Rob Herring
maintainerRe: [PATCH 3/9] dt-bindings: ASoC: Add chv3-audio
Quoted 8 lines · Paweł Anikiel
Add binding for chv3-audio device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/sound/google,chv3-audio.yaml:34:23: [error] empty value in block mapping (empty-values) ./Documentation/devicetree/bindings/sound/google,chv3-audio.yaml:35:25: [error] empty value in block mapping (empty-values) ./Documentation/devicetree/bindings/sound/google,chv3-audio.yaml:36:23: [error] empty value in block mapping (empty-values) ./Documentation/devicetree/bindings/sound/google,chv3-audio.yaml:37:25: [error] empty value in block mapping (empty-values)
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/google,chv3-audio.yaml: required:1: {'google,audio-cpu0': None} is not of type 'string'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/google,chv3-audio.yaml: required:2: {'google,audio-codec0': None} is not of type 'string'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/google,chv3-audio.yaml: required:3: {'google,audio-cpu1': None} is not of type 'string'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/google,chv3-audio.yaml: required:4: {'google,audio-codec1': None} is not of type 'string'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/google,chv3-audio.yaml: ignoring, error in schema: required: 1 Documentation/devicetree/bindings/sound/google,chv3-audio.example.dtb: /example-0/sound: failed to match any schema with compatible: ['google,chv3-audio']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Rob Herring
maintainerRe: [PATCH 3/9] dt-bindings: ASoC: Add chv3-audio
In reply to Paweł AnikielQuoted 34 lines · Paweł Anikiel
Add binding for chv3-audio device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yamlDocumentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +20
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-audio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: google,chv3-audio + + google,audio-cpu0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #0 + + google,audio-codec0:
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +10
-0+ $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #0 + + google,audio-cpu1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #1 + + google,audio-codec1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #1
Why do you need custom properties when we have standard property to point to these things (sound-dai). We also have bindings to handle multiple devices.
Rob
Re: [PATCH 3/9] dt-bindings: ASoC: Add chv3-audio
Quoted 42 lines · Rob Herring
Quoted 40 lines · Paweł Anikiel
Add binding for chv3-audio device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yamlDocumentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +26
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-audio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: google,chv3-audio + + google,audio-cpu0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #0 + + google,audio-codec0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #0 + + google,audio-cpu1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #1
Quoted 8 lines
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml line 30
Quoted 4 lines
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +4
-0+ + google,audio-codec1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #1Why do you need custom properties when we have standard property to point to these things (sound-dai). We also have bindings to handle multiple devices.
Thanks, I will read up on that and try to use it here
Regards,
Paweł
Re: [PATCH 3/9] dt-bindings: ASoC: Add chv3-audio
In reply to Rob HerringQuoted 42 lines · Rob Herring
Quoted 40 lines · Paweł Anikiel
Add binding for chv3-audio device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yamlDocumentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +26
-0@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-audio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: google,chv3-audio + + google,audio-cpu0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #0 + + google,audio-codec0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #0 + + google,audio-cpu1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #1
Quoted 8 lines
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml line 30
Quoted 4 lines
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +4
-0+ + google,audio-codec1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #1Why do you need custom properties when we have standard property to point to these things (sound-dai). We also have bindings to handle multiple devices.
Thanks, I will read up on that and try to use it here
Regards,
Paweł
PATCH 4/9 dt-bindings: ASoC: Add it68051
In reply to Paweł AnikielAdd binding for it68051 device.
--- .../bindings/sound/ite,it68051.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ite,it68051.yaml
Documentation/devicetree/bindings/sound/ite,it68051.yaml new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/ite,it68051.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: it68051 audio codec + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: ite,it68051 + +required: + - compatible + +examples: + - | + it68051: audio-codec { + compatible = "ite,it68051"; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Re: [PATCH 4/9] dt-bindings: ASoC: Add it68051
Quoted 19 lines · Paweł Anikiel
Add binding for it68051 device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/ite,it68051.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ite,it68051.yamlDocumentation/devicetree/bindings/sound/ite,it68051.yaml new file +5
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/ite,it68051.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#
Documentation/devicetree/bindings/sound/ite,it68051.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/sound/ite,it68051.yaml new file +10
-0+ +title: it68051 audio codec + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: ite,it68051 +
No ref to common DAI properties? No sound-dai-cells? No resources? Bindings are supposed to be complete.
Documentation/devicetree/bindings/sound/ite,it68051.yaml line 21
Quoted 6 lines
Documentation/devicetree/bindings/sound/ite,it68051.yaml new file +6
-0+required: + - compatible + +examples: + - | + it68051: audio-codec {
Drop label, you do not use it here.
Documentation/devicetree/bindings/sound/ite,it68051.yaml line 23
Quoted 2 lines
Documentation/devicetree/bindings/sound/ite,it68051.yaml new file +2
-0+ compatible = "ite,it68051"; + };
Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH 4/9] dt-bindings: ASoC: Add it68051
In reply to Paweł AnikielQuoted 8 lines · Paweł Anikiel
Add binding for it68051 device.
Signed-off-by Paweł Anikiel <[email protected]>--- .../bindings/sound/ite,it68051.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ite,it68051.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/ite,it68051.yaml: 'oneOf' conditional failed, one must be fixed:
'unevaluatedProperties' is a required property
'additionalProperties' is a required property
hint: Either unevaluatedProperties or additionalProperties must be present
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
PATCH 5/9 ASoC: ssm2602: Add workaround for playback with external MCLK
In reply to Paweł AnikielApply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
The workaround powers them on in probe for the first time, as doing it later may be impossible (e.g. when starting playback while recording, whole chip power will already be on).
Here are some initialization sequences run after all other control registers were set (ssmset reg val sets the value of a register via i2c):
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x87 # out, dac
ssmset 0x06 0x07 # chip
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
(enable MCLK)
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x06 0x1f # chip
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
ssmset 0x06 0x07 # dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
ssmset 0x06 0x07 # out
NOT OK
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
(enable MCLK after reset)
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
NOT OK
ssmset 0x06 0x07 # chip, out, dac
NOT OK
This was tested on a Google Chameleon v3 board using an SSM2603 with an external MCLK. This doesn't seem to just be a PCB issue, as this was also observed on a ZYBO Z7-10:
https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
--- sound/soc/codecs/ssm2602.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/ssm2602.c +11 -0
@@ -589,6 +589,17 @@ static int ssm260x_component_probe(struct snd_soc_component *component)return ret; } +/* Workaround for what seems to be a hardware quirk: when using an +* external MCLK signal, powering on Output and DAC for the first +* time produces output distortions unless they're powered together +* with whole chip power. We power them here for the first time, +* as doing it later may be impossible (e.g. when starting playback +* while recording, whole chip power will already be on) +*/ +regmap_write (ssm2602->regmap,SSM2602_ACTIVE ,0x01 ); +regmap_write (ssm2602->regmap,SSM2602_PWR ,0x07 ); +regmap_write (ssm2602->regmap,SSM2602_RESET ,0x00 ); +/* set the update bits */ regmap_update_bits (ssm2602->regmap,SSM2602_LINVOL ,LINVOL_LRIN_BOTH ,LINVOL_LRIN_BOTH );
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Mark Brown
maintainerRe: [PATCH 5/9] ASoC: ssm2602: Add workaround for playback with external MCLK
Quoted 4 lines · Paweł Anikiel
Apply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
This doesn't seem coherent, these are multiple register writes so clearly can't be done at the same moment as initial power on. Clearly there's some other constraint here.
Quoted 3 lines
The workaround powers them on in probe for the first time, as doing it later may be impossible (e.g. when starting playback while recording, whole chip power will already be on).
It doesn't do that, it powers them on at component probe.
Quoted 6 lines
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset
0x090x01# core
ssmset0x060x07# chip, out, dac
OK
I can't tell what any of this is trying to say, especially given all the magic numbers, and obviously no actual use of the driver should be writing directly to the register map.
sound/soc/codecs/ssm2602.c static int ssm260x_component_probe(struct snd_soc_component *component) · line 602
Quoted 11 lines
sound/soc/codecs/ssm2602.c +11
-0+/* Workaround for what seems to be a hardware quirk: when using an +* external MCLK signal, powering on Output and DAC for the first +* time produces output distortions unless they're powered together +* with whole chip power. We power them here for the first time, +* as doing it later may be impossible (e.g. when starting playback +* while recording, whole chip power will already be on) +*/ +regmap_write (ssm2602->regmap,SSM2602_ACTIVE ,0x01 ); +regmap_write (ssm2602->regmap,SSM2602_PWR ,0x07 ); +regmap_write (ssm2602->regmap,SSM2602_RESET ,0x00 ); +
The rest of the driver uses symbolic names for register values, this code should too.
This also seems buggy in that it writes non-default values to the hardware then does a reset, meaning that the cache and hardware values will be out of sync, and since it only happens on probe there will be an issue after suspend if power is removed. It looks like this would be most comfortably implemented as a register patch applied as soon as the regmap is instantiated. See regmap_register_patch().
Re: [PATCH 5/9] ASoC: ssm2602: Add workaround for playback with external MCLK
Quoted 11 lines · Mark Brown
Quoted 4 lines · Paweł Anikiel
Apply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
This doesn't seem coherent, these are multiple register writes so clearly can't be done at the same moment as initial power on. Clearly there's some other constraint here.
The "at the same time" part is done by writing multiple bits at once to SSM2602_PWR. But before that, SSM2602_ACTIVE has to be set, and then the chip is reset (SSM2602_RESET) to power everything down again.
Quoted 6 lines
Quoted 4 lines
The workaround powers them on in probe for the first time, as doing it later may be impossible (e.g. when starting playback while recording, whole chip power will already be on).
It doesn't do that, it powers them on at component probe.
Yes, I meant component probe.
Quoted 11 lines
Quoted 7 lines
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset
0x090x01# core
ssmset0x060x07# chip, out, dac
OKI can't tell what any of this is trying to say, especially given all the magic numbers, and obviously no actual use of the driver should be writing directly to the register map.
These are shell commands run from userspace (with no ssm2602 driver present in the kernel). ssmset is a wrapper for the i2cset command:
ssmset() {
i2cset -y 0 0x1a $(($1*2)) $2
}I definitely should have made that more clear.
Do you think these logs are worth adding? If so, I'll improve the explanation what these mean.
Quoted 13 lines
sound/soc/codecs/ssm2602.c static int ssm260x_component_probe(struct snd_soc_component *component) · line 602
Quoted 12 lines
sound/soc/codecs/ssm2602.c +11
-0+/* Workaround for what seems to be a hardware quirk: when using an +* external MCLK signal, powering on Output and DAC for the first +* time produces output distortions unless they're powered together +* with whole chip power. We power them here for the first time, +* as doing it later may be impossible (e.g. when starting playback +* while recording, whole chip power will already be on) +*/ +regmap_write (ssm2602->regmap,SSM2602_ACTIVE ,0x01 ); +regmap_write (ssm2602->regmap,SSM2602_PWR ,0x07 ); +regmap_write (ssm2602->regmap,SSM2602_RESET ,0x00 ); +
Quoted 2 lines
The rest of the driver uses symbolic names for register values, this code should too.
Ok, I'll correct that.
Quoted 7 lines
This also seems buggy in that it writes non-default values to the hardware then does a reset, meaning that the cache and hardware values will be out of sync, and since it only happens on probe there will be an issue after suspend if power is removed. It looks like this would be most comfortably implemented as a register patch applied as soon as the regmap is instantiated. See
regmap_register_patch().
I haven't considered that. I will look at regmap_register_patch() and try to use it.
Regards,
Paweł
Mark Brown
maintainerRe: [PATCH 5/9] ASoC: ssm2602: Add workaround for playback with external MCLK
Quoted 8 lines · Paweł Anikiel
Quoted 6 lines · Mark Brown
Quoted 4 lines · Paweł Anikiel
Apply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
Quoted 7 lines
Quoted 3 lines
This doesn't seem coherent, these are multiple register writes so clearly can't be done at the same moment as initial power on. Clearly there's some other constraint here.
The "at the same time" part is done by writing multiple bits at once to
SSM2602_PWR. But before that,SSM2602_ACTIVEhas to be set, and then the chip is reset (SSM2602_RESET) to power everything down again.
So you need to power up the chip then do a register write sequence - that's noticably different to what the description says.
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset
0x090x01# core
ssmset0x060x07# chip, out, dac
OKI can't tell what any of this is trying to say, especially given all the magic numbers, and obviously no actual use of the driver should be writing directly to the register map.
These are shell commands run from userspace (with no ssm2602 driver present in the kernel). ssmset is a wrapper for the i2cset command:
Quoted 7 lines
ssmset() { i2cset -y 0 0x1a $(($1*2)) $2 }I definitely should have made that more clear.
Do you think these logs are worth adding? If so, I'll improve the explanation what these mean.
Probably? Since I couldn't really follow what these were trying to tell me it's a bit hard to say. It looks like you worked this out yourself rather than using an erratum so documenting where the workaround comes from seems useful.
Re: [PATCH 5/9] ASoC: ssm2602: Add workaround for playback with external MCLK
In reply to Mark BrownQuoted 11 lines · Mark Brown
Quoted 4 lines · Paweł Anikiel
Apply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
This doesn't seem coherent, these are multiple register writes so clearly can't be done at the same moment as initial power on. Clearly there's some other constraint here.
The "at the same time" part is done by writing multiple bits at once to SSM2602_PWR. But before that, SSM2602_ACTIVE has to be set, and then the chip is reset (SSM2602_RESET) to power everything down again.
Quoted 6 lines
Quoted 4 lines
The workaround powers them on in probe for the first time, as doing it later may be impossible (e.g. when starting playback while recording, whole chip power will already be on).
It doesn't do that, it powers them on at component probe.
Yes, I meant component probe.
Quoted 11 lines
Quoted 7 lines
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset
0x090x01# core
ssmset0x060x07# chip, out, dac
OKI can't tell what any of this is trying to say, especially given all the magic numbers, and obviously no actual use of the driver should be writing directly to the register map.
These are shell commands run from userspace (with no ssm2602 driver present in the kernel). ssmset is a wrapper for the i2cset command:
ssmset() {
i2cset -y 0 0x1a $(($1*2)) $2
}I definitely should have made that more clear.
Do you think these logs are worth adding? If so, I'll improve the explanation what these mean.
Quoted 13 lines
sound/soc/codecs/ssm2602.c static int ssm260x_component_probe(struct snd_soc_component *component) · line 602
Quoted 12 lines
sound/soc/codecs/ssm2602.c +11
-0+/* Workaround for what seems to be a hardware quirk: when using an +* external MCLK signal, powering on Output and DAC for the first +* time produces output distortions unless they're powered together +* with whole chip power. We power them here for the first time, +* as doing it later may be impossible (e.g. when starting playback +* while recording, whole chip power will already be on) +*/ +regmap_write (ssm2602->regmap,SSM2602_ACTIVE ,0x01 ); +regmap_write (ssm2602->regmap,SSM2602_PWR ,0x07 ); +regmap_write (ssm2602->regmap,SSM2602_RESET ,0x00 ); +
Quoted 2 lines
The rest of the driver uses symbolic names for register values, this code should too.
Ok, I'll correct that.
Quoted 7 lines
This also seems buggy in that it writes non-default values to the hardware then does a reset, meaning that the cache and hardware values will be out of sync, and since it only happens on probe there will be an issue after suspend if power is removed. It looks like this would be most comfortably implemented as a register patch applied as soon as the regmap is instantiated. See
regmap_register_patch().
I haven't considered that. I will look at regmap_register_patch() and try to use it.
Regards,
Paweł
PATCH 6/9 ASoC: ssm2602: Add support for CLKDIV2
In reply to Paweł AnikielThe SSM260x chips have an internal MCLK /2 divider (bit D7 in register R8). Add logic that allows for more MCLK values using this divider.
--- sound/soc/codecs/ssm2602.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/soc/codecs/ssm2602.c +12 -3
@@ -280,9 +280,12 @@ static inline int ssm2602_get_coeff(int mclk, int rate)int i;for (i =0 ; i <ARRAY_SIZE (ssm2602_coeff_table); i++) { -if (ssm2602_coeff_table[i].rate == rate && - ssm2602_coeff_table[i].mclk == mclk) -return ssm2602_coeff_table[i].srate; +if (ssm2602_coeff_table[i].rate == rate) { +if (ssm2602_coeff_table[i].mclk == mclk) +return ssm2602_coeff_table[i].srate; +if (ssm2602_coeff_table[i].mclk == mclk /2 ) +return ssm2602_coeff_table[i].srate |SRATE_CORECLK_DIV2 ; + } }return -EINVAL ; }
@@ -365,18 +368,24 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,switch (freq) {case 12288000 :case 18432000 : +case 24576000 : +case 36864000 : ssm2602->sysclk_constraints = &ssm2602_constraints_12288000;break ;case 11289600 :case 16934400 : +case 22579200 : +case 33868800 : ssm2602->sysclk_constraints = &ssm2602_constraints_11289600;break ;case 12000000 : +case 24000000 : ssm2602->sysclk_constraints =NULL ;break ;default :return -EINVAL ; } + ssm2602->sysclk = freq; }else {unsigned int mask;
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 7/9 ASoC: ssm2602: Add mute gpio
In reply to Paweł AnikielThe SSM2603 has a hardware mute pin. Add an optional mute gpio to control it.
--- sound/soc/codecs/ssm2602.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/ssm2602.c +11 -0
@@ -14,6 +14,7 @@#include <linux/delay.h> #include <linux/module.h> #include <linux/regmap.h> +#include <linux/gpio/consumer.h> #include <linux/slab.h> #include <sound/pcm.h>
@@ -32,6 +33,8 @@ struct ssm2602_priv {enum ssm2602_type type;unsigned int clk_out_pwr; + +struct gpio_desc *mute_gpiod; };/*
@@ -352,6 +355,10 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction)else regmap_update_bits (ssm2602->regmap,SSM2602_APDIGI ,APDIGI_ENABLE_DAC_MUTE ,0 ); + +if (ssm2602->mute_gpiod) +gpiod_set_value_cansleep (ssm2602->mute_gpiod, mute); +return 0 ; }
@@ -680,6 +687,10 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, ssm2602->type = type; ssm2602->regmap = regmap; + ssm2602->mute_gpiod =devm_gpiod_get_optional (dev,"mute" ,GPIOD_OUT_LOW ); +if (IS_ERR (ssm2602->mute_gpiod)) +return PTR_ERR (ssm2602->mute_gpiod); +return devm_snd_soc_register_component (dev, &soc_component_dev_ssm2602, &ssm2602_dai,1 ); }
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Mark Brown
maintainerRe: [PATCH 7/9] ASoC: ssm2602: Add mute gpio
sound/soc/codecs/ssm2602.c static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction) · line 361
Quoted 8 lines · Paweł Anikiel
sound/soc/codecs/ssm2602.c +4
-0@@ -352,6 +355,10 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction)else regmap_update_bits (ssm2602->regmap,SSM2602_APDIGI ,APDIGI_ENABLE_DAC_MUTE ,0 ); + +if (ssm2602->mute_gpiod) +gpiod_set_value_cansleep (ssm2602->mute_gpiod, mute); +
It seems pointless to control both the mute register and the GPIO mute here, we gain nothing but overhead from having the GPIO. What I would suggest is that if the GPIO is present then that is used in _mute() and we add a control allowing the user to mute and unmute via the register.
PATCH 8/9 dt-bindings: ASoC: Add mute-gpio to ssm2602
In reply to Paweł AnikielAdd mute-gpio to ssm2602
--- Documentation/devicetree/bindings/sound/adi,ssm2602.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/adi,ssm2602.txt +4 -0
@@ -11,6 +11,10 @@ Required properties: - reg : the I2C address of the device for I2C, the chip select number for SPI. +Optional properties: + +- mute-gpios: GPIO specifier for the mute pin + Example: ssm2602: ssm2602@1a {
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 9/9 ARM: dts: chameleonv3: Add ssm2603 mute gpio
In reply to Paweł AnikielThe ssm2603 mute pin is connected to a gpio expander. Add this connection to the devicetree.
--- arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +2 -0
@@ -3,6 +3,7 @@ * Copyright 2022 Google LLC */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "socfpga_arria10_mercury_aa1.dtsi" / {
@@ -67,6 +68,7 @@ &i2c0 { ssm2603: audio-codec@1a { compatible = "adi,ssm2603"; reg = <0x1a>; + mute-gpios = <&u80 0 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Mark Brown
maintainerQuoted 6 lines · Paweł Anikiel
sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++
Please at least make a directory for Google as a vendor, we don't want people adding directories for each individual product. That said generally we add machine drivers in the directory for the relevant SoC family, is there any reason that pattern isn't followed here?
Quoted 10 lines · Mark Brown
Quoted 6 lines · Paweł Anikiel
sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++
Quoted 4 lines
Please at least make a directory for Google as a vendor, we don't want people adding directories for each individual product. That said generally we add machine drivers in the directory for the relevant SoC family, is there any reason that pattern isn't followed here?
The board is based around an Intel Arria 10 SoC FPGA. The ring buffer device and all the routing is implemented inside the FPGA. Is it ok to put the machine driver in the product directory in this case?. As for the directory path, would sound/soc/google/chameleonv3/* be ok?
Regards,
Paweł
Mark Brown
maintainerQuoted 9 lines · Paweł Anikiel
Quoted 4 lines
Please at least make a directory for Google as a vendor, we don't want people adding directories for each individual product. That said generally we add machine drivers in the directory for the relevant SoC family, is there any reason that pattern isn't followed here?
The board is based around an Intel Arria 10 SoC FPGA. The ring buffer device and all the routing is implemented inside the FPGA. Is it ok to put the machine driver in the product directory in this case?. As for the directory path, would
sound/soc/google/chameleonv3/*be ok?
Does the individual product really need a directory - nobody's going to reuse the IP on the FPGA for anything?
Quoted 10 lines · Mark Brown
Quoted 6 lines · Paweł Anikiel
sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++
Quoted 4 lines
Please at least make a directory for Google as a vendor, we don't want people adding directories for each individual product. That said generally we add machine drivers in the directory for the relevant SoC family, is there any reason that pattern isn't followed here?
The board is based around an Intel Arria 10 SoC FPGA. The ring buffer device and all the routing is implemented inside the FPGA. Is it ok to put the machine driver in the product directory in this case?. As for the directory path, would sound/soc/google/chameleonv3/* be ok?
Regards,
Paweł
PATCH 1/9 ASoC: Add Chameleon v3 audio
In reply to Paweł AnikielAdd machine and platform drivers for ASoC audio on Chameleon v3.
The board has two audio sources: HDMI audio from the it68051 chip (RX only), and analog audio from the ssm2603 chip (RX and TX).
--- .../boot/dts/socfpga_arria10_chameleonv3.dts | 28 ++ sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/chameleonv3/Kconfig | 7 + sound/soc/chameleonv3/Makefile | 2 + sound/soc/chameleonv3/chv3-audio.c | 111 ++++++ sound/soc/chameleonv3/chv3-i2s.c | 347 ++++++++++++++++++ sound/soc/chameleonv3/chv3-it68051.c | 41 +++ 8 files changed, 538 insertions(+) create mode 100644 sound/soc/chameleonv3/Kconfig create mode 100644 sound/soc/chameleonv3/Makefile create mode 100644 sound/soc/chameleonv3/chv3-audio.c create mode 100644 sound/soc/chameleonv3/chv3-i2s.c create mode 100644 sound/soc/chameleonv3/chv3-it68051.c
arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +28 -0
@@ -15,6 +15,34 @@ aliases { i2c0 = &i2c0; i2c1 = &i2c1; }; + + soc { + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>; + }; + + i2s1: i2s@c0060400 { + compatible = "google,chv3-i2s"; + reg = <0xc0060400 0x100>, + <0xc0060f10 0x10>; + interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + + sound { + compatible = "google,chv3-audio"; + google,audio-cpu0 = <&i2s1>; + google,audio-codec0 = <&ssm2603>; + google,audio-cpu1 = <&i2s0>; + google,audio-codec1 = <&it68051>; + }; + + it68051: audio-codec { + compatible = "ite,it68051"; + }; }; &gmac0 {
sound/soc/Kconfig +1 -0
@@ -72,6 +72,7 @@ source "sound/soc/apple/Kconfig" source "sound/soc/atmel/Kconfig" source "sound/soc/au1x/Kconfig" source "sound/soc/bcm/Kconfig" +source "sound/soc/chameleonv3/Kconfig" source "sound/soc/cirrus/Kconfig" source "sound/soc/dwc/Kconfig" source "sound/soc/fsl/Kconfig"
sound/soc/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_SND_SOC) += amd/ obj-$(CONFIG_SND_SOC) += atmel/ obj-$(CONFIG_SND_SOC) += au1x/ obj-$(CONFIG_SND_SOC) += bcm/ +obj-$(CONFIG_SND_SOC) += chameleonv3/ obj-$(CONFIG_SND_SOC) += cirrus/ obj-$(CONFIG_SND_SOC) += dwc/ obj-$(CONFIG_SND_SOC) += fsl/
sound/soc/chameleonv3/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +config SND_SOC_CHV3 + tristate "SoC Audio support for Chameleon v3" + select SND_SOC_SSM2602 + select SND_SOC_SSM2602_I2C + help + Say Y if you want to add audio support for the Chameleon v3.
sound/soc/chameleonv3/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_SND_SOC_CHV3) += chv3-i2s.o chv3-audio.o chv3-it68051.o
sound/soc/chameleonv3/chv3-audio.c new file +111 -0
111 lines not on this page · raw message
sound/soc/chameleonv3/chv3-i2s.c new file +347 -0
347 lines not on this page · raw message
sound/soc/chameleonv3/chv3-it68051.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 2/9 dt-bindings: ASoC: Add chv3-i2s
In reply to Paweł AnikielAdd binding for chv3-i2s device.
--- .../bindings/sound/google,chv3-i2s.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml
Documentation/devicetree/bindings/sound/google,chv3-i2s.yaml new file +42 -0
@@ -0,0 +1,42 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-i2s.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 I2S device + +maintainers: + - Paweł Anikiel <[email protected]> + +description: | + I2S device for the Google Chameleon v3. The device handles both RX + and TX using a producer/consumer ring buffer design. + +properties: + compatible: + const: google,chv3-i2s + reg: + items: + - description: core registers + - description: irq registers + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2s0: i2s@c0060300 { + compatible = "google,chv3-i2s"; + reg = <0xc0060300 0x100>, + <0xc0060f00 0x10>; + interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 3/9 dt-bindings: ASoC: Add chv3-audio
In reply to Paweł AnikielAdd binding for chv3-audio device.
--- .../bindings/sound/google,chv3-audio.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/google,chv3-audio.yaml
Documentation/devicetree/bindings/sound/google,chv3-audio.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/google,chv3-audio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chameleon v3 audio + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: google,chv3-audio + + google,audio-cpu0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #0 + + google,audio-codec0: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #0 + + google,audio-cpu1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of controller #1 + + google,audio-codec1: + $ref: /schemas/types.yaml#/definitions/phandle + description: The phandle of codec #1 + +required: + - compatible + - google,audio-cpu0: + - google,audio-codec0: + - google,audio-cpu1: + - google,audio-codec1: + +additionalProperties: false + +examples: + - | + sound { + compatible = "google,chv3-audio"; + google,audio-cpu0 = <&i2s1>; + google,audio-codec0 = <&ssm2603>; + google,audio-cpu1 = <&i2s0>; + google,audio-codec1 = <&it68051>; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 4/9 dt-bindings: ASoC: Add it68051
In reply to Paweł AnikielAdd binding for it68051 device.
--- .../bindings/sound/ite,it68051.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ite,it68051.yaml
Documentation/devicetree/bindings/sound/ite,it68051.yaml new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/ite,it68051.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: it68051 audio codec + +maintainers: + - Paweł Anikiel <[email protected]> + +properties: + compatible: + const: ite,it68051 + +required: + - compatible + +examples: + - | + it68051: audio-codec { + compatible = "ite,it68051"; + };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 5/9 ASoC: ssm2602: Add workaround for playback with external MCLK
In reply to Paweł AnikielApply a workaround for what seems to be a hardware quirk: when using an external MCLK signal, powering on Output and DAC for the first time produces output distortions unless they're powered together with whole chip power.
The workaround powers them on in probe for the first time, as doing it later may be impossible (e.g. when starting playback while recording, whole chip power will already be on).
Here are some initialization sequences run after all other control registers were set (ssmset reg val sets the value of a register via i2c):
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x87 # out, dac
ssmset 0x06 0x07 # chip
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
(enable MCLK)
OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x1f # chip
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x06 0x1f # chip
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # out, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
ssmset 0x06 0x07 # dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
ssmset 0x06 0x07 # out
NOT OK
Here are some sequences run at the very start before a sw reset (and later using one of the NOT OK sequences from above):
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
OK
(disable MCLK)
ssmset 0x09 0x01 # core
ssmset 0x06 0x07 # chip, out, dac
(enable MCLK after reset)
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x17 # chip, dac
NOT OK
ssmset 0x09 0x01 # core
ssmset 0x06 0x0f # chip, out
NOT OK
ssmset 0x06 0x07 # chip, out, dac
NOT OK
This was tested on a Google Chameleon v3 board using an SSM2603 with an external MCLK. This doesn't seem to just be a PCB issue, as this was also observed on a ZYBO Z7-10:
https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
--- sound/soc/codecs/ssm2602.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/ssm2602.c +11 -0
@@ -589,6 +589,17 @@ static int ssm260x_component_probe(struct snd_soc_component *component)return ret; } +/* Workaround for what seems to be a hardware quirk: when using an +* external MCLK signal, powering on Output and DAC for the first +* time produces output distortions unless they're powered together +* with whole chip power. We power them here for the first time, +* as doing it later may be impossible (e.g. when starting playback +* while recording, whole chip power will already be on) +*/ +regmap_write (ssm2602->regmap,SSM2602_ACTIVE ,0x01 ); +regmap_write (ssm2602->regmap,SSM2602_PWR ,0x07 ); +regmap_write (ssm2602->regmap,SSM2602_RESET ,0x00 ); +/* set the update bits */ regmap_update_bits (ssm2602->regmap,SSM2602_LINVOL ,LINVOL_LRIN_BOTH ,LINVOL_LRIN_BOTH );
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 6/9 ASoC: ssm2602: Add support for CLKDIV2
In reply to Paweł AnikielThe SSM260x chips have an internal MCLK /2 divider (bit D7 in register R8). Add logic that allows for more MCLK values using this divider.
--- sound/soc/codecs/ssm2602.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
sound/soc/codecs/ssm2602.c +12 -3
@@ -280,9 +280,12 @@ static inline int ssm2602_get_coeff(int mclk, int rate)int i;for (i =0 ; i <ARRAY_SIZE (ssm2602_coeff_table); i++) { -if (ssm2602_coeff_table[i].rate == rate && - ssm2602_coeff_table[i].mclk == mclk) -return ssm2602_coeff_table[i].srate; +if (ssm2602_coeff_table[i].rate == rate) { +if (ssm2602_coeff_table[i].mclk == mclk) +return ssm2602_coeff_table[i].srate; +if (ssm2602_coeff_table[i].mclk == mclk /2 ) +return ssm2602_coeff_table[i].srate |SRATE_CORECLK_DIV2 ; + } }return -EINVAL ; }
@@ -365,18 +368,24 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,switch (freq) {case 12288000 :case 18432000 : +case 24576000 : +case 36864000 : ssm2602->sysclk_constraints = &ssm2602_constraints_12288000;break ;case 11289600 :case 16934400 : +case 22579200 : +case 33868800 : ssm2602->sysclk_constraints = &ssm2602_constraints_11289600;break ;case 12000000 : +case 24000000 : ssm2602->sysclk_constraints =NULL ;break ;default :return -EINVAL ; } + ssm2602->sysclk = freq; }else {unsigned int mask;
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 7/9 ASoC: ssm2602: Add mute gpio
In reply to Paweł AnikielThe SSM2603 has a hardware mute pin. Add an optional mute gpio to control it.
--- sound/soc/codecs/ssm2602.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/ssm2602.c +11 -0
@@ -14,6 +14,7 @@#include <linux/delay.h> #include <linux/module.h> #include <linux/regmap.h> +#include <linux/gpio/consumer.h> #include <linux/slab.h> #include <sound/pcm.h>
@@ -32,6 +33,8 @@ struct ssm2602_priv {enum ssm2602_type type;unsigned int clk_out_pwr; + +struct gpio_desc *mute_gpiod; };/*
@@ -352,6 +355,10 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction)else regmap_update_bits (ssm2602->regmap,SSM2602_APDIGI ,APDIGI_ENABLE_DAC_MUTE ,0 ); + +if (ssm2602->mute_gpiod) +gpiod_set_value_cansleep (ssm2602->mute_gpiod, mute); +return 0 ; }
@@ -680,6 +687,10 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, ssm2602->type = type; ssm2602->regmap = regmap; + ssm2602->mute_gpiod =devm_gpiod_get_optional (dev,"mute" ,GPIOD_OUT_LOW ); +if (IS_ERR (ssm2602->mute_gpiod)) +return PTR_ERR (ssm2602->mute_gpiod); +return devm_snd_soc_register_component (dev, &soc_component_dev_ssm2602, &ssm2602_dai,1 ); }
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 8/9 dt-bindings: ASoC: Add mute-gpio to ssm2602
In reply to Paweł AnikielAdd mute-gpio to ssm2602
--- Documentation/devicetree/bindings/sound/adi,ssm2602.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/adi,ssm2602.txt +4 -0
@@ -11,6 +11,10 @@ Required properties: - reg : the I2C address of the device for I2C, the chip select number for SPI. +Optional properties: + +- mute-gpios: GPIO specifier for the mute pin + Example: ssm2602: ssm2602@1a {
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
PATCH 9/9 ARM: dts: chameleonv3: Add ssm2603 mute gpio
In reply to Paweł AnikielThe ssm2603 mute pin is connected to a gpio expander. Add this connection to the devicetree.
--- arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/socfpga_arria10_chameleonv3.dts +2 -0
@@ -3,6 +3,7 @@ * Copyright 2022 Google LLC */ /dts-v1/; +#include <dt-bindings/gpio/gpio.h> #include "socfpga_arria10_mercury_aa1.dtsi" / {
@@ -67,6 +68,7 @@ &i2c0 { ssm2603: audio-codec@1a { compatible = "adi,ssm2603"; reg = <0x1a>; + mute-gpios = <&u80 0 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.40.0.634.g4ca3ef3211-goog
Mark Brown
maintainerRe: (subset) [PATCH 0/9] Add Chameleon v3 ASoC audio
In reply to Paweł AnikielQuoted 9 lines · Paweł Anikiel
The Google Chameleon v3 is a device made for testing audio and video paths of other devices. This patchset adds support for ASoC audio on this device. It has two audio sources: HDMI audio from the it68051 chip (RX only), and analog audio from the ssm2603 chip (RX and TX).
The patchset adds the ASoC platform and machine drivers, as well as some changes to the existing ssm2602 codec driver.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[6/9] ASoC: ssm2602: Add support for CLKDIV2
commit: 8076c586bbc1c62e075e58f41dafdd8b5022b24d
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark