Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Joakim  Zhang" <joakim.zhang@cixtech.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	cix-kernel-upstream <cix-kernel-upstream@cixtech.com>
Subject: Re: [PATCH V1 2/3] ALSA: hda: add bus callback for address translation
Date: Mon, 01 Dec 2025 09:41:03 +0100	[thread overview]
Message-ID: <87cy4yd274.wl-tiwai@suse.de> (raw)
In-Reply-To: <SEYPR06MB62263D352405481E3046320782DBA@SEYPR06MB6226.apcprd06.prod.outlook.com>

On Mon, 01 Dec 2025 09:14:57 +0100,
Joakim  Zhang wrote:
> 
> 
> Hello Takashi,
> 
> > -----Original Message-----
> > From: Takashi Iwai <tiwai@suse.de>
> > Sent: Saturday, November 29, 2025 1:23 AM
> > To: Joakim Zhang <joakim.zhang@cixtech.com>
> > Cc: Takashi Iwai <tiwai@suse.de>; lgirdwood@gmail.com;
> > broonie@kernel.org; robh@kernel.org; krzk+dt@kernel.org;
> > conor+dt@kernel.org; perex@perex.cz; tiwai@suse.com; linux-
> > sound@vger.kernel.org; devicetree@vger.kernel.org; cix-kernel-upstream
> > <cix-kernel-upstream@cixtech.com>
> > Subject: Re: [PATCH V1 2/3] ALSA: hda: add bus callback for address
> > translation
> >
> > EXTERNAL EMAIL
> >
> > CAUTION: Suspicious Email from unusual domain.
> >
> > On Thu, 27 Nov 2025 10:44:26 +0100,
> > Joakim  Zhang wrote:
> > >
> > > [...]
> > > > >  include/sound/hdaudio.h     |  3 +++
> > > > >  sound/hda/core/controller.c | 25 +++++++++++++++++++------
> > > > >  sound/hda/core/stream.c     | 17 ++++++++++++++---
> > > > >  3 files changed, 36 insertions(+), 9 deletions(-)
> > > > >
> > > > > diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
> > > > > index 4e0c1d8af09f..61b41a014f4a 100644
> > > > > --- a/include/sound/hdaudio.h
> > > > > +++ b/include/sound/hdaudio.h
> > > > > @@ -293,6 +293,9 @@ struct hdac_bus {
> > > > >       const struct hdac_bus_ops *ops;
> > > > >       const struct hdac_ext_bus_ops *ext_ops;
> > > > >
> > > > > +     /* address translation from host to hdac */
> > > > > +     dma_addr_t (*addr_host_to_hdac)(struct hdac_bus *bus,
> > > > > + dma_addr_t addr);
> > > >
> > > > This should be rather added to hdac_bus_ops instead.
> > > >
> > > > Or, we can just add addr_offset field in hdac_bus instead of yet
> > > > another callback.  Then the change would be simpler.
> > > >
> > >
> > > Hello Takashi,
> > >
> > > Sorry for late updating since I am involving in other tasks recently.
> > >
> > > I tried to add addr_offset field in hdac_bus for the address
> > > translation, but met the issue, e.g.
> > > On our platform, if HOST address is 0xd0c09000, HDAC address is
> > 0xd0c09000 - 0x90000000 = 0x40c09000.
> > >
> > > If we use the pattern, HOST_addr + addr_offset = HDAC_addr For 64bit
> > > host, then addr_offset shound be 0x70000000,
> > > 0xd0c09000+0x70000000=0x1_40c09000, it will update both lower 32bit
> > > and upper 32bit into hda registers. However, hda controller in our
> > > audio subsystem can only support 32bit address, if hda  sending address
> > more than 32bit, it would not work.
> >
> > Hm, I don't understand.  It we define something like
> >
> >         dma_addr_t addr_offset;
> >
> > in hdac_bus, and the driver setting
> >
> >         bus->addr_offset = -0x90000000;
> >
> > then a calculation
> >
> >         dma_addr_t addr;
> >
> >         addr = bus->rb.addr + bus->addr_offset;
> >
> > will lead to the very same result as your callback, no?
> > Or am I missing something?
> 
> typedef u64 dma_addr_t;
> 
> 1)
> dma_addr_t a = 0xd0c09000;
> dma_addr_t b = -0x90000000;

You have to pass with ULL suffix as a 64bit value instead:
  dma_addr_t b = -0x90000000ULL;


thanks,

Takashi

  reply	other threads:[~2025-12-01  8:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 11:09 [PATCH V1 0/3] ALSA: hda: add CIX IPBLOQ HDA controller support joakim.zhang
2025-10-30 11:09 ` [PATCH V1 1/3] dt-bindings: sound: add binding for CIX IPBLOQ HDA controller joakim.zhang
2025-10-31  8:58   ` Krzysztof Kozlowski
2025-10-31  9:28     ` Krzysztof Kozlowski
2025-10-31 14:57     ` Conor Dooley
2025-11-03 10:36     ` Joakim  Zhang
2025-10-30 11:09 ` [PATCH V1 2/3] ALSA: hda: add bus callback for address translation joakim.zhang
2025-10-31 11:28   ` Takashi Iwai
2025-11-03 11:30     ` Joakim  Zhang
2025-11-27  9:44     ` Joakim  Zhang
2025-11-28 17:22       ` Takashi Iwai
2025-12-01  8:14         ` Joakim  Zhang
2025-12-01  8:41           ` Takashi Iwai [this message]
2025-12-01 10:58             ` Joakim  Zhang
2025-10-30 11:09 ` [PATCH V1 3/3] ALSA: hda: add CIX IPBLOQ HDA controller support joakim.zhang
2025-10-31  9:05   ` Krzysztof Kozlowski
2025-10-31  9:57     ` Takashi Iwai
2025-11-03 10:43     ` Joakim  Zhang

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-all 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=87cy4yd274.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=broonie@kernel.org \
    --cc=cix-kernel-upstream@cixtech.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joakim.zhang@cixtech.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=tiwai@suse.com \
    /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