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

omapdss: HDMI: Use OMAP4 HDMI core functions directly and remove hdmi_ip_ops

After removing wrapper, pll and phy funcs from ti_hdmi_4xxx_ip.c, we are left
with OMAP4 HDMI core functions. Use these directly in hdmi.c rather than using
hdmi_ip_ops. Rename the core functions with a 'hdmi4' suffix.

We used to have hdmi_ip_ops so that one could support HDMI within a TI SoC which
had a non-DSS display subsytem. This however never got put into use, and hence
these ops aren't useful any more.

The DT/hwmod information for hdmi doesn't split the address space according to
the required sub blocks. Keep the address offset and size information in the
driver for now. This will be removed when the driver gets the information
correctly from DT/hwmod.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Archit Taneja and committed by
Tomi Valkeinen
425f02fd 5cac5aee

+162 -184
-33
drivers/video/omap2/dss/dss_features.c
··· 789 789 .burst_size_unit = 16, 790 790 }; 791 791 792 - #if defined(CONFIG_OMAP4_DSS_HDMI) 793 - /* HDMI OMAP4 Functions*/ 794 - static const struct ti_hdmi_ip_ops omap4_hdmi_functions = { 795 - 796 - .video_configure = ti_hdmi_4xxx_basic_configure, 797 - .read_edid = ti_hdmi_4xxx_read_edid, 798 - .dump_core = ti_hdmi_4xxx_core_dump, 799 - #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 800 - .audio_start = ti_hdmi_4xxx_audio_start, 801 - .audio_stop = ti_hdmi_4xxx_audio_stop, 802 - .audio_config = ti_hdmi_4xxx_audio_config, 803 - .audio_get_dma_port = ti_hdmi_4xxx_audio_get_dma_port, 804 - #endif 805 - 806 - }; 807 - 808 - void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, 809 - enum omapdss_version version) 810 - { 811 - switch (version) { 812 - case OMAPDSS_VER_OMAP4430_ES1: 813 - case OMAPDSS_VER_OMAP4430_ES2: 814 - case OMAPDSS_VER_OMAP4: 815 - ip_data->ops = &omap4_hdmi_functions; 816 - break; 817 - default: 818 - ip_data->ops = NULL; 819 - } 820 - 821 - WARN_ON(ip_data->ops == NULL); 822 - } 823 - #endif 824 - 825 792 /* Functions returning values related to a DSS feature */ 826 793 int dss_feat_get_num_mgrs(void) 827 794 {
-8
drivers/video/omap2/dss/dss_features.h
··· 20 20 #ifndef __OMAP2_DSS_FEATURES_H 21 21 #define __OMAP2_DSS_FEATURES_H 22 22 23 - #if defined(CONFIG_OMAP4_DSS_HDMI) 24 - #include "ti_hdmi.h" 25 - #endif 26 - 27 23 #define MAX_DSS_MANAGERS 4 28 24 #define MAX_DSS_OVERLAYS 4 29 25 #define MAX_DSS_LCD_MANAGERS 3 ··· 113 117 bool dss_has_feature(enum dss_feat_id id); 114 118 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); 115 119 void dss_features_init(enum omapdss_version version); 116 - #if defined(CONFIG_OMAP4_DSS_HDMI) 117 - void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data, 118 - enum omapdss_version version); 119 - #endif 120 120 #endif
+12 -15
drivers/video/omap2/dss/hdmi.c
··· 37 37 #include <video/omapdss.h> 38 38 39 39 #include "ti_hdmi.h" 40 + #include "ti_hdmi_4xxx_ip.h" 40 41 #include "dss.h" 41 42 #include "dss_features.h" 42 - 43 - #define HDMI_CORE_SYS 0x400 44 - #define HDMI_CORE_AV 0x900 45 43 46 44 /* HDMI EDID Length move this */ 47 45 #define HDMI_EDID_MAX_LENGTH 256 ··· 491 493 goto err_phy_enable; 492 494 } 493 495 494 - hdmi.ip_data.ops->video_configure(&hdmi.ip_data); 496 + hdmi4_configure(&hdmi.ip_data.core, &hdmi.ip_data.wp, 497 + &hdmi.ip_data.cfg); 495 498 496 499 /* bypass TV gamma table */ 497 500 dispc_enable_gamma_table(0); ··· 593 594 hdmi_wp_dump(&hdmi.ip_data.wp, s); 594 595 hdmi_pll_dump(&hdmi.ip_data.pll, s); 595 596 hdmi_phy_dump(&hdmi.ip_data.phy, s); 596 - hdmi.ip_data.ops->dump_core(&hdmi.ip_data, s); 597 + hdmi4_core_dump(&hdmi.ip_data.core, s); 597 598 598 599 hdmi_runtime_put(); 599 600 mutex_unlock(&hdmi.lock); ··· 608 609 r = hdmi_runtime_get(); 609 610 BUG_ON(r); 610 611 611 - r = hdmi.ip_data.ops->read_edid(&hdmi.ip_data, buf, len); 612 + r = hdmi4_read_edid(&hdmi.ip_data.core, buf, len); 612 613 613 614 hdmi_runtime_put(); 614 615 mutex_unlock(&hdmi.lock); ··· 812 813 else 813 814 return false; 814 815 } 815 - 816 816 #endif 817 817 818 818 static int hdmi_connect(struct omap_dss_device *dssdev, ··· 819 821 { 820 822 struct omap_overlay_manager *mgr; 821 823 int r; 822 - 823 - dss_init_hdmi_ip_ops(&hdmi.ip_data, omapdss_get_version()); 824 824 825 825 r = hdmi_init_regulator(); 826 826 if (r) ··· 910 914 911 915 static int hdmi_audio_start(struct omap_dss_device *dssdev) 912 916 { 913 - return hdmi.ip_data.ops->audio_start(&hdmi.ip_data); 917 + return hdmi4_audio_start(&hdmi.ip_data.core, &hdmi.ip_data.wp); 914 918 } 915 919 916 920 static void hdmi_audio_stop(struct omap_dss_device *dssdev) 917 921 { 918 - hdmi.ip_data.ops->audio_stop(&hdmi.ip_data); 922 + hdmi4_audio_stop(&hdmi.ip_data.core, &hdmi.ip_data.wp); 919 923 } 920 924 921 925 static bool hdmi_audio_supported(struct omap_dss_device *dssdev) ··· 942 946 goto err; 943 947 } 944 948 945 - r = hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio); 949 + r = hdmi4_audio_config(&hdmi.ip_data.core, &hdmi.ip_data.wp, audio); 946 950 if (r) 947 951 goto err; 948 952 ··· 1049 1053 if (r) 1050 1054 return r; 1051 1055 1056 + r = hdmi4_core_init(pdev, &hdmi.ip_data.core); 1057 + if (r) 1058 + return r; 1059 + 1052 1060 r = hdmi_get_clocks(pdev); 1053 1061 if (r) { 1054 1062 DSSERR("can't get clocks\n"); ··· 1060 1060 } 1061 1061 1062 1062 pm_runtime_enable(&pdev->dev); 1063 - 1064 - hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS; 1065 - hdmi.ip_data.core_av_offset = HDMI_CORE_AV; 1066 1063 1067 1064 hdmi_init_output(pdev); 1068 1065
+7 -34
drivers/video/omap2/dss/ti_hdmi.h
··· 145 145 u16 fifo_threshold; 146 146 }; 147 147 148 - struct ti_hdmi_ip_ops { 149 - 150 - void (*video_configure)(struct hdmi_ip_data *ip_data); 151 - 152 - int (*read_edid)(struct hdmi_ip_data *ip_data, u8 *edid, int len); 153 - 154 - void (*dump_core)(struct hdmi_ip_data *ip_data, struct seq_file *s); 155 - 156 - #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 157 - int (*audio_start)(struct hdmi_ip_data *ip_data); 158 - 159 - void (*audio_stop)(struct hdmi_ip_data *ip_data); 160 - 161 - int (*audio_config)(struct hdmi_ip_data *ip_data, 162 - struct omap_dss_audio *audio); 163 - 164 - int (*audio_get_dma_port)(u32 *offset, u32 *size); 165 - #endif 166 - 167 - }; 168 - 169 148 /* 170 149 * Refer to section 8.2 in HDMI 1.3 specification for 171 150 * details about infoframe databytes ··· 202 223 int irq; 203 224 }; 204 225 226 + struct hdmi_core_data { 227 + void __iomem *base; 228 + 229 + struct hdmi_core_infoframe_avi avi_cfg; 230 + }; 231 + 205 232 struct hdmi_ip_data { 206 233 struct hdmi_wp_data wp; 207 234 struct hdmi_pll_data pll; 208 235 struct hdmi_phy_data phy; 236 + struct hdmi_core_data core; 209 237 210 - unsigned long core_sys_offset; 211 - unsigned long core_av_offset; 212 - 213 - const struct ti_hdmi_ip_ops *ops; 214 238 struct hdmi_config cfg; 215 - struct hdmi_core_infoframe_avi avi_cfg; 216 239 217 240 /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */ 218 241 struct mutex lock; ··· 254 273 void hdmi_phy_dump(struct hdmi_phy_data *phy, struct seq_file *s); 255 274 int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy); 256 275 257 - int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, u8 *edid, int len); 258 - void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data); 259 - void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s); 260 276 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 261 277 int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts); 262 278 int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable); ··· 262 284 struct hdmi_audio_format *aud_fmt); 263 285 void hdmi_wp_audio_config_dma(struct hdmi_wp_data *wp, 264 286 struct hdmi_audio_dma *aud_dma); 265 - int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data); 266 - void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data); 267 - int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data, 268 - struct omap_dss_audio *audio); 269 - int ti_hdmi_4xxx_audio_get_dma_port(u32 *offset, u32 *size); 270 287 #endif 271 288 #endif
+129 -94
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
··· 26 26 #include <linux/interrupt.h> 27 27 #include <linux/mutex.h> 28 28 #include <linux/delay.h> 29 + #include <linux/platform_device.h> 29 30 #include <linux/string.h> 30 31 #include <linux/seq_file.h> 31 32 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) ··· 37 36 #include "ti_hdmi_4xxx_ip.h" 38 37 #include "dss.h" 39 38 #include "dss_features.h" 39 + 40 + #define HDMI_CORE_AV 0x500 40 41 41 42 static inline void hdmi_write_reg(void __iomem *base_addr, 42 43 const u16 idx, u32 val) ··· 70 67 return val; 71 68 } 72 69 73 - static inline void __iomem *hdmi_av_base(struct hdmi_ip_data *ip_data) 70 + static inline void __iomem *hdmi_av_base(struct hdmi_core_data *core) 74 71 { 75 - return ip_data->wp.base + ip_data->core_av_offset; 72 + return core->base + HDMI_CORE_AV; 76 73 } 77 74 78 - static inline void __iomem *hdmi_core_sys_base(struct hdmi_ip_data *ip_data) 75 + static int hdmi_core_ddc_init(struct hdmi_core_data *core) 79 76 { 80 - return ip_data->wp.base + ip_data->core_sys_offset; 81 - } 82 - 83 - static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data) 84 - { 85 - void __iomem *base = hdmi_core_sys_base(ip_data); 77 + void __iomem *base = core->base; 86 78 87 79 /* Turn on CLK for DDC */ 88 80 REG_FLD_MOD(base, HDMI_CORE_AV_DPD, 0x7, 2, 0); ··· 117 119 return 0; 118 120 } 119 121 120 - static int hdmi_core_ddc_edid(struct hdmi_ip_data *ip_data, 122 + static int hdmi_core_ddc_edid(struct hdmi_core_data *core, 121 123 u8 *pedid, int ext) 122 124 { 123 - void __iomem *base = hdmi_core_sys_base(ip_data); 125 + void __iomem *base = core->base; 124 126 u32 i; 125 127 char checksum; 126 128 u32 offset = 0; ··· 199 201 return 0; 200 202 } 201 203 202 - int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, 203 - u8 *edid, int len) 204 + int hdmi4_read_edid(struct hdmi_core_data *core, u8 *edid, int len) 204 205 { 205 206 int r, l; 206 207 207 208 if (len < 128) 208 209 return -EINVAL; 209 210 210 - r = hdmi_core_ddc_init(ip_data); 211 + r = hdmi_core_ddc_init(core); 211 212 if (r) 212 213 return r; 213 214 214 - r = hdmi_core_ddc_edid(ip_data, edid, 0); 215 + r = hdmi_core_ddc_edid(core, edid, 0); 215 216 if (r) 216 217 return r; 217 218 218 219 l = 128; 219 220 220 221 if (len >= 128 * 2 && edid[0x7e] > 0) { 221 - r = hdmi_core_ddc_edid(ip_data, edid + 0x80, 1); 222 + r = hdmi_core_ddc_edid(core, edid + 0x80, 1); 222 223 if (r) 223 224 return r; 224 225 l += 128; ··· 270 273 repeat_cfg->generic_pkt_repeat = 0; 271 274 } 272 275 273 - static void hdmi_core_powerdown_disable(struct hdmi_ip_data *ip_data) 276 + static void hdmi_core_powerdown_disable(struct hdmi_core_data *core) 274 277 { 275 278 pr_debug("Enter hdmi_core_powerdown_disable\n"); 276 - REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SYS_CTRL1, 0x0, 0, 0); 279 + REG_FLD_MOD(core->base, HDMI_CORE_SYS_SYS_CTRL1, 0x0, 0, 0); 277 280 } 278 281 279 - static void hdmi_core_swreset_release(struct hdmi_ip_data *ip_data) 282 + static void hdmi_core_swreset_release(struct hdmi_core_data *core) 280 283 { 281 284 pr_debug("Enter hdmi_core_swreset_release\n"); 282 - REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x0, 0, 0); 285 + REG_FLD_MOD(core->base, HDMI_CORE_SYS_SRST, 0x0, 0, 0); 283 286 } 284 287 285 - static void hdmi_core_swreset_assert(struct hdmi_ip_data *ip_data) 288 + static void hdmi_core_swreset_assert(struct hdmi_core_data *core) 286 289 { 287 290 pr_debug("Enter hdmi_core_swreset_assert\n"); 288 - REG_FLD_MOD(hdmi_core_sys_base(ip_data), HDMI_CORE_SYS_SRST, 0x1, 0, 0); 291 + REG_FLD_MOD(core->base, HDMI_CORE_SYS_SRST, 0x1, 0, 0); 289 292 } 290 293 291 294 /* HDMI_CORE_VIDEO_CONFIG */ 292 - static void hdmi_core_video_config(struct hdmi_ip_data *ip_data, 295 + static void hdmi_core_video_config(struct hdmi_core_data *core, 293 296 struct hdmi_core_video_config *cfg) 294 297 { 295 298 u32 r = 0; 296 - void __iomem *core_sys_base = hdmi_core_sys_base(ip_data); 299 + void __iomem *core_sys_base = core->base; 300 + void __iomem *core_av_base = hdmi_av_base(core); 297 301 298 302 /* sys_ctrl1 default configuration not tunable */ 299 303 r = hdmi_read_reg(core_sys_base, HDMI_CORE_SYS_SYS_CTRL1); ··· 321 323 hdmi_write_reg(core_sys_base, HDMI_CORE_SYS_VID_MODE, r); 322 324 323 325 /* HDMI_Ctrl */ 324 - r = hdmi_read_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL); 326 + r = hdmi_read_reg(core_av_base, HDMI_CORE_AV_HDMI_CTRL); 325 327 r = FLD_MOD(r, cfg->deep_color_pkt, 6, 6); 326 328 r = FLD_MOD(r, cfg->pkt_mode, 5, 3); 327 329 r = FLD_MOD(r, cfg->hdmi_dvi, 0, 0); 328 - hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_HDMI_CTRL, r); 330 + hdmi_write_reg(core_av_base, HDMI_CORE_AV_HDMI_CTRL, r); 329 331 330 332 /* TMDS_CTRL */ 331 333 REG_FLD_MOD(core_sys_base, 332 334 HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5); 333 335 } 334 336 335 - static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data) 337 + static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 336 338 { 337 339 u32 val; 338 340 char sum = 0, checksum = 0; 339 - void __iomem *av_base = hdmi_av_base(ip_data); 340 - struct hdmi_core_infoframe_avi info_avi = ip_data->avi_cfg; 341 + void __iomem *av_base = hdmi_av_base(core); 342 + struct hdmi_core_infoframe_avi info_avi = core->avi_cfg; 341 343 342 344 sum += 0x82 + 0x002 + 0x00D; 343 345 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082); ··· 408 410 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum); 409 411 } 410 412 411 - static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data, 413 + static void hdmi_core_av_packet_config(struct hdmi_core_data *core, 412 414 struct hdmi_core_packet_enable_repeat repeat_cfg) 413 415 { 414 416 /* enable/repeat the infoframe */ 415 - hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL1, 417 + hdmi_write_reg(hdmi_av_base(core), HDMI_CORE_AV_PB_CTRL1, 416 418 (repeat_cfg.audio_pkt << 5) | 417 419 (repeat_cfg.audio_pkt_repeat << 4) | 418 420 (repeat_cfg.avi_infoframe << 1) | 419 421 (repeat_cfg.avi_infoframe_repeat)); 420 422 421 423 /* enable/repeat the packet */ 422 - hdmi_write_reg(hdmi_av_base(ip_data), HDMI_CORE_AV_PB_CTRL2, 424 + hdmi_write_reg(hdmi_av_base(core), HDMI_CORE_AV_PB_CTRL2, 423 425 (repeat_cfg.gen_cntrl_pkt << 3) | 424 426 (repeat_cfg.gen_cntrl_pkt_repeat << 2) | 425 427 (repeat_cfg.generic_pkt << 1) | 426 428 (repeat_cfg.generic_pkt_repeat)); 427 429 } 428 430 429 - void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data *ip_data) 431 + void hdmi4_configure(struct hdmi_core_data *core, 432 + struct hdmi_wp_data *wp, struct hdmi_config *cfg) 430 433 { 431 434 /* HDMI */ 432 435 struct omap_video_timings video_timing; 433 436 struct hdmi_video_format video_format; 434 437 /* HDMI core */ 435 - struct hdmi_core_infoframe_avi *avi_cfg = &ip_data->avi_cfg; 438 + struct hdmi_core_infoframe_avi *avi_cfg = &core->avi_cfg; 436 439 struct hdmi_core_video_config v_core_cfg; 437 440 struct hdmi_core_packet_enable_repeat repeat_cfg; 438 - struct hdmi_config *cfg = &ip_data->cfg; 439 441 440 442 hdmi_core_init(&v_core_cfg, avi_cfg, &repeat_cfg); 441 443 442 444 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg); 443 445 444 - hdmi_wp_video_config_timing(&ip_data->wp, &video_timing); 446 + hdmi_wp_video_config_timing(wp, &video_timing); 445 447 446 448 /* video config */ 447 449 video_format.packing_mode = HDMI_PACK_24b_RGB_YUV444_YUV422; 448 450 449 - hdmi_wp_video_config_format(&ip_data->wp, &video_format); 451 + hdmi_wp_video_config_format(wp, &video_format); 450 452 451 - hdmi_wp_video_config_interface(&ip_data->wp, &video_timing); 453 + hdmi_wp_video_config_interface(wp, &video_timing); 452 454 453 455 /* 454 456 * configure core video part 455 457 * set software reset in the core 456 458 */ 457 - hdmi_core_swreset_assert(ip_data); 459 + hdmi_core_swreset_assert(core); 458 460 459 461 /* power down off */ 460 - hdmi_core_powerdown_disable(ip_data); 462 + hdmi_core_powerdown_disable(core); 461 463 462 464 v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL; 463 465 v_core_cfg.hdmi_dvi = cfg->cm.mode; 464 466 465 - hdmi_core_video_config(ip_data, &v_core_cfg); 467 + hdmi_core_video_config(core, &v_core_cfg); 466 468 467 469 /* release software reset in the core */ 468 - hdmi_core_swreset_release(ip_data); 470 + hdmi_core_swreset_release(core); 469 471 470 472 /* 471 473 * configure packet ··· 490 492 avi_cfg->db10_11_pixel_eofleft = 0; 491 493 avi_cfg->db12_13_pixel_sofright = 0; 492 494 493 - hdmi_core_aux_infoframe_avi_config(ip_data); 495 + hdmi_core_aux_infoframe_avi_config(core); 494 496 495 497 /* enable/repeat the infoframe */ 496 498 repeat_cfg.avi_infoframe = HDMI_PACKETENABLE; ··· 498 500 /* wakeup */ 499 501 repeat_cfg.audio_pkt = HDMI_PACKETENABLE; 500 502 repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON; 501 - hdmi_core_av_packet_config(ip_data, repeat_cfg); 503 + hdmi_core_av_packet_config(core, repeat_cfg); 502 504 } 503 505 504 - void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s) 506 + void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s) 505 507 { 506 508 int i; 507 509 508 510 #define CORE_REG(i, name) name(i) 509 511 #define DUMPCORE(r) seq_printf(s, "%-35s %08x\n", #r,\ 510 - hdmi_read_reg(hdmi_core_sys_base(ip_data), r)) 512 + hdmi_read_reg(core->base, r)) 511 513 #define DUMPCOREAV(r) seq_printf(s, "%-35s %08x\n", #r,\ 512 - hdmi_read_reg(hdmi_av_base(ip_data), r)) 514 + hdmi_read_reg(hdmi_av_base(core), r)) 513 515 #define DUMPCOREAV2(i, r) seq_printf(s, "%s[%d]%*s %08x\n", #r, i, \ 514 516 (i < 10) ? 32 - (int)strlen(#r) : 31 - (int)strlen(#r), " ", \ 515 - hdmi_read_reg(hdmi_av_base(ip_data), CORE_REG(i, r))) 517 + hdmi_read_reg(hdmi_av_base(core), CORE_REG(i, r))) 516 518 517 519 DUMPCORE(HDMI_CORE_SYS_VND_IDL); 518 520 DUMPCORE(HDMI_CORE_SYS_DEV_IDL); ··· 670 672 } 671 673 672 674 #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 673 - static void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data, 675 + static void hdmi_core_audio_config(struct hdmi_core_data *core, 674 676 struct hdmi_core_audio_config *cfg) 675 677 { 676 678 u32 r; 677 - void __iomem *av_base = hdmi_av_base(ip_data); 679 + void __iomem *av_base = hdmi_av_base(core); 678 680 679 681 /* 680 682 * Parameters for generation of Audio Clock Recovery packets ··· 769 771 REG_FLD_MOD(av_base, HDMI_CORE_AV_SWAP_I2S, 1, 5, 5); 770 772 } 771 773 772 - static void ti_hdmi_4xxx_core_audio_infoframe_cfg(struct hdmi_ip_data *ip_data, 774 + static void hdmi_core_audio_infoframe_cfg(struct hdmi_core_data *core, 773 775 struct snd_cea_861_aud_if *info_aud) 774 776 { 775 777 u8 sum = 0, checksum = 0; 776 - void __iomem *av_base = hdmi_av_base(ip_data); 778 + void __iomem *av_base = hdmi_av_base(core); 777 779 778 780 /* 779 781 * Set audio info frame type, version and length as ··· 819 821 */ 820 822 } 821 823 822 - int ti_hdmi_4xxx_audio_config(struct hdmi_ip_data *ip_data, 824 + int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, 823 825 struct omap_dss_audio *audio) 824 826 { 825 827 struct hdmi_audio_format audio_format; 826 828 struct hdmi_audio_dma audio_dma; 827 - struct hdmi_core_audio_config core; 829 + struct hdmi_core_audio_config acore; 828 830 int err, n, cts, channel_count; 829 831 unsigned int fs_nr; 830 832 bool word_length_16b = false; 831 833 832 - if (!audio || !audio->iec || !audio->cea || !ip_data) 834 + if (!audio || !audio->iec || !audio->cea || !core) 833 835 return -EINVAL; 834 836 835 - core.iec60958_cfg = audio->iec; 837 + acore.iec60958_cfg = audio->iec; 836 838 /* 837 839 * In the IEC-60958 status word, check if the audio sample word length 838 840 * is 16-bit as several optimizations can be performed in such case. ··· 843 845 844 846 /* I2S configuration. See Phillips' specification */ 845 847 if (word_length_16b) 846 - core.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_LEFT; 848 + acore.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_LEFT; 847 849 else 848 - core.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; 850 + acore.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; 849 851 /* 850 852 * The I2S input word length is twice the lenght given in the IEC-60958 851 853 * status word. If the word size is greater than 852 854 * 20 bits, increment by one. 853 855 */ 854 - core.i2s_cfg.in_length_bits = audio->iec->status[4] 856 + acore.i2s_cfg.in_length_bits = audio->iec->status[4] 855 857 & IEC958_AES4_CON_WORDLEN; 856 858 if (audio->iec->status[4] & IEC958_AES4_CON_MAX_WORDLEN_24) 857 - core.i2s_cfg.in_length_bits++; 858 - core.i2s_cfg.sck_edge_mode = HDMI_AUDIO_I2S_SCK_EDGE_RISING; 859 - core.i2s_cfg.vbit = HDMI_AUDIO_I2S_VBIT_FOR_PCM; 860 - core.i2s_cfg.direction = HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST; 861 - core.i2s_cfg.shift = HDMI_AUDIO_I2S_FIRST_BIT_SHIFT; 859 + acore.i2s_cfg.in_length_bits++; 860 + acore.i2s_cfg.sck_edge_mode = HDMI_AUDIO_I2S_SCK_EDGE_RISING; 861 + acore.i2s_cfg.vbit = HDMI_AUDIO_I2S_VBIT_FOR_PCM; 862 + acore.i2s_cfg.direction = HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST; 863 + acore.i2s_cfg.shift = HDMI_AUDIO_I2S_FIRST_BIT_SHIFT; 862 864 863 865 /* convert sample frequency to a number */ 864 866 switch (audio->iec->status[3] & IEC958_AES3_CON_FS) { ··· 890 892 err = hdmi_compute_acr(fs_nr, &n, &cts); 891 893 892 894 /* Audio clock regeneration settings */ 893 - core.n = n; 894 - core.cts = cts; 895 + acore.n = n; 896 + acore.cts = cts; 895 897 if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) { 896 - core.aud_par_busclk = 0; 897 - core.cts_mode = HDMI_AUDIO_CTS_MODE_SW; 898 - core.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK); 898 + acore.aud_par_busclk = 0; 899 + acore.cts_mode = HDMI_AUDIO_CTS_MODE_SW; 900 + acore.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK); 899 901 } else { 900 - core.aud_par_busclk = (((128 * 31) - 1) << 8); 901 - core.cts_mode = HDMI_AUDIO_CTS_MODE_HW; 902 - core.use_mclk = true; 902 + acore.aud_par_busclk = (((128 * 31) - 1) << 8); 903 + acore.cts_mode = HDMI_AUDIO_CTS_MODE_HW; 904 + acore.use_mclk = true; 903 905 } 904 906 905 - if (core.use_mclk) 906 - core.mclk_mode = HDMI_AUDIO_MCLK_128FS; 907 + if (acore.use_mclk) 908 + acore.mclk_mode = HDMI_AUDIO_MCLK_128FS; 907 909 908 910 /* Audio channels settings */ 909 911 channel_count = (audio->cea->db1_ct_cc & ··· 941 943 */ 942 944 if (channel_count == 2) { 943 945 audio_format.stereo_channels = HDMI_AUDIO_STEREO_ONECHANNEL; 944 - core.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN; 945 - core.layout = HDMI_AUDIO_LAYOUT_2CH; 946 + acore.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN; 947 + acore.layout = HDMI_AUDIO_LAYOUT_2CH; 946 948 } else { 947 949 audio_format.stereo_channels = HDMI_AUDIO_STEREO_FOURCHANNELS; 948 - core.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN | 950 + acore.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN | 949 951 HDMI_AUDIO_I2S_SD1_EN | HDMI_AUDIO_I2S_SD2_EN | 950 952 HDMI_AUDIO_I2S_SD3_EN; 951 - core.layout = HDMI_AUDIO_LAYOUT_8CH; 953 + acore.layout = HDMI_AUDIO_LAYOUT_8CH; 952 954 } 953 955 954 - core.en_spdif = false; 956 + acore.en_spdif = false; 955 957 /* use sample frequency from channel status word */ 956 - core.fs_override = true; 958 + acore.fs_override = true; 957 959 /* enable ACR packets */ 958 - core.en_acr_pkt = true; 960 + acore.en_acr_pkt = true; 959 961 /* disable direct streaming digital audio */ 960 - core.en_dsd_audio = false; 962 + acore.en_dsd_audio = false; 961 963 /* use parallel audio interface */ 962 - core.en_parallel_aud_input = true; 964 + acore.en_parallel_aud_input = true; 963 965 964 966 /* DMA settings */ 965 967 if (word_length_16b) ··· 986 988 audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_ON; 987 989 988 990 /* configure DMA and audio FIFO format*/ 989 - hdmi_wp_audio_config_dma(&ip_data->wp, &audio_dma); 990 - hdmi_wp_audio_config_format(&ip_data->wp, &audio_format); 991 + hdmi_wp_audio_config_dma(wp, &audio_dma); 992 + hdmi_wp_audio_config_format(wp, &audio_format); 991 993 992 994 /* configure the core*/ 993 - ti_hdmi_4xxx_core_audio_config(ip_data, &core); 995 + hdmi_core_audio_config(core, &acore); 994 996 995 997 /* configure CEA 861 audio infoframe*/ 996 - ti_hdmi_4xxx_core_audio_infoframe_cfg(ip_data, audio->cea); 998 + hdmi_core_audio_infoframe_cfg(core, audio->cea); 997 999 998 1000 return 0; 999 1001 } 1000 1002 1001 - int ti_hdmi_4xxx_audio_start(struct hdmi_ip_data *ip_data) 1003 + int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp) 1002 1004 { 1003 - REG_FLD_MOD(hdmi_av_base(ip_data), 1005 + REG_FLD_MOD(hdmi_av_base(core), 1004 1006 HDMI_CORE_AV_AUD_MODE, true, 0, 0); 1005 1007 1006 - hdmi_wp_audio_core_req_enable(&ip_data->wp, true); 1008 + hdmi_wp_audio_core_req_enable(wp, true); 1007 1009 1008 1010 return 0; 1009 1011 } 1010 1012 1011 - void ti_hdmi_4xxx_audio_stop(struct hdmi_ip_data *ip_data) 1013 + void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp) 1012 1014 { 1013 - REG_FLD_MOD(hdmi_av_base(ip_data), 1015 + REG_FLD_MOD(hdmi_av_base(core), 1014 1016 HDMI_CORE_AV_AUD_MODE, false, 0, 0); 1015 1017 1016 - hdmi_wp_audio_core_req_enable(&ip_data->wp, false); 1018 + hdmi_wp_audio_core_req_enable(wp, false); 1017 1019 } 1018 1020 1019 - int ti_hdmi_4xxx_audio_get_dma_port(u32 *offset, u32 *size) 1021 + int hdmi4_audio_get_dma_port(u32 *offset, u32 *size) 1020 1022 { 1021 1023 if (!offset || !size) 1022 1024 return -EINVAL; ··· 1026 1028 } 1027 1029 1028 1030 #endif 1031 + 1032 + #define CORE_OFFSET 0x400 1033 + #define CORE_SIZE 0xc00 1034 + 1035 + int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core) 1036 + { 1037 + struct resource *res; 1038 + struct resource temp_res; 1039 + 1040 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hdmi_core"); 1041 + if (!res) { 1042 + DSSDBG("can't get CORE mem resource by name\n"); 1043 + /* 1044 + * if hwmod/DT doesn't have the memory resource information 1045 + * split into HDMI sub blocks by name, we try again by getting 1046 + * the platform's first resource. this code will be removed when 1047 + * the driver can get the mem resources by name 1048 + */ 1049 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1050 + if (!res) { 1051 + DSSERR("can't get CORE mem resource\n"); 1052 + return -EINVAL; 1053 + } 1054 + 1055 + temp_res.start = res->start + CORE_OFFSET; 1056 + temp_res.end = temp_res.start + CORE_SIZE - 1; 1057 + res = &temp_res; 1058 + } 1059 + 1060 + core->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 1061 + if (!core->base) { 1062 + DSSERR("can't ioremap CORE\n"); 1063 + return -ENOMEM; 1064 + } 1065 + 1066 + return 0; 1067 + }
+14
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
··· 400 400 bool en_spdif; 401 401 }; 402 402 403 + int hdmi4_read_edid(struct hdmi_core_data *core, u8 *edid, int len); 404 + void hdmi4_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp, 405 + struct hdmi_config *cfg); 406 + void hdmi4_core_dump(struct hdmi_core_data *core, struct seq_file *s); 407 + int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core); 408 + 409 + #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 410 + int hdmi4_audio_start(struct hdmi_core_data *core, struct hdmi_wp_data *wp); 411 + void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp); 412 + int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, 413 + struct omap_dss_audio *audio); 414 + int hdmi4_audio_get_dma_port(u32 *offset, u32 *size); 415 + #endif 416 + 403 417 #endif