Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm into drm-next

This adds the ASoC codec interfaces for TDA998x HDMI audio from
Jyri Sarha.

* 'drm-tda998x-devel' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: dts: am335x-boneblack: Add HDMI audio support
drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding
drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata

+368 -55
+18
Documentation/devicetree/bindings/display/bridge/tda998x.txt
··· 21 21 - video-ports: 24 bits value which defines how the video controller 22 22 output is wired to the TDA998x input - default: <0x230145> 23 23 24 + - audio-ports: array of 8-bit values, 2 values per one DAI[1]. 25 + The first value defines the DAI type: TDA998x_SPDIF or TDA998x_I2S[2]. 26 + The second value defines the tda998x AP_ENA reg content when the DAI 27 + in question is used. The implementation allows one or two DAIs. If two 28 + DAIs are defined, they must be of different type. 29 + 30 + [1] Documentation/sound/alsa/soc/DAI.txt 31 + [2] include/dt-bindings/display/tda998x.h 32 + 24 33 Example: 34 + 35 + #include <dt-bindings/display/tda998x.h> 25 36 26 37 tda998x: hdmi-encoder { 27 38 compatible = "nxp,tda998x"; ··· 41 30 interrupts = <27 2>; /* falling edge */ 42 31 pinctrl-0 = <&pmx_camera>; 43 32 pinctrl-names = "default"; 33 + video-ports = <0x230145>; 34 + 35 + #sound-dai-cells = <2>; 36 + /* DAI-format AP_ENA reg value */ 37 + audio-ports = < TDA998x_SPDIF 0x04 38 + TDA998x_I2S 0x03>; 39 + 44 40 };
+67 -4
arch/arm/boot/dts/am335x-boneblack.dts
··· 9 9 10 10 #include "am33xx.dtsi" 11 11 #include "am335x-bone-common.dtsi" 12 + #include <dt-bindings/display/tda998x.h> 12 13 13 14 / { 14 15 model = "TI AM335x BeagleBone Black"; ··· 76 75 AM33XX_IOPAD(0x9b0, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr0 */ 77 76 >; 78 77 }; 78 + 79 + mcasp0_pins: mcasp0_pins { 80 + pinctrl-single,pins = < 81 + AM33XX_IOPAD(0x9ac, PIN_INPUT_PULLUP | MUX_MODE0) /* mcasp0_ahcklx.mcasp0_ahclkx */ 82 + AM33XX_IOPAD(0x99c, PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mcasp0_ahclkr.mcasp0_axr2*/ 83 + AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0) /* mcasp0_fsx.mcasp0_fsx */ 84 + AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mcasp0_aclkx.mcasp0_aclkx */ 85 + AM33XX_IOPAD(0x86c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.GPIO1_27 */ 86 + >; 87 + }; 79 88 }; 80 89 81 90 &lcdc { ··· 98 87 }; 99 88 100 89 &i2c0 { 101 - tda19988 { 90 + tda19988: tda19988 { 102 91 compatible = "nxp,tda998x"; 103 92 reg = <0x70>; 93 + 104 94 pinctrl-names = "default", "off"; 105 95 pinctrl-0 = <&nxp_hdmi_bonelt_pins>; 106 96 pinctrl-1 = <&nxp_hdmi_bonelt_off_pins>; 107 97 108 - port { 109 - hdmi_0: endpoint@0 { 110 - remote-endpoint = <&lcdc_0>; 98 + #sound-dai-cells = <0>; 99 + audio-ports = < TDA998x_I2S 0x03>; 100 + 101 + ports { 102 + port@0 { 103 + hdmi_0: endpoint@0 { 104 + remote-endpoint = <&lcdc_0>; 105 + }; 111 106 }; 112 107 }; 113 108 }; ··· 121 104 122 105 &rtc { 123 106 system-power-controller; 107 + }; 108 + 109 + &mcasp0 { 110 + #sound-dai-cells = <0>; 111 + pinctrl-names = "default"; 112 + pinctrl-0 = <&mcasp0_pins>; 113 + status = "okay"; 114 + op-mode = <0>; /* MCASP_IIS_MODE */ 115 + tdm-slots = <2>; 116 + serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ 117 + 0 0 1 0 118 + >; 119 + tx-num-evt = <32>; 120 + rx-num-evt = <32>; 121 + }; 122 + 123 + / { 124 + clk_mcasp0_fixed: clk_mcasp0_fixed { 125 + #clock-cells = <0>; 126 + compatible = "fixed-clock"; 127 + clock-frequency = <24576000>; 128 + }; 129 + 130 + clk_mcasp0: clk_mcasp0 { 131 + #clock-cells = <0>; 132 + compatible = "gpio-gate-clock"; 133 + clocks = <&clk_mcasp0_fixed>; 134 + enable-gpios = <&gpio1 27 0>; /* BeagleBone Black Clk enable on GPIO1_27 */ 135 + }; 136 + 137 + sound { 138 + compatible = "simple-audio-card"; 139 + simple-audio-card,name = "TI BeagleBone Black"; 140 + simple-audio-card,format = "i2s"; 141 + simple-audio-card,bitclock-master = <&dailink0_master>; 142 + simple-audio-card,frame-master = <&dailink0_master>; 143 + 144 + dailink0_master: simple-audio-card,cpu { 145 + sound-dai = <&mcasp0>; 146 + clocks = <&clk_mcasp0>; 147 + }; 148 + 149 + simple-audio-card,codec { 150 + sound-dai = <&tda19988>; 151 + }; 152 + }; 124 153 };
+1
drivers/gpu/drm/i2c/Kconfig
··· 22 22 config DRM_I2C_NXP_TDA998X 23 23 tristate "NXP Semiconductors TDA998X HDMI encoder" 24 24 default m if DRM_TILCDC 25 + select SND_SOC_HDMI_CODEC if SND_SOC 25 26 help 26 27 Support for NXP Semiconductors TDA998X HDMI encoders. 27 28
+256 -41
drivers/gpu/drm/i2c/tda998x_drv.c
··· 20 20 #include <linux/module.h> 21 21 #include <linux/irq.h> 22 22 #include <sound/asoundef.h> 23 + #include <sound/hdmi-codec.h> 23 24 24 25 #include <drm/drmP.h> 25 26 #include <drm/drm_atomic_helper.h> ··· 30 29 #include <drm/i2c/tda998x.h> 31 30 32 31 #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) 32 + 33 + struct tda998x_audio_port { 34 + u8 format; /* AFMT_xxx */ 35 + u8 config; /* AP value */ 36 + }; 33 37 34 38 struct tda998x_priv { 35 39 struct i2c_client *cec; ··· 47 41 u8 vip_cntrl_0; 48 42 u8 vip_cntrl_1; 49 43 u8 vip_cntrl_2; 50 - struct tda998x_encoder_params params; 44 + struct tda998x_audio_params audio_params; 45 + 46 + struct platform_device *audio_pdev; 47 + struct mutex audio_mutex; 51 48 52 49 wait_queue_head_t wq_edid; 53 50 volatile int wq_edid_wait; ··· 62 53 63 54 struct drm_encoder encoder; 64 55 struct drm_connector connector; 56 + 57 + struct tda998x_audio_port audio_port[2]; 65 58 }; 66 59 67 60 #define conn_to_tda998x_priv(x) \ ··· 677 666 reg_set(priv, REG_DIP_IF_FLAGS, bit); 678 667 } 679 668 680 - static void 681 - tda998x_write_aif(struct tda998x_priv *priv, struct tda998x_encoder_params *p) 669 + static int tda998x_write_aif(struct tda998x_priv *priv, 670 + struct hdmi_audio_infoframe *cea) 682 671 { 683 672 union hdmi_infoframe frame; 684 673 685 - hdmi_audio_infoframe_init(&frame.audio); 686 - 687 - frame.audio.channels = p->audio_frame[1] & 0x07; 688 - frame.audio.channel_allocation = p->audio_frame[4]; 689 - frame.audio.level_shift_value = (p->audio_frame[5] & 0x78) >> 3; 690 - frame.audio.downmix_inhibit = (p->audio_frame[5] & 0x80) >> 7; 691 - 692 - /* 693 - * L-PCM and IEC61937 compressed audio shall always set sample 694 - * frequency to "refer to stream". For others, see the HDMI 695 - * specification. 696 - */ 697 - frame.audio.sample_frequency = (p->audio_frame[2] & 0x1c) >> 2; 674 + frame.audio = *cea; 698 675 699 676 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, &frame); 677 + 678 + return 0; 700 679 } 701 680 702 681 static void ··· 711 710 } 712 711 } 713 712 714 - static void 713 + static int 715 714 tda998x_configure_audio(struct tda998x_priv *priv, 716 - struct drm_display_mode *mode, struct tda998x_encoder_params *p) 715 + struct tda998x_audio_params *params, 716 + unsigned mode_clock) 717 717 { 718 718 u8 buf[6], clksel_aip, clksel_fs, cts_n, adiv; 719 719 u32 n; 720 720 721 721 /* Enable audio ports */ 722 - reg_write(priv, REG_ENA_AP, p->audio_cfg); 723 - reg_write(priv, REG_ENA_ACLK, p->audio_clk_cfg); 722 + reg_write(priv, REG_ENA_AP, params->config); 724 723 725 724 /* Set audio input source */ 726 - switch (p->audio_format) { 725 + switch (params->format) { 727 726 case AFMT_SPDIF: 727 + reg_write(priv, REG_ENA_ACLK, 0); 728 728 reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_SPDIF); 729 729 clksel_aip = AIP_CLKSEL_AIP_SPDIF; 730 730 clksel_fs = AIP_CLKSEL_FS_FS64SPDIF; ··· 733 731 break; 734 732 735 733 case AFMT_I2S: 734 + reg_write(priv, REG_ENA_ACLK, 1); 736 735 reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S); 737 736 clksel_aip = AIP_CLKSEL_AIP_I2S; 738 737 clksel_fs = AIP_CLKSEL_FS_ACLK; 739 - cts_n = CTS_N_M(3) | CTS_N_K(3); 738 + switch (params->sample_width) { 739 + case 16: 740 + cts_n = CTS_N_M(3) | CTS_N_K(1); 741 + break; 742 + case 18: 743 + case 20: 744 + case 24: 745 + cts_n = CTS_N_M(3) | CTS_N_K(2); 746 + break; 747 + default: 748 + case 32: 749 + cts_n = CTS_N_M(3) | CTS_N_K(3); 750 + break; 751 + } 740 752 break; 741 753 742 754 default: 743 - BUG(); 744 - return; 755 + dev_err(&priv->hdmi->dev, "Unsupported I2S format\n"); 756 + return -EINVAL; 745 757 } 746 758 747 759 reg_write(priv, REG_AIP_CLKSEL, clksel_aip); ··· 771 755 * assume 100MHz requires larger divider. 772 756 */ 773 757 adiv = AUDIO_DIV_SERCLK_8; 774 - if (mode->clock > 100000) 758 + if (mode_clock > 100000) 775 759 adiv++; /* AUDIO_DIV_SERCLK_16 */ 776 760 777 761 /* S/PDIF asks for a larger divider */ 778 - if (p->audio_format == AFMT_SPDIF) 762 + if (params->format == AFMT_SPDIF) 779 763 adiv++; /* AUDIO_DIV_SERCLK_16 or _32 */ 780 764 781 765 reg_write(priv, REG_AUDIO_DIV, adiv); ··· 784 768 * This is the approximate value of N, which happens to be 785 769 * the recommended values for non-coherent clocks. 786 770 */ 787 - n = 128 * p->audio_sample_rate / 1000; 771 + n = 128 * params->sample_rate / 1000; 788 772 789 773 /* Write the CTS and N values */ 790 774 buf[0] = 0x44; ··· 802 786 reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS); 803 787 reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS); 804 788 805 - /* Write the channel status */ 806 - buf[0] = IEC958_AES0_CON_NOT_COPYRIGHT; 807 - buf[1] = 0x00; 808 - buf[2] = IEC958_AES3_CON_FS_NOTID; 809 - buf[3] = IEC958_AES4_CON_ORIGFS_NOTID | 810 - IEC958_AES4_CON_MAX_WORDLEN_24; 789 + /* Write the channel status 790 + * The REG_CH_STAT_B-registers skip IEC958 AES2 byte, because 791 + * there is a separate register for each I2S wire. 792 + */ 793 + buf[0] = params->status[0]; 794 + buf[1] = params->status[1]; 795 + buf[2] = params->status[3]; 796 + buf[3] = params->status[4]; 811 797 reg_write_range(priv, REG_CH_STAT_B(0), buf, 4); 812 798 813 799 tda998x_audio_mute(priv, true); 814 800 msleep(20); 815 801 tda998x_audio_mute(priv, false); 816 802 817 - /* Write the audio information packet */ 818 - tda998x_write_aif(priv, p); 803 + return tda998x_write_aif(priv, &params->cea); 819 804 } 820 805 821 806 /* DRM encoder functions */ ··· 837 820 VIP_CNTRL_2_SWAP_F(p->swap_f) | 838 821 (p->mirr_f ? VIP_CNTRL_2_MIRR_F : 0); 839 822 840 - priv->params = *p; 823 + priv->audio_params = p->audio_params; 841 824 } 842 825 843 826 static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) ··· 1074 1057 1075 1058 tda998x_write_avi(priv, adjusted_mode); 1076 1059 1077 - if (priv->params.audio_cfg) 1078 - tda998x_configure_audio(priv, adjusted_mode, 1079 - &priv->params); 1060 + if (priv->audio_params.format != AFMT_UNUSED) { 1061 + mutex_lock(&priv->audio_mutex); 1062 + tda998x_configure_audio(priv, 1063 + &priv->audio_params, 1064 + adjusted_mode->clock); 1065 + mutex_unlock(&priv->audio_mutex); 1066 + } 1080 1067 } 1081 1068 } 1082 1069 ··· 1180 1159 drm_mode_connector_update_edid_property(connector, edid); 1181 1160 n = drm_add_edid_modes(connector, edid); 1182 1161 priv->is_hdmi_sink = drm_detect_hdmi_monitor(edid); 1162 + drm_edid_to_eld(connector, edid); 1163 + 1183 1164 kfree(edid); 1184 1165 1185 1166 return n; ··· 1203 1180 cec_write(priv, REG_CEC_RXSHPDINTENA, 0); 1204 1181 reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD); 1205 1182 1183 + if (priv->audio_pdev) 1184 + platform_device_unregister(priv->audio_pdev); 1185 + 1206 1186 if (priv->hdmi->irq) 1207 1187 free_irq(priv->hdmi->irq, priv); 1208 1188 ··· 1215 1189 i2c_unregister_device(priv->cec); 1216 1190 } 1217 1191 1192 + static int tda998x_audio_hw_params(struct device *dev, void *data, 1193 + struct hdmi_codec_daifmt *daifmt, 1194 + struct hdmi_codec_params *params) 1195 + { 1196 + struct tda998x_priv *priv = dev_get_drvdata(dev); 1197 + int i, ret; 1198 + struct tda998x_audio_params audio = { 1199 + .sample_width = params->sample_width, 1200 + .sample_rate = params->sample_rate, 1201 + .cea = params->cea, 1202 + }; 1203 + 1204 + if (!priv->encoder.crtc) 1205 + return -ENODEV; 1206 + 1207 + memcpy(audio.status, params->iec.status, 1208 + min(sizeof(audio.status), sizeof(params->iec.status))); 1209 + 1210 + switch (daifmt->fmt) { 1211 + case HDMI_I2S: 1212 + if (daifmt->bit_clk_inv || daifmt->frame_clk_inv || 1213 + daifmt->bit_clk_master || daifmt->frame_clk_master) { 1214 + dev_err(dev, "%s: Bad flags %d %d %d %d\n", __func__, 1215 + daifmt->bit_clk_inv, daifmt->frame_clk_inv, 1216 + daifmt->bit_clk_master, 1217 + daifmt->frame_clk_master); 1218 + return -EINVAL; 1219 + } 1220 + for (i = 0; i < ARRAY_SIZE(priv->audio_port); i++) 1221 + if (priv->audio_port[i].format == AFMT_I2S) 1222 + audio.config = priv->audio_port[i].config; 1223 + audio.format = AFMT_I2S; 1224 + break; 1225 + case HDMI_SPDIF: 1226 + for (i = 0; i < ARRAY_SIZE(priv->audio_port); i++) 1227 + if (priv->audio_port[i].format == AFMT_SPDIF) 1228 + audio.config = priv->audio_port[i].config; 1229 + audio.format = AFMT_SPDIF; 1230 + break; 1231 + default: 1232 + dev_err(dev, "%s: Invalid format %d\n", __func__, daifmt->fmt); 1233 + return -EINVAL; 1234 + } 1235 + 1236 + if (audio.config == 0) { 1237 + dev_err(dev, "%s: No audio configutation found\n", __func__); 1238 + return -EINVAL; 1239 + } 1240 + 1241 + mutex_lock(&priv->audio_mutex); 1242 + ret = tda998x_configure_audio(priv, 1243 + &audio, 1244 + priv->encoder.crtc->hwmode.clock); 1245 + 1246 + if (ret == 0) 1247 + priv->audio_params = audio; 1248 + mutex_unlock(&priv->audio_mutex); 1249 + 1250 + return ret; 1251 + } 1252 + 1253 + static void tda998x_audio_shutdown(struct device *dev, void *data) 1254 + { 1255 + struct tda998x_priv *priv = dev_get_drvdata(dev); 1256 + 1257 + mutex_lock(&priv->audio_mutex); 1258 + 1259 + reg_write(priv, REG_ENA_AP, 0); 1260 + 1261 + priv->audio_params.format = AFMT_UNUSED; 1262 + 1263 + mutex_unlock(&priv->audio_mutex); 1264 + } 1265 + 1266 + int tda998x_audio_digital_mute(struct device *dev, void *data, bool enable) 1267 + { 1268 + struct tda998x_priv *priv = dev_get_drvdata(dev); 1269 + 1270 + mutex_lock(&priv->audio_mutex); 1271 + 1272 + tda998x_audio_mute(priv, enable); 1273 + 1274 + mutex_unlock(&priv->audio_mutex); 1275 + return 0; 1276 + } 1277 + 1278 + static int tda998x_audio_get_eld(struct device *dev, void *data, 1279 + uint8_t *buf, size_t len) 1280 + { 1281 + struct tda998x_priv *priv = dev_get_drvdata(dev); 1282 + struct drm_mode_config *config = &priv->encoder.dev->mode_config; 1283 + struct drm_connector *connector; 1284 + int ret = -ENODEV; 1285 + 1286 + mutex_lock(&config->mutex); 1287 + list_for_each_entry(connector, &config->connector_list, head) { 1288 + if (&priv->encoder == connector->encoder) { 1289 + memcpy(buf, connector->eld, 1290 + min(sizeof(connector->eld), len)); 1291 + ret = 0; 1292 + } 1293 + } 1294 + mutex_unlock(&config->mutex); 1295 + 1296 + return ret; 1297 + } 1298 + 1299 + static const struct hdmi_codec_ops audio_codec_ops = { 1300 + .hw_params = tda998x_audio_hw_params, 1301 + .audio_shutdown = tda998x_audio_shutdown, 1302 + .digital_mute = tda998x_audio_digital_mute, 1303 + .get_eld = tda998x_audio_get_eld, 1304 + }; 1305 + 1306 + static int tda998x_audio_codec_init(struct tda998x_priv *priv, 1307 + struct device *dev) 1308 + { 1309 + struct hdmi_codec_pdata codec_data = { 1310 + .ops = &audio_codec_ops, 1311 + .max_i2s_channels = 2, 1312 + }; 1313 + int i; 1314 + 1315 + for (i = 0; i < ARRAY_SIZE(priv->audio_port); i++) { 1316 + if (priv->audio_port[i].format == AFMT_I2S && 1317 + priv->audio_port[i].config != 0) 1318 + codec_data.i2s = 1; 1319 + if (priv->audio_port[i].format == AFMT_SPDIF && 1320 + priv->audio_port[i].config != 0) 1321 + codec_data.spdif = 1; 1322 + } 1323 + 1324 + priv->audio_pdev = platform_device_register_data( 1325 + dev, HDMI_CODEC_DRV_NAME, PLATFORM_DEVID_AUTO, 1326 + &codec_data, sizeof(codec_data)); 1327 + 1328 + return PTR_ERR_OR_ZERO(priv->audio_pdev); 1329 + } 1330 + 1218 1331 /* I2C driver functions */ 1332 + 1333 + static int tda998x_get_audio_ports(struct tda998x_priv *priv, 1334 + struct device_node *np) 1335 + { 1336 + const u32 *port_data; 1337 + u32 size; 1338 + int i; 1339 + 1340 + port_data = of_get_property(np, "audio-ports", &size); 1341 + if (!port_data) 1342 + return 0; 1343 + 1344 + size /= sizeof(u32); 1345 + if (size > 2 * ARRAY_SIZE(priv->audio_port) || size % 2 != 0) { 1346 + dev_err(&priv->hdmi->dev, 1347 + "Bad number of elements in audio-ports dt-property\n"); 1348 + return -EINVAL; 1349 + } 1350 + 1351 + size /= 2; 1352 + 1353 + for (i = 0; i < size; i++) { 1354 + u8 afmt = be32_to_cpup(&port_data[2*i]); 1355 + u8 ena_ap = be32_to_cpup(&port_data[2*i+1]); 1356 + 1357 + if (afmt != AFMT_SPDIF && afmt != AFMT_I2S) { 1358 + dev_err(&priv->hdmi->dev, 1359 + "Bad audio format %u\n", afmt); 1360 + return -EINVAL; 1361 + } 1362 + 1363 + priv->audio_port[i].format = afmt; 1364 + priv->audio_port[i].config = ena_ap; 1365 + } 1366 + 1367 + if (priv->audio_port[0].format == priv->audio_port[1].format) { 1368 + dev_err(&priv->hdmi->dev, 1369 + "There can only be on I2S port and one SPDIF port\n"); 1370 + return -EINVAL; 1371 + } 1372 + return 0; 1373 + } 1219 1374 1220 1375 static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) 1221 1376 { ··· 1511 1304 if (!np) 1512 1305 return 0; /* non-DT */ 1513 1306 1514 - /* get the optional video properties */ 1307 + /* get the device tree parameters */ 1515 1308 ret = of_property_read_u32(np, "video-ports", &video); 1516 1309 if (ret == 0) { 1517 1310 priv->vip_cntrl_0 = video >> 16; ··· 1519 1312 priv->vip_cntrl_2 = video; 1520 1313 } 1521 1314 1522 - return 0; 1315 + mutex_init(&priv->audio_mutex); /* Protect access from audio thread */ 1523 1316 1317 + ret = tda998x_get_audio_ports(priv, np); 1318 + if (ret) 1319 + goto fail; 1320 + 1321 + if (priv->audio_port[0].format != AFMT_UNUSED) 1322 + tda998x_audio_codec_init(priv, &client->dev); 1323 + 1324 + return 0; 1524 1325 fail: 1525 1326 /* if encoder_init fails, the encoder slave is never registered, 1526 1327 * so cleanup here:
+19 -10
include/drm/i2c/tda998x.h
··· 1 1 #ifndef __DRM_I2C_TDA998X_H__ 2 2 #define __DRM_I2C_TDA998X_H__ 3 3 4 + #include <linux/hdmi.h> 5 + #include <dt-bindings/display/tda998x.h> 6 + 7 + enum { 8 + AFMT_UNUSED = 0, 9 + AFMT_SPDIF = TDA998x_SPDIF, 10 + AFMT_I2S = TDA998x_I2S, 11 + }; 12 + 13 + struct tda998x_audio_params { 14 + u8 config; 15 + u8 format; 16 + unsigned sample_width; 17 + unsigned sample_rate; 18 + struct hdmi_audio_infoframe cea; 19 + u8 status[5]; 20 + }; 21 + 4 22 struct tda998x_encoder_params { 5 23 u8 swap_b:3; 6 24 u8 mirr_b:1; ··· 33 15 u8 swap_e:3; 34 16 u8 mirr_e:1; 35 17 36 - u8 audio_cfg; 37 - u8 audio_clk_cfg; 38 - u8 audio_frame[6]; 39 - 40 - enum { 41 - AFMT_SPDIF, 42 - AFMT_I2S 43 - } audio_format; 44 - 45 - unsigned audio_sample_rate; 18 + struct tda998x_audio_params audio_params; 46 19 }; 47 20 48 21 #endif
+7
include/dt-bindings/display/tda998x.h
··· 1 + #ifndef _DT_BINDINGS_TDA998X_H 2 + #define _DT_BINDINGS_TDA998X_H 3 + 4 + #define TDA998x_SPDIF 1 5 + #define TDA998x_I2S 2 6 + 7 + #endif /*_DT_BINDINGS_TDA998X_H */