From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web10.1194.1637083839313677132 for ; Tue, 16 Nov 2021 09:30:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ROJ0623X; spf=pass (domain: gmail.com, ip: 209.85.221.54, mailfrom: mariobalanica02@gmail.com) Received: by mail-wr1-f54.google.com with SMTP id i5so39110383wrb.2 for ; Tue, 16 Nov 2021 09:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=A1QHQH36i26niVSqsQHEBYCeFZ2PLjVOREDI70fdoeQ=; b=ROJ0623XVZ0g0/oQ8fux1TdhSZ04BwBReHaoLn0NLpG2JJ2Vkfr2ifHAp0ftDjD4zJ d0G17D2HP/Vz+UuiUKw7dTlhUDaelO1F4UvrtDnanKJqHemDN8/5x7cNkx85WSGVDkGC F/KL6yHbor9OYxsNTe/XbYLtl/1uvkSw51i1lyvF9gkjvxl+rovRDT1ra5gUYkD1cHaR HISwqN0RJD6wGOvEOAkhun73v8nmhS6YCP2/JYdHcghwyxXU2do/oumOgSp+bchQrBU2 KOh0fmeUOpOixjnrrmVDf++SxRsF7d+vZCeaHjFMhIsTsTo45CMrc1pTNADq7na5H0GI pgZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=A1QHQH36i26niVSqsQHEBYCeFZ2PLjVOREDI70fdoeQ=; b=vFHdaAjUpFFGGb/jvuqeJgxRVP8SWlnmoz/DcO8u3Z1bELyIqNb/H74l0a8Owd5VkR /eIrU8yluYwzzJy3H7V2YRenSXB6FXhAO0ibY1MT0IlV3O2XCsHXW2mPkEDzhHVkg/eN 3pjDGPki+WKyShr8J/K/ziltbuBZh8bnvbJwKmxo7Q8/4pYm2XVOZph4H+bbMSREkhub 6N2Q7TrK7Na6PZzPRCFg3MMf/1qzlLCN9zBzciao8tf8NNPuY9JRUBEwJn2lB7UVhHSo e75sZiS8IhkhB46uvjlljZ1sttcTeCjaEMXO1yJemY/l9na2RKKT6rNMiOWoSvn2ch0s lxhQ== X-Gm-Message-State: AOAM531GiG0C3XiSQ+Yx2H5WK8QhykoRe8oIF8sp0ifhD9W6tvrkwZxA Xe+B9M46HH+wHi/p2zUNTTLCKZ56ZPkPuJnNh0k= X-Google-Smtp-Source: ABdhPJwRLL0/biiqqW3iFn29hRoDMvFFvm8tl8Tl2qh9+PLYmA7THCs6x52UxrLaioo/T5FrnENkANWB5PtcMfKyFB8= X-Received: by 2002:a5d:460d:: with SMTP id t13mr11402903wrq.44.1637083837450; Tue, 16 Nov 2021 09:30:37 -0800 (PST) MIME-Version: 1.0 References: <20211105203436.997-1-mariobalanica02@gmail.com> <8222b523-dc66-9413-a0fa-fcd68b085cdd@arm.com> In-Reply-To: <8222b523-dc66-9413-a0fa-fcd68b085cdd@arm.com> From: =?UTF-8?B?TWFyaW8gQsSDbMSDbmljxIM=?= Date: Tue, 16 Nov 2021 19:30:26 +0200 Message-ID: Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/2] Platform/RaspberryPi: Add support for PWM1 in ACPI To: Jeremy Linton Cc: devel@edk2.groups.io, Ard Biesheuvel , Leif Lindholm , Pete Batard , Samer El-Haj-Mahmoud , Sunny Wang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jeremy, > On 11/5/21 15:34, Mario B=C4=83l=C4=83nic=C4=83 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