* Re: [PATCH 5.10.y-cip 04/31] ASoC: dt-bindings: renesas,rz-ssi: Update slave dma channel configuration parameter
From: Biju Das @ 2022-01-04 10:25 UTC (permalink / raw)
To: Pavel Machek, Prabhakar Mahadev Lad
Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu
In-Reply-To: <20211230105507.GA9799@amd>
Hi Pavel,
> Subject: Re: [PATCH 5.10.y-cip 04/31] ASoC: dt-bindings: renesas,rz-ssi:
> Update slave dma channel configuration parameter
>
> Hi!
>
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > commit bed0b1c1e88a27b76c74584128cadebc6fa58622 upstream.
> >
> > The DMAC on RZ/G2L has specific slave channel configuration parameters
> > for SSI.
> > This patch updates the dmas description and example node to include
> > the encoded slave channel configuration.
>
> > +++ b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
> > @@ -48,6 +48,24 @@ properties:
> > dmas:
> > minItems: 1
> > maxItems: 2
> > + description:
> > + The first cell represents a phandle to dmac
> > + The second cell specifies the encoded MID/RID values of the SSI
> port
> > + connected to the DMA client and the slave channel configuration
> > + parameters.
> > + bits[0:9] - Specifies MID/RID value of a SSI channel as below
> > + MID/RID value of SSI rx0 = 0x256
> > + MID/RID value of SSI tx0 = 0x255
> > + MID/RID value of SSI rx1 = 0x25a
> > + MID/RID value of SSI tx1 = 0x259
> > + MID/RID value of SSI rt2 = 0x25f
> > + MID/RID value of SSI rx3 = 0x262
> > + MID/RID value of SSI tx3 = 0x261
> > + bit[10] - HIEN = 1, Detects a request in response to the
> rising edge
> > + of the signal
> > + bit[11] - LVL = 0, Detects based on the edge
> > + bits[12:14] - AM = 2, Bus cycle mode
> > + bit[15] - TM = 0, Single transfer mode
>
> I wish there was better solution to this. Device tree sources are quite
> human-readable, this really is not.
Can you please suggest the better solution?
Cheers,
Biju
^ permalink raw reply
* Re: [cip-dev] New CVE entries in this week
From: Masami Ichikawa @ 2021-12-30 23:05 UTC (permalink / raw)
To: cip-dev
In-Reply-To: <20211230102038.GA7207@amd>
Hi !
On Thu, Dec 30, 2021 at 7:20 PM Pavel Machek <pavel@denx.de> wrote:
>
> Hi!
>
> > CVE-2021-45469: f2fs: fix to do sanity check on last xattr entry in
> > __f2fs_setxattr()
> >
> > CVSS v3 score is not provided
> >
> > OOB access bug in __f2fs_setxattr().
> >
> > Although it is fixed in stable trees, the patch isn't merged in the
> > mainline yet at 2021/12/30. The commit 5598b24 ("f2fs: fix to do
> > sanity check on last xattr entry in __f2fs_setxattr()") is in
> > https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/commit/?h=dev&id=5598b24efaf4892741c798b425d543e4bed357a1
> > but not in the mainline.
> >
>
> Interesting. That's wrong and unusual for stable tree.
>
> > CVE-2021-45480: rds: memory leak in __rds_conn_create()
> >
> > CVSS v3 score is not provided
> >
> > This bug was introdued by commit aced3ce57cd3 ("RDS tcp loopback
> > connection can hang") which was merged at 5.13-rc4.
>
> It was also merged in 4.19-stable as 0a3158ac5999fe. That's why we see
> 4.19 tree needing the fix. 4.4 is not affected. Good.
>
Thank you for the information.
> > mainline: [5f9562ebe710c307adc5f666bf1a2162ee7977c0]
> > stable/4.19: [1ed173726c1a0082e9d77c7d5a85411e85bdd983]
>
> Best regards,
> Pavel
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#7310): https://lists.cip-project.org/g/cip-dev/message/7310
> Mute This Topic: https://lists.cip-project.org/mt/88025787/6028936
> Group Owner: cip-dev+owner@lists.cip-project.org
> Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/10394996/6028936/1199334894/xyzzy [masami256@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Regards,
--
/**
* Masami Ichikawa
* personal: masami256@gmail.com
* fedora project: masami@fedoraproject.org
*/
^ permalink raw reply
* Re: [PATCH 5.10.y-cip 03/31] ASoC: sh: Add RZ/G2L SSIF-2 driver
From: Pavel Machek @ 2021-12-30 20:07 UTC (permalink / raw)
To: Prabhakar Mahadev Lad
Cc: Pavel Machek, cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu,
Biju Das
In-Reply-To: <OSZPR01MB7019B90F14E42871D896F12BAA459@OSZPR01MB7019.jpnprd01.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 3470 bytes --]
Hi!
> > > +static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct
> > > +rz_ssi_stream *strm) {
> > > + struct snd_pcm_substream *substream = strm->substream;
> > > + struct snd_pcm_runtime *runtime = substream->runtime;
> > > + int sample_space;
> > > + int samples = 0;
> > > + int frames_left;
> > > + int i;
> > > + u32 ssifsr;
> > > + u16 *buf;
> > > +
> > > + if (!rz_ssi_stream_is_valid(ssi, strm))
> > > + return -EINVAL;
> >
> > Access without locking before verifying that stream is valid with the lock. This is wrong.
> >
> rz_ssi_stream_is_valid() does lock/unlock to check stream validity.
Yes, but "struct snd_pcm_runtime *runtime = substream->runtime" above
already accessed that data without locking.
> > > +static int rz_ssi_probe(struct platform_device *pdev) {
> > ...
> > > + /* Error Interrupt */
> > > + ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
> > > + if (ssi->irq_int < 0)
> > > + return dev_err_probe(&pdev->dev, -ENODEV,
> > > + "Unable to get SSI int_req IRQ\n");
> > > +
> > > + ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt,
> > > + 0, dev_name(&pdev->dev), ssi);
> > > + if (ret < 0)
> > > + return dev_err_probe(&pdev->dev, ret,
> > > + "irq request error (int_req)\n");
> > > +
> > > + /* Tx and Rx interrupts (pio only) */
> > > + ssi->irq_tx = platform_get_irq_byname(pdev, "dma_tx");
> > > + if (ssi->irq_tx < 0)
> > > + return dev_err_probe(&pdev->dev, -ENODEV,
> > > + "Unable to get SSI dma_tx IRQ\n");
> > ...
> >
> > So you registered interrupt handlers...
> >
> > > +
> > > + ret = devm_request_irq(&pdev->dev, ssi->irq_tx, &rz_ssi_interrupt, 0,
> > > + dev_name(&pdev->dev), ssi);
> > > + if (ret < 0)
> > > + return dev_err_probe(&pdev->dev, ret,
> > > + "irq request error (dma_tx)\n");
> > > +
> > > + ssi->irq_rx = platform_get_irq_byname(pdev, "dma_rx");
> > > + if (ssi->irq_rx < 0)
> > > + return dev_err_probe(&pdev->dev, -ENODEV,
> > > + "Unable to get SSI dma_rx IRQ\n");
> > > +
> > > + ret = devm_request_irq(&pdev->dev, ssi->irq_rx, &rz_ssi_interrupt, 0,
> > > + dev_name(&pdev->dev), ssi);
> > > + if (ret < 0)
> > > + return dev_err_probe(&pdev->dev, ret,
> > > + "irq request error (dma_rx)\n");
> > > +
> > > + ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> > > + if (IS_ERR(ssi->rstc))
> > > + return PTR_ERR(ssi->rstc);
> > > +
> > > + reset_control_deassert(ssi->rstc);
> > > + pm_runtime_enable(&pdev->dev);
> > > + pm_runtime_resume_and_get(&pdev->dev);
> > > +
> > > + spin_lock_init(&ssi->lock);
> > > + dev_set_drvdata(&pdev->dev, ssi);
> >
> > But only here you have data structures ready to handle the interrupts. You won't see obvious problems
> > w/o shared interrupts, but I believe there are debugging modes that trigger this intentionally.
> >
> But the devm_snd_soc_register_component() is after this so it should be OK I believe unless there is a spurious interrupt which will trigger the handler.
>
I believe your code will do fine in usual configurations. But
reordering it should be quite easy, and there are kernel options like
"irqpoll", "irqfixup" and CONFIG_DEBUG_SHIRQ.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply
* RE: [PATCH 5.10.y-cip 03/31] ASoC: sh: Add RZ/G2L SSIF-2 driver
From: Prabhakar Mahadev Lad @ 2021-12-30 14:18 UTC (permalink / raw)
To: Pavel Machek; +Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu, Biju Das
In-Reply-To: <20211230111500.GD9799@amd>
Hi Pavel,
Thank you for the review.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 30 December 2021 11:15
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Biju Das <biju.das.jz@bp.renesas.com>
> Subject: Re: [PATCH 5.10.y-cip 03/31] ASoC: sh: Add RZ/G2L SSIF-2 driver
>
> Hi!
>
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > commit 03e786bd43410fa93e5d2459f7a43e90ff0ae801 upstream.
> >
> > Add serial sound interface(SSIF-2) driver support for RZ/G2L SoC.
> >
> > Based on the work done by Chris Brandt for RZ/A SSI driver.
>
> I'm not sure what the locking rules are here.
>
> > --- /dev/null
> > +++ b/sound/soc/sh/rz-ssi.c
> > +static int rz_ssi_stream_is_valid(struct rz_ssi_priv *ssi,
> > + struct rz_ssi_stream *strm)
> > +{
> > + unsigned long flags;
> > + int ret;
> > +
> > + spin_lock_irqsave(&ssi->lock, flags);
> > + ret = !!(strm->substream && strm->substream->runtime);
> > + spin_unlock_irqrestore(&ssi->lock, flags);
> > +
> > + return ret;
> > +}
>
> Nit: I don't think !!() is useful here, as it is boolean expression anyway.
>
Agreed can be dropped.
> But I notice that code is very careful to access strm->substream with spinlock held.
>
...
> > +static void rz_ssi_pointer_update(struct rz_ssi_stream *strm, int
> > +frames) {
> > + struct snd_pcm_substream *substream = strm->substream;
> > + struct snd_pcm_runtime *runtime;
> > + int current_period;
> > +
> > + if (!strm->running || !substream || !substream->runtime)
> > + return;
>
> But here we do same checks, and this time without the spinlock?
>
... agree we need to lock...
> > +static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct
> > +rz_ssi_stream *strm) {
> > + struct snd_pcm_substream *substream = strm->substream;
> > + struct snd_pcm_runtime *runtime;
> > + u16 *buf;
> > + int fifo_samples;
> > + int frames_left;
> > + int samples = 0;
> > + int i;
> > +
> > + if (!rz_ssi_stream_is_valid(ssi, strm))
> > + return -EINVAL;
> > +
> > + runtime = substream->runtime;
>
> Again, access without locking.
>
... and here too.
> > + /*
> > + * If we finished this period, but there are more samples in
> > + * the RX FIFO, call this function again
> > + */
> > + if (frames_left == 0 && fifo_samples >= runtime->channels)
> > + rz_ssi_pio_recv(ssi, strm);
>
> Here we call ourselves recurively. Without checking the return value.. but more importantly recursion
> is unwelcome in kernel due to limited stack use.
>
>
Agreed, this needs to be handled differently with recursion removed.
> > +static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct
> > +rz_ssi_stream *strm) {
> > + struct snd_pcm_substream *substream = strm->substream;
> > + struct snd_pcm_runtime *runtime = substream->runtime;
> > + int sample_space;
> > + int samples = 0;
> > + int frames_left;
> > + int i;
> > + u32 ssifsr;
> > + u16 *buf;
> > +
> > + if (!rz_ssi_stream_is_valid(ssi, strm))
> > + return -EINVAL;
>
> Access without locking before verifying that stream is valid with the lock. This is wrong.
>
rz_ssi_stream_is_valid() does lock/unlock to check stream validity.
> > +static irqreturn_t rz_ssi_interrupt(int irq, void *data) {
> > + struct rz_ssi_stream *strm = NULL;
> > + struct rz_ssi_priv *ssi = data;
> > + u32 ssisr = rz_ssi_reg_readl(ssi, SSISR);
> > +
> > + if (ssi->playback.substream)
> > + strm = &ssi->playback;
> > + else if (ssi->capture.substream)
> > + strm = &ssi->capture;
> > + else
> > + return IRQ_HANDLED; /* Left over TX/RX interrupt */
>
> You mark interrupt as handled even when it is not. Probably not a problem w/o shared interrupts.
>
ATM the interrupts aren't shared so this should be OK.
> > +static int rz_ssi_probe(struct platform_device *pdev) {
> ...
> > + /* Error Interrupt */
> > + ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
> > + if (ssi->irq_int < 0)
> > + return dev_err_probe(&pdev->dev, -ENODEV,
> > + "Unable to get SSI int_req IRQ\n");
> > +
> > + ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt,
> > + 0, dev_name(&pdev->dev), ssi);
> > + if (ret < 0)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "irq request error (int_req)\n");
> > +
> > + /* Tx and Rx interrupts (pio only) */
> > + ssi->irq_tx = platform_get_irq_byname(pdev, "dma_tx");
> > + if (ssi->irq_tx < 0)
> > + return dev_err_probe(&pdev->dev, -ENODEV,
> > + "Unable to get SSI dma_tx IRQ\n");
> ...
>
> So you registered interrupt handlers...
>
> > +
> > + ret = devm_request_irq(&pdev->dev, ssi->irq_tx, &rz_ssi_interrupt, 0,
> > + dev_name(&pdev->dev), ssi);
> > + if (ret < 0)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "irq request error (dma_tx)\n");
> > +
> > + ssi->irq_rx = platform_get_irq_byname(pdev, "dma_rx");
> > + if (ssi->irq_rx < 0)
> > + return dev_err_probe(&pdev->dev, -ENODEV,
> > + "Unable to get SSI dma_rx IRQ\n");
> > +
> > + ret = devm_request_irq(&pdev->dev, ssi->irq_rx, &rz_ssi_interrupt, 0,
> > + dev_name(&pdev->dev), ssi);
> > + if (ret < 0)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "irq request error (dma_rx)\n");
> > +
> > + ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> > + if (IS_ERR(ssi->rstc))
> > + return PTR_ERR(ssi->rstc);
> > +
> > + reset_control_deassert(ssi->rstc);
> > + pm_runtime_enable(&pdev->dev);
> > + pm_runtime_resume_and_get(&pdev->dev);
> > +
> > + spin_lock_init(&ssi->lock);
> > + dev_set_drvdata(&pdev->dev, ssi);
>
> But only here you have data structures ready to handle the interrupts. You won't see obvious problems
> w/o shared interrupts, but I believe there are debugging modes that trigger this intentionally.
>
But the devm_snd_soc_register_component() is after this so it should be OK I believe unless there is a spurious interrupt which will trigger the handler.
Cheers,
Prabhakar
^ permalink raw reply
* RE: [PATCH 5.10.y-cip 21/31] arm64: dts: renesas: rzg2l-smarc: Enable audio
From: Prabhakar Mahadev Lad @ 2021-12-30 13:40 UTC (permalink / raw)
To: Pavel Machek; +Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu, Biju Das
In-Reply-To: <20211230110227.GC9799@amd>
Hi Pavel,
Thank you for the review.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 30 December 2021 11:02
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Biju Das <biju.das.jz@bp.renesas.com>
> Subject: Re: [PATCH 5.10.y-cip 21/31] arm64: dts: renesas: rzg2l-smarc: Enable audio
>
> Hi!
>
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > commit e396d6103343ff95874444bd8a67f031eafe0e38 upstream.
> >
> > Enable audio on RZ/G2L SMARC EVK by linking SSI0 with WM8978 audio
> > CODEC.
>
> > +++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
> > @@ -8,6 +8,19 @@
> > #include <dt-bindings/gpio/gpio.h>
> > #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
> >
> > +/*
> > + * SSI-WM8978
> > + *
> > + * This command is required when Playback/Capture
> > + *
> > + * amixer cset name='Left Input Mixer L2 Switch' on
> > + * amixer cset name='Right Input Mixer R2 Switch' on
> > + * amixer cset name='Headphone Playback Volume' 100
> > + * amixer cset name='PCM Volume' 100%
> > + * amixer cset name='Input PGA Volume' 25
>
> "These commands are required for Playback/Capture".
>
Will fix that.
> > @@ -30,6 +66,14 @@
> > };
> > };
> >
> > +&audio_clk1{
> > + clock-frequency = <11289600>;
> > +};
> > +
> > +&audio_clk2{
> > + clock-frequency = <12288000>;
> > +};
> > +
>
> I'd expect spaces before {. (And yes, I'm picking nits here).
>
Ditto.
Cheers,
Prabhakar
^ permalink raw reply
* RE: [PATCH 5.10.y-cip 10/31] iio: adc: Add driver for Renesas RZ/G2L A/D converter
From: Prabhakar Mahadev Lad @ 2021-12-30 13:39 UTC (permalink / raw)
To: Pavel Machek; +Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu, Biju Das
In-Reply-To: <20211230110035.GB9799@amd>
Hi Pavel,
Thank you for the review.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 30 December 2021 11:01
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Biju Das <biju.das.jz@bp.renesas.com>
> Subject: Re: [PATCH 5.10.y-cip 10/31] iio: adc: Add driver for Renesas RZ/G2L A/D converter
>
> Hi!
>
> > commit d484c21bacfa8bd2fa9fc26393ec59108f508c4c upstream.
> >
> > Add ADC driver support for Renesas RZ/G2L A/D converter in SW trigger
> > mode.
> >
> > A/D Converter block is a successive approximation analog-to-digital
> > converter with a 12-bit accuracy and supports a maximum of 8 input
> > channels.
> >
> > new file mode 100644
> > index 000000000000..919108d798ba
> > --- /dev/null
> > +++ b/drivers/iio/adc/rzg2l_adc.c
> ...
> > +
> > +#define RZG2L_ADSMP_DEFUALT_SAMPLING 0x578
> > +
>
> This should be "DEFAULT".
>
Agreed.
> > + do {
> > + usleep_range(100, 200);
> > + reg = rzg2l_adc_readl(adc, RZG2L_ADM(0));
> > + timeout--;
> > + if (!timeout) {
> > + pr_err("%s stopping ADC timed out\n", __func__);
> > + break;
> > + }
> > + } while (((reg & RZG2L_ADM0_ADBSY) || (reg & RZG2L_ADM0_ADCE))); }
>
> I'd write this as (reg & (RZG2L_ADM0_ADBSY | RZG2L_ADM0_ADCE)). Note that we wait, then check for
> timeout without using the register values. Which is strange and basically makes timeout one tick
> lower. (But probably does not matter much).
>
Agreed.
> > +static void rzg2l_set_trigger(struct rzg2l_adc *adc) {
> > + u32 reg;
> > +
> > + /*
> > + * Setup ADM1 for SW trigger
> > + * EGA[13:12] - Set 00 to indicate hardware trigger is invalid
> > + * BS[4] - Enable 1-buffer mode
> > + * MS[1] - Enable Select mode
> > + * TRG[0] - Enable software trigger mode
> > + */
> > + reg = rzg2l_adc_readl(adc, RZG2L_ADM(1));
> > + reg &= ~RZG2L_ADM1_EGA_MASK;
> > + reg &= ~RZG2L_ADM1_BS;
> > + reg &= ~RZG2L_ADM1_TRG;
>
> reg &= ~(RZG2L_ADM1_EGA_MASK | RZG2L_ADM1_BS | ...) would be usual way to write this. You can use it
> in more than one place in the file.
>
Agreed.
Cheers,
Prabhakar
^ permalink raw reply
* RE: [PATCH 5.10.y-cip 04/31] ASoC: dt-bindings: renesas,rz-ssi: Update slave dma channel configuration parameter
From: Prabhakar Mahadev Lad @ 2021-12-30 13:36 UTC (permalink / raw)
To: Pavel Machek; +Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu, Biju Das
In-Reply-To: <20211230105507.GA9799@amd>
Hi Pavel,
Thank you for the review.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 30 December 2021 10:55
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Biju Das <biju.das.jz@bp.renesas.com>
> Subject: Re: [PATCH 5.10.y-cip 04/31] ASoC: dt-bindings: renesas,rz-ssi: Update slave dma channel
> configuration parameter
>
> Hi!
>
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > commit bed0b1c1e88a27b76c74584128cadebc6fa58622 upstream.
> >
> > The DMAC on RZ/G2L has specific slave channel configuration parameters
> > for SSI.
> > This patch updates the dmas description and example node to include
> > the encoded slave channel configuration.
>
> > +++ b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
> > @@ -48,6 +48,24 @@ properties:
> > dmas:
> > minItems: 1
> > maxItems: 2
> > + description:
> > + The first cell represents a phandle to dmac
> > + The second cell specifies the encoded MID/RID values of the SSI port
> > + connected to the DMA client and the slave channel configuration
> > + parameters.
> > + bits[0:9] - Specifies MID/RID value of a SSI channel as below
> > + MID/RID value of SSI rx0 = 0x256
> > + MID/RID value of SSI tx0 = 0x255
> > + MID/RID value of SSI rx1 = 0x25a
> > + MID/RID value of SSI tx1 = 0x259
> > + MID/RID value of SSI rt2 = 0x25f
> > + MID/RID value of SSI rx3 = 0x262
> > + MID/RID value of SSI tx3 = 0x261
> > + bit[10] - HIEN = 1, Detects a request in response to the rising edge
> > + of the signal
> > + bit[11] - LVL = 0, Detects based on the edge
> > + bits[12:14] - AM = 2, Bus cycle mode
> > + bit[15] - TM = 0, Single transfer mode
>
> I wish there was better solution to this. Device tree sources are quite human-readable, this really is
> not.
>
Do agree!
Cheers,
Prabhakar
^ permalink raw reply
* Re: [PATCH 5.10.y-cip 03/31] ASoC: sh: Add RZ/G2L SSIF-2 driver
From: Pavel Machek @ 2021-12-30 11:15 UTC (permalink / raw)
To: Lad Prabhakar; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das
In-Reply-To: <20211229101530.22783-4-prabhakar.mahadev-lad.rj@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 5184 bytes --]
Hi!
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> commit 03e786bd43410fa93e5d2459f7a43e90ff0ae801 upstream.
>
> Add serial sound interface(SSIF-2) driver support for
> RZ/G2L SoC.
>
> Based on the work done by Chris Brandt for RZ/A SSI driver.
I'm not sure what the locking rules are here.
> --- /dev/null
> +++ b/sound/soc/sh/rz-ssi.c
> +static int rz_ssi_stream_is_valid(struct rz_ssi_priv *ssi,
> + struct rz_ssi_stream *strm)
> +{
> + unsigned long flags;
> + int ret;
> +
> + spin_lock_irqsave(&ssi->lock, flags);
> + ret = !!(strm->substream && strm->substream->runtime);
> + spin_unlock_irqrestore(&ssi->lock, flags);
> +
> + return ret;
> +}
Nit: I don't think !!() is useful here, as it is boolean expression
anyway.
But I notice that code is very careful to access strm->substream with
spinlock held.
> +static void rz_ssi_pointer_update(struct rz_ssi_stream *strm, int frames)
> +{
> + struct snd_pcm_substream *substream = strm->substream;
> + struct snd_pcm_runtime *runtime;
> + int current_period;
> +
> + if (!strm->running || !substream || !substream->runtime)
> + return;
But here we do same checks, and this time without the spinlock?
> +static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
> +{
> + struct snd_pcm_substream *substream = strm->substream;
> + struct snd_pcm_runtime *runtime;
> + u16 *buf;
> + int fifo_samples;
> + int frames_left;
> + int samples = 0;
> + int i;
> +
> + if (!rz_ssi_stream_is_valid(ssi, strm))
> + return -EINVAL;
> +
> + runtime = substream->runtime;
Again, access without locking.
> + /*
> + * If we finished this period, but there are more samples in
> + * the RX FIFO, call this function again
> + */
> + if (frames_left == 0 && fifo_samples >= runtime->channels)
> + rz_ssi_pio_recv(ssi, strm);
Here we call ourselves recurively. Without checking the return
value.. but more importantly recursion is unwelcome in kernel due to
limited stack use.
> +static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
> +{
> + struct snd_pcm_substream *substream = strm->substream;
> + struct snd_pcm_runtime *runtime = substream->runtime;
> + int sample_space;
> + int samples = 0;
> + int frames_left;
> + int i;
> + u32 ssifsr;
> + u16 *buf;
> +
> + if (!rz_ssi_stream_is_valid(ssi, strm))
> + return -EINVAL;
Access without locking before verifying that stream is valid with the
lock. This is wrong.
> +static irqreturn_t rz_ssi_interrupt(int irq, void *data)
> +{
> + struct rz_ssi_stream *strm = NULL;
> + struct rz_ssi_priv *ssi = data;
> + u32 ssisr = rz_ssi_reg_readl(ssi, SSISR);
> +
> + if (ssi->playback.substream)
> + strm = &ssi->playback;
> + else if (ssi->capture.substream)
> + strm = &ssi->capture;
> + else
> + return IRQ_HANDLED; /* Left over TX/RX interrupt */
You mark interrupt as handled even when it is not. Probably not a
problem w/o shared interrupts.
> +static int rz_ssi_probe(struct platform_device *pdev)
> +{
...
> + /* Error Interrupt */
> + ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
> + if (ssi->irq_int < 0)
> + return dev_err_probe(&pdev->dev, -ENODEV,
> + "Unable to get SSI int_req IRQ\n");
> +
> + ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt,
> + 0, dev_name(&pdev->dev), ssi);
> + if (ret < 0)
> + return dev_err_probe(&pdev->dev, ret,
> + "irq request error (int_req)\n");
> +
> + /* Tx and Rx interrupts (pio only) */
> + ssi->irq_tx = platform_get_irq_byname(pdev, "dma_tx");
> + if (ssi->irq_tx < 0)
> + return dev_err_probe(&pdev->dev, -ENODEV,
> + "Unable to get SSI dma_tx IRQ\n");
...
So you registered interrupt handlers...
> +
> + ret = devm_request_irq(&pdev->dev, ssi->irq_tx, &rz_ssi_interrupt, 0,
> + dev_name(&pdev->dev), ssi);
> + if (ret < 0)
> + return dev_err_probe(&pdev->dev, ret,
> + "irq request error (dma_tx)\n");
> +
> + ssi->irq_rx = platform_get_irq_byname(pdev, "dma_rx");
> + if (ssi->irq_rx < 0)
> + return dev_err_probe(&pdev->dev, -ENODEV,
> + "Unable to get SSI dma_rx IRQ\n");
> +
> + ret = devm_request_irq(&pdev->dev, ssi->irq_rx, &rz_ssi_interrupt, 0,
> + dev_name(&pdev->dev), ssi);
> + if (ret < 0)
> + return dev_err_probe(&pdev->dev, ret,
> + "irq request error (dma_rx)\n");
> +
> + ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> + if (IS_ERR(ssi->rstc))
> + return PTR_ERR(ssi->rstc);
> +
> + reset_control_deassert(ssi->rstc);
> + pm_runtime_enable(&pdev->dev);
> + pm_runtime_resume_and_get(&pdev->dev);
> +
> + spin_lock_init(&ssi->lock);
> + dev_set_drvdata(&pdev->dev, ssi);
But only here you have data structures ready to handle the
interrupts. You won't see obvious problems w/o shared interrupts, but
I believe there are debugging modes that trigger this intentionally.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH 5.10.y-cip 21/31] arm64: dts: renesas: rzg2l-smarc: Enable audio
From: Pavel Machek @ 2021-12-30 11:02 UTC (permalink / raw)
To: Lad Prabhakar; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das
In-Reply-To: <20211229101530.22783-22-prabhakar.mahadev-lad.rj@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]
Hi!
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> commit e396d6103343ff95874444bd8a67f031eafe0e38 upstream.
>
> Enable audio on RZ/G2L SMARC EVK by linking SSI0 with WM8978
> audio CODEC.
> +++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
> @@ -8,6 +8,19 @@
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
>
> +/*
> + * SSI-WM8978
> + *
> + * This command is required when Playback/Capture
> + *
> + * amixer cset name='Left Input Mixer L2 Switch' on
> + * amixer cset name='Right Input Mixer R2 Switch' on
> + * amixer cset name='Headphone Playback Volume' 100
> + * amixer cset name='PCM Volume' 100%
> + * amixer cset name='Input PGA Volume' 25
"These commands are required for Playback/Capture".
> @@ -30,6 +66,14 @@
> };
> };
>
> +&audio_clk1{
> + clock-frequency = <11289600>;
> +};
> +
> +&audio_clk2{
> + clock-frequency = <12288000>;
> +};
> +
I'd expect spaces before {. (And yes, I'm picking nits here).
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH 5.10.y-cip 10/31] iio: adc: Add driver for Renesas RZ/G2L A/D converter
From: Pavel Machek @ 2021-12-30 11:00 UTC (permalink / raw)
To: Lad Prabhakar; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das
In-Reply-To: <20211229101530.22783-11-prabhakar.mahadev-lad.rj@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]
Hi!
> commit d484c21bacfa8bd2fa9fc26393ec59108f508c4c upstream.
>
> Add ADC driver support for Renesas RZ/G2L A/D converter in SW
> trigger mode.
>
> A/D Converter block is a successive approximation analog-to-digital
> converter with a 12-bit accuracy and supports a maximum of 8 input
> channels.
>
> new file mode 100644
> index 000000000000..919108d798ba
> --- /dev/null
> +++ b/drivers/iio/adc/rzg2l_adc.c
...
> +
> +#define RZG2L_ADSMP_DEFUALT_SAMPLING 0x578
> +
This should be "DEFAULT".
> + do {
> + usleep_range(100, 200);
> + reg = rzg2l_adc_readl(adc, RZG2L_ADM(0));
> + timeout--;
> + if (!timeout) {
> + pr_err("%s stopping ADC timed out\n", __func__);
> + break;
> + }
> + } while (((reg & RZG2L_ADM0_ADBSY) || (reg & RZG2L_ADM0_ADCE)));
> +}
I'd write this as (reg & (RZG2L_ADM0_ADBSY | RZG2L_ADM0_ADCE)). Note
that we wait, then check for timeout without using the register
values. Which is strange and basically makes timeout one tick
lower. (But probably does not matter much).
> +static void rzg2l_set_trigger(struct rzg2l_adc *adc)
> +{
> + u32 reg;
> +
> + /*
> + * Setup ADM1 for SW trigger
> + * EGA[13:12] - Set 00 to indicate hardware trigger is invalid
> + * BS[4] - Enable 1-buffer mode
> + * MS[1] - Enable Select mode
> + * TRG[0] - Enable software trigger mode
> + */
> + reg = rzg2l_adc_readl(adc, RZG2L_ADM(1));
> + reg &= ~RZG2L_ADM1_EGA_MASK;
> + reg &= ~RZG2L_ADM1_BS;
> + reg &= ~RZG2L_ADM1_TRG;
reg &= ~(RZG2L_ADM1_EGA_MASK | RZG2L_ADM1_BS | ...) would be usual way
to write this. You can use it in more than one place in the file.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH 5.10.y-cip 04/31] ASoC: dt-bindings: renesas,rz-ssi: Update slave dma channel configuration parameter
From: Pavel Machek @ 2021-12-30 10:55 UTC (permalink / raw)
To: Lad Prabhakar; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das
In-Reply-To: <20211229101530.22783-5-prabhakar.mahadev-lad.rj@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]
Hi!
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> commit bed0b1c1e88a27b76c74584128cadebc6fa58622 upstream.
>
> The DMAC on RZ/G2L has specific slave channel configuration
> parameters for SSI.
> This patch updates the dmas description and example node to include
> the encoded slave channel configuration.
> +++ b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
> @@ -48,6 +48,24 @@ properties:
> dmas:
> minItems: 1
> maxItems: 2
> + description:
> + The first cell represents a phandle to dmac
> + The second cell specifies the encoded MID/RID values of the SSI port
> + connected to the DMA client and the slave channel configuration
> + parameters.
> + bits[0:9] - Specifies MID/RID value of a SSI channel as below
> + MID/RID value of SSI rx0 = 0x256
> + MID/RID value of SSI tx0 = 0x255
> + MID/RID value of SSI rx1 = 0x25a
> + MID/RID value of SSI tx1 = 0x259
> + MID/RID value of SSI rt2 = 0x25f
> + MID/RID value of SSI rx3 = 0x262
> + MID/RID value of SSI tx3 = 0x261
> + bit[10] - HIEN = 1, Detects a request in response to the rising edge
> + of the signal
> + bit[11] - LVL = 0, Detects based on the edge
> + bits[12:14] - AM = 2, Bus cycle mode
> + bit[15] - TM = 0, Single transfer mode
I wish there was better solution to this. Device tree sources are
quite human-readable, this really is not.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [cip-dev] New CVE entries in this week
From: Pavel Machek @ 2021-12-30 10:20 UTC (permalink / raw)
To: cip-dev
In-Reply-To: <CACOXgS9X11kXTPC+ukH2aommTWahwWSuAcuqXveZPpT2YiNBZw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]
Hi!
> CVE-2021-45469: f2fs: fix to do sanity check on last xattr entry in
> __f2fs_setxattr()
>
> CVSS v3 score is not provided
>
> OOB access bug in __f2fs_setxattr().
>
> Although it is fixed in stable trees, the patch isn't merged in the
> mainline yet at 2021/12/30. The commit 5598b24 ("f2fs: fix to do
> sanity check on last xattr entry in __f2fs_setxattr()") is in
> https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/commit/?h=dev&id=5598b24efaf4892741c798b425d543e4bed357a1
> but not in the mainline.
>
Interesting. That's wrong and unusual for stable tree.
> CVE-2021-45480: rds: memory leak in __rds_conn_create()
>
> CVSS v3 score is not provided
>
> This bug was introdued by commit aced3ce57cd3 ("RDS tcp loopback
> connection can hang") which was merged at 5.13-rc4.
It was also merged in 4.19-stable as 0a3158ac5999fe. That's why we see
4.19 tree needing the fix. 4.4 is not affected. Good.
> mainline: [5f9562ebe710c307adc5f666bf1a2162ee7977c0]
> stable/4.19: [1ed173726c1a0082e9d77c7d5a85411e85bdd983]
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* New CVE entries in this week
From: Masami Ichikawa @ 2021-12-29 23:29 UTC (permalink / raw)
To: cip-dev
Hi !
It's this week's CVE report.
This week reported six new CVEs.
* New CVEs
CVE-2021-45469: f2fs: fix to do sanity check on last xattr entry in
__f2fs_setxattr()
CVSS v3 score is not provided
OOB access bug in __f2fs_setxattr().
Although it is fixed in stable trees, the patch isn't merged in the
mainline yet at 2021/12/30. The commit 5598b24 ("f2fs: fix to do
sanity check on last xattr entry in __f2fs_setxattr()") is in
https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/commit/?h=dev&id=5598b24efaf4892741c798b425d543e4bed357a1
but not in the mainline.
Fixed status
stable/4.19: [f9dfa44be0fb5e8426183a70f69a246cf5827f49]
stable/5.10: [fffb6581a23add416239dfcf7e7f3980c6b913da]
CVE-2021-4154: cgroup: verify that source is a string
CVSS v3 score is not provided
UAF bug was found in cgroup v1 code which was introduced by commit
8d2451f4994f ("cgroup1: switch to option-by-option parsing"). This
commit was merged at 5.1-rc1. This bug will cause local DoS.
The mainline and stable kernels are fixed.
Fixed status
mainline: [3b0462726e7ef281c35a7a4ae33e93ee2bc9975b]
stable/5.10: [811763e3beb6c922d168e9f509ec593e9240842e]
stable/5.4: [c17363ccd620c1a57ede00d5c777f0b8624debe6]
CVE-2021-4157: pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()
CVSS v3 score is not provided
This OOB write bug was introduced by commit d67ae82 ("pnfs/flexfiles:
Add the FlexFile Layout Driver") which was merged at 4.0-rc1. A local
attacker could do system crash or escalate privileges on the system.
The mainline and stable kernels are fixed.
Fixed status
mainline: [ed34695e15aba74f45247f1ee2cf7e09d449f925]
stable/4.14: [40286f0852d2ecfa713438199557c706dc6a8db3]
stable/4.19: [f27638a92f77d8107efbaf48a0d3bfa24da8cdad]
stable/4.4: [0c5ccd5e2a2e291774618c24c459fa397fd1b7da]
stable/4.9: [c621f3654bba1096ec913d0942e27bd032bb6090]
stable/5.10: [1fbea60ea658ab887fb899532d783732b04e53e6]
stable/5.4: [89862bd77e9cf511628eb7a97fe7f8d246192eec]
CVE-2021-45480: rds: memory leak in __rds_conn_create()
CVSS v3 score is not provided
This bug was introdued by commit aced3ce57cd3 ("RDS tcp loopback
connection can hang") which was merged at 5.13-rc4.
Fixed status
mainline: [5f9562ebe710c307adc5f666bf1a2162ee7977c0]
stable/4.19: [1ed173726c1a0082e9d77c7d5a85411e85bdd983]
stable/5.10: [74dc97dfb276542f12746d706abef63364d816bb]
stable/5.15: [68014890e4382ff9192e1357be39b7d0455665fa]
stable/5.4: [166f0adf7e7525c87595ceadb21a91e2a9519a1e]
CVE-2021-45485: ipv6: use prandom_u32() for ID generation
CVSS v3 score is not provided
CVE-2021-45485 and CVE-2021-45486 are related issue. A bug fixed
commit 62f20e0 is a complement to aa6dd21 ("inet: use bigger hash
table for IP ID generation") which is CVE-2021-45486.
The mainline and stable kernels are fixed.
Fixed status
mainline: [62f20e068ccc50d6ab66fdb72ba90da2b9418c99]
stable/4.14: [4b55d7b3106a410cdab4ea60f5e55ca0668c6a09]
stable/4.19: [f0be58ec9931907e980cf21737e51d369808eb95]
stable/4.4: [c43fa9ee9f1de295474a28903607f84209d7e611]
stable/4.9: [3fc852e59c0a48094cc0f1b2e866604986bbcd31]
stable/5.10: [8f939b79579715b195dc3ad36669707fce6853ee]
stable/5.4: [ccde03a6a0fbdc3c0ba81930e629b8b14974cce4]
CVE-2021-45486: inet: use bigger hash table for IP ID generation
CVE-2021-45485 and CVE-2021-45486 are related issue. This CVE fixes
commit 73f156a ("inetpeer: get rid of ip_id_count"). The commit
73f156a was merged at 3.16-rc1.
The mainline and stable kernels are fixed.
Fixed status
mainline: [aa6dd211e4b1dde9d5dc25d699d35f789ae7eeba]
stable/4.14: [3ba51ed2c3ac36aa947d0b250d318de6ed7cf552]
stable/4.19: [7f7e23df8509e072593200400a4b094cc44376d2]
stable/4.4: [8fb8c138b5d69128964e54e1b5ee49fc395f011c]
stable/4.9: [0889f0a3bb2de535f48424491d8f9d5954a3cde8]
stable/5.10: [a273c27d7255fc527023edeb528386d1b64bedf5]
stable/5.4: [fee81285bd09ec2080ce2cbb5063aad0e58eb272]
* Updated CVEs
no updated CVEs.
Currently tracking CVEs
CVE-2021-31615: Unencrypted Bluetooth Low Energy baseband links in
Bluetooth Core Specifications 4.0 through 5.2
There is no fix information.
CVE-2020-26555: BR/EDR pin code pairing broken
No fix information
CVE-2020-26556: kernel: malleable commitment Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26557: kernel: predictable Authvalue in Bluetooth Mesh
Provisioning Leads to MITM
No fix information.
CVE-2020-26559: kernel: Authvalue leak in Bluetooth Mesh Provisioning
No fix information.
CVE-2020-26560: kernel: impersonation attack in Bluetooth Mesh Provisioning
No fix information.
Regards,
--
/**
* Masami Ichikawa
* personal: masami256@gmail.com
* fedora project: masami@fedoraproject.org
*/
^ permalink raw reply
* [PATCH 5.10.y-cip 31/31] arm64: defconfig: Enable RIIC
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit df364a82bf5b2dc2d78212c53205bbb91e40f850 upstream.
Enable RIIC driver support for Renesas RZ/G2L based platforms.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210611165624.30749-6-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index edf32d432541..0957b725eb1b 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -443,6 +443,7 @@ CONFIG_I2C_PXA=y
CONFIG_I2C_QCOM_CCI=m
CONFIG_I2C_QCOM_GENI=m
CONFIG_I2C_QUP=y
+CONFIG_I2C_RIIC=y
CONFIG_I2C_RK3X=y
CONFIG_I2C_SH_MOBILE=y
CONFIG_I2C_TEGRA=y
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 30/31] i2c: riic: Add RZ/G2L support
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 010e765b406f8e08685ea5b687c63a5ea234719a upstream.
RZ/G2L i2c controller is compatible with RZ/A i2c controller.
By default IP is in reset state, so need to perform release
reset before accessing any register.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/i2c/busses/i2c-riic.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index 4eccc0f69861..78b84445ee6a 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -42,8 +42,10 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#define RIIC_ICCR1 0x00
#define RIIC_ICCR2 0x04
@@ -86,6 +88,11 @@
#define RIIC_INIT_MSG -1
+enum riic_type {
+ RIIC_RZ_A,
+ RIIC_RZ_G2L,
+};
+
struct riic_dev {
void __iomem *base;
u8 *buf;
@@ -395,7 +402,9 @@ static int riic_i2c_probe(struct platform_device *pdev)
struct i2c_adapter *adap;
struct resource *res;
struct i2c_timings i2c_t;
+ struct reset_control *rstc;
int i, ret;
+ enum riic_type type;
riic = devm_kzalloc(&pdev->dev, sizeof(*riic), GFP_KERNEL);
if (!riic)
@@ -412,6 +421,17 @@ static int riic_i2c_probe(struct platform_device *pdev)
return PTR_ERR(riic->clk);
}
+ type = (enum riic_type)of_device_get_match_data(&pdev->dev);
+ if (type == RIIC_RZ_G2L) {
+ rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(rstc)) {
+ dev_err(&pdev->dev, "Error: missing reset ctrl\n");
+ return PTR_ERR(rstc);
+ }
+
+ reset_control_deassert(rstc);
+ }
+
for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {
res = platform_get_resource(pdev, IORESOURCE_IRQ, riic_irqs[i].res_num);
if (!res)
@@ -472,7 +492,8 @@ static int riic_i2c_remove(struct platform_device *pdev)
}
static const struct of_device_id riic_i2c_dt_ids[] = {
- { .compatible = "renesas,riic-rz" },
+ { .compatible = "renesas,riic-r9a07g044", .data = (void *)RIIC_RZ_G2L },
+ { .compatible = "renesas,riic-rz", .data = (void *)RIIC_RZ_A },
{ /* Sentinel */ },
};
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 29/31] clk: renesas: r9a07g044: Mark IA55_CLK and DMAC_ACLK critical
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 664bb2e45b89cd8213e3c9772713323f75e21892 upstream.
Add IA55_CLK and DMAC_ACLK as critical clocks.
Previously it worked ok, because of a bug in clock status function
and the following patch in this series fixes the original bug.
Fixes: c3e67ad6f5a2 ("dt-bindings: clock: r9a07g044-cpg: Update clock/reset definitions")
Fixes: eb829e549ba6 ("clk: renesas: r9a07g044: Add DMAC clocks/resets")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210922112405.26413-1-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/clk/renesas/r9a07g044-cpg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 4c94b94c4125..1490446985e2 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -186,6 +186,8 @@ static struct rzg2l_reset r9a07g044_resets[] = {
static const unsigned int r9a07g044_crit_mod_clks[] __initconst = {
MOD_CLK_BASE + R9A07G044_GIC600_GICCLK,
+ MOD_CLK_BASE + R9A07G044_IA55_CLK,
+ MOD_CLK_BASE + R9A07G044_DMAC_ACLK,
};
const struct rzg2l_cpg_info r9a07g044_cpg_info = {
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 28/31] arm64: defconfig: Enable RZG2L_ADC
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 93207e415d134e6fbcee6a723ab4cf060ef3926e upstream.
Enable ADC driver support for Renesas RZ/G2L based platforms.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210927193551.22422-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index c9b0874a541e..edf32d432541 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -975,6 +975,7 @@ CONFIG_EXYNOS_ADC=y
CONFIG_MAX9611=m
CONFIG_QCOM_SPMI_ADC5=m
CONFIG_ROCKCHIP_SARADC=m
+CONFIG_RZG2L_ADC=m
CONFIG_IIO_CROS_EC_SENSORS_CORE=m
CONFIG_IIO_CROS_EC_SENSORS=m
CONFIG_IIO_CROS_EC_LIGHT_PROX=m
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 27/31] arm64: defconfig: Enable SND_SOC_WM8978
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 3c158ec884d8d75526594c888997cabc3223f521 upstream.
WM8978 audio CODEC is supported on RZ/G2L SMARC EVK.
Enable it on arm64 defconfig as module.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210920093905.10878-1-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[PL: Manually applied the changes]
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6cd2171308af..c9b0874a541e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -723,6 +723,7 @@ CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m
CONFIG_SND_SOC_TAS571X=m
CONFIG_SND_SOC_WCD934X=m
CONFIG_SND_SOC_WM8904=m
+CONFIG_SND_SOC_WM8978=m
CONFIG_SND_SOC_WSA881X=m
CONFIG_SND_SIMPLE_CARD=m
CONFIG_SND_AUDIO_GRAPH_CARD=m
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 26/31] arm64: defconfig: Enable SOUND_SOC_RZ
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit be15aa5cc14f94b520c13ab3540fdf7e735bff47 upstream.
Enable sound driver support for Renesas RZ/G2L based platforms.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210920093905.10878-2-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[PL: Manually applied the changes]
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index afc696d94c89..6cd2171308af 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -707,6 +707,7 @@ CONFIG_SND_SOC_ROCKCHIP_RT5645=m
CONFIG_SND_SOC_RK3399_GRU_SOUND=m
CONFIG_SND_SOC_SAMSUNG=y
CONFIG_SND_SOC_RCAR=m
+CONFIG_SND_SOC_RZ=m
CONFIG_SND_SUN4I_SPDIF=m
CONFIG_SND_SOC_TEGRA=m
CONFIG_SND_SOC_TEGRA210_AHUB=m
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 25/31] arm64: dts: renesas: rzg2l-smarc: Enable CANFD
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 7ae09309c324120b145224789102e730a98950d5 upstream.
Enable CANFD on RZ/G2L SMARC platform.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210924102338.11595-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi | 40 ++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
index e895f6e7fa28..a02784fab46a 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
@@ -80,6 +80,20 @@
clock-frequency = <12288000>;
};
+&canfd {
+ pinctrl-0 = <&can0_pins &can1_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ channel0 {
+ status = "okay";
+ };
+
+ channel1 {
+ status = "okay";
+ };
+};
+
&ehci0 {
dr_mode = "otg";
status = "okay";
@@ -139,6 +153,32 @@
pinctrl-0 = <&sound_clk_pins>;
pinctrl-names = "default";
+ can0_pins: can0 {
+ pinmux = <RZG2L_PORT_PINMUX(10, 1, 2)>, /* TX */
+ <RZG2L_PORT_PINMUX(11, 0, 2)>; /* RX */
+ };
+
+ /* SW7 should be at position 2->3 so that GPIO8_CAN0_STB line is activated */
+ can0-stb {
+ gpio-hog;
+ gpios = <RZG2L_GPIO(42, 2) GPIO_ACTIVE_HIGH>;
+ output-low;
+ line-name = "can0_stb";
+ };
+
+ can1_pins: can1 {
+ pinmux = <RZG2L_PORT_PINMUX(12, 1, 2)>, /* TX */
+ <RZG2L_PORT_PINMUX(13, 0, 2)>; /* RX */
+ };
+
+ /* SW8 should be at position 2->3 so that GPIO9_CAN1_STB line is activated */
+ can1-stb {
+ gpio-hog;
+ gpios = <RZG2L_GPIO(42, 3) GPIO_ACTIVE_HIGH>;
+ output-low;
+ line-name = "can1_stb";
+ };
+
i2c0_pins: i2c0 {
pins = "RIIC0_SDA", "RIIC0_SCL";
input-enable;
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 24/31] arm64: dts: renesas: rzg2l-smarc-som: Enable ADC on SMARC platform
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 03f7d78e8850ddb8cb1e623ef93e9018e4049ad7 upstream.
Enable the ADC which is present on RZ/G2L SMARC SOM.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210922212049.19851-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
.../arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
index 0748f2e7396a..da1ee2206e1a 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
@@ -5,6 +5,8 @@
* Copyright (C) 2021 Renesas Electronics Corp.
*/
+#include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
+
/ {
memory@48000000 {
device_type = "memory";
@@ -13,6 +15,21 @@
};
};
+&adc {
+ pinctrl-0 = <&adc_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ /delete-node/ channel@6;
+ /delete-node/ channel@7;
+};
+
&extal_clk {
clock-frequency = <24000000>;
};
+
+&pinctrl {
+ adc_pins: adc {
+ pinmux = <RZG2L_PORT_PINMUX(9, 0, 2)>; /* ADC_TRG */
+ };
+};
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 23/31] arm64: dts: renesas: rzg2l-smarc-som: Move extal and memory nodes to SOM DTSI
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 55c6826119f64be75c4b423a0092a8c1353a7a81 upstream.
Move extal and memory nodes to SOM DTSI.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210922212049.19851-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
.../boot/dts/renesas/r9a07g044l2-smarc.dts | 7 +------
.../boot/dts/renesas/rzg2l-smarc-som.dtsi | 18 ++++++++++++++++++
arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi | 4 ----
3 files changed, 19 insertions(+), 10 deletions(-)
create mode 100644 arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
diff --git a/arch/arm64/boot/dts/renesas/r9a07g044l2-smarc.dts b/arch/arm64/boot/dts/renesas/r9a07g044l2-smarc.dts
index d3f72ec62f03..247b0b3f1b58 100644
--- a/arch/arm64/boot/dts/renesas/r9a07g044l2-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a07g044l2-smarc.dts
@@ -7,15 +7,10 @@
/dts-v1/;
#include "r9a07g044l2.dtsi"
+#include "rzg2l-smarc-som.dtsi"
#include "rzg2l-smarc.dtsi"
/ {
model = "Renesas SMARC EVK based on r9a07g044l2";
compatible = "renesas,smarc-evk", "renesas,r9a07g044l2", "renesas,r9a07g044";
-
- memory@48000000 {
- device_type = "memory";
- /* first 128MB is reserved for secure area. */
- reg = <0x0 0x48000000 0x0 0x78000000>;
- };
};
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
new file mode 100644
index 000000000000..0748f2e7396a
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Device Tree Source for the RZ/G2L SMARC SOM common parts
+ *
+ * Copyright (C) 2021 Renesas Electronics Corp.
+ */
+
+/ {
+ memory@48000000 {
+ device_type = "memory";
+ /* first 128MB is reserved for secure area. */
+ reg = <0x0 0x48000000 0x0 0x78000000>;
+ };
+};
+
+&extal_clk {
+ clock-frequency = <24000000>;
+};
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
index 39e05169aaaa..e895f6e7fa28 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
@@ -89,10 +89,6 @@
status = "okay";
};
-&extal_clk {
- clock-frequency = <24000000>;
-};
-
&hsusb {
dr_mode = "otg";
status = "okay";
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 22/31] arm64: dts: renesas: rzg2l-smarc: Add Mic routing
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 87b1e27af4c1e3422bb2189b5f8f72075e841d6f upstream.
Add audio routing for Mic with bias to reduce noise when doing
audio capture.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210921084605.16250-5-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
index 1791c21dfe74..39e05169aaaa 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
@@ -47,6 +47,12 @@
simple-audio-card,frame-master = <&cpu_dai>;
simple-audio-card,mclk-fs = <256>;
+ simple-audio-card,widgets = "Microphone", "Microphone Jack";
+ simple-audio-card,routing =
+ "L2", "Mic Bias",
+ "R2", "Mic Bias",
+ "Mic Bias", "Microphone Jack";
+
cpu_dai: simple-audio-card,cpu {
sound-dai = <&ssi0>;
};
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 21/31] arm64: dts: renesas: rzg2l-smarc: Enable audio
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit e396d6103343ff95874444bd8a67f031eafe0e38 upstream.
Enable audio on RZ/G2L SMARC EVK by linking SSI0 with WM8978
audio CODEC.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210921084605.16250-4-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi | 66 ++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
index 85fd6dbabff2..1791c21dfe74 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
@@ -8,6 +8,19 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
+/*
+ * SSI-WM8978
+ *
+ * This command is required when Playback/Capture
+ *
+ * amixer cset name='Left Input Mixer L2 Switch' on
+ * amixer cset name='Right Input Mixer R2 Switch' on
+ * amixer cset name='Headphone Playback Volume' 100
+ * amixer cset name='PCM Volume' 100%
+ * amixer cset name='Input PGA Volume' 25
+ *
+ */
+
/ {
aliases {
serial0 = &scif0;
@@ -21,6 +34,29 @@
stdout-path = "serial0:115200n8";
};
+ audio_mclock: audio_mclock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <11289600>;
+ };
+
+ snd_rzg2l: sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,bitclock-master = <&cpu_dai>;
+ simple-audio-card,frame-master = <&cpu_dai>;
+ simple-audio-card,mclk-fs = <256>;
+
+ cpu_dai: simple-audio-card,cpu {
+ sound-dai = <&ssi0>;
+ };
+
+ codec_dai: simple-audio-card,codec {
+ clocks = <&audio_mclock>;
+ sound-dai = <&wm8978>;
+ };
+ };
+
usb0_vbus_otg: regulator-usb0-vbus-otg {
compatible = "regulator-fixed";
@@ -30,6 +66,14 @@
};
};
+&audio_clk1{
+ clock-frequency = <11289600>;
+};
+
+&audio_clk2{
+ clock-frequency = <12288000>;
+};
+
&ehci0 {
dr_mode = "otg";
status = "okay";
@@ -90,6 +134,9 @@
};
&pinctrl {
+ pinctrl-0 = <&sound_clk_pins>;
+ pinctrl-names = "default";
+
i2c0_pins: i2c0 {
pins = "RIIC0_SDA", "RIIC0_SCL";
input-enable;
@@ -110,6 +157,18 @@
<RZG2L_PORT_PINMUX(38, 1, 1)>; /* RxD */
};
+ sound_clk_pins: sound_clk {
+ pins = "AUDIO_CLK1", "AUDIO_CLK2";
+ input-enable;
+ };
+
+ ssi0_pins: ssi0 {
+ pinmux = <RZG2L_PORT_PINMUX(45, 0, 1)>, /* BCK */
+ <RZG2L_PORT_PINMUX(45, 1, 1)>, /* RCK */
+ <RZG2L_PORT_PINMUX(45, 2, 1)>, /* TXD */
+ <RZG2L_PORT_PINMUX(45, 3, 1)>; /* RXD */
+ };
+
usb0_pins: usb0 {
pinmux = <RZG2L_PORT_PINMUX(4, 0, 1)>, /* VBUS */
<RZG2L_PORT_PINMUX(5, 0, 1)>, /* OVC */
@@ -128,6 +187,13 @@
status = "okay";
};
+&ssi0 {
+ pinctrl-0 = <&ssi0_pins>;
+ pinctrl-names = "default";
+
+ status = "okay";
+};
+
&usb2_phy0 {
pinctrl-0 = <&usb0_pins>;
pinctrl-names = "default";
--
2.17.1
^ permalink raw reply related
* [PATCH 5.10.y-cip 20/31] arm64: dts: renesas: rzg2l-smarc: Add WM8978 sound codec
From: Lad Prabhakar @ 2021-12-29 10:15 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
In-Reply-To: <20211229101530.22783-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 1c8da81cc452075a21d4654f88264df8e8e89676 upstream.
Add WM8978 sound codec node to RZ/G2L SMARC EVK.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210921084605.16250-3-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
index 8ecc5b45fc99..85fd6dbabff2 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc.dtsi
@@ -65,8 +65,15 @@
&i2c3 {
pinctrl-0 = <&i2c3_pins>;
pinctrl-names = "default";
+ clock-frequency = <400000>;
status = "okay";
+
+ wm8978: codec@1a {
+ compatible = "wlf,wm8978";
+ #sound-dai-cells = <0>;
+ reg = <0x1a>;
+ };
};
&ohci0 {
--
2.17.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox