* [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio @ 2017-03-12 6:38 Michael Zoran [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-20 16:50 ` [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio Rob Herring 0 siblings, 2 replies; 18+ messages in thread From: Michael Zoran @ 2017-03-12 6:38 UTC (permalink / raw) To: perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: Michael Zoran Add documentation for the DMA properties required when using the PWM controller of the bcm2835 for analog audio output. Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> --- Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt index cf573e85b11d..08fc06fc083a 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt @@ -1,14 +1,21 @@ BCM2835 PWM controller (Raspberry Pi controller) Required properties: -- compatible: should be "brcm,bcm2835-pwm" +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835-analog-audio" - reg: physical base address and length of the controller's registers - clocks: This clock defines the base clock frequency of the PWM hardware system, the period and the duty_cycle of the PWM signal is a multiple of the base period. + +Required properties(PWM Output): - #pwm-cells: Should be 2. See pwm.txt in this directory for a description of the cells format. +Required properties(Audio Output): +- dmas: Should contain one entry pointing to the DMA channel used to + transfer audio data +- dma-names: Should contain "tx" + Examples: pwm@2020c000 { -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 18+ messages in thread
[parent not found: <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack. [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-12 6:38 ` Michael Zoran 2017-03-16 0:01 ` Eric Anholt 2017-03-12 6:38 ` [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver Michael Zoran 2017-03-12 6:38 ` [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 Michael Zoran 2 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-12 6:38 UTC (permalink / raw) To: perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: Michael Zoran Add driver for the bcm2835 analog/headphone jack which uses the PWM hardware to generate audio. Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> --- sound/arm/bcm2835-analog-audio.c | 678 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 678 insertions(+) create mode 100644 sound/arm/bcm2835-analog-audio.c diff --git a/sound/arm/bcm2835-analog-audio.c b/sound/arm/bcm2835-analog-audio.c new file mode 100644 index 000000000000..c95456e16506 --- /dev/null +++ b/sound/arm/bcm2835-analog-audio.c @@ -0,0 +1,678 @@ +/* + * Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> + * + * 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; version 2. + * + * bcm2835-analog-audio provides support for very simple analog + * audio using the PWM hardware of the bcm2835. It is assumed + * that additional analog hardware is connected to the GPIO pins + * to amplify the audio and provide basic analog filtering. + * + */ + +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/clk.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/of.h> +#include <linux/slab.h> +#include <sound/pcm.h> +#include <sound/initval.h> +#include <sound/pcm_params.h> +#include <sound/dmaengine_pcm.h> +#include <linux/of_address.h> +#include <linux/dma-mapping.h> + +/* + * PWM Register Offsets + */ +#define PWM_REG_CTR 0x00 +#define PWM_REG_STA 0x04 +#define PWM_REG_DMAC 0x08 +#define PWM_REG_RNG1 0x10 +#define PWM_REG_DAT1 0x14 +#define PWM_REG_FIFO 0x18 +#define PWM_REG_RNG2 0x20 +#define PWM_REG_DAT2 0x24 + +#define PWM_CLOCK_FREQUENCY 100000000 +#define PWM_SAMPLE_RATE 48000 +#define PWM_SYMBOLS (PWM_CLOCK_FREQUENCY / PWM_SAMPLE_RATE) +#define PWM_DC_OFFSET (PWM_SYMBOLS / 2) + +/* + * The channel order that needs to be passed to the PWM FIFO is opposite the + * order that is passed by the application. So the order needs to be flipped + * in software. + */ + + +struct bcm2835_hardware_frame { + u32 right; + u32 left; +}; + +struct bcm2835_software_frame { + s16 left; + s16 right; +}; + +#define HARDWARE_BUFFER_FRAMES_PER_PERIOD 720 +#define HARDWARE_BUFFER_PERIODS_PER_BUFFER 2 +#define HARDWARE_BUFFER_FRAMES_PER_BUFFER (HARDWARE_BUFFER_FRAMES_PER_PERIOD * \ + HARDWARE_BUFFER_PERIODS_PER_BUFFER) +#define HARDWARE_BUFFER_PERIOD_BYTES (sizeof(struct bcm2835_hardware_frame) * \ + HARDWARE_BUFFER_FRAMES_PER_PERIOD) +#define HARDWARE_BUFFER_BYTES (HARDWARE_BUFFER_PERIOD_BYTES * \ + HARDWARE_BUFFER_PERIODS_PER_BUFFER) + +struct bcm2835_chip; + +struct bcm2835_chip_runtime { + struct bcm2835_chip *chip; + struct snd_pcm_substream *substream; + spinlock_t spinlock; + struct dma_slave_config dma_slave_config; + struct dma_async_tx_descriptor *dma_desc; + dma_cookie_t dma_cookie; + struct bcm2835_hardware_frame *hardware_buffer; + dma_addr_t hardware_buffer_dma; + int hardware_period_number; + bool is_playing; + struct bcm2835_software_frame *playback_src_buffer; + snd_pcm_uframes_t playback_src_pos; + snd_pcm_uframes_t playback_src_frames_this_period; +}; + +struct bcm2835_chip { + struct platform_device *pdev; + struct device *dev; + struct mutex lock; + u32 dma_addr; + void __iomem *base; + struct clk *clk; + int opencount; + struct dma_chan *dma_channel; + struct snd_card *card; + struct snd_pcm *pcm; + struct bcm2835_chip_runtime *runtime; +}; + +static u32 convert_audio_data(s16 input) +{ + s32 output; + + output = ((s32) input * (s32)(PWM_SYMBOLS / 2)) / (s32)32762; + return (u32)(output + PWM_DC_OFFSET); +} + +static void convert_dma_buffer(struct bcm2835_chip_runtime *chip_runtime) +{ + snd_pcm_uframes_t i; + snd_pcm_uframes_t hardware_start_pos = + chip_runtime->hardware_period_number * + HARDWARE_BUFFER_FRAMES_PER_PERIOD; + snd_pcm_uframes_t buffer_size = + chip_runtime->substream->runtime->buffer_size; + struct bcm2835_hardware_frame *hard_frame = + chip_runtime->hardware_buffer + hardware_start_pos; + + for (i = 0; i < HARDWARE_BUFFER_FRAMES_PER_PERIOD; i++) { + struct bcm2835_software_frame *soft_frame = + chip_runtime->playback_src_buffer + + chip_runtime->playback_src_pos; + + hard_frame->left = convert_audio_data(soft_frame->left); + hard_frame->right = convert_audio_data(soft_frame->right); + hard_frame++; + + if (chip_runtime->playback_src_pos >= buffer_size - 1) + chip_runtime->playback_src_pos = 0; + else + chip_runtime->playback_src_pos++; + } +} + +static void fill_silence(struct bcm2835_chip_runtime *chip_runtime) +{ + snd_pcm_uframes_t i; + snd_pcm_uframes_t hardware_start_pos = + chip_runtime->hardware_period_number * + HARDWARE_BUFFER_FRAMES_PER_PERIOD; + struct bcm2835_hardware_frame *hard_frame = + chip_runtime->hardware_buffer + hardware_start_pos; + + for (i = 0; i < HARDWARE_BUFFER_FRAMES_PER_PERIOD; i++) { + hard_frame->left = PWM_DC_OFFSET; + hard_frame->right = PWM_DC_OFFSET; + hard_frame++; + } +} + +static void dma_complete(void *arg) +{ + struct bcm2835_chip_runtime *chip_runtime = arg; + unsigned long flags; + bool period_elapsed = false; + + spin_lock_irqsave(&chip_runtime->spinlock, flags); + + chip_runtime->hardware_period_number++; + if (chip_runtime->hardware_period_number >= + HARDWARE_BUFFER_PERIODS_PER_BUFFER) + chip_runtime->hardware_period_number = 0; + + if (!chip_runtime->is_playing) + fill_silence(chip_runtime); + else { + chip_runtime->playback_src_frames_this_period += + HARDWARE_BUFFER_FRAMES_PER_PERIOD; + + if (chip_runtime->playback_src_frames_this_period >= + chip_runtime->substream->runtime->period_size) { + chip_runtime->playback_src_frames_this_period = 0; + period_elapsed = true; + } + + convert_dma_buffer(chip_runtime); + } + + spin_unlock_irqrestore(&chip_runtime->spinlock, flags); + + if (period_elapsed) + snd_pcm_period_elapsed(chip_runtime->substream); +} + +static void snd_bcm2835_cleanup_runtime(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime = chip->runtime; + + if (!chip_runtime) + return; + + if (chip_runtime->dma_cookie) + dmaengine_terminate_sync(chip->dma_channel); + + writel(0x00, chip->base + PWM_REG_CTR); + writel(0x00, chip->base + PWM_REG_DMAC); + + if (chip_runtime->dma_desc) + dmaengine_desc_free(chip_runtime->dma_desc); + + if (chip_runtime->hardware_buffer) + dma_free_coherent(chip->dma_channel->device->dev, + HARDWARE_BUFFER_BYTES, + chip_runtime->hardware_buffer, + chip_runtime->hardware_buffer_dma); + + chip->runtime = NULL; + kfree(chip_runtime); +} + +static int snd_bcm2835_init_runtime(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime; + int err; + int i; + + if (chip->runtime) + return 0; + + chip_runtime = kzalloc(sizeof(*chip_runtime), GFP_KERNEL); + + if (!chip_runtime) + return -ENOMEM; + + chip_runtime->chip = chip; + chip_runtime->substream = substream; + spin_lock_init(&chip_runtime->spinlock); + chip->runtime = chip_runtime; + + chip_runtime->hardware_buffer = + dma_alloc_coherent(chip->dma_channel->device->dev, + HARDWARE_BUFFER_BYTES, + &chip_runtime->hardware_buffer_dma, + GFP_KERNEL); + + if (!chip_runtime->hardware_buffer) { + snd_bcm2835_cleanup_runtime(substream); + return -ENOMEM; + } + + for (i = 0; i < HARDWARE_BUFFER_FRAMES_PER_BUFFER; i++) { + chip_runtime->hardware_buffer[i].left = PWM_DC_OFFSET; + chip_runtime->hardware_buffer[i].right = PWM_DC_OFFSET; + } + + chip_runtime->hardware_period_number = + (HARDWARE_BUFFER_PERIODS_PER_BUFFER - 1); + + chip_runtime->dma_slave_config.direction = DMA_MEM_TO_DEV; + chip_runtime->dma_slave_config.dst_addr = chip->dma_addr; + chip_runtime->dma_slave_config.dst_maxburst = 2; + chip_runtime->dma_slave_config.dst_addr_width = 4; + chip_runtime->dma_slave_config.src_addr = + chip_runtime->hardware_buffer_dma; + chip_runtime->dma_slave_config.src_maxburst = 2; + chip_runtime->dma_slave_config.src_addr_width = 4; + + err = dmaengine_slave_config(chip->dma_channel, + &chip_runtime->dma_slave_config); + + if (err < 0) { + snd_bcm2835_cleanup_runtime(substream); + return err; + } + + chip_runtime->dma_desc = + dmaengine_prep_dma_cyclic(chip->dma_channel, + chip_runtime->hardware_buffer_dma, + HARDWARE_BUFFER_BYTES, + HARDWARE_BUFFER_PERIOD_BYTES, + DMA_MEM_TO_DEV, + DMA_CTRL_ACK | DMA_PREP_INTERRUPT); + + if (!chip_runtime->dma_desc) { + snd_bcm2835_cleanup_runtime(substream); + return -ENOMEM; + } + + chip_runtime->dma_desc->callback = dma_complete; + chip_runtime->dma_desc->callback_param = chip_runtime; + + writel(PWM_SYMBOLS, chip->base + PWM_REG_RNG1); + writel(PWM_SYMBOLS, chip->base + PWM_REG_RNG2); + writel(0xa1e1, chip->base + PWM_REG_CTR); + writel(0x80000E0E, chip->base + PWM_REG_DMAC); + + chip_runtime->dma_cookie = dmaengine_submit(chip_runtime->dma_desc); + dma_async_issue_pending(chip->dma_channel); + + return 0; + +} +static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .channels_min = 2, + .channels_max = 2, + .buffer_bytes_max = 128 * 1024, + .period_bytes_min = 4 * 1024, + .period_bytes_max = 128 * 1024, + .periods_min = 1, + .periods_max = 128 / 4, + .fifo_size = 0, +}; + +static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime) +{ + runtime->private_data = NULL; +} + +static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + + if (mutex_lock_interruptible(&chip->lock)) + return -EINTR; + + if (chip->opencount) { + chip->opencount++; + mutex_unlock(&chip->lock); + return 0; + } + + clk_set_rate(chip->clk, PWM_CLOCK_FREQUENCY); + err = clk_prepare_enable(chip->clk); + if (err) + return err; + + err = snd_bcm2835_init_runtime(substream); + if (err) { + clk_disable_unprepare(chip->clk); + mutex_unlock(&chip->lock); + return err; + } + + chip->opencount++; + + runtime->hw = snd_bcm2835_playback_hw; + runtime->private_data = chip->runtime; + runtime->private_free = snd_bcm2835_playback_free; + + mutex_unlock(&chip->lock); + + return 0; +} + +static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + if (mutex_lock_interruptible(&chip->lock)) + return -EINTR; + + if (!chip->opencount) { + mutex_unlock(&chip->lock); + return 0; + } + + chip->opencount--; + if (chip->opencount) { + mutex_unlock(&chip->lock); + return 0; + } + + snd_bcm2835_cleanup_runtime(substream); + clk_disable_unprepare(chip->clk); + + runtime->private_data = NULL; + runtime->private_free = NULL; + + mutex_unlock(&chip->lock); + return 0; +} + +static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) +{ + return snd_pcm_lib_free_pages(substream); +} + +static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime = chip->runtime; + snd_pcm_uframes_t playback_src_buffer_frames; + snd_pcm_uframes_t playback_src_period_frames; + int err = 0; + + if (mutex_lock_interruptible(&chip->lock)) + return -EINTR; + + snd_bcm2835_pcm_hw_free(substream); + + playback_src_buffer_frames = params_buffer_bytes(params) / 4; + playback_src_period_frames = params_period_bytes(params) / 4; + + err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); + if (err < 0) { + snd_bcm2835_pcm_hw_free(substream); + mutex_unlock(&chip->lock); + return err; + } + + chip_runtime->playback_src_buffer = + (struct bcm2835_software_frame *)(substream->runtime->dma_area); + chip_runtime->playback_src_pos = 0; + chip_runtime->playback_src_frames_this_period = 0; + + mutex_unlock(&chip->lock); + return 0; +} + +static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime = chip->runtime; + + if (mutex_lock_interruptible(&chip->lock)) + return -EINTR; + + chip_runtime->playback_src_buffer = + (struct bcm2835_software_frame *)(substream->runtime->dma_area); + chip_runtime->playback_src_pos = 0; + chip_runtime->playback_src_frames_this_period = 0; + + memset(chip_runtime->playback_src_buffer, 0, + substream->runtime->buffer_size * + sizeof(*(chip_runtime->playback_src_buffer))); + + mutex_unlock(&chip->lock); + return 0; +} + +static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime = chip->runtime; + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(&chip_runtime->spinlock, flags); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + chip_runtime->is_playing = true; + break; + case SNDRV_PCM_TRIGGER_STOP: + chip_runtime->is_playing = false; + break; + default: + ret = -EINVAL; + } + + spin_unlock_irqrestore(&chip_runtime->spinlock, flags); + + return ret; +} + +static snd_pcm_uframes_t +snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) +{ + struct bcm2835_chip *chip = snd_pcm_substream_chip(substream); + struct bcm2835_chip_runtime *chip_runtime = chip->runtime; + snd_pcm_uframes_t ret; + unsigned long flags; + + spin_lock_irqsave(&chip_runtime->spinlock, flags); + ret = chip_runtime->playback_src_pos; + spin_unlock_irqrestore(&chip_runtime->spinlock, flags); + + return ret; +} + +static struct snd_pcm_ops snd_bcm2835_playback_ops = { + .open = snd_bcm2835_playback_open, + .close = snd_bcm2835_playback_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_bcm2835_pcm_hw_params, + .hw_free = snd_bcm2835_pcm_hw_free, + .prepare = snd_bcm2835_pcm_prepare, + .trigger = snd_bcm2835_pcm_trigger, + .pointer = snd_bcm2835_pcm_pointer, +}; + +static int snd_bcm2835_new_pcm(struct bcm2835_chip *chip) +{ + struct snd_pcm *pcm; + int err; + + err = snd_pcm_new(chip->card, "BCM2835 Analog", 0, 1, 0, &pcm); + + if (err < 0) + return err; + + pcm->private_data = chip; + strcpy(pcm->name, "BCM2835 Analog"); + chip->pcm = pcm; + + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, + &snd_bcm2835_playback_ops); + + /* pre-allocation of buffers */ + /* NOTE: this may fail */ + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + snd_dma_continuous_data(GFP_KERNEL), + snd_bcm2835_playback_hw.buffer_bytes_max, + snd_bcm2835_playback_hw.buffer_bytes_max); + + return 0; +} + +static int snd_bcm2835_free(struct bcm2835_chip *chip) +{ + if (chip->dma_channel) + dma_release_channel(chip->dma_channel); + + return 0; +} + +static int snd_bcm2835_dev_free(struct snd_device *device) +{ + return snd_bcm2835_free(device->device_data); +} + +static struct snd_device_ops snd_bcm2835_dev_ops = { + .dev_free = snd_bcm2835_dev_free, +}; + +static int snd_bcm2835_create(struct snd_card *card, + struct platform_device *pdev, + struct bcm2835_chip **rchip) +{ + struct bcm2835_chip *chip; + struct resource *res; + int err; + const __be32 *addr; + + *rchip = NULL; + + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->pdev = pdev; + chip->dev = &pdev->dev; + chip->card = card; + + mutex_init(&chip->lock); + + /* + * Get the physical address of the PWM FIFO. We need to retrieve + * the bus address specified in the DT, because the physical address + * (the one returned by platform_get_resource()) is not appropriate + * for DMA transfers. + */ + addr = of_get_address(chip->dev->of_node, 0, NULL, NULL); + chip->dma_addr = be32_to_cpup(addr) + PWM_REG_FIFO; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + + chip->base = devm_ioremap_resource(chip->dev, res); + if (IS_ERR(chip->base)) + return PTR_ERR(chip->base); + + chip->clk = devm_clk_get(chip->dev, NULL); + if (IS_ERR(chip->clk)) { + dev_err(&pdev->dev, "clock not found: %ld\n", + PTR_ERR(chip->clk)); + return PTR_ERR(chip->clk); + } + + chip->dma_channel = dma_request_slave_channel(chip->dev, "tx"); + + if (!chip->dma_channel) + return -ENOMEM; + + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, + &snd_bcm2835_dev_ops); + + if (err < 0) { + snd_bcm2835_free(chip); + return err; + } + + *rchip = chip; + return 0; +} + +static int bcm2835_analog_audio_probe(struct platform_device *pdev) +{ + struct snd_card *card; + int ret; + struct device *dev = &pdev->dev; + struct bcm2835_chip *chip; + + ret = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card); + if (ret) { + dev_err(dev, "Failed to create sound card structure\n"); + return ret; + } + + ret = snd_bcm2835_create(card, pdev, &chip); + if (ret < 0) { + dev_err(dev, "Failed to create bcm2835 chip\n"); + return ret; + } + + snd_card_set_dev(card, dev); + strcpy(card->driver, "BCM2835 Analog"); + strcpy(card->shortname, "BCM2835 Analog"); + sprintf(card->longname, "%s", card->shortname); + + ret = snd_bcm2835_new_pcm(chip); + if (ret < 0) { + snd_card_free(card); + return ret; + } + + ret = snd_card_register(card); + if (ret < 0) { + snd_card_free(card); + return ret; + } + + platform_set_drvdata(pdev, card); + + dev_notice(dev, "BCM2835 Analog Audio Initialized\n"); + + return 0; +} + +static int bcm2835_analog_audio_remove(struct platform_device *pdev) +{ + struct snd_card *card; + + card = platform_get_drvdata(pdev); + + if (card) + snd_card_free(card); + + return 0; +} + +static const struct of_device_id bcm2835_analog_audio_of_match[] = { + { .compatible = "brcm,bcm2835-analog-audio",}, + { /* sentinel */} +}; +MODULE_DEVICE_TABLE(of, bcm2835_analog_audio_of_match); + +static struct platform_driver bcm2835_analog_audio_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "bcm2835-analog-audio", + .of_match_table = bcm2835_analog_audio_of_match, + }, + .probe = bcm2835_analog_audio_probe, + .remove = bcm2835_analog_audio_remove, +}; +module_platform_driver(bcm2835_analog_audio_driver); + +MODULE_AUTHOR("Michael Zoran"); +MODULE_DESCRIPTION("Audio driver for analog output on the BCM2835 chip"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:brcm,bcm2835-analog-audio"); -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack. 2017-03-12 6:38 ` [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack Michael Zoran @ 2017-03-16 0:01 ` Eric Anholt 0 siblings, 0 replies; 18+ messages in thread From: Eric Anholt @ 2017-03-16 0:01 UTC (permalink / raw) To: perex, tiwai, robh+dt, mark.rutland, stefan.wahren, alsa-devel, linux-rpi-kernel, devicetree Cc: Michael Zoran [-- Attachment #1.1: Type: text/plain, Size: 771 bytes --] Michael Zoran <mzoran@crowfest.net> writes: > Add driver for the bcm2835 analog/headphone jack which > uses the PWM hardware to generate audio. > > Signed-off-by: Michael Zoran <mzoran@crowfest.net> ALSA folks: is a driver like this acceptable? In particular, I'm wondering how you feel about the in-kernel munging of the audio buffers to something appropriate for the PWM hardware, before we get into review of driver details. This driver isn't quite a replacement for the closed source driver in the firmware (couple of notes: firmware seems to have some dithering of the audio values in the sigma delta modulation process, and a priority bump on the DMA because the PWM's fifo is tiny), but I'm definitely interested in us having something like it in open source. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver. [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-12 6:38 ` [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack Michael Zoran @ 2017-03-12 6:38 ` Michael Zoran [not found] ` <20170312063820.19313-3-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-12 6:38 ` [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 Michael Zoran 2 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-12 6:38 UTC (permalink / raw) To: perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: Michael Zoran Update the build system to add the bcm2835-analog-audio driver. Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> --- sound/arm/Kconfig | 10 +++++++++- sound/arm/Makefile | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 65171f6657a2..71aef1dae6b8 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -2,7 +2,7 @@ menuconfig SND_ARM bool "ARM sound devices" - depends on ARM + depends on ARM || ARM64 default y help Support for sound devices specific to ARM architectures. @@ -11,6 +11,14 @@ menuconfig SND_ARM if SND_ARM +config SND_BCM2835_ANALOG_AUDIO + tristate "Analog/Headphone jack support for BCM2835" + depends on ARCH_BCM2835 && HAS_DMA + select SND_PCM + help + Say y or m to support the analog/headphone jack + for the BCM2835 as used by the Raspberry PI. + config SND_ARMAACI tristate "ARM PrimeCell PL041 AC Link support" depends on ARM_AMBA diff --git a/sound/arm/Makefile b/sound/arm/Makefile index 8c0c851d4641..744ff77e580a 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile @@ -14,3 +14,6 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o snd-pxa2xx-ac97-objs := pxa2xx-ac97.o + +obj-$(CONFIG_SND_BCM2835_ANALOG_AUDIO) += bcm2835-analog-audio.o + -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 18+ messages in thread
[parent not found: <20170312063820.19313-3-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* Re: [alsa-devel] [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver. [not found] ` <20170312063820.19313-3-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-14 7:15 ` kbuild test robot [not found] ` <201703141503.gyuLu0Kr%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: kbuild test robot @ 2017-03-14 7:15 UTC (permalink / raw) Cc: kbuild-all-JC7UmRfGjtg, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, Michael Zoran [-- Attachment #1: Type: text/plain, Size: 1384 bytes --] Hi Michael, [auto build test ERROR on sound/for-next] [also build test ERROR on v4.11-rc2 next-20170310] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Michael-Zoran/dt-bindings-Document-the-dmas-and-dma-names-properties-for-bcm2835-analog-audio/20170314-091035 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next config: arm64-allmodconfig (attached as .config) compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm64 All errors (new ones prefixed by >>): /tmp/ccNU8kQ5.s: Assembler messages: >> /tmp/ccNU8kQ5.s:1411: Error: unknown mnemonic `ldmia' -- `ldmia x26,{r0,r1,r2,r3}' >> /tmp/ccNU8kQ5.s:1412: Error: unknown mnemonic `stmia' -- `stmia x19!,{r0,r1,r2,r3}' >> /tmp/ccNU8kQ5.s:1618: Error: unknown mnemonic `ldmia' -- `ldmia x19!,{r0,r1,r2,r3}' >> /tmp/ccNU8kQ5.s:1619: Error: unknown mnemonic `stmia' -- `stmia x26,{r0,r1,r2,r3}' --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 53593 bytes --] ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <201703141503.gyuLu0Kr%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [alsa-devel] [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver. [not found] ` <201703141503.gyuLu0Kr%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-03-14 8:58 ` Michael Zoran [not found] ` <1489481899.656.5.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-14 8:58 UTC (permalink / raw) To: kbuild test robot Cc: kbuild-all-JC7UmRfGjtg, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA On Tue, 2017-03-14 at 15:15 +0800, kbuild test robot wrote: > Hi Michael, > > [auto build test ERROR on sound/for-next] > [also build test ERROR on v4.11-rc2 next-20170310] > [if your patch is applied to the wrong git tree, please drop us a > note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Michael-Zoran/dt-bin > dings-Document-the-dmas-and-dma-names-properties-for-bcm2835-analog- > audio/20170314-091035 > base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.g > it for-next > config: arm64-allmodconfig (attached as .config) > compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 > reproduce: > wget https://raw.githubusercontent.com/01org/lkp-tests/master > /sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=arm64 > > All errors (new ones prefixed by >>): > > /tmp/ccNU8kQ5.s: Assembler messages: > > > /tmp/ccNU8kQ5.s:1411: Error: unknown mnemonic `ldmia' -- `ldmia > > > x26,{r0,r1,r2,r3}' > > > /tmp/ccNU8kQ5.s:1412: Error: unknown mnemonic `stmia' -- `stmia > > > x19!,{r0,r1,r2,r3}' > > > /tmp/ccNU8kQ5.s:1618: Error: unknown mnemonic `ldmia' -- `ldmia > > > x19!,{r0,r1,r2,r3}' > > > /tmp/ccNU8kQ5.s:1619: Error: unknown mnemonic `stmia' -- `stmia > > > x26,{r0,r1,r2,r3}' > > --- > 0-DAY kernel test infrastructure Open Source > Technology Center > https://lists.01.org/pipermail/kbuild-all Intel > Corporation I'm a bit confused here. Why I'm I seeing assembly instruction build errors when the mail points to a DT binding document change? -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <1489481899.656.5.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* Re: [alsa-devel] [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver. [not found] ` <1489481899.656.5.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-14 9:13 ` Stefan Wahren [not found] ` <5a437138-bf9c-1e48-9fa6-82fac9b6e54c-eS4NqCHxEME@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Stefan Wahren @ 2017-03-14 9:13 UTC (permalink / raw) To: Michael Zoran, kbuild test robot Cc: kbuild-all-JC7UmRfGjtg, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, eric-WhKQ6XTQaPysTnJN9+BGXg, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Am 14.03.2017 um 09:58 schrieb Michael Zoran: > On Tue, 2017-03-14 at 15:15 +0800, kbuild test robot wrote: >> Hi Michael, >> >> [auto build test ERROR on sound/for-next] >> [also build test ERROR on v4.11-rc2 next-20170310] >> [if your patch is applied to the wrong git tree, please drop us a >> note to help improve the system] >> >> url: https://github.com/0day-ci/linux/commits/Michael-Zoran/dt-bin >> dings-Document-the-dmas-and-dma-names-properties-for-bcm2835-analog- >> audio/20170314-091035 >> base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.g >> it for-next >> config: arm64-allmodconfig (attached as .config) >> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 >> reproduce: >> wget https://raw.githubusercontent.com/01org/lkp-tests/master >> /sbin/make.cross -O ~/bin/make.cross >> chmod +x ~/bin/make.cross >> # save the attached .config to linux build tree >> make.cross ARCH=arm64 >> >> All errors (new ones prefixed by >>): >> >> /tmp/ccNU8kQ5.s: Assembler messages: >>>> /tmp/ccNU8kQ5.s:1411: Error: unknown mnemonic `ldmia' -- `ldmia >>>> x26,{r0,r1,r2,r3}' >>>> /tmp/ccNU8kQ5.s:1412: Error: unknown mnemonic `stmia' -- `stmia >>>> x19!,{r0,r1,r2,r3}' >>>> /tmp/ccNU8kQ5.s:1618: Error: unknown mnemonic `ldmia' -- `ldmia >>>> x19!,{r0,r1,r2,r3}' >>>> /tmp/ccNU8kQ5.s:1619: Error: unknown mnemonic `stmia' -- `stmia >>>> x26,{r0,r1,r2,r3}' >> --- >> 0-DAY kernel test infrastructure Open Source >> Technology Center >> https://lists.01.org/pipermail/kbuild-all Intel >> Corporation > I'm a bit confused here. Why I'm I seeing assembly instruction build > errors when the mail points to a DT binding document change? > > The email subject doesn't refer to a DT binding. I assume it's your change to enable ARM64 for all SND_ARM drivers, which aren't aware of that. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <5a437138-bf9c-1e48-9fa6-82fac9b6e54c-eS4NqCHxEME@public.gmane.org>]
* Re: [alsa-devel] [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver. [not found] ` <5a437138-bf9c-1e48-9fa6-82fac9b6e54c-eS4NqCHxEME@public.gmane.org> @ 2017-03-14 9:53 ` Michael Zoran 0 siblings, 0 replies; 18+ messages in thread From: Michael Zoran @ 2017-03-14 9:53 UTC (permalink / raw) To: Stefan Wahren, kbuild test robot Cc: kbuild-all-JC7UmRfGjtg, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, eric-WhKQ6XTQaPysTnJN9+BGXg, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA On Tue, 2017-03-14 at 10:13 +0100, Stefan Wahren wrote: > Am 14.03.2017 um 09:58 schrieb Michael Zoran: > > On Tue, 2017-03-14 at 15:15 +0800, kbuild test robot wrote: > > > Hi Michael, > > > > > > [auto build test ERROR on sound/for-next] > > > [also build test ERROR on v4.11-rc2 next-20170310] > > > [if your patch is applied to the wrong git tree, please drop us a > > > note to help improve the system] > > > > > > url: https://github.com/0day-ci/linux/commits/Michael-Zoran/dt > > > -bin > > > dings-Document-the-dmas-and-dma-names-properties-for-bcm2835- > > > analog- > > > audio/20170314-091035 > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sou > > > nd.g > > > it for-next > > > config: arm64-allmodconfig (attached as .config) > > > compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 > > > reproduce: > > > wget https://raw.githubusercontent.com/01org/lkp-tests/ma > > > ster > > > /sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # save the attached .config to linux build tree > > > make.cross ARCH=arm64 > > > > > > All errors (new ones prefixed by >>): > > > > > > /tmp/ccNU8kQ5.s: Assembler messages: > > > > > /tmp/ccNU8kQ5.s:1411: Error: unknown mnemonic `ldmia' -- > > > > > `ldmia > > > > > x26,{r0,r1,r2,r3}' > > > > > /tmp/ccNU8kQ5.s:1412: Error: unknown mnemonic `stmia' -- > > > > > `stmia > > > > > x19!,{r0,r1,r2,r3}' > > > > > /tmp/ccNU8kQ5.s:1618: Error: unknown mnemonic `ldmia' -- > > > > > `ldmia > > > > > x19!,{r0,r1,r2,r3}' > > > > > /tmp/ccNU8kQ5.s:1619: Error: unknown mnemonic `stmia' -- > > > > > `stmia > > > > > x26,{r0,r1,r2,r3}' > > > > > > --- > > > 0-DAY kernel test infrastructure Open Source > > > Technology Center > > > https://lists.01.org/pipermail/kbuild-all Intel > > > Corporation > > > > I'm a bit confused here. Why I'm I seeing assembly instruction > > build > > errors when the mail points to a DT binding document change? > > > > > > The email subject doesn't refer to a DT binding. > > I assume it's your change to enable ARM64 for all SND_ARM drivers, > which > aren't aware of that. OK, that makes sense now. Should I just submit another change adding a depends on ARM to the 1 or 2 other drivers in the directory? -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-12 6:38 ` [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack Michael Zoran 2017-03-12 6:38 ` [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver Michael Zoran @ 2017-03-12 6:38 ` Michael Zoran [not found] ` <20170312063820.19313-4-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-12 6:38 UTC (permalink / raw) To: perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-AbSShOkvfpQ, eric-WhKQ6XTQaPysTnJN9+BGXg, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: Michael Zoran Add the DT nodes for the analog audio/headphone jack for the BCM2835 Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> --- arch/arm/boot/dts/bcm283x.dtsi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi index 9798bc9293d8..bf2cd463a6e6 100644 --- a/arch/arm/boot/dts/bcm283x.dtsi +++ b/arch/arm/boot/dts/bcm283x.dtsi @@ -338,7 +338,12 @@ brcm,pins = <42 43>; brcm,function = <BCM2835_FSEL_ALT5>; }; - }; + + analog_audio_pins: analog_audio_pins { + brcm,pins = <40 45>; + brcm,function = <4 4>; /* Alt0 */ + }; + }; uart0: serial@7e201000 { compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; @@ -464,6 +469,17 @@ status = "disabled"; }; + analogaudio: analogaudio@7e20c000 { + compatible = "brcm,bcm2835-analog-audio"; + reg = <0x7e20c000 0x28>; + clocks = <&clocks BCM2835_CLOCK_PWM>; + assigned-clocks = <&clocks BCM2835_CLOCK_PWM>; + pinctrl-names = "default"; + pinctrl-0 = <&analog_audio_pins>; + dmas = <&dma 5>; + dma-names = "tx"; + }; + sdhci: sdhci@7e300000 { compatible = "brcm,bcm2835-sdhci"; reg = <0x7e300000 0x100>; -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 18+ messages in thread
[parent not found: <20170312063820.19313-4-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* Re: [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 [not found] ` <20170312063820.19313-4-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-14 8:05 ` Stefan Wahren [not found] ` <a5ae562f-6843-f137-6470-36c53cfd1799-eS4NqCHxEME@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Stefan Wahren @ 2017-03-14 8:05 UTC (permalink / raw) To: Michael Zoran, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, eric-WhKQ6XTQaPysTnJN9+BGXg, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Am 12.03.2017 um 07:38 schrieb Michael Zoran: > Add the DT nodes for the analog audio/headphone jack for the BCM2835 > > Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> > --- > arch/arm/boot/dts/bcm283x.dtsi | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi > index 9798bc9293d8..bf2cd463a6e6 100644 > --- a/arch/arm/boot/dts/bcm283x.dtsi > +++ b/arch/arm/boot/dts/bcm283x.dtsi > @@ -338,7 +338,12 @@ > brcm,pins = <42 43>; > brcm,function = <BCM2835_FSEL_ALT5>; > }; > - }; > + > + analog_audio_pins: analog_audio_pins { > + brcm,pins = <40 45>; > + brcm,function = <4 4>; /* Alt0 */ Please look at the other pin groups and adapt accordingly (defines, naming). > + }; > + }; > > uart0: serial@7e201000 { > compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; > @@ -464,6 +469,17 @@ > status = "disabled"; > }; > > + analogaudio: analogaudio@7e20c000 { > + compatible = "brcm,bcm2835-analog-audio"; > + reg = <0x7e20c000 0x28>; > + clocks = <&clocks BCM2835_CLOCK_PWM>; > + assigned-clocks = <&clocks BCM2835_CLOCK_PWM>; > + pinctrl-names = "default"; > + pinctrl-0 = <&analog_audio_pins>; This isn't future-proof. Don't define pintrl at SoC level. This should be done on board level. AFAIK the Raspberry Pi 3 uses pin 40 and 41. Thanks Stefan > + dmas = <&dma 5>; > + dma-names = "tx"; > + }; > + > sdhci: sdhci@7e300000 { > compatible = "brcm,bcm2835-sdhci"; > reg = <0x7e300000 0x100>; -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <a5ae562f-6843-f137-6470-36c53cfd1799-eS4NqCHxEME@public.gmane.org>]
* Re: [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 [not found] ` <a5ae562f-6843-f137-6470-36c53cfd1799-eS4NqCHxEME@public.gmane.org> @ 2017-03-14 8:47 ` Michael Zoran [not found] ` <1489481279.656.1.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-14 8:47 UTC (permalink / raw) To: Stefan Wahren, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, eric-WhKQ6XTQaPysTnJN9+BGXg, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA On Tue, 2017-03-14 at 09:05 +0100, Stefan Wahren wrote: > AFAIK the Raspberry Pi 3 uses pin 40 and 41. > I did all my testing on the RPI 3, so I'm almost certain it's correct. It matches with the schematic and it matches with what the downstream tree uses for the firmware based driver(dummy claiming of pins). -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <1489481279.656.1.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* Re: [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 [not found] ` <1489481279.656.1.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-14 10:07 ` Stefan Wahren 2017-03-14 10:18 ` Michael Zoran 0 siblings, 1 reply; 18+ messages in thread From: Stefan Wahren @ 2017-03-14 10:07 UTC (permalink / raw) To: Michael Zoran, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, eric-WhKQ6XTQaPysTnJN9+BGXg, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA Am 14.03.2017 um 09:47 schrieb Michael Zoran: > On Tue, 2017-03-14 at 09:05 +0100, Stefan Wahren wrote: > >> AFAIK the Raspberry Pi 3 uses pin 40 and 41. >> > I did all my testing on the RPI 3, so I'm almost certain it's correct. > It matches with the schematic and it matches with what the downstream > tree uses for the firmware based driver(dummy claiming of pins). The reduced schematic that i have name the pins as AUD_PWM0 and AUD_PWM1, which says nothing about the actual pins. Do you have a better document? In the firmware dt-blob.dts [1] the Raspberry Pi 3 uses pin 40 and 41. [1] - https://github.com/raspberrypi/firmware/blob/master/extra/dt-blob.dts -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 2017-03-14 10:07 ` Stefan Wahren @ 2017-03-14 10:18 ` Michael Zoran 0 siblings, 0 replies; 18+ messages in thread From: Michael Zoran @ 2017-03-14 10:18 UTC (permalink / raw) To: Stefan Wahren, perex, tiwai, robh+dt, mark.rutland, eric, alsa-devel, linux-rpi-kernel, devicetree On Tue, 2017-03-14 at 11:07 +0100, Stefan Wahren wrote: > Am 14.03.2017 um 09:47 schrieb Michael Zoran: > > On Tue, 2017-03-14 at 09:05 +0100, Stefan Wahren wrote: > > > > > AFAIK the Raspberry Pi 3 uses pin 40 and 41. > > > > > > > I did all my testing on the RPI 3, so I'm almost certain it's > > correct. > > It matches with the schematic and it matches with what the > > downstream > > tree uses for the firmware based driver(dummy claiming of pins). > > The reduced schematic that i have name the pins as AUD_PWM0 and > AUD_PWM1, which says nothing about the actual pins. Do you have a > better > document? > > In the firmware dt-blob.dts [1] the Raspberry Pi 3 uses pin 40 and > 41. > > [1] - https://github.com/raspberrypi/firmware/blob/master/extra/dt-bl > ob.dts Here are the references I used: https://www.raspberrypi.org/documentation/hardware/raspberrypi/schemati cs/Raspberry-Pi-Rev-2.0-Model-AB-Schematics.pdf https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/o verlays/pwm-2chan-overlay.dts But looking at the downstream specific RPI 3 device tree, maybe it should be 40,41 instead of 40,45. The source code and tree I submitted does work. But I agree this is something that needs to be fixed. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio 2017-03-12 6:38 [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio Michael Zoran [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-20 16:50 ` Rob Herring 2017-03-20 17:07 ` [alsa-devel] " Michael Zoran 1 sibling, 1 reply; 18+ messages in thread From: Rob Herring @ 2017-03-20 16:50 UTC (permalink / raw) To: Michael Zoran Cc: mark.rutland, stefan.wahren, alsa-devel, devicetree, tiwai, eric, linux-rpi-kernel On Sat, Mar 11, 2017 at 10:38:17PM -0800, Michael Zoran wrote: > Add documentation for the DMA properties required when using the > PWM controller of the bcm2835 for analog audio output. > > Signed-off-by: Michael Zoran <mzoran@crowfest.net> > --- > Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > index cf573e85b11d..08fc06fc083a 100644 > --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > @@ -1,14 +1,21 @@ > BCM2835 PWM controller (Raspberry Pi controller) > > Required properties: > -- compatible: should be "brcm,bcm2835-pwm" > +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835-analog-audio" Compatibles are not for selecting usage modes. You should describe the connection to the pwm that makes it an audio output rather than change the compatible. > - reg: physical base address and length of the controller's registers > - clocks: This clock defines the base clock frequency of the PWM hardware > system, the period and the duty_cycle of the PWM signal is a multiple of > the base period. > + > +Required properties(PWM Output): > - #pwm-cells: Should be 2. See pwm.txt in this directory for a description of > the cells format. > > +Required properties(Audio Output): > +- dmas: Should contain one entry pointing to the DMA channel used to > + transfer audio data > +- dma-names: Should contain "tx" > + > Examples: > > pwm@2020c000 { > -- > 2.11.0 > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [alsa-devel] [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio 2017-03-20 16:50 ` [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio Rob Herring @ 2017-03-20 17:07 ` Michael Zoran [not found] ` <1490029654.11105.7.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-20 17:07 UTC (permalink / raw) To: Rob Herring Cc: mark.rutland-AbSShOkvfpQ, stefan.wahren-eS4NqCHxEME, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, devicetree-u79uwXL29TY76Z2rM5mHXA, tiwai-IBi9RG/b67k, eric-WhKQ6XTQaPysTnJN9+BGXg, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Mon, 2017-03-20 at 11:50 -0500, Rob Herring wrote: > On Sat, Mar 11, 2017 at 10:38:17PM -0800, Michael Zoran wrote: > > Add documentation for the DMA properties required when using the > > PWM controller of the bcm2835 for analog audio output. > > > > Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> > > --- > > Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 > > ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > index cf573e85b11d..08fc06fc083a 100644 > > --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > @@ -1,14 +1,21 @@ > > BCM2835 PWM controller (Raspberry Pi controller) > > > > Required properties: > > -- compatible: should be "brcm,bcm2835-pwm" > > +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835- > > analog-audio" > > Compatibles are not for selecting usage modes. You should describe > the > connection to the pwm that makes it an audio output rather than > change > the compatible. > Cool, that's good to know that someone let me know after all this time. And please tell how if DT nodes are an exact documentation of the hardware how are virtualized DT nodes like firmware getting into the DTs? -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <1490029654.11105.7.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org>]
* Re: [alsa-devel] [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio [not found] ` <1490029654.11105.7.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> @ 2017-03-21 12:53 ` Rob Herring 2017-03-21 13:30 ` Michael Zoran 0 siblings, 1 reply; 18+ messages in thread From: Rob Herring @ 2017-03-21 12:53 UTC (permalink / raw) To: Michael Zoran Cc: Mark Rutland, Stefan Wahren, Linux-ALSA, devicetree-u79uwXL29TY76Z2rM5mHXA, Takashi Iwai, Eric Anholt, linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Mon, Mar 20, 2017 at 12:07 PM, Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> wrote: > On Mon, 2017-03-20 at 11:50 -0500, Rob Herring wrote: >> On Sat, Mar 11, 2017 at 10:38:17PM -0800, Michael Zoran wrote: >> > Add documentation for the DMA properties required when using the >> > PWM controller of the bcm2835 for analog audio output. >> > >> > Signed-off-by: Michael Zoran <mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> >> > --- >> > Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 >> > ++++++++- >> > 1 file changed, 8 insertions(+), 1 deletion(-) >> > >> > diff --git a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > index cf573e85b11d..08fc06fc083a 100644 >> > --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > @@ -1,14 +1,21 @@ >> > BCM2835 PWM controller (Raspberry Pi controller) >> > >> > Required properties: >> > -- compatible: should be "brcm,bcm2835-pwm" >> > +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835- >> > analog-audio" >> >> Compatibles are not for selecting usage modes. You should describe >> the >> connection to the pwm that makes it an audio output rather than >> change >> the compatible. >> > > Cool, that's good to know that someone let me know after all this time. Well, there are more submitters than reviewers and maintainers and we have travel and vacation (aka lives). > And please tell how if DT nodes are an exact documentation of the > hardware how are virtualized DT nodes like firmware getting into the > DTs? DT is software's view of the hardware. Firmware provides interfaces to the OS just like a h/w device does. And just like h/w devices, the firmware is not discoverable and needs to be described. Originally, DT was the firmware's interface to the OS with OpenFirmware. Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio 2017-03-21 12:53 ` Rob Herring @ 2017-03-21 13:30 ` Michael Zoran 2017-03-21 17:59 ` Rob Herring 0 siblings, 1 reply; 18+ messages in thread From: Michael Zoran @ 2017-03-21 13:30 UTC (permalink / raw) To: Rob Herring Cc: Mark Rutland, Stefan Wahren, Linux-ALSA, devicetree, Takashi Iwai, Eric Anholt, linux-rpi-kernel On Tue, 2017-03-21 at 07:53 -0500, Rob Herring wrote: > On Mon, Mar 20, 2017 at 12:07 PM, Michael Zoran <mzoran@crowfest.net> > wrote: > > On Mon, 2017-03-20 at 11:50 -0500, Rob Herring wrote: > > > On Sat, Mar 11, 2017 at 10:38:17PM -0800, Michael Zoran wrote: > > > > Add documentation for the DMA properties required when using > > > > the > > > > PWM controller of the bcm2835 for analog audio output. > > > > > > > > Signed-off-by: Michael Zoran <mzoran@crowfest.net> > > > > --- > > > > Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 > > > > ++++++++- > > > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/Documentation/devicetree/bindings/pwm/pwm- > > > > bcm2835.txt > > > > b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > > > index cf573e85b11d..08fc06fc083a 100644 > > > > --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > > > +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt > > > > @@ -1,14 +1,21 @@ > > > > BCM2835 PWM controller (Raspberry Pi controller) > > > > > > > > Required properties: > > > > -- compatible: should be "brcm,bcm2835-pwm" > > > > +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835- > > > > analog-audio" > > > > > > Compatibles are not for selecting usage modes. You should > > > describe > > > the > > > connection to the pwm that makes it an audio output rather than > > > change > > > the compatible. > > > > > > > Cool, that's good to know that someone let me know after all this > > time. > > Well, there are more submitters than reviewers and maintainers and we > have travel and vacation (aka lives). > > > And please tell how if DT nodes are an exact documentation of the > > hardware how are virtualized DT nodes like firmware getting into > > the > > DTs? > > DT is software's view of the hardware. Firmware provides interfaces > to > the OS just like a h/w device does. And just like h/w devices, the > firmware is not discoverable and needs to be described. Originally, > DT > was the firmware's interface to the OS with OpenFirmware. > > Rob OK, I understand better know. So it sounds like what I really want to do is be able to keep the existing DT as much as possible but load an alternative driver. Presumably at the request of the end user some how. I'm not sure something like that is supported in the linux kernel. For this specific example, I don't know of any reason I couldn't write a replacement driver for the existing PWM control that does both audio and standard PWM, but I've heard replacing existing drivers is really accepted and having alternative drivers isn't something that's supported. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio 2017-03-21 13:30 ` Michael Zoran @ 2017-03-21 17:59 ` Rob Herring 0 siblings, 0 replies; 18+ messages in thread From: Rob Herring @ 2017-03-21 17:59 UTC (permalink / raw) To: Michael Zoran Cc: Mark Rutland, Stefan Wahren, Linux-ALSA, devicetree, Takashi Iwai, Eric Anholt, linux-rpi-kernel On Tue, Mar 21, 2017 at 8:30 AM, Michael Zoran <mzoran@crowfest.net> wrote: > On Tue, 2017-03-21 at 07:53 -0500, Rob Herring wrote: >> On Mon, Mar 20, 2017 at 12:07 PM, Michael Zoran <mzoran@crowfest.net> >> wrote: >> > On Mon, 2017-03-20 at 11:50 -0500, Rob Herring wrote: >> > > On Sat, Mar 11, 2017 at 10:38:17PM -0800, Michael Zoran wrote: >> > > > Add documentation for the DMA properties required when using >> > > > the >> > > > PWM controller of the bcm2835 for analog audio output. >> > > > >> > > > Signed-off-by: Michael Zoran <mzoran@crowfest.net> >> > > > --- >> > > > Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt | 9 >> > > > ++++++++- >> > > > 1 file changed, 8 insertions(+), 1 deletion(-) >> > > > >> > > > diff --git a/Documentation/devicetree/bindings/pwm/pwm- >> > > > bcm2835.txt >> > > > b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > > > index cf573e85b11d..08fc06fc083a 100644 >> > > > --- a/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > > > +++ b/Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt >> > > > @@ -1,14 +1,21 @@ >> > > > BCM2835 PWM controller (Raspberry Pi controller) >> > > > >> > > > Required properties: >> > > > -- compatible: should be "brcm,bcm2835-pwm" >> > > > +- compatible: should be "brcm,bcm2835-pwm" or "brcm,bcm2835- >> > > > analog-audio" >> > > >> > > Compatibles are not for selecting usage modes. You should >> > > describe >> > > the >> > > connection to the pwm that makes it an audio output rather than >> > > change >> > > the compatible. >> > > >> > >> > Cool, that's good to know that someone let me know after all this >> > time. >> >> Well, there are more submitters than reviewers and maintainers and we >> have travel and vacation (aka lives). >> >> > And please tell how if DT nodes are an exact documentation of the >> > hardware how are virtualized DT nodes like firmware getting into >> > the >> > DTs? >> >> DT is software's view of the hardware. Firmware provides interfaces >> to >> the OS just like a h/w device does. And just like h/w devices, the >> firmware is not discoverable and needs to be described. Originally, >> DT >> was the firmware's interface to the OS with OpenFirmware. >> >> Rob > > OK, I understand better know. So it sounds like what I really want to > do is be able to keep the existing DT as much as possible but load an > alternative driver. Presumably at the request of the end user some > how. > > I'm not sure something like that is supported in the linux kernel. For > this specific example, I don't know of any reason I couldn't write a > replacement driver for the existing PWM control that does both audio > and standard PWM, but I've heard replacing existing drivers is really > accepted and having alternative drivers isn't something that's > supported. 2 drivers for the same compatible would be a bit of a problem without any other information to tell one of the drivers not to probe. What I had in mind was adding a pwm-audio node (describing what's connected to the PWM output) similar to what we have for pwm-backlight. We already have pwm-beeper as well. In theory, then a pwm-audio driver could work with any PWM. In reality, the overhead would be too high for dumb PWMs. You would need some batching support in the PWM subsystem in order to use DMA effectively, and I don't know if the PWM subsystem supports that currently. Rob ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2017-03-21 17:59 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-03-12 6:38 [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio Michael Zoran [not found] ` <20170312063820.19313-1-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-12 6:38 ` [PATCH 2/4] sound: bcm2835-analog-audio: Add driver for bcm2835(Raspberry PI) headphone jack Michael Zoran 2017-03-16 0:01 ` Eric Anholt 2017-03-12 6:38 ` [PATCH 3/4] sound: arm: Add build system for bcm2835-analog-audio driver Michael Zoran [not found] ` <20170312063820.19313-3-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-14 7:15 ` [alsa-devel] " kbuild test robot [not found] ` <201703141503.gyuLu0Kr%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-03-14 8:58 ` Michael Zoran [not found] ` <1489481899.656.5.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-14 9:13 ` Stefan Wahren [not found] ` <5a437138-bf9c-1e48-9fa6-82fac9b6e54c-eS4NqCHxEME@public.gmane.org> 2017-03-14 9:53 ` Michael Zoran 2017-03-12 6:38 ` [PATCH 4/4] dts: bcm283x.dtsi: Add analog audio/headphone jack for bcm2835 Michael Zoran [not found] ` <20170312063820.19313-4-mzoran-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-14 8:05 ` Stefan Wahren [not found] ` <a5ae562f-6843-f137-6470-36c53cfd1799-eS4NqCHxEME@public.gmane.org> 2017-03-14 8:47 ` Michael Zoran [not found] ` <1489481279.656.1.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-14 10:07 ` Stefan Wahren 2017-03-14 10:18 ` Michael Zoran 2017-03-20 16:50 ` [PATCH 1/4] dt-bindings: Document the dmas and dma-names properties for bcm2835-analog-audio Rob Herring 2017-03-20 17:07 ` [alsa-devel] " Michael Zoran [not found] ` <1490029654.11105.7.camel-O+n0w2l5AFbk1uMJSBkQmQ@public.gmane.org> 2017-03-21 12:53 ` Rob Herring 2017-03-21 13:30 ` Michael Zoran 2017-03-21 17:59 ` Rob Herring
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.