public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mario Bălănică" <mariobalanica02@gmail.com>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: devel@edk2.groups.io, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	 Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
	 Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>,
	Sunny Wang <sunny.wang@arm.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/2] Platform/RaspberryPi: Add support for PWM1 in ACPI
Date: Tue, 16 Nov 2021 19:30:26 +0200	[thread overview]
Message-ID: <CAA3kFM_+MXAj7xKmZ9Nq4L=ttBG6qTO+EfYfgpJ=Yk3V0heo-g@mail.gmail.com> (raw)
In-Reply-To: <8222b523-dc66-9413-a0fa-fcd68b085cdd@arm.com>

Hi Jeremy,

> On 11/5/21 15:34, Mario Bălănică via groups.io wrote:
>>
>> Also fix PWM0 on the Raspberry Pi 4, but we can't expose both yet.
>
> Why is that? The rpi4 needs both PWM devices to output stereo right? So
> with this patch is still mono?


Each PWM controller has two channels, so only one controller is needed
for stereo output.

> Assuming we are just aiming for mono on the rpi4, Do we need a separate
> set of buffers here for both the rpi3 and 4, can't the buffers be reused
> below?


> I would expect that the pi4 just reuses 17-30 here, or it uses both PWM
> channels.


Right, they could be reused, but the plan is to expose both
controllers on RPi 4 in the future.
We can't do it right now because of some conflicts in the Windows drivers.

The Clock Manager is shared, which may cause a race condition if both
devices try to change the PWM clock.

> But, that said. I think there might be a better, but much more complex
> way to do this.


> So, instead of trying to _DSD the base freq/etc in the next patch we
> just define a _DSM() method which sets the audio/pwm rate. Maybe it
> takes the audio sample rate and depth, sets up the PWM divisor and
> returns the pwm rate. (along with errors about boundaries, or we assume
> the sample rate is 4 bits and bound the sample rate/etc).


Yeah, a _DSM would be better. This way, I can also get rid of the
clock handling code in the PWM driver.
But then only the audio driver would be able to set the clock divisor.
I guess it's not really an issue, as long as we set an initial divisor
so that the PWM peripherals can be used without the audio driver being
installed.

Even though I don't really like having those clock values in the audio
_DSD, I think it's fine until we decide on / implement a better
solution.

--Mario

      reply	other threads:[~2021-11-16 17:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 20:34 [edk2-platforms][PATCH v1 1/2] Platform/RaspberryPi: Add support for PWM1 in ACPI Mario Bălănică
2021-11-05 20:34 ` [edk2-platforms][PATCH v1 2/2] Platform/RaspberryPi: Add analog audio device " Mario Bălănică
2021-11-15 22:59 ` [edk2-devel] [edk2-platforms][PATCH v1 1/2] Platform/RaspberryPi: Add support for PWM1 " Jeremy Linton
2021-11-16 17:30   ` Mario Bălănică [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA3kFM_+MXAj7xKmZ9Nq4L=ttBG6qTO+EfYfgpJ=Yk3V0heo-g@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox