siihdmi: backport 2.6.35 driver to .31 - hotplug is the biggest major feature

This commit is contained in:
Matt Sealey
2011-07-04 14:26:27 -05:00
parent 5c480f9bf8
commit 1f0c20d638
7 changed files with 627 additions and 630 deletions

View File

@@ -26,7 +26,6 @@
#include <linux/i2c.h>
#include <linux/ipu.h>
#include <linux/mxcfb.h>
#include <linux/i2c/siihdmi.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <asm/setup.h>
@@ -39,7 +38,7 @@
#include "mx51_pins.h"
#include "mx51_efikamx.h"
#include "../../../drivers/video/mxc/siihdmi.h"
extern void mx5_ipu_reset(void);

View File

@@ -901,7 +901,7 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
}
/**
* fb_find_best_nearest_mode - find closest videomode a different way
* fb_find_best_mode_at_most - find closest videomode a different way
*
* @mode: pointer to struct fb_videomode
* @head: pointer to modelist
@@ -921,33 +921,32 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
* the greatest mode in the vast majority of cases)
*
*/
const struct fb_videomode *fb_find_best_nearest_mode(const struct fb_videomode *mode,
struct list_head *head)
const struct fb_videomode *fb_find_best_mode_at_most(const struct fb_videomode *max,
struct list_head *modes)
{
struct list_head *pos;
struct fb_modelist *modelist;
struct fb_videomode *cmode, *best = NULL;
u32 diff = -1;
struct fb_videomode *best = NULL;
struct list_head *entry;
u32 difference = -1;
list_for_each(pos, head) {
u32 d;
list_for_each(entry, modes) {
const struct fb_modelist * const modelist =
list_entry(entry, struct fb_modelist, list);
const struct fb_videomode * const mode = &modelist->mode;
modelist = list_entry(pos, struct fb_modelist, list);
cmode = &modelist->mode;
if (mode->xres <= max->xres && mode->yres <= max->yres) {
const u32 delta = (max->xres - mode->xres)
+ (max->yres - mode->yres);
/* the calculations here assume that every other mode than the one
passed is somewhat smaller :) */
if (mode->xres >= cmode->xres && mode->yres >= cmode->yres) {
d = (mode->xres - cmode->xres) +
(mode->yres - cmode->yres);
if (diff > d) {
/* as d grows smaller, best gets closer to the
* passed mode */
diff = d;
best = cmode;
} else if (diff == d && best &&
cmode->refresh > best->refresh) {
best = cmode;
if (delta == difference) {
if (best && mode->refresh > best->refresh)
best = mode;
continue;
}
if (delta < difference) {
difference = delta;
best = mode;
continue;
}
}
}

View File

@@ -1473,6 +1473,8 @@ static int mxcfb_resume(struct platform_device *pdev)
*/
static int mxcfb_map_video_memory(struct fb_info *fbi)
{
if (fbi->fix.line_length == 0) fbi->fix.line_length = fbi->var.xres;
fbi->fix.smem_len = fbi->var.yres_virtual * fbi->fix.line_length;
fbi->fix.smem_len = (fbi->fix.smem_len + SZ_1M - 1) & ~(SZ_1M - 1);

File diff suppressed because it is too large Load Diff

View File

@@ -29,8 +29,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LINUX_SIIHDMI_H
#define LINUX_SIIHDMI_H
#ifndef LINUX_DRIVERS_VIDEO_SIIHDMI_H
#define LINUX_DRIVERS_VIDEO_SIIHDMI_H
#include <linux/cea861.h>
#include <linux/ioport.h>
@@ -76,6 +76,7 @@
#define SIIHDMI_TPI_REG_I2S_SOURCE_CHANNEL (0x23)
#define SIIHDMI_TPI_REG_I2S_ACCURACY_SAMPLING_FREQUENCY (0x24)
#define SIIHDMI_TPI_REG_I2S_ORIGINAL_FREQ_SAMPLE_LENGTH (0x25)
#define SIIHDMI_TPI_REG_I2S_AUDIO_CONFIGURATION_BASE (0x26)
#define SIIHDMI_TPI_REG_I2S_AUDIO_PACKET_LAYOUT_CTRL (0x26)
#define SIIHDMI_TPI_REG_I2S_AUDIO_SAMPLING_HBR (0x27)
#define SIIHDMI_TPI_REG_I2S_AUDIO_RESERVED (0x28)
@@ -148,6 +149,8 @@
#define SIIHDMI_HOTPLUG_HANDLER_TIMEOUT (0x32)
#define SIIHDMI_VERSION_FLAG_VIRTUAL (1 << 7)
/* Input Bus and Pixel Repetition */
#define SIIHDMI_PIXEL_REPETITION_DUAL (1 << 0)
#define SIIHDMI_PIXEL_REPETITION_QUAD (3 << 0)
@@ -202,12 +205,34 @@
#define SIIHDMI_POWER_STATE_D3 (3 << 0)
#define SIIHDMI_WAKEUP_STATE_COLD (1 << 2)
/* Audio Frequency Sampling Length */
#define SIIHDMI_AUDIO_HANDLING_PASS_BASIC_AUDIO (0 << 0)
#define SIIHDMI_AUDIO_HANDLING_PASS_ALL_AUDIO_MODES (1 << 0)
#define SIIHDMI_AUDIO_HANDLING_DOWN_SAMPLE (2 << 0)
#define SIIHDMI_AUDIO_HANDLING_UNCHECKED (3 << 0)
/* Audio Interface Control */
#define SIIHDMI_AUDIO_DISABLE (0 << 6)
#define SIIHDMI_AUDIO_I2S_ENABLE (2 << 6)
#define SIIHDMI_AUDIO_SPDIF_ENABLE (1 << 6)
#define SIIHDMI_AUDIO_MUTE (1 << 4)
#define SIIHDMI_AUDIO_UNMUTE (0 << 4)
#define SIIHDMI_AUDIO_MUTE (1 << 4)
#define SIIHDMI_AUDIO_DISABLE (0 << 6)
#define SIIHDMI_AUDIO_I2S_ENABLE (2 << 6)
#define SIIHDMI_AUDIO_SPDIF_ENABLE (1 << 6)
/* Audio Sampling HBR */
#define SIIHDMI_AUDIO_SAMPLING_HBR_ENABLE (1 << 2)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_AUTO (0 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_32_KHZ (1 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_44_1_KHZ (2 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_48_KHZ (3 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_88_2_KHZ (4 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_96_KHZ (5 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_176_4_KHZ (6 << 3)
#define SIIHDMI_AUDIO_SAMPLING_FREQUENCY_192_KHZ (7 << 3)
#define SIIHDMI_AUDIO_SAMPLING_DEPTH_AUTO (0 << 6)
#define SIIHDMI_AUDIO_SAMPLING_DEPTH_16_BIT (1 << 6)
#define SIIHDMI_AUDIO_SAMPLING_DEPTH_20_BIT (2 << 6)
#define SIIHDMI_AUDIO_SAMPLING_DEPTH_24_BIT (3 << 6)
/* I²S Enable and Mapping */
#define SIIHDMI_I2S_MAPPING_SELECT_SD_CHANNEL_0 (0 << 0)
@@ -251,7 +276,9 @@
#define SIIHDMI_ISR_HOT_PLUG_EVENT (1 << 0)
#define SIIHDMI_ISR_RECEIVER_SENSE_EVENT (1 << 1)
#define SIIHDMI_ISR_CTRL_BUS_EVENT (1 << 2)
#define SIIHDMI_ISR_DISPLAY_ATTACHED (1 << 2)
#define SIIHDMI_ISR_CPI_EVENT (1 << 3)
#define SIIHDMI_ISR_RECEIVER_SENSE (1 << 3)
#define SIIHDMI_ISR_AUDIO_EVENT (1 << 4)
#define SIIHDMI_ISR_SECURITY_STATUS_CHANGED (1 << 5)
#define SIIHDMI_ISR_HDCP_VALUE_READY (1 << 6)
@@ -350,37 +377,40 @@ struct siihdmi_tx {
struct fb_info *info;
struct notifier_block nb;
struct delayed_work hotplug;
struct {
bool enabled;
struct delayed_work handler;
} hotplug;
u16 device_id;
u8 tpi;
u8 hdcp;
struct {
u8 *data;
u32 length;
#if defined(CONFIG_SYSFS)
struct bin_attribute attributes;
#endif
} edid;
bool tmds_enabled;
struct {
bool available;
#if defined(CONFIG_SYSFS)
struct bin_attribute attributes;
#endif
} audio;
u8 *edid;
u32 edid_length;
struct bin_attribute edid_attr;
struct bin_attribute audio_attr;
struct {
enum {
SINK_TYPE_DVI,
SINK_TYPE_HDMI,
} type;
/* sink information */
bool basic_audio;
enum {
CONNECTION_TYPE_DVI,
CONNECTION_TYPE_HDMI,
} connection_type;
enum {
PIXEL_MAPPING_EXACT,
PIXEL_MAPPING_UNDERSCANNED,
PIXEL_MAPPING_OVERSCANNED,
} pixel_mapping;
enum {
SCANNING_EXACT,
SCANNING_UNDERSCANNED,
SCANNING_OVERSCANNED,
} scanning;
int pt_overunder_behavior;
int ce_overunder_behavior;
int it_overunder_behavior;
/* preferred video mode (based on EDID) */
struct fb_videomode preferred;
struct fb_videomode preferred_mode;
} sink;
};
#endif

View File

@@ -42,7 +42,7 @@
#endif
#define CEA81_NO_DTDS_PRESENT (0x04)
#define CEA861_NO_DTDS_PRESENT (0x04)
static const u8 CEA861_OUI_REGISTRATION_ID_HDMI_LSB[] = { 0x03, 0x0C, 0x00 };
@@ -77,16 +77,18 @@ struct __packed cea861_vendor_specific_data_block {
u8 data[28];
};
#define CEA861_SVD_NATIVE_FLAG (1 << 7)
struct __packed cea861_video_data_block {
struct cea861_data_block_header header;
/* actual length in header, the index stops us from walking out of
/*
* actual length in header, the index stops us from walking out of
* spec but not out of bounds
*/
u8 svd[31];
};
struct __packed cea861_timing_block {
/* CEA Extension Header */
u8 tag;
@@ -211,6 +213,7 @@ enum scan_information {
SCAN_INFORMATION_UNKNOWN,
SCAN_INFORMATION_OVERSCANNED,
SCAN_INFORMATION_UNDERSCANNED,
SCAN_INFORMATION_RESERVED,
};
enum bar_info {

View File

@@ -1081,7 +1081,7 @@ extern const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *
extern const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
struct list_head *head);
extern const struct fb_videomode *fb_find_best_nearest_mode(const struct fb_videomode *mode,
extern const struct fb_videomode *fb_find_best_mode_at_most(const struct fb_videomode *mode,
struct list_head *head);
extern const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
struct list_head *head);