From: Alexey Sheplyakov <asheplyakov@basealt.ru>
To: devel-kernel@lists.altlinux.org
Cc: rst@basealt.ru, nir@basealt.ru, sin@basealt.ru
Subject: [d-kernel] [PATCH 5/7] drm/bridge: dw-hdmi: refreshed hw revision 0x2a support patch
Date: Tue, 23 Aug 2022 14:43:20 +0400
Message-ID: <20220823104318.2338489-6-asheplyakov@basealt.ru> (raw)
In-Reply-To: <20220823104318.2338489-1-asheplyakov@basealt.ru>
The hardware needs non-zero register shift (from DTB), and
a special conf0 parameter.
With this patch I can use HDMI audio on Baikal-M SoC.
Signed-off-by: Alexey Sheplyakov <asheplyakov@basealt.ru>
---
.../display/bridge/synopsys,dw-hdmi.yaml | 7 +++++++
.../drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 18 +++++++++---------
.../gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 2 +-
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++----
4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
index 9be44a682e67..b86365ebb650 100644
--- a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
@@ -31,6 +31,13 @@ properties:
- enum: [1, 4]
default: 1
+ ahb-audio-regshift:
+ description:
+ AHB audio registers offset shift
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [0, 2]
+ default: 0
+
clocks:
minItems: 2
maxItems: 5
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
index 8ea999aac4bf..9faae3604c2e 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
@@ -135,24 +135,24 @@ struct snd_dw_hdmi {
static inline void dw_hdmi_writeb_relaxed(u8 value, const struct dw_hdmi_audio_data *data, int offset)
{
void __iomem *base = data->base;
- if (data->reg_offset != 0)
- offset <<= data->reg_offset;
+ if (data->regshift != 0)
+ offset <<= data->regshift;
writeb_relaxed(value, base + offset);
}
static inline void dw_hdmi_writeb(u8 value, const struct dw_hdmi_audio_data *data, int offset)
{
void __iomem *base = data->base;
- if (data->reg_offset != 0)
- offset <<= data->reg_offset;
+ if (data->regshift != 0)
+ offset <<= data->regshift;
writeb(value, base + offset);
}
static inline u8 dw_hdmi_readb(const struct dw_hdmi_audio_data *data, int offset)
{
void __iomem *base = data->base;
- if (data->reg_offset != 0)
- offset <<= data->reg_offset;
+ if (data->regshift != 0)
+ offset <<= data->regshift;
return readb(base + offset);
}
@@ -160,8 +160,8 @@ static inline u8 dw_hdmi_readb(const struct dw_hdmi_audio_data *data, int offset
static inline u8 dw_hdmi_readb_relaxed(const struct dw_hdmi_audio_data *data, int offset)
{
void __iomem *base = data->base;
- if (data->reg_offset != 0)
- offset <<= data->reg_offset;
+ if (data->regshift != 0)
+ offset <<= data->regshift;
return readb_relaxed(base + offset);
}
@@ -451,7 +451,7 @@ static int dw_hdmi_prepare(struct snd_pcm_substream *substream)
HDMI_AHB_DMA_CONF0_INCR8;
threshold = 128;
break;
- case 0x2a: /* this revision is used in Baikal-M SoC */
+ case 0x2a:
conf0 = HDMI_AHB_DMA_CONF0_BURST_MODE |
HDMI_AHB_DMA_CONF0_INCR16;
threshold = 128;
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
index bc8468fe52a0..3250588d39ff 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h
@@ -10,7 +10,7 @@ struct dw_hdmi_audio_data {
int irq;
struct dw_hdmi *hdmi;
u8 *(*get_eld)(struct dw_hdmi *hdmi);
- unsigned reg_offset;
+ unsigned regshift;
};
struct dw_hdmi_i2s_audio_data {
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 573c9820030e..0472ab97ea39 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3441,11 +3441,15 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
audio.irq = irq;
audio.hdmi = hdmi;
audio.get_eld = hdmi_audio_get_eld;
- audio.reg_offset = 0;
+ if (of_property_read_u32(np, "ahb-audio-regshift", &audio.regshift) != 0) {
+ audio.regshift = 0;
+ } else {
+ dev_dbg(dev, "set audio.regshift=%u from DTB\n", audio.regshift);
+ }
if (of_device_is_compatible(np, "baikal,hdmi")) {
- audio.reg_offset = 2;
- dev_info(dev, "setting audio.reg_offset=%d for BE-M1000 SoC\n",
- audio.reg_offset);
+ audio.regshift = 2;
+ dev_info(dev, "setting audio.regshift=%d for BE-M1000 SoC\n",
+ audio.regshift);
}
hdmi->enable_audio = dw_hdmi_ahb_audio_enable;
hdmi->disable_audio = dw_hdmi_ahb_audio_disable;
--
2.32.0
next prev parent reply other threads:[~2022-08-23 10:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 10:43 [d-kernel] p10/un-def: поддержка ноутбука Элпитех (и SDK-M 5.5) Alexey Sheplyakov
2022-08-23 10:43 ` [d-kernel] [PATCH 1/7] arm64: dts: wiped out obsolete Baikal-M device trees Alexey Sheplyakov
2022-08-23 10:43 ` [d-kernel] [PATCH 2/7] net: stmmac: removed obsolete Baikal-M specific mdio reset Alexey Sheplyakov
2022-08-23 10:43 ` [d-kernel] [PATCH 3/7] Added PCI-E driver for Baikal-M with SDK-M 5.5 firmware Alexey Sheplyakov
2022-08-23 10:43 ` [d-kernel] [PATCH 4/7] input: new driver - serdev-serio Alexey Sheplyakov
2022-08-23 10:43 ` Alexey Sheplyakov [this message]
2022-08-23 10:43 ` [d-kernel] [PATCH 6/7] arm64/configs: refreshed Baikal-M specific config Alexey Sheplyakov
2022-08-23 10:43 ` [d-kernel] [PATCH 7/7] config-aarch64: enabled Baikal-M specific drivers Alexey Sheplyakov
2022-08-23 15:50 ` [d-kernel] p10/un-def: поддержка ноутбука Элпитех (и SDK-M 5.5) Vitaly Chikunov
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=20220823104318.2338489-6-asheplyakov@basealt.ru \
--to=asheplyakov@basealt.ru \
--cc=devel-kernel@lists.altlinux.org \
--cc=nir@basealt.ru \
--cc=rst@basealt.ru \
--cc=sin@basealt.ru \
/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
ALT Linux kernel packages development
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
public-inbox-index devel-kernel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git