linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PWM DMA interface
@ 2014-06-09 10:49 Gordon Hollingworth
  2014-06-17 22:54 ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Gordon Hollingworth @ 2014-06-09 10:49 UTC (permalink / raw)
  To: linux-pwm@vger.kernel.org

Hi,

I've been writing a driver that uses the PWM to talk to devices that
communicate through a pwm like signal.  To achieve this some devices have
a dma interface that you can stream data at to the pwm...

We use something similar to this on Raspberry Pi to do audio output, we
use the PWM interface to output a 'stream' of audio data which is
subsequently filtered (RC filter) to give an audio output.

I was hoping to create a driver that was suitably upstreamable and thought
about implementing within the world of the pwm class (and was coming here
to ask for guidance).  Basically I was thinking about implementing it in
as an extension of the pwm class:

Add parameter to config() to enable dma access, this will then create a
suitable /dev/pwm_dma0 etc. interface to write data to

Only issue is we have a number of parameters / modes we'd like to support
that are likely to be platform specific rather than general:

1) Ability to switch between three different modes:
	A) serial mode (where the output is actually just a serialisation of the
fifo data.)
	B) two formats of mark space ratio, giving a standard duty cycle or a
distributed mark space
2) Ability to set a 'silence value' i.e. what value you transmit when the
fifo runs dry

Whats your take on it?  In the end if not I'll implement a pwm_dma driver
as a platform device specific to the 2835 device

Thanks

Gordon


-- 
Director of Engineering, Raspberry Pi (Trading) Limited
T:	+44 (0) 1223 322633
M:	+44 (0) 7450 946289
E:	gordon@raspberrypi.org
W:	www.raspberrypi.org












^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PWM DMA interface
  2014-06-09 10:49 PWM DMA interface Gordon Hollingworth
@ 2014-06-17 22:54 ` Thierry Reding
  2014-06-18  8:20   ` Gordon Hollingworth
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2014-06-17 22:54 UTC (permalink / raw)
  To: Gordon Hollingworth; +Cc: linux-pwm@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

On Mon, Jun 09, 2014 at 10:49:46AM +0000, Gordon Hollingworth wrote:
> Hi,
> 
> I've been writing a driver that uses the PWM to talk to devices that
> communicate through a pwm like signal.  To achieve this some devices have
> a dma interface that you can stream data at to the pwm...
> 
> We use something similar to this on Raspberry Pi to do audio output, we
> use the PWM interface to output a 'stream' of audio data which is
> subsequently filtered (RC filter) to give an audio output.

What kind of audio data is this? Is it able to play back any arbitrary
audio signal?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PWM DMA interface
  2014-06-17 22:54 ` Thierry Reding
@ 2014-06-18  8:20   ` Gordon Hollingworth
  2014-06-18 22:12     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Gordon Hollingworth @ 2014-06-18  8:20 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm@vger.kernel.org

Yes within the limitations of the simple RC filter but basically it's working like a one bit DAC

Gordon


> On 17 Jun 2014, at 23:54, "Thierry Reding" <thierry.reding@gmail.com> wrote:
> 
>> On Mon, Jun 09, 2014 at 10:49:46AM +0000, Gordon Hollingworth wrote:
>> Hi,
>> 
>> I've been writing a driver that uses the PWM to talk to devices that
>> communicate through a pwm like signal.  To achieve this some devices have
>> a dma interface that you can stream data at to the pwm...
>> 
>> We use something similar to this on Raspberry Pi to do audio output, we
>> use the PWM interface to output a 'stream' of audio data which is
>> subsequently filtered (RC filter) to give an audio output.
> 
> What kind of audio data is this? Is it able to play back any arbitrary
> audio signal?
> 
> Thierry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PWM DMA interface
  2014-06-18  8:20   ` Gordon Hollingworth
@ 2014-06-18 22:12     ` Thierry Reding
  2014-06-19 15:12       ` Gordon Hollingworth
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2014-06-18 22:12 UTC (permalink / raw)
  To: Gordon Hollingworth; +Cc: linux-pwm@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

On Wed, Jun 18, 2014 at 08:20:58AM +0000, Gordon Hollingworth wrote:
> Yes within the limitations of the simple RC filter but basically it's
> working like a one bit DAC

Perhaps a better way to expose this, then, would be as a proper sound
device so that the standard ALSA tools can be used to play back audio
rather than needing a set of custom tools.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PWM DMA interface
  2014-06-18 22:12     ` Thierry Reding
@ 2014-06-19 15:12       ` Gordon Hollingworth
  0 siblings, 0 replies; 5+ messages in thread
From: Gordon Hollingworth @ 2014-06-19 15:12 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm@vger.kernel.org

On 18/06/2014 23:12, "Thierry Reding" <thierry.reding@gmail.com> wrote:


>On Wed, Jun 18, 2014 at 08:20:58AM +0000, Gordon Hollingworth wrote:
>> Yes within the limitations of the simple RC filter but basically it's
>> working like a one bit DAC
>
>Perhaps a better way to expose this, then, would be as a proper sound
>device so that the standard ALSA tools can be used to play back audio
>rather than needing a set of custom tools.
>
>Thierry

Yes, although it would be better to expose the PWM DMA interface through a
PWM class and then implement an ALSA driver on top of this rather than
just hacking in a Pi specific pwm driver...

Mostly because I want to write a different driver that uses the PWM DMA
interface on the Pi but it seems wrong to do this without having a common
PWM_DMA interface


Gordon


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-19 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-09 10:49 PWM DMA interface Gordon Hollingworth
2014-06-17 22:54 ` Thierry Reding
2014-06-18  8:20   ` Gordon Hollingworth
2014-06-18 22:12     ` Thierry Reding
2014-06-19 15:12       ` Gordon Hollingworth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).