#define EDID_SIGNATURE 0x00FFFFFFFFFFFF00ull
/*
- * Debug printing setup
- */
-/* TODO: All printing should use one method,either PD_LOG_PRINT,
- * EDID_PRINT, DRM printing, pr_debug. The solution should be run-time
- * instead of compile-time switches. Will need some work to get
- * that done. Deferring for the time-being. Keep EDID prints
- * disabled as they are invoked on every DRM get_mode query
- * and prove costly and add problems like slow, jittery playback */
-#ifndef OTM_HDMI_FIXME
-static int EDID_PRINT(const char *fmt, ...)
-{
- return 0;
-}
-#else
-static int EDID_PRINT(const char *fmt, ...)
-{
- va_list arg_list;
-
- va_start(arg_list, fmt);
- vprintk(fmt, arg_list);
- va_end(arg_list);
- return 0;
-}
-#endif
-
-/*
* Structure to keep state of read operation
*/
typedef struct {
int position;
} read_context_t;
-static void fetch_generic_descriptor(generic_descriptor_t *gd,
- read_context_t *rctx)
- __attribute__((unused));
-
static void fetch_timing_descriptor(timing_descriptor_t *td,
read_context_t *rctx)
__attribute__((unused));
OTM_HDMI_ERR_INVAL, exit);
/* Print info about it */
- print_pd_timing(pdt, order, EDID_PRINT);
+ print_pd_timing(pdt, order);
/* Do not add modes that we dont support */
i = find_timing_tp(edid->ref_timings, edid->num_ref_timings, pdt);
{
int ne = n / 3;
- EDID_PRINT("[speaker block]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[speaker block]\n");
while (ne-- > 0) {
edid->speaker_map =
(unsigned)*e | (unsigned)(*(e + 1) & 0x7) << 8;
- print_speaker_layout(edid->speaker_map, EDID_PRINT);
+ print_speaker_layout(edid->speaker_map);
e++;
e++; /* skip the rest of the block */
}
{
int vic, j, i = 0;
- EDID_PRINT("[video data block]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[video data block]\n");
while (n-- > 0) {
vic = *e & 0x7F;
- EDID_PRINT("- mode #%d %s\n", vic, (*e & 0x80) ? "native" : "");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "- mode #%d %s\n", vic, (*e & 0x80) ? "native" : "");
if ((j =
find_timing_by_vic_tp(edid->ref_timings,
int ne = n / 3;
otm_hdmi_audio_cap_t *adb = (otm_hdmi_audio_cap_t *) &edid->audio_caps;
- EDID_PRINT("[audio data block... %d entries]\n", ne);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[audio data block... %d entries]\n", ne);
while (ne-- > 0) {
/* Do we have room for another capability? */
adb[edid->num_caps].max_channels = (*e & 0x07) + 1;
adb[edid->num_caps].fs = *(e + 1) & 0x7F;
adb[edid->num_caps].ss_bitrate = *(e + 2);
- print_audio_capability(&adb[edid->num_caps],
- EDID_PRINT);
+ print_audio_capability(&adb[edid->num_caps]);
edid->num_caps++;
}
/* Go to the next entry of the block */
{
unsigned int offset;
- EDID_PRINT("- 3D modes supported:\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "- 3D modes supported:\n");
/* Declare mandatory modes */
declare_mandatory_3d(edid);
unsigned int len_3d, len_hdmi;
#endif
- EDID_PRINT("[vendor specific data block.. length %d]\n", n);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[vendor specific data block.. length %d]\n", n);
/* Look for HDMI signature [0x030C00] */
if (n >= 3) {
if ((e[0] == 0x03) && (e[1] == 0x0C) && (e[2] == 0x00)) {
edid->hdmi = true;
- EDID_PRINT("- HDMI signature found\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "- HDMI signature found\n");
}
}
/* Parse Source Physical Address */
static void decode_extended_data_block(unsigned char *e,
int n, edid_info_t *edid)
{
- EDID_PRINT("[extended data block.. length %d]\n", n);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[extended data block.. length %d]\n", n);
switch (*(e + 0)) {
case 0x00: /* Video Capability Block */
- EDID_PRINT("Video Capability Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "Video Capability Block\n");
edid->rgb_quant_selectable = *(e + 1) & 0x40;
edid->ycc_quant_selectable = *(e + 1) & 0x80;
break;
case 0x01: /* Vendor Specific Video Data Block */
- EDID_PRINT("Vendor Specific Video Data Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "Vendor Specific Video Data Block\n");
break;
case 0x05: /* Colorimetry Block */
- EDID_PRINT("Colorimetry Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "Colorimetry Block\n");
if (n == 3) {
edid->xvycc601 = (*(e + 1) & 0x01) != 0;
edid->xvycc709 = (*(e + 1) & 0x02) != 0;
}
break;
case 0x11: /* CEA Misc Audio Block */
- EDID_PRINT("CEA Misc Audio Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "CEA Misc Audio Block\n");
break;
case 0x12: /* Vendor specific audio data block */
- EDID_PRINT("Vendor specific audio data Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "Vendor specific audio data Block\n");
break;
default: /* reserved blocks */
- EDID_PRINT("Reserved Block\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "Reserved Block\n");
break;
}
payload_size,
edid);
} else {
- EDID_PRINT("[block 0x%x.. TBA]\n", block_type);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[block 0x%x.. TBA]\n", block_type);
}
}
/* Unknown */
else
- EDID_PRINT("[unknown block 0x%x]\n", (int)*c);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[unknown block 0x%x]\n", (int)*c);
- EDID_PRINT("\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "\n");
c += (*c & 0x1F) + 1;
}
}
/* Indicate no stereo support */
pdt.stereo_type = OTM_HDMI_STEREO_NONE;
- EDID_PRINT("[Standart timing]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[Standart timing]\n");
add_timings(edid, &pdt, 0);
}
}
int h_img_size = ((td->hv_image_size & 0xF0) << 4) | td->h_image_size;
int v_img_size = ((td->hv_image_size & 0x0F) << 8) | td->v_image_size;
- EDID_PRINT("[detailed timing descriptor]\n");
-
-#ifndef PRINT_DETAILED_TIMINGS
- EDID_PRINT(" - pixel_clock : %d KHz\n", pixel_clock);
- EDID_PRINT(" - horz_active : %d pixels\n", h_active);
- EDID_PRINT(" - horz_blanking : %d pixels\n", h_blanking);
- EDID_PRINT(" - vert_active : %d lines\n", v_active);
- EDID_PRINT(" - vert_blanking : %d lines\n", v_blanking);
- EDID_PRINT(" - horz_sync_off : %d pixels\n", h_sync_off);
- EDID_PRINT(" - horz_sync_pw : %d pixels\n", h_sync_pw);
- EDID_PRINT(" - vert_sync_off : %d lines\n", v_sync_off);
- EDID_PRINT(" - vert_sync_pw : %d lines\n", v_sync_pw);
- EDID_PRINT(" - image ratio : %d : %d\n", h_img_size, v_img_size);
-#endif
+ LOG_PRINT(LOG_LEVEL_DETAIL, "[detailed timing descriptor]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - pixel_clock : %d KHz\n", pixel_clock);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - horz_active : %d pixels\n", h_active);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - horz_blanking : %d pixels\n", h_blanking);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - vert_active : %d lines\n", v_active);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - vert_blanking : %d lines\n", v_blanking);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - horz_sync_off : %d pixels\n", h_sync_off);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - horz_sync_pw : %d pixels\n", h_sync_pw);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - vert_sync_off : %d lines\n", v_sync_off);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - vert_sync_pw : %d lines\n", v_sync_pw);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " - image ratio : %d : %d\n", h_img_size, v_img_size);
pdt->width = h_active;
pdt->htotal = h_active + h_blanking;
&& (gd->flag == 0)) {
switch (gd->data_type_tag) {
case 0xFF:
- EDID_PRINT("[Monitor Serial Number ]\n");
- EDID_PRINT(" - %s\n", gd->payload);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Monitor Serial Number ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, " - %s\n", gd->payload);
break;
case 0xFE:
- EDID_PRINT("[ASCII String ]\n");
- EDID_PRINT(" - %s\n", gd->payload);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[ASCII String ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, " - %s\n", gd->payload);
break;
case 0xFD:
- EDID_PRINT("[Monitor Range Limits ]\n");
- EDID_PRINT(" - ...\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Monitor Range Limits ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, " - ...\n");
break;
case 0xFC:
- EDID_PRINT("[Monitor Name ]\n");
- EDID_PRINT(" - %s\n", gd->payload);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Monitor Name ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, " - %s\n", gd->payload);
for (i = 0; i < 13; i++) {
if (gd->payload[i] == '\n')
break;
}
break;
case 0xFB:
- EDID_PRINT("[Color Data ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Color Data ]\n");
break;
case 0xFA:
- EDID_PRINT("[More Standard Timings ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[More Standard Timings ]\n");
for (i = 0; i < 12; i += 2) {
/* TODO: Need more info on proper byte order */
decode_standard_timings
}
break;
case 0x10:
- EDID_PRINT("[Dummy ]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Dummy ]\n");
break;
default:
- EDID_PRINT("[Manufacturer/Undefined]\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "[Manufacturer/Undefined]\n");
break;
}
}
otm_hdmi_ret_t rc = OTM_HDMI_SUCCESS;
extention_block_cea_t eb;
- EDID_PRINT("Decoding extension 0x%x\n", type);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "Decoding extension 0x%x\n", type);
switch (type) {
case 0x02:
break;
default:
- EDID_PRINT("Extension 0x%x is not supported; Bypassing\n",
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "Extension 0x%x is not supported; Bypassing\n",
type);
break;
}
* edid_parse()
*/
otm_hdmi_ret_t edid_parse(edid_info_t *edid_info,
- i2c_read_t data_read, void *cd,
- bool hex_dump)
+ i2c_read_t data_read, void *cd)
{
unsigned char buffer[SEGMENT_SIZE];
edid_block_zero_t ebz;
/* Read block zero */
rc = data_read(cd, 0, 0, buffer, SEGMENT_SIZE);
VERIFY_QUICK(rc == OTM_HDMI_SUCCESS, exit);
- print_raw_block(buffer, SEGMENT_SIZE, (bool) hex_dump);
+ print_raw_block(buffer, SEGMENT_SIZE);
VERIFY(checksum_valid(buffer, SEGMENT_SIZE), rc,
OTM_HDMI_ERR_FAILED, exit);
/* Read next block */
rc = data_read(cd, 0, SEGMENT_SIZE, buffer, SEGMENT_SIZE);
VERIFY_QUICK(rc == OTM_HDMI_SUCCESS, exit);
- print_raw_block(buffer, SEGMENT_SIZE, (bool) hex_dump);
+ print_raw_block(buffer, SEGMENT_SIZE);
VERIFY(checksum_valid(buffer, SEGMENT_SIZE), rc,
OTM_HDMI_ERR_FAILED, exit);
/* Read extension block */
rc = data_read(cd, sp, offset, buffer, SEGMENT_SIZE);
VERIFY_QUICK(rc == OTM_HDMI_SUCCESS, exit);
- print_raw_block(buffer, SEGMENT_SIZE, (bool) hex_dump);
+ print_raw_block(buffer, SEGMENT_SIZE);
VERIFY(checksum_valid(buffer, SEGMENT_SIZE), rc,
OTM_HDMI_ERR_FAILED, exit);
} edid_info_t;
otm_hdmi_ret_t edid_parse(edid_info_t *edid_info, i2c_read_t data_read,
- void *cd, bool hex_dump);
+ void *cd);
-void print_pd_timing(const otm_hdmi_timing_t *pdt, unsigned int order,
- printf_t print);
-void print_audio_capability(otm_hdmi_audio_cap_t *adb, printf_t print);
-void print_speaker_layout(unsigned int layout, printf_t print);
-void print_raw_block(unsigned char *buffer, int size, bool print);
+void print_pd_timing(const otm_hdmi_timing_t *pdt, unsigned int order);
+void print_audio_capability(otm_hdmi_audio_cap_t *adb);
+void print_speaker_layout(unsigned int layout);
+void print_raw_block(unsigned char *buffer, int size);
int find_timing(const otm_hdmi_timing_t *set, int size,
const otm_hdmi_timing_t *e);
#include <linux/kernel.h>
#include "edid_internal.h"
-/* __fake_printf */
-static int __fake_printf(const char *fmt, ...)
-{
- return 0;
-}
-
/* Convert the refresh rate enum to a string for printing */
static char *_refresh_string(otm_hdmi_refresh_t r)
{
/* print_pd_timing */
void print_pd_timing(const otm_hdmi_timing_t *t,
- unsigned int order, printf_t print)
+ unsigned int order)
{
- printf_t p = print ? print : __fake_printf;
-
- p(" - %dx%d @ %s", t->width, t->height, _refresh_string(t->refresh));
- p("%s", (t->mode_info_flags & PD_SCAN_INTERLACE) ? "i" : "p");
- p(" [%s]", (t->mode_info_flags & PD_AR_16_BY_9) ? "16:9" : "4:3");
- p(" [%d]", order);
- p(" [%s]\n", _stereo_string(t->stereo_type));
-
-#ifdef PRINT_DETAILED_TIMINGS
- p(" - htotal : %d\n", t->htotal);
- p(" - hblank_start: %d\n", t->hblank_start);
- p(" - hblank_end : %d\n", t->hblank_end);
- p(" - hsync_start : %d\n", t->hsync_start);
- p(" - hsync_end : %d\n", t->hsync_end);
- p(" - vtotal : %d\n", t->vtotal);
- p(" - vblank_start: %d\n", t->vblank_start);
- p(" - vblank_end : %d\n", t->vblank_end);
- p(" - vsync_start : %d\n", t->vsync_start);
- p(" - vsync_end : %d\n", t->vsync_end);
- p(" - clock : %dMhz\n", (int)(t->dclk / 1000));
-#endif
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "%dx%d @ %s %s [%s] [%d] [%s]\n",
+ t->width, t->height, _refresh_string(t->refresh),
+ ((t->mode_info_flags & PD_SCAN_INTERLACE) ? "i" : "p"),
+ ((t->mode_info_flags & PD_AR_16_BY_9) ? "16:9" : "4:3"),
+ order, _stereo_string(t->stereo_type));
+
+ LOG_PRINT(LOG_LEVEL_DETAIL, "htotal : %d\n",
+ t->htotal);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "hblank_start: %d\n", t->hblank_start);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "hblank_end : %d\n", t->hblank_end);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "hsync_start : %d\n",
+ t->hsync_start);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "hsync_end : %d\n",
+ t->hsync_end);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "vtotal : %d\n",
+ t->vtotal);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "vblank_start: %d\n",
+ t->vblank_start);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "vblank_end : %d\n",
+ t->vblank_end);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "vsync_start : %d\n",
+ t->vsync_start);
+ LOG_PRINT(LOG_LEVEL_DETAIL, "vsync_end : %d\n",
+ t->vsync_end);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "clock : %dMhz\n", (int)(t->dclk / 1000));
}
/* Convert audio format enum to a string for printing */
}
/* print_audio_capability() */
-void print_audio_capability(otm_hdmi_audio_cap_t *cap, printf_t print)
+void print_audio_capability(otm_hdmi_audio_cap_t *cap)
{
- printf_t p = print ? print : __fake_printf;
int i;
- p(" - Format: %s; Max channels: %d; Sampling rates, KHz:",
- _audio_format(cap->format), cap->max_channels);
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ "Format: %s; Max channels: %d; Sampling rates, KHz:",
+ _audio_format(cap->format), cap->max_channels);
for (i = 0; i < 7; i++)
- p(" %s", (cap->fs & (1 << i)) ? _sampling_rate(1 << i) : "");
- p("\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " %s", (cap->fs & (1 << i)) ? _sampling_rate(1 << i) : "");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "\n");
}
/* Convert a speaker map enum to a string for printing */
}
/* print_speaker_layout() */
-void print_speaker_layout(unsigned int layout, printf_t print)
+void print_speaker_layout(unsigned int layout)
{
- printf_t p = print ? print : __fake_printf;
int i;
- p(" - Speaker layout map:");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "Speaker layout map:");
for (i = 0; i < 11; i++)
- p(" %s", (layout & (1 << i)) ? _speaker_map(1 << i) : "");
- p("\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL,
+ " %s", (layout & (1 << i)) ? _speaker_map(1 << i) : "");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "\n");
}
/* print_raw_block() */
-void print_raw_block(unsigned char *buffer, int size, bool print)
+void print_raw_block(unsigned char *buffer, int size)
{
int i;
- if (!print)
- return;
-
for (i = 0; i < size; i++) {
- pr_debug("%s", (i % 0x10) ? "" : "\n");
- pr_debug("%02X ", buffer[i]);
+ if (i != 0 && ((i % 0x10) == 0))
+ LOG_PRINT(LOG_LEVEL_DETAIL, "\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "%02X\n", buffer[i]);
}
- pr_debug("\n");
+ LOG_PRINT(LOG_LEVEL_DETAIL, "\n");
}
return rc;
}
-/*
- * Wrapper over printing to both console and SVEN. Note that Both underlying
- * routines accept frame stack pointer
- */
-static int __vprintf(const char *fmt, ...)
-{
- int rc = 0;
- va_list argp;
-
- /* Log on console only if debug is on */
- if (PD_ATTR_UINT(ATTRS[OTM_HDMI_ATTR_ID_DEBUG]) >= PD_LOG_LEVEL_ERROR) {
- va_start(argp, fmt);
- rc = vprintk(fmt, argp);
- va_end(argp);
- }
- return rc;
-}
-
static void __hdmi_report_edid(hdmi_context_t *ctx, edid_info_t *edid)
{
int i = 0;
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "----------------------\n");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Name : %s\n", edid->product_name);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Year : %d\n", edid->product_year);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "SN : %d\n", edid->product_sn);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Type : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "----------------------\n");
+ LOG_PRINT(LOG_LEVEL_HIGH, "Name : %s\n", edid->product_name);
+ LOG_PRINT(LOG_LEVEL_HIGH, "Year : %d\n", edid->product_year);
+ LOG_PRINT(LOG_LEVEL_HIGH, "SN : %d\n", edid->product_sn);
+ LOG_PRINT(LOG_LEVEL_HIGH, "Type : %s\n",
edid->hdmi ? "HDMI" : "DVI");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "YCbCr444 : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "YCbCr444 : %s\n",
edid->ycbcr444 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "YCbCr422 : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "YCbCr422 : %s\n",
edid->ycbcr422 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "30 bpp : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "30 bpp : %s\n",
edid->dc_30 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "36 bpp : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "36 bpp : %s\n",
edid->dc_36 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "48 bpp : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "48 bpp : %s\n",
edid->dc_48 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "DC_YUV : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "DC_YUV : %s\n",
edid->dc_y444 ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Max CLK : %d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "Max CLK : %d\n",
edid->max_tmds_clock);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Lip sync : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "Lip sync : %s\n",
edid->latency_present ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "ILip sync: %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "ILip sync: %s\n",
edid->latency_int_present ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Vid lat : %d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "Vid lat : %d\n",
edid->latency_video);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Aud lat : %d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "Aud lat : %d\n",
edid->latency_audio);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "IVid lat : %d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "IVid lat : %d\n",
edid->latency_video_interlaced);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "IAud lat : %d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "IAud lat : %d\n",
edid->latency_audio_interlaced);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "HDMI VID : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "HDMI VID : %s\n",
edid->hdmi_video_present ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "HDMI 3D : %s\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "HDMI 3D : %s\n",
edid->enabled_3d ? "Y" : "N");
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "SPA : %d.%d.%d.%d\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "SPA : %d.%d.%d.%d\n",
(edid->spa & 0xF000) >> 12,
(edid->spa & 0x0F00) >> 8,
(edid->spa & 0x00F0) >> 4, (edid->spa & 0x000F) >> 0);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Supported timings [%d]:\n",
+ LOG_PRINT(LOG_LEVEL_HIGH, "Supported timings [%d]:\n",
edid->num_timings);
for (i = 0; i < edid->num_timings; i++)
- print_pd_timing(&edid->timings[i], edid->order[i], __vprintf);
+ print_pd_timing(&edid->timings[i], edid->order[i]);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "Audio capabilities:\n");
+ LOG_PRINT(LOG_LEVEL_HIGH, "Audio capabilities:\n");
for (i = 0; i < edid->num_caps; i++)
- print_audio_capability(&edid->audio_caps[i], __vprintf);
+ print_audio_capability(&edid->audio_caps[i]);
- print_speaker_layout(edid->speaker_map, __vprintf);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "----------------------\n");
+ print_speaker_layout(edid->speaker_map);
+ LOG_PRINT(LOG_LEVEL_HIGH, "----------------------\n");
}
static otm_hdmi_ret_t __hdmi_edid_override(hdmi_context_t *ctx,
/* Try reading EDID. If reading failed pick overriding strategy
* based on cable status
*/
- rc = edid_parse(edid, edid_foo, ctx, false);
+ rc = edid_parse(edid, edid_foo, ctx);
if (rc != OTM_HDMI_SUCCESS) {
pr_debug("Failed to read EDID info\n");
use_edid = cable ? OTM_HDMI_USE_EDID_SAFE :
break;
case OTM_HDMI_USE_EDID_SAFE:
/* In safe mode we still need real EDID */
- edid_parse(edid, edid_foo, ctx, false);
+ edid_parse(edid, edid_foo, ctx);
break;
case OTM_HDMI_USE_EDID_NONE:
/* In full override mode we dont care of real EDID
/* Print warning message in case there are no timings */
if (ctx->edid_int.num_timings == 0) {
- PD_LOG_ERROR
+ LOG_ERROR
("----------------- WARNING -----------------------\n");
- PD_LOG_ERROR
+ LOG_ERROR
("-- TV timings are not available --\n");
- PD_LOG_ERROR
+ LOG_ERROR
("-- To resolve this switch to static TV timings --\n");
}
/* Update EDID availability indicator */
ctx->phy_status = status;
/* Debug print */
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "PHY -> %s\n", status ? "on" : "off");
+ LOG_PRINT(LOG_LEVEL_HIGH, "PHY -> %s\n", status ? "on" : "off");
exit:
return rc;
hdmi_context_t *ctx = NULL;
unsigned int isr_address;
- PD_LOG_ENTRY(PD_LOG_LEVEL_HIGH);
+ LOG_ENTRY(LOG_LEVEL_HIGH);
/* Verify pointers */
if (context == NULL) {
mutex_init (&ctx->mute_sema);
exit:
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
otm_hdmi_ret_t rc = OTM_HDMI_SUCCESS;
hdmi_context_t *ctx = NULL;
- PD_LOG_ENTRY(PD_LOG_LEVEL_HIGH);
+ LOG_ENTRY(LOG_LEVEL_HIGH);
/* Verify pointers */
if (context == NULL) {
pr_debug("Exiting deinit with error code %d\n", rc);
exit:
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return;
}
hdmi_context_t *ctx = NULL;
int n;
- PD_LOG_ENTRY(PD_LOG_LEVEL_HIGH);
+ LOG_ENTRY(LOG_LEVEL_HIGH);
/* Verify pointers */
if (context == NULL) {
if ((rc != OTM_HDMI_SUCCESS) && (ctx != NULL))
otm_hdmi_deinit((void *)ctx);
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
int in, out;
if (NULL == ctx) {
- PD_LOG_ERROR("Invalid argument passed (ctx)\n");
+ LOG_ERROR("Invalid argument passed (ctx)\n");
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
int str_len = 0;
if (id < 0 || id >= OTM_HDMI_MAX_SUPPORTED_ATTRIBUTES) {
- PD_LOG_ERROR("Invalid argument passed (id): %d\n", id);
+ LOG_ERROR("Invalid argument passed (id): %d\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
if (NULL == value) {
- PD_LOG_ERROR("Invalid argument passed (value): %d\n", id);
+ LOG_ERROR("Invalid argument passed (value): %d\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
- if (OTM_HDMI_ATTR_FLAG_WRITE != ATTRS[id].flags) {
- PD_LOG_ERROR("Attribute id: %d is read-only\n", id);
+ if ((OTM_HDMI_ATTR_FLAG_WRITE & ATTRS[id].flags) != 1) {
+ LOG_ERROR("Attribute id: %d is read-only\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
}
break;
default:
- PD_LOG_ERROR("Invalid attribute id (%d)\n", id);
+ LOG_ERROR("Invalid attribute id (%d)\n", id);
rc = OTM_HDMI_ERR_FAILED;
break;
}
exit:
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
bool abool;
unsigned int auint, out, depth;
otm_hdmi_attribute_flag_t flags;
- PD_LOG_ENTRY(PD_LOG_LEVEL_HIGH);
+ LOG_ENTRY(LOG_LEVEL_HIGH);
if (NULL == ctx) {
- PD_LOG_ERROR("Invalid argument passed (context): %d\n", id);
+ LOG_ERROR("Invalid argument passed (context): %d\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
goto exit;
abool = *(bool *) (data);
auint = *(unsigned int *) (data);
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH, "ATTR[%d] -> %d\n", id, auint);
+ LOG_PRINT(LOG_LEVEL_HIGH, "ATTR[%d] -> %d\n", id, auint);
#ifdef OTM_HDMI_FIXME
/*
rc = __update_edid(ctx);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_setmode_required(pipe);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_setmode_required(pipe);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
case OTM_HDMI_ATTR_ID_BG_COLOR:
rc = hdmi_video_set_pixel_color(&ctx->dev, auint);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_setmode_required(pipe);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
rc = service_hdcp_set(ctx, false,
true);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code :%d\n",
+ LOG_ERROR("ERR: %s at %d code :%d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = hdmi_i2c_set_ddc_speed(&ctx->dev, abool);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
goto exit;
rc = __switch_pipe(ctx);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = hdmi_video_set_video_indicator(&ctx->dev, abool);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_setmode_required(pipe);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = hdmi_hdcp_set_enc(ctx, abool && HDCP_OFF != hdcp_status);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_setmode_required(pipe);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
goto exit;
}
break;
-
+ case OTM_HDMI_ATTR_ID_DEBUG:
+ ATTRS[id].content._uint.value = auint;
+ break;
default:
break;
}
#ifdef OTM_HDMI_FIXME
rc = ctx->support->pd_attr_set(ATTRS, id, data, flags);
if (rc != OTM_HDMI_SUCCESS) {
- PD_LOG_ERROR("ERR: %s at %d code = %d\n",
+ LOG_ERROR("ERR: %s at %d code = %d\n",
__func__, __LINE__, rc);
goto exit;
}
}
exit:
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
EXPORT_SYMBOL(otm_hdmi_set_attribute);
{
otm_hdmi_ret_t rc = OTM_HDMI_SUCCESS;
if (id < 0 || id >= OTM_HDMI_MAX_SUPPORTED_ATTRIBUTES) {
- PD_LOG_ERROR("Invalid argument passed (id): %d\n", id);
+ LOG_ERROR("Invalid argument passed (id): %d\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
/*
* Based on attribute type perform appropriate check
*/
- switch (ATTRS[id].flags) {
- case OTM_HDMI_ATTR_FLAG_WRITE:
- break;
-
- case OTM_HDMI_ATTR_FLAG_SUPPORTED:
+ if (OTM_HDMI_ATTR_FLAG_WRITE & ATTRS[id].flags) {
+ return rc;
+ } else if (OTM_HDMI_ATTR_FLAG_SUPPORTED & ATTRS[id].flags) {
/*
* Needs a Fix.
*/
- rc = OTM_HDMI_SUCCESS;
- break;
-
- case OTM_HDMI_ATTR_FLAG_INTERNAL:
+ return rc;
+ } else if (OTM_HDMI_ATTR_FLAG_INTERNAL & ATTRS[id].flags) {
rc = OTM_HDMI_ERR_INTERNAL;
- break;
- default:
- PD_LOG_ERROR("Invalid attribute accessed: (%d)\n", id);
+ return rc;
+ } else {
+ LOG_ERROR("Invalid attribute accessed: (%d)\n", id);
rc = OTM_HDMI_ERR_FAILED;
- break;
+ return rc;
}
exit:
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
bool log)
{
otm_hdmi_ret_t rc = OTM_HDMI_SUCCESS;
- PD_LOG_ENTRY((log) ? PD_LOG_LEVEL_HIGH : PD_LOG_LEVEL_VBLANK);
+ LOG_ENTRY((log) ? LOG_LEVEL_HIGH : LOG_LEVEL_VBLANK);
rc = otm_hdmi_attr_get_validate(id);
if (OTM_HDMI_SUCCESS != rc)
goto exit;
if (NULL == attribute || NULL == context) {
- PD_LOG_ERROR("Invalid argument passed (attribute): %d\n", id);
+ LOG_ERROR("Invalid argument passed (attribute): %d\n", id);
rc = OTM_HDMI_ERR_FAILED;
goto exit;
}
*attribute = ATTRS[id];
exit:
- PD_LOG_EXIT((log) ? PD_LOG_LEVEL_HIGH : PD_LOG_LEVEL_VBLANK, rc);
+ LOG_EXIT((log) ? LOG_LEVEL_HIGH : LOG_LEVEL_VBLANK, rc);
return rc;
}
EXPORT_SYMBOL(otm_hdmi_get_attribute);
if ((name != NULL) && (strlen(name) < OTM_HDMI_MAX_STRING_LENGTH))
strncpy(table[id].name, name, strlen(table[id].name));
else if (strlen(table[id].name) == 0)
- PD_LOG_ERROR("set default name\n");
+ LOG_ERROR("set default name\n");
/* TODO: set default name */
table[id].flags = flags;
otm_hdmi_attribute_t *table = otm_hdmi_attributes_table;
- PD_LOG_ENTRY(PD_LOG_LEVEL_HIGH);
+ LOG_ENTRY(LOG_LEVEL_HIGH);
/*
* declare(table, OTM_HDMI_ATTR_ID_NAME,
OTM_HDMI_ATTR_ID_DEBUG,
PD_ATTR_FLAGS_RWS,
get_name,
- PD_LOG_LEVEL_ERROR,
- __PD_LOG_LEVEL_MIN, __PD_LOG_LEVEL_MAX);
+ LOG_LEVEL_ERROR,
+ __LOG_LEVEL_MIN, __LOG_LEVEL_MAX);
PD_DECLARE_ATTRIBUTE_UINT(declare, table,
OTM_HDMI_ATTR_ID_VERSION_MAJOR,
OTM_HDMI_ATTR_ID_HDCP_RI_RETRY,
PD_ATTR_FLAGS_RWS, get_name, 40, 0, 50);
- PD_LOG_EXIT(PD_LOG_LEVEL_HIGH, rc);
+ LOG_EXIT(LOG_LEVEL_HIGH, rc);
return rc;
}
EXPORT_SYMBOL(otm_hdmi_declare_attributes);
{
edid_info_t *edid = NULL;
if (NULL == g_context) {
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH,
+ LOG_PRINT(LOG_LEVEL_HIGH,
"Cant print EDID, Initialize otm_hdmi first!\n");
return;
}
edid = &g_context->edid_int;
if (NULL == edid) {
- PD_LOG_PRINT(PD_LOG_LEVEL_HIGH,
+ LOG_PRINT(LOG_LEVEL_HIGH,
"EDID not initialized in driver.\n");
return;
}
}
EXPORT_SYMBOL_GPL(test_otm_hdmi_report_edid);
#endif
+
+#ifdef OTM_HDMI_UNIT_TEST
+
+/**
+ * get_hdmi_context() - Getting hdmi_context
+ *
+ * This routine gives a handle to hdmi_context
+ * to be used with other function calls like
+ * set_attribute which requires hdmi_context
+ * as one of the params
+ *
+ * Returns - hdmi_context
+ */
+void *otm_hdmi_get_context(void)
+{
+ return (void *)g_context;
+}
+EXPORT_SYMBOL_GPL(otm_hdmi_get_context);
+#endif
/*
* Logging macros
*/
-#define ATTRIBUTES otm_hdmi_attributes_table
+
+/*
+ * Table of attributes
+ */
+extern otm_hdmi_attribute_t otm_hdmi_attributes_table[];
+
+#define ATTR otm_hdmi_attributes_table
typedef enum {
- PD_LOG_LEVEL_ERROR = 0, /* Error messages; Will always be printed */
- __PD_LOG_LEVEL_MIN = PD_LOG_LEVEL_ERROR,
+ LOG_LEVEL_ERROR = 0, /* Error messages; Will always be printed */
+ __LOG_LEVEL_MIN = LOG_LEVEL_ERROR,
/* Add log levels below this line */
- PD_LOG_LEVEL_HIGH = 1, /* Printed if 'debug' is set to 1 or higher */
- PD_LOG_LEVEL_LOW, /* Printed if 'debug' is set to 2 or higher */
- PD_LOG_LEVEL_VBLANK, /* Printed if 'debug' at highest level */
+ LOG_LEVEL_HIGH = 1, /* Printed if 'debug' is set to 1 or higher */
+ LOG_LEVEL_LOW, /* Printed if 'debug' is set to 2 or higher */
+ LOG_LEVEL_VBLANK, /* Printed if 'debug' at highest level */
+ LOG_LEVEL_DETAIL, /* Print detailed info */
/* Add log levels above this line */
- __PD_LOG_LEVEL_TEMP_UPPER__, /* DO NOT USE */
- __PD_LOG_LEVEL_MAX = __PD_LOG_LEVEL_TEMP_UPPER__ - 1,
-} pd_log_level_t;
+ __LOG_LEVEL_TEMP_UPPER__, /* DO NOT USE */
+ __LOG_LEVEL_MAX = __LOG_LEVEL_TEMP_UPPER__ - 1,
+} log_level_t;
/* Used to log entry in to a function */
-#define PD_LOG_ENTRY(log_level) \
- if ((log_level) <= (int) PD_ATTR_UINT( \
- ATTRIBUTES[OTM_HDMI_ATTR_ID_DEBUG])) \
+#define LOG_ENTRY(log_level) \
+ if ((log_level) <= (int) PD_ATTR_UINT(ATTR[OTM_HDMI_ATTR_ID_DEBUG])) \
printk("OTM_HDMI: Entering %s\n", __func__)
/* Used to log exit from a function */
-#define PD_LOG_EXIT(log_level, rc) \
- if ((log_level) <= (int) PD_ATTR_UINT( \
- ATTRIBUTES[OTM_HDMI_ATTR_ID_DEBUG])) \
+#define LOG_EXIT(log_level, rc) \
+ if ((log_level) <= (int) PD_ATTR_UINT(ATTR[OTM_HDMI_ATTR_ID_DEBUG])) \
printk("OTM_HDMI: Exiting %s with %d\n", __func__, rc)
-#ifdef OTM_HDMI_FIXME
-#define PD_LOG_PRINT(log_level, args...) \
- if ((log_level) <= (int) PD_ATTR_UINT( \
- ATTRIBUTES[OTM_HDMI_ATTR_ID_DEBUG])) \
- printk(args)
-#else
-#define PD_LOG_PRINT(log_level, args...) printk("OTM_HDMI: " args)
-#endif
+#define LOG_PRINT(log_level, args...) \
+ if ((log_level) <= (int) PD_ATTR_UINT(ATTR[OTM_HDMI_ATTR_ID_DEBUG])) \
+ printk("OTM_HDMI:" args)
-#define PD_LOG_ERROR(msg, args...) PD_LOG_PRINT(PD_LOG_LEVEL_ERROR, msg, ##args)
+#define LOG_ERROR(msg, args...) LOG_PRINT(LOG_LEVEL_ERROR, msg, ##args)
/*
* Bits in 'mode_info_flags' field
void test_otm_hdmi_report_edid(void);
#endif
+/*
+ * Description: function to get hdmi_context
+ * handle
+ *
+ * Returns: hdmi_context
+ */
+extern void *otm_hdmi_get_context(void);
+
#endif /* _OTM_HDMI_H */