drm/i2c: tda998x ASoC hdmi-codec support + BeagleBoneBlack audio support
Subsystems (5)
cover drm/i2c: tda998x ASoC hdmi-codec support + BeagleBoneBlack audio support
These patches are just a rebase of the same patches from my "[PATCH v4 0/7] Implement generic ASoC HDMI codec and use it in tda998x" -patch series. I have only made updates required by efc9194bcff8 ("ASoC: hdmi-codec: callback function will be called with private data") -patch.
The first patch changes tda998x pdata, so if there are any out of tree users of tda998x-driver the out of tree code needs to be updated.
Jyri Sarha (3):
drm/i2c: tda998x: Improve tda998x_configure_audio() audio related
pdata
drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
ARM: dts: am335x-boneblack: Add HDMI audio support
.../devicetree/bindings/display/bridge/tda998x.txt | 18 ++ arch/arm/boot/dts/am335x-boneblack.dts | 71 +++++- drivers/gpu/drm/i2c/Kconfig | 1 + drivers/gpu/drm/i2c/tda998x_drv.c | 276 ++++++++++++++++++--- include/drm/i2c/tda998x.h | 24 +- include/dt-bindings/display/tda998x.h | 7 + 6 files changed, 342 insertions(+), 55 deletions(-) create mode 100644 include/dt-bindings/display/tda998x.h
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
Define struct tda998x_audio_params in include/drm/i2c/tda998x.h and use it in pdata and for tda998x_configure_audio() parameters. Also updates tda998x_write_aif() to take struct hdmi_audio_infoframe * directly as a parameter.
--- drivers/gpu/drm/i2c/tda998x_drv.c | 77 ++++++++++++++++++++------------------- include/drm/i2c/tda998x.h | 24 +++++++----- 2 files changed, 53 insertions(+), 48 deletions(-)
drivers/gpu/drm/i2c/tda998x_drv.c +39 -38
@@ -41,7 +41,7 @@ struct tda998x_priv {u8 vip_cntrl_0;u8 vip_cntrl_1;u8 vip_cntrl_2; -struct tda998x_encoder_params params; +struct tda998x_audio_params audio_params;wait_queue_head_t wq_edid;volatile int wq_edid_wait;
@@ -666,26 +666,16 @@ tda998x_write_if(struct tda998x_priv *priv, u8 bit, u16 addr,reg_set (priv,REG_DIP_IF_FLAGS , bit); } -static void -tda998x_write_aif (struct tda998x_priv *priv,struct tda998x_encoder_params *p) +static int tda998x_write_aif (struct tda998x_priv *priv, +struct hdmi_audio_infoframe *cea) {union hdmi_infoframe frame; -hdmi_audio_infoframe_init (&frame.audio); - - frame.audio.channels = p->audio_frame[1 ] &0x07 ; - frame.audio.channel_allocation = p->audio_frame[4 ]; - frame.audio.level_shift_value = (p->audio_frame[5 ] &0x78 ) >>3 ; - frame.audio.downmix_inhibit = (p->audio_frame[5 ] &0x80 ) >>7 ; - -/* -* L-PCM and IEC61937 compressed audio shall always set sample -* frequency to "refer to stream". For others, see the HDMI -* specification. -*/ - frame.audio.sample_frequency = (p->audio_frame[2 ] &0x1c ) >>2 ; + frame.audio = *cea;tda998x_write_if (priv,DIP_IF_FLAGS_IF4 ,REG_IF4_HB0 , &frame); + +return 0 ; } static void
@@ -710,20 +700,21 @@ static void tda998x_audio_mute(struct tda998x_priv *priv, bool on) } } -static void +static int tda998x_configure_audio (struct tda998x_priv *priv, -struct drm_display_mode *mode,struct tda998x_encoder_params *p) +struct tda998x_audio_params *params, +unsigned mode_clock) {u8 buf[6 ], clksel_aip, clksel_fs, cts_n, adiv;u32 n;/* Enable audio ports */ -reg_write (priv,REG_ENA_AP , p->audio_cfg); -reg_write (priv,REG_ENA_ACLK , p->audio_clk_cfg); +reg_write (priv,REG_ENA_AP , params->config);/* Set audio input source */ -switch (p->audio_format) { +switch (params->format) {case AFMT_SPDIF : +reg_write (priv,REG_ENA_ACLK ,0 );reg_write (priv,REG_MUX_AP ,MUX_AP_SELECT_SPDIF ); clksel_aip =AIP_CLKSEL_AIP_SPDIF ; clksel_fs =AIP_CLKSEL_FS_FS64SPDIF ;
@@ -731,15 +722,29 @@ tda998x_configure_audio(struct tda998x_priv *priv,break ;case AFMT_I2S : +reg_write (priv,REG_ENA_ACLK ,1 );reg_write (priv,REG_MUX_AP ,MUX_AP_SELECT_I2S ); clksel_aip =AIP_CLKSEL_AIP_I2S ; clksel_fs =AIP_CLKSEL_FS_ACLK ; - cts_n =CTS_N_M (3 ) |CTS_N_K (3 ); +switch (params->sample_width) { +case 16 : + cts_n =CTS_N_M (3 ) |CTS_N_K (1 ); +break ; +case 18 : +case 20 : +case 24 : + cts_n =CTS_N_M (3 ) |CTS_N_K (2 ); +break ; +default : +case 32 : + cts_n =CTS_N_M (3 ) |CTS_N_K (3 ); +break ; + }break ;default :BUG (); -return ; +return -EINVAL ; }reg_write (priv,REG_AIP_CLKSEL , clksel_aip);
@@ -755,11 +760,11 @@ tda998x_configure_audio(struct tda998x_priv *priv,* assume 100MHz requires larger divider. */ adiv =AUDIO_DIV_SERCLK_8 ; -if (mode->clock >100000 ) +if (mode_clock >100000 ) adiv++;/* AUDIO_DIV_SERCLK_16 */ /* S/PDIF asks for a larger divider */ -if (p->audio_format ==AFMT_SPDIF ) +if (params->format ==AFMT_SPDIF ) adiv++;/* AUDIO_DIV_SERCLK_16 or _32 */ reg_write (priv,REG_AUDIO_DIV , adiv);
@@ -768,7 +773,7 @@ tda998x_configure_audio(struct tda998x_priv *priv,* This is the approximate value of N, which happens to be * the recommended values for non-coherent clocks. */ - n =128 * p->audio_sample_rate /1000 ; + n =128 * params->sample_rate /1000 ;/* Write the CTS and N values */ buf[0 ] =0x44 ;
@@ -787,19 +792,13 @@ tda998x_configure_audio(struct tda998x_priv *priv,reg_clear (priv,REG_AIP_CNTRL_0 ,AIP_CNTRL_0_RST_CTS );/* Write the channel status */ - buf[0 ] =IEC958_AES0_CON_NOT_COPYRIGHT ; - buf[1 ] =0x00 ; - buf[2 ] =IEC958_AES3_CON_FS_NOTID ; - buf[3 ] =IEC958_AES4_CON_ORIGFS_NOTID | -IEC958_AES4_CON_MAX_WORDLEN_24 ; -reg_write_range (priv,REG_CH_STAT_B (0 ), buf,4 ); +reg_write_range (priv,REG_CH_STAT_B (0 ), params->status,4 );tda998x_audio_mute (priv, true);msleep (20 );tda998x_audio_mute (priv, false); -/* Write the audio information packet */ -tda998x_write_aif (priv, p); +return tda998x_write_aif (priv, ¶ms->cea); }/* DRM encoder functions */
@@ -820,7 +819,7 @@ static void tda998x_encoder_set_config(struct tda998x_priv *priv,VIP_CNTRL_2_SWAP_F (p->swap_f) | (p->mirr_f ?VIP_CNTRL_2_MIRR_F :0 ); - priv->params = *p; + priv->audio_params = p->audio; }static void tda998x_encoder_dpms (struct drm_encoder *encoder,int mode)
@@ -1057,9 +1056,11 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,tda998x_write_avi (priv, adjusted_mode); -if (priv->params.audio_cfg) -tda998x_configure_audio (priv, adjusted_mode, - &priv->params); +if (priv->audio_params.format !=AFMT_UNUSED ) { +tda998x_configure_audio (priv, + &priv->audio_params, + adjusted_mode->clock); + } } }
include/drm/i2c/tda998x.h +14 -10
@@ -1,6 +1,19 @@ #ifndef __DRM_I2C_TDA998X_H__ #define __DRM_I2C_TDA998X_H__ +#define AFMT_UNUSED 0 +#define AFMT_SPDIF 1 +#define AFMT_I2S 2 + +struct tda998x_audio_params { + u8 config; + u8 format; + unsigned sample_width; + unsigned sample_rate; + struct hdmi_audio_infoframe cea; + u8 status[4]; +}; + struct tda998x_encoder_params { u8 swap_b:3; u8 mirr_b:1;
@@ -15,16 +28,7 @@ struct tda998x_encoder_params { u8 swap_e:3; u8 mirr_e:1; -u8 audio_cfg; -u8 audio_clk_cfg; -u8 audio_frame[6 ]; - -enum { -AFMT_SPDIF , -AFMT_I2S - } audio_format; - - unsigned audio_sample_rate; + struct tda998x_audio_params audio; };#endif
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 5adcd94104080abcd5b072a5d6a85b85c5ea0584.1470129989.git.jsarha-l0cyMroinI0@public.gmane.org
Re: [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
drivers/gpu/drm/i2c/tda998x_drv.c tda998x_configure_audio(struct tda998x_priv *priv, · line 795
Quoted 11 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +1
-6@@ -787,19 +792,13 @@ tda998x_configure_audio(struct tda998x_priv *priv,reg_clear (priv,REG_AIP_CNTRL_0 ,AIP_CNTRL_0_RST_CTS );/* Write the channel status */ - buf[0 ] =IEC958_AES0_CON_NOT_COPYRIGHT ; - buf[1 ] =0x00 ; - buf[2 ] =IEC958_AES3_CON_FS_NOTID ; - buf[3 ] =IEC958_AES4_CON_ORIGFS_NOTID | -IEC958_AES4_CON_MAX_WORDLEN_24 ; -reg_write_range (priv,REG_CH_STAT_B (0 ), buf,4 ); +reg_write_range (priv,REG_CH_STAT_B (0 ), params->status,4 );
Take a close look at the code you are replacing here - the buffer contents is not AES bytes 0, 1, 2, 3, 4, but AES bytes 0, 1, 3, 4
- byte 2 is not present in this array. I don't think you've noticed this as your second patch merely copies verboten the IEC status:
+ memcpy(audio.status, params->iec.status,
+ min(sizeof(audio.status), sizeof(params->iec.status)));
assuming that it is bytes 0-3. Byte 2 is stored separately for each I2S channel in the following registers.
include/drm/i2c/tda998x.h line 6
Quoted 11 lines
include/drm/i2c/tda998x.h +3
-0@@ -1,6 +1,19 @@#ifndef __DRM_I2C_TDA998X_H__#define __DRM_I2C_TDA998X_H__ +#define AFMT_UNUSED 0 +#define AFMT_SPDIF 1 +#define AFMT_I2S 2
I'd prefer this to stay an enum please.
include/drm/i2c/tda998x.h line 13
Quoted 6 lines
include/drm/i2c/tda998x.h +6
-0+struct tda998x_audio_params { +u8 config; +u8 format; +unsigned sample_width; +unsigned sample_rate; +struct hdmi_audio_infoframe cea;
With this addition, this file will need to include linux/hdmi.h.
include/drm/i2c/tda998x.h line 14
Quoted 1 line
include/drm/i2c/tda998x.h +1
-0+u8 status[4 ];
A comment here about the missing byte 2 would probably be a good idea.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
Quoted 21 lines · Russell King - ARM Linux
drivers/gpu/drm/i2c/tda998x_drv.c tda998x_configure_audio(struct tda998x_priv *priv, · line 795
Quoted 11 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +1
-6@@ -787,19 +792,13 @@ tda998x_configure_audio(struct tda998x_priv *priv,reg_clear (priv,REG_AIP_CNTRL_0 ,AIP_CNTRL_0_RST_CTS );/* Write the channel status */ - buf[0 ] =IEC958_AES0_CON_NOT_COPYRIGHT ; - buf[1 ] =0x00 ; - buf[2 ] =IEC958_AES3_CON_FS_NOTID ; - buf[3 ] =IEC958_AES4_CON_ORIGFS_NOTID | -IEC958_AES4_CON_MAX_WORDLEN_24 ; -reg_write_range (priv,REG_CH_STAT_B (0 ), buf,4 ); +reg_write_range (priv,REG_CH_STAT_B (0 ), params->status,4 );Take a close look at the code you are replacing here - the buffer contents is not AES bytes 0, 1, 2, 3, 4, but AES bytes 0, 1, 3, 4
- byte 2 is not present in this array. I don't think you've noticed this as your second patch merely copies verboten the IEC status:(quoted diff) +2
-0+ memcpy(audio.status, params->iec.status, + min(sizeof(audio.status), sizeof(params->iec.status)));
Quoted 3 lines
assuming that it is bytes 0-3. Byte 2 is stored separately for each I2S channel in the following registers.
Oh, yes. I missed that. I think it would be better to increase tda998x_audio_params status buffer length by one and keep it otherwise as it is. Then just write the bytes 0-1 and 3-4 separately into channel status registers, with appropriate comments. I guess the the AES byte 2 can remain 0 for now (source and channel unspecified, with assumption of consumer stream).
Quoted 8 lines
Quoted 8 lines
include/drm/i2c/tda998x.h +0
-0@@ -1,6 +1,19 @@#ifndef __DRM_I2C_TDA998X_H__#define __DRM_I2C_TDA998X_H__
Quoted 6 lines
include/drm/i2c/tda998x.h line 6
Quoted 3 lines
include/drm/i2c/tda998x.h +3
-0+#define AFMT_UNUSED 0 +#define AFMT_SPDIF 1 +#define AFMT_I2S 2I'd prefer this to stay an enum please.
Ok.
Quoted 9 lines
include/drm/i2c/tda998x.h line 13
Quoted 6 lines
include/drm/i2c/tda998x.h +6
-0+struct tda998x_audio_params { +u8 config; +u8 format; +unsigned sample_width; +unsigned sample_rate; +struct hdmi_audio_infoframe cea;With this addition, this file will need to include
linux/hdmi.h.
Oh yes, thanks.
Quoted 4 lines
include/drm/i2c/tda998x.h line 14
Quoted 1 line
include/drm/i2c/tda998x.h +1
-0+u8 status[4 ];A comment here about the missing byte 2 would probably be a good idea.
As I said earlier, I'd rather keep this as plain channel status buffer and just increase its size by one.
Thanks a lot for the review!
Best reagards,
Jyri
Russell King - ARM Linux
maintainerRe: [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
In reply to Jyri Sarhadrivers/gpu/drm/i2c/tda998x_drv.c tda998x_configure_audio(struct tda998x_priv *priv, · line 795
Quoted 11 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +1
-6@@ -787,19 +792,13 @@ tda998x_configure_audio(struct tda998x_priv *priv,reg_clear (priv,REG_AIP_CNTRL_0 ,AIP_CNTRL_0_RST_CTS );/* Write the channel status */ - buf[0 ] =IEC958_AES0_CON_NOT_COPYRIGHT ; - buf[1 ] =0x00 ; - buf[2 ] =IEC958_AES3_CON_FS_NOTID ; - buf[3 ] =IEC958_AES4_CON_ORIGFS_NOTID | -IEC958_AES4_CON_MAX_WORDLEN_24 ; -reg_write_range (priv,REG_CH_STAT_B (0 ), buf,4 ); +reg_write_range (priv,REG_CH_STAT_B (0 ), params->status,4 );
Another couple of points here:
1. I think we should only write the channel status if I2S mode is selected - channel status won't be used on SPDIF mode as SPDIF supplies its own channel status.
2. I think we should continue writing all the channel status in a single I2C transaction, and not breaking it into several different transactions to cater for the odd register order. I don't have any direct evidence that one way is better than the other in terms of atomicity of the update, but I think having it as a single transaction stands a better chance of the chip atomically updating the channel status.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Russell King - ARM Linux
maintainerRe: [PATCH 1/3] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata
In reply to Jyri SarhaQuoted 6 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +1
-1@@ -41,7 +41,7 @@ struct tda998x_priv {u8 vip_cntrl_0;u8 vip_cntrl_1;u8 vip_cntrl_2; -struct tda998x_encoder_params params; +struct tda998x_audio_params audio_params;
...
Quoted 6 lines
drivers/gpu/drm/i2c/tda998x_drv.c +1
-1@@ -820,7 +819,7 @@ static void tda998x_encoder_set_config(struct tda998x_priv *priv,VIP_CNTRL_2_SWAP_F (p->swap_f) | (p->mirr_f ?VIP_CNTRL_2_MIRR_F :0 ); - priv->params = *p; + priv->audio_params = p->audio;
...
Quoted 5 lines
include/drm/i2c/tda998x.h +0
-1@@ -15,16 +28,7 @@ struct tda998x_encoder_params { u8 swap_e:3; u8 mirr_e:1; -u8 audio_cfg;
include/drm/i2c/tda998x.h struct tda998x_encoder_params { · line 31
Quoted 10 lines
include/drm/i2c/tda998x.h +1
-9-u8 audio_clk_cfg; -u8 audio_frame[6 ]; - -enum { -AFMT_SPDIF , -AFMT_I2S - } audio_format; - -unsigned audio_sample_rate; +struct tda998x_audio_params audio;
Another point - it would be nice if the name for both tda998x_audio_params structures was the same.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 2/3 drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
In reply to Jyri SarhaRegister ASoC HDMI codec for audio functionality and adds device tree binding for audio configuration.
With the registered HDMI codec the tda998x node can be used like a regular codec node in ASoC card configurations. HDMI audio info-frame and audio stream header is generated by the ASoC HDMI codec. The codec also applies constraints for available sample-rates based on Edid Like Data from the display. The device tree binding document has been updated [1].
Part of this patch has been inspired by Jean Francoise's "drm/i2c: tda998x:
Add support of a DT graph of ports"-patch [2]. There may still be some identical lines left from the original patch and some of the ideas have come from there.
[1] Documentation/devicetree/bindings/display/bridge/tda998x.txt
[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-July/095255.html
--- .../devicetree/bindings/display/bridge/tda998x.txt | 18 ++ drivers/gpu/drm/i2c/Kconfig | 1 + drivers/gpu/drm/i2c/tda998x_drv.c | 199 ++++++++++++++++++++- include/drm/i2c/tda998x.h | 4 +- include/dt-bindings/display/tda998x.h | 7 + 5 files changed, 224 insertions(+), 5 deletions(-) create mode 100644 include/dt-bindings/display/tda998x.h
Documentation/devicetree/bindings/display/bridge/tda998x.txt +18 -0
@@ -21,8 +21,19 @@ Optional properties: - video-ports: 24 bits value which defines how the video controller output is wired to the TDA998x input - default: <0x230145> + - audio-ports: array of 8-bit values, 2 values per one DAI[1]. + The first value defines the DAI type: TDA998x_SPDIF or TDA998x_I2S[2]. + The second value defines the tda998x AP_ENA reg content when the DAI + in question is used. The implementation allows one or two DAIs. If two + DAIs are defined, they must be of different type. + +[1] Documentation/sound/alsa/soc/DAI.txt +[2] include/dt-bindings/display/tda998x.h + Example: +#include <dt-bindings/display/tda998x.h> + tda998x: hdmi-encoder { compatible = "nxp,tda998x"; reg = <0x70>;
@@ -30,4 +41,11 @@ Example: interrupts = <27 2>; /* falling edge */ pinctrl-0 = <&pmx_camera>; pinctrl-names = "default"; + video-ports = <0x230145>; + + #sound-dai-cells = <2>; + /* DAI-format AP_ENA reg value */ + audio-ports = < TDA998x_SPDIF 0x04 + TDA998x_I2S 0x03>; + };
drivers/gpu/drm/i2c/Kconfig +1 -0
@@ -22,6 +22,7 @@ config DRM_I2C_SIL164 config DRM_I2C_NXP_TDA998X tristate "NXP Semiconductors TDA998X HDMI encoder" default m if DRM_TILCDC + select SND_SOC_HDMI_CODEC if SND_SOC help Support for NXP Semiconductors TDA998X HDMI encoders.
drivers/gpu/drm/i2c/tda998x_drv.c +196 -3
262 lines not on this page · raw message
include/drm/i2c/tda998x.h +2 -2
@@ -1,9 +1,9 @@ #ifndef __DRM_I2C_TDA998X_H__ #define __DRM_I2C_TDA998X_H__ +#include <dt-bindings/display/tda998x.h> + #define AFMT_UNUSED 0 -#define AFMT_SPDIF 1 -#define AFMT_I2S 2 struct tda998x_audio_params { u8 config;
include/dt-bindings/display/tda998x.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef _DT_BINDINGS_TDA998X_H +#define _DT_BINDINGS_TDA998X_H + +#define AFMT_SPDIF 1 +#define AFMT_I2S 2 + +#endif /*_DT_BINDINGS_TDA998X_H */
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): ce10548e1c28270d80ee99a525e117d0d25f5656.1470129989.git.jsarha-l0cyMroinI0@public.gmane.org
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1224
Quoted 2 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +2
-0+memcpy (audio.status, params->iec.status, +min (sizeof (audio.status),sizeof (params->iec.status)));
As mentioned in the other patch, the audio status does not directly correspond with the AES bytes, so this ends up causing the driver to write the wrong bytes to the wrong registers.
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1259
Quoted 3 lines
drivers/gpu/drm/i2c/tda998x_drv.c +3
-0+ ret =tda998x_configure_audio (priv, + &audio, + priv->encoder.crtc->hwmode.clock);
What happens if audio changes at the same time that the video mode changes? What protection is there against two threads concurrently executing tda998x_configure_audio() ?
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1333
Quoted 3 lines
drivers/gpu/drm/i2c/tda998x_drv.c +3
-0+ priv->audio_pdev =platform_device_register_data ( + dev,HDMI_CODEC_DRV_NAME ,PLATFORM_DEVID_AUTO , + &codec_data,sizeof (codec_data));
I'd much prefer that this was a child of the I2C device, which will show the relationship between this virtual platform device and the device which it's associated with. That can be done via platform_device_register_full().
Thanks.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 8 lines · Russell King - ARM Linux
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1224
Quoted 2 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +2
-0+memcpy (audio.status, params->iec.status, +min (sizeof (audio.status),sizeof (params->iec.status)));As mentioned in the other patch, the audio status does not directly correspond with the AES bytes, so this ends up causing the driver to write the wrong bytes to the wrong registers.
As I said earlier, I'd rather have it as plain AES/IEC958 channel status bits buffer.
Quoted 8 lines
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1259
Quoted 3 lines
drivers/gpu/drm/i2c/tda998x_drv.c +3
-0+ ret =tda998x_configure_audio (priv, + &audio, + priv->encoder.crtc->hwmode.clock);What happens if audio changes at the same time that the video mode changes? What protection is there against two threads concurrently executing
tda998x_configure_audio()?
Oh, yes. I definitely need some locking here. The same lock could protect the atomicity of tda998x_audio_params update and usage.
Quoted 9 lines
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1333
Quoted 3 lines
drivers/gpu/drm/i2c/tda998x_drv.c +3
-0+ priv->audio_pdev =platform_device_register_data ( + dev,HDMI_CODEC_DRV_NAME ,PLATFORM_DEVID_AUTO , + &codec_data,sizeof (codec_data));I'd much prefer that this was a child of the I2C device, which will show the relationship between this virtual platform device and the device which it's associated with. That can be done via
platform_device_register_full().
That may be a problem. The ASoC card device tree binding current looks for the ASoC DAI's parent's of-node if it can not find the node for the DAI-device itself. Indicating ASoC DAI-link by referencing the parent i2c device simply won't work, because there may be other ASoC codecs on the same i2c bus. Adding a separate DT-node for a virtual audio device should be possible, but it needs some thinking and may have its own problems. I can not follow the reasoning behind this, is this really necessary?
Best regards,
Jyri
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 3a3dcfa4-cec8-53f8-eddb-9a0e04c10ac9-l0cyMroinI0@public.gmane.org
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 12 lines · Jyri Sarha
Quoted 10 lines · Russell King - ARM Linux
drivers/gpu/drm/i2c/tda998x_drv.c static void tda998x_destroy(struct tda998x_priv *priv) · line 1333
Quoted 3 lines · Jyri Sarha
drivers/gpu/drm/i2c/tda998x_drv.c +3
-0+ priv->audio_pdev =platform_device_register_data ( + dev,HDMI_CODEC_DRV_NAME ,PLATFORM_DEVID_AUTO , + &codec_data,sizeof (codec_data));I'd much prefer that this was a child of the I2C device, which will show the relationship between this virtual platform device and the device which it's associated with. That can be done via
platform_device_register_full().
Quoted 3 lines
That may be a problem. The ASoC card device tree binding current looks for the ASoC DAI's parent's of-node if it can not find the node for the DAI-device itself.
I don't follow. The "parent" of this audio_pdev device above is the "platform" device - /sys/devices/platform. If ASoC is referencing the parent of the above platform device for some reason, it's probably not going to get anything useful from such an attempt.
Any other ASoC codec driver where the codec platform device was declared with a NULL parent pointer also ends up as a child of that same location.
I'd _really_ be surprised if ASoC is even doing what you describe, because such an action is totally illogical (as can be seen from my description above.)
Moving it under the I2C device means it stays as a platform device, but the relationship between the platform device and its I2C parent is properly represented in the tree of devices, and also ensures that, should PM hooks be added, that the platform device gets properly ordered wrt the I2C device.
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160805164845.GP5783-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 12 lines · Russell King - ARM Linux
Quoted 3 lines · Jyri Sarha
That may be a problem. The ASoC card device tree binding current looks for the ASoC DAI's parent's of-node if it can not find the node for the DAI-device itself.
I don't follow. The "parent" of this
audio_pdevdevice above is the "platform" device -/sys/devices/platform. If ASoC is referencing the parent of the above platform device for some reason, it's probably not going to get anything useful from such an attempt.
Quoted 7 lines
Any other ASoC codec driver where the codec platform device was declared with a NULL parent pointer also ends up as a child of that same location.
I'd _really_ be surprised if ASoC is even doing what you describe, because such an action is totally illogical (as can be seen from my description above.)
We do have some stuff in there in order to handle MFDs - they'll instantiate a Linux-internal virtual platform device as a child of the DT device that represents the device as a whole. We're definitely not expecting to find anything for parentless platform devices though, it's only done if the ASoC level device has no of_node and the parent does.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 21 lines · Mark Brown
Quoted 12 lines · Russell King - ARM Linux
Quoted 3 lines · Jyri Sarha
That may be a problem. The ASoC card device tree binding current looks for the ASoC DAI's parent's of-node if it can not find the node for the DAI-device itself.
I don't follow. The "parent" of this
audio_pdevdevice above is the "platform" device -/sys/devices/platform. If ASoC is referencing the parent of the above platform device for some reason, it's probably not going to get anything useful from such an attempt.Quoted 7 lines
Any other ASoC codec driver where the codec platform device was declared with a NULL parent pointer also ends up as a child of that same location.
I'd _really_ be surprised if ASoC is even doing what you describe, because such an action is totally illogical (as can be seen from my description above.)
Quoted 5 lines
We do have some stuff in there in order to handle MFDs - they'll instantiate a Linux-internal virtual platform device as a child of the DT device that represents the device as a whole. We're definitely not expecting to find anything for parentless platform devices though, it's only done if the ASoC level device has no
of_nodeand the parent does.
And if we make the hdmi-codec device a child of the I2C device which does have an of-node, what will happen?
Signature · 7 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 10 lines · Russell King - ARM Linux
Quoted 5 lines · Mark Brown
We do have some stuff in there in order to handle MFDs - they'll instantiate a Linux-internal virtual platform device as a child of the DT device that represents the device as a whole. We're definitely not expecting to find anything for parentless platform devices though, it's only done if the ASoC level device has no
of_nodeand the parent does.And if we make the hdmi-codec device a child of the I2C device which does have an of-node, what will happen?
It'll pick up that as the DT device to hang things off which I'd expect to be the desired outcome given that this is a very similar situation to the MFD situation. I've not been following the full thread so there is probably context I'm missing here...
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Russell King - ARM Linux
maintainerRe: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 9 lines · Mark Brown
Quoted 7 lines · Russell King - ARM Linux
Quoted 5 lines · Mark Brown
We do have some stuff in there in order to handle MFDs - they'll instantiate a Linux-internal virtual platform device as a child of the DT device that represents the device as a whole. We're definitely not expecting to find anything for parentless platform devices though, it's only done if the ASoC level device has no
of_nodeand the parent does.
Quoted 7 lines
Quoted 2 lines
And if we make the hdmi-codec device a child of the I2C device which does have an of-node, what will happen?
It'll pick up that as the DT device to hang things off which I'd expect to be the desired outcome given that this is a very similar situation to the MFD situation. I've not been following the full thread so there is probably context I'm missing here...
Okay, and that sounds to me like a very reasonable thing to want to happen - so that the audio side can be clearly identified as being coupled with the video side.
So, I'm not seeing a problem with my suggestion... I'm actually more reasons why it's a good thing to want.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
A message that is not in the archive (sent off-list or not yet received): 20160805221944.GR5783-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org
Re: [PATCH 2/3] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
Quoted 10 lines · Russell King - ARM Linux
Quoted 4 lines
Quoted 4 lines
It'll pick up that as the DT device to hang things off which I'd expect to be the desired outcome given that this is a very similar situation to the MFD situation. I've not been following the full thread so there is probably context I'm missing here...
Okay, and that sounds to me like a very reasonable thing to want to happen - so that the audio side can be clearly identified as being coupled with the video side.
So, I'm not seeing a problem with my suggestion... I'm actually more reasons why it's a good thing to want.
Ok, so getting back to this comment:
Quoted 7 lines
Quoted 3 lines
(quoted diff) +1
-0+ priv->audio_pdev = platform_device_register_data(Review
Quoted 2 lines
(quoted diff) +2
-0+ dev, HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_AUTO, + &codec_data, sizeof(codec_data));I'd much prefer that this was a child of the I2C device, which will show the relationship between this virtual platform device and the device which it's associated with. That can be done via
platform_device_register_full().
The platform_device_register_data() sets the parent of the registered platform device according to the first parameter, the tda998x i2c-client in this case. Is there some reason why I should use platform_device_register_full() and should I set parent to something else than the tda998x i2c device?
BR,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 ARM: dts: am335x-boneblack: Add HDMI audio support
In reply to Jyri SarhaAdd HDMI audio support. Adds mcasp0_pins, clk_mcasp0_fixed, clk_mcasp0, mcasp0, sound node, and updates the tda19988 node to follow the new binding.
--- arch/arm/boot/dts/am335x-boneblack.dts | 71 ++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 4 deletions(-)
arch/arm/boot/dts/am335x-boneblack.dts +67 -4
@@ -9,6 +9,7 @@ #include "am33xx.dtsi" #include "am335x-bone-common.dtsi" +#include <dt-bindings/display/tda998x.h> / { model = "TI AM335x BeagleBone Black";
@@ -64,6 +65,16 @@ AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr0 */ >; }; + + mcasp0_pins: mcasp0_pins { + pinctrl-single,pins = < + AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */ + AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/ + AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */ + AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */ + AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 */ + >; + }; }; &lcdc {
@@ -76,16 +87,22 @@ }; &i2c0 { - tda19988 { + tda19988: tda19988 { compatible = "nxp,tda998x"; reg = <0x70>; + pinctrl-names = "default", "off"; pinctrl-0 = <&nxp_hdmi_bonelt_pins>; pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>; - port { - hdmi_0: endpoint@0 { - remote-endpoint = <&lcdc_0>; + #sound-dai-cells = <0>; + audio-ports = < AFMT_I2S 0x03>; + + ports { + port@0 { + hdmi_0: endpoint@0 { + remote-endpoint = <&lcdc_0>; + }; }; }; };
@@ -94,3 +111,49 @@ &rtc { system-power-controller; }; + +&mcasp0 { + #sound-dai-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&mcasp0_pins>; + status = "okay"; + op-mode = <0>; /* MCASP_IIS_MODE */ + tdm-slots = <2>; + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ + 0 0 1 0 + >; + tx-num-evt = <32>; + rx-num-evt = <32>; +}; + +/ { + clk_mcasp0_fixed: clk_mcasp0_fixed { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <24576000>; + }; + + clk_mcasp0: clk_mcasp0 { + #clock-cells = <0>; + compatible = "gpio-gate-clock"; + clocks = <&clk_mcasp0_fixed>; + enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */ + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "TI BeagleBone Black"; + simple-audio-card,format = "i2s"; + simple-audio-card,bitclock-master = <&dailink0_master>; + simple-audio-card,frame-master = <&dailink0_master>; + + dailink0_master: simple-audio-card,cpu { + sound-dai = <&mcasp0>; + clocks = <&clk_mcasp0>; + }; + + simple-audio-card,codec { + sound-dai = <&tda19988>; + }; + }; +};
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel