mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
video: udlfb: Kill off some magic constants for EDID sizing.
The edid length is fixed, so use the standard definition consistently. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
1a3e528cfc
commit
b9f03a3cd0
2 changed files with 7 additions and 14 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <video/udlfb.h>
|
#include <video/udlfb.h>
|
||||||
|
#include "edid.h"
|
||||||
|
|
||||||
static struct fb_fix_screeninfo dlfb_fix = {
|
static struct fb_fix_screeninfo dlfb_fix = {
|
||||||
.id = "udlfb",
|
.id = "udlfb",
|
||||||
|
@ -1169,7 +1170,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
|
||||||
if (info->dev) /* only use mutex if info has been registered */
|
if (info->dev) /* only use mutex if info has been registered */
|
||||||
mutex_lock(&info->lock);
|
mutex_lock(&info->lock);
|
||||||
|
|
||||||
edid = kmalloc(MAX_EDID_SIZE, GFP_KERNEL);
|
edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
|
||||||
if (!edid) {
|
if (!edid) {
|
||||||
result = -ENOMEM;
|
result = -ENOMEM;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1185,9 +1186,9 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
|
||||||
*/
|
*/
|
||||||
while (tries--) {
|
while (tries--) {
|
||||||
|
|
||||||
i = dlfb_get_edid(dev, edid, MAX_EDID_SIZE);
|
i = dlfb_get_edid(dev, edid, EDID_LENGTH);
|
||||||
|
|
||||||
if (i >= MIN_EDID_SIZE)
|
if (i >= EDID_LENGTH)
|
||||||
fb_edid_to_monspecs(edid, &info->monspecs);
|
fb_edid_to_monspecs(edid, &info->monspecs);
|
||||||
|
|
||||||
if (info->monspecs.modedb_len > 0) {
|
if (info->monspecs.modedb_len > 0) {
|
||||||
|
@ -1211,7 +1212,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
|
||||||
|
|
||||||
/* If that fails, use the default EDID we were handed */
|
/* If that fails, use the default EDID we were handed */
|
||||||
if (info->monspecs.modedb_len == 0) {
|
if (info->monspecs.modedb_len == 0) {
|
||||||
if (default_edid_size >= MIN_EDID_SIZE) {
|
if (default_edid_size >= EDID_LENGTH) {
|
||||||
fb_edid_to_monspecs(default_edid, &info->monspecs);
|
fb_edid_to_monspecs(default_edid, &info->monspecs);
|
||||||
if (info->monspecs.modedb_len > 0) {
|
if (info->monspecs.modedb_len > 0) {
|
||||||
memcpy(edid, default_edid, default_edid_size);
|
memcpy(edid, default_edid, default_edid_size);
|
||||||
|
@ -1360,9 +1361,7 @@ static ssize_t edid_store(
|
||||||
struct dlfb_data *dev = fb_info->par;
|
struct dlfb_data *dev = fb_info->par;
|
||||||
|
|
||||||
/* We only support write of entire EDID at once, no offset*/
|
/* We only support write of entire EDID at once, no offset*/
|
||||||
if ((src_size < MIN_EDID_SIZE) ||
|
if ((src_size != EDID_LENGTH) || (src_off != 0))
|
||||||
(src_size > MAX_EDID_SIZE) ||
|
|
||||||
(src_off != 0))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dlfb_setup_modes(dev, fb_info, src, src_size);
|
dlfb_setup_modes(dev, fb_info, src, src_size);
|
||||||
|
@ -1393,7 +1392,7 @@ static ssize_t metrics_reset_store(struct device *fbdev,
|
||||||
static struct bin_attribute edid_attr = {
|
static struct bin_attribute edid_attr = {
|
||||||
.attr.name = "edid",
|
.attr.name = "edid",
|
||||||
.attr.mode = 0666,
|
.attr.mode = 0666,
|
||||||
.size = MAX_EDID_SIZE,
|
.size = EDID_LENGTH,
|
||||||
.read = edid_show,
|
.read = edid_show,
|
||||||
.write = edid_store
|
.write = edid_store
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,9 +65,6 @@ struct dlfb_data {
|
||||||
#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
|
#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
|
||||||
#define WRITES_IN_FLIGHT (4)
|
#define WRITES_IN_FLIGHT (4)
|
||||||
|
|
||||||
#define MIN_EDID_SIZE 128
|
|
||||||
#define MAX_EDID_SIZE 128
|
|
||||||
|
|
||||||
#define MAX_VENDOR_DESCRIPTOR_SIZE 256
|
#define MAX_VENDOR_DESCRIPTOR_SIZE 256
|
||||||
|
|
||||||
#define GET_URB_TIMEOUT HZ
|
#define GET_URB_TIMEOUT HZ
|
||||||
|
@ -95,9 +92,6 @@ struct dlfb_data {
|
||||||
#define DL_ALIGN_UP(x, a) ALIGN(x, a)
|
#define DL_ALIGN_UP(x, a) ALIGN(x, a)
|
||||||
#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
|
#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
|
||||||
|
|
||||||
/* remove once this gets added to sysfs.h */
|
|
||||||
#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* udlfb is both a usb device, and a framebuffer device.
|
* udlfb is both a usb device, and a framebuffer device.
|
||||||
* They may exist at the same time, but during various stages
|
* They may exist at the same time, but during various stages
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue