* [PATCH 3/4] viafb: strip some structures
From: Florian Tobias Schandinat @ 2011-03-12 21:22 UTC (permalink / raw)
To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <1299964979-3391-1-git-send-email-FlorianSchandinat@gmx.de>
This patch removes some write-only variables from the device management
structures. Just a small cleanup.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
drivers/video/via/chip.h | 4 ----
drivers/video/via/hw.c | 11 -----------
2 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 3e8aacd..781f3aa 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -139,9 +139,6 @@ struct chip_information {
struct crt_setting_information {
int iga_path;
- int h_active;
- int v_active;
- int bpp;
int refresh_rate;
};
@@ -159,7 +156,6 @@ struct lvds_setting_information {
int h_active;
int v_active;
int bpp;
- int refresh_rate;
int lcd_panel_hres;
int lcd_panel_vres;
int display_method;
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 9ecf486..b0b0278 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2117,9 +2117,6 @@ void viafb_update_device_setting(int hres, int vres,
int bpp, int vmode_refresh, int flag)
{
if (flag = 0) {
- viaparinfo->crt_setting_info->h_active = hres;
- viaparinfo->crt_setting_info->v_active = vres;
- viaparinfo->crt_setting_info->bpp = bpp;
viaparinfo->crt_setting_info->refresh_rate vmode_refresh;
@@ -2129,13 +2126,9 @@ void viafb_update_device_setting(int hres, int vres,
viaparinfo->lvds_setting_info->h_active = hres;
viaparinfo->lvds_setting_info->v_active = vres;
viaparinfo->lvds_setting_info->bpp = bpp;
- viaparinfo->lvds_setting_info->refresh_rate - vmode_refresh;
viaparinfo->lvds_setting_info2->h_active = hres;
viaparinfo->lvds_setting_info2->v_active = vres;
viaparinfo->lvds_setting_info2->bpp = bpp;
- viaparinfo->lvds_setting_info2->refresh_rate - vmode_refresh;
} else {
if (viaparinfo->tmds_setting_info->iga_path = IGA2) {
@@ -2147,15 +2140,11 @@ void viafb_update_device_setting(int hres, int vres,
viaparinfo->lvds_setting_info->h_active = hres;
viaparinfo->lvds_setting_info->v_active = vres;
viaparinfo->lvds_setting_info->bpp = bpp;
- viaparinfo->lvds_setting_info->refresh_rate - vmode_refresh;
}
if (IGA2 = viaparinfo->lvds_setting_info2->iga_path) {
viaparinfo->lvds_setting_info2->h_active = hres;
viaparinfo->lvds_setting_info2->v_active = vres;
viaparinfo->lvds_setting_info2->bpp = bpp;
- viaparinfo->lvds_setting_info2->refresh_rate - vmode_refresh;
}
}
}
--
1.6.3.2
^ permalink raw reply related
* [PATCH 2/4] viafb: remove unused data_mode and device_type
From: Florian Tobias Schandinat @ 2011-03-12 21:22 UTC (permalink / raw)
To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <1299964979-3391-1-git-send-email-FlorianSchandinat@gmx.de>
This patch is a little cleanup for the chip_info structures.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
drivers/video/via/chip.h | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index a2f6200..3e8aacd 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -110,16 +110,13 @@
struct tmds_chip_information {
int tmds_chip_name;
int tmds_chip_slave_addr;
- int data_mode;
int output_interface;
int i2c_port;
- int device_type;
};
struct lvds_chip_information {
int lvds_chip_name;
int lvds_chip_slave_addr;
- int data_mode;
int output_interface;
int i2c_port;
};
--
1.6.3.2
^ permalink raw reply related
* [PATCH 1/4] viafb: kill lcd_panel_id
From: Florian Tobias Schandinat @ 2011-03-12 21:22 UTC (permalink / raw)
To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat
In-Reply-To: <1299964979-3391-1-git-send-email-FlorianSchandinat@gmx.de>
This patch removes all internal uses of another mostly artificial
value. It does duplicate the information of the maximum resolution and
it is not flexible as only a few resolutions exist. Hence it is better
to remove it and clean the mess up.
No runtime change expected.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
drivers/video/via/chip.h | 2 -
drivers/video/via/lcd.c | 50 -------------------------------------
drivers/video/via/tblDPASetting.c | 23 -----------------
drivers/video/via/tblDPASetting.h | 2 -
drivers/video/via/vt1636.c | 43 +++++++++----------------------
5 files changed, 13 insertions(+), 107 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 48f1342..a2f6200 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -163,7 +163,6 @@ struct lvds_setting_information {
int v_active;
int bpp;
int refresh_rate;
- int lcd_panel_id;
int lcd_panel_hres;
int lcd_panel_vres;
int display_method;
@@ -188,7 +187,6 @@ struct GFX_DPA_SETTING {
};
struct VT1636_DPA_SETTING {
- int PanelSizeID;
u8 CLK_SEL_ST1;
u8 CLK_SEL_ST2;
};
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 2ca3bb8..d75e3f8 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -97,8 +97,6 @@ void __devinit viafb_init_lcd_size(void)
DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n");
fp_id_to_vindex(viafb_lcd_panel_id);
- viaparinfo->lvds_setting_info2->lcd_panel_id - viaparinfo->lvds_setting_info->lcd_panel_id;
viaparinfo->lvds_setting_info2->lcd_panel_hres viaparinfo->lvds_setting_info->lcd_panel_hres;
viaparinfo->lvds_setting_info2->lcd_panel_vres @@ -205,176 +203,132 @@ static void __devinit fp_id_to_vindex(int panel_id)
case 0x0:
viaparinfo->lvds_setting_info->lcd_panel_hres = 640;
viaparinfo->lvds_setting_info->lcd_panel_vres = 480;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID0_640X480;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x1:
viaparinfo->lvds_setting_info->lcd_panel_hres = 800;
viaparinfo->lvds_setting_info->lcd_panel_vres = 600;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID1_800X600;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x2:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1024;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID2_1024X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x3:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID3_1280X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x4:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1024;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID4_1280X1024;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x5:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1400;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1050;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID5_1400X1050;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x6:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1600;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1200;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID6_1600X1200;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x8:
viaparinfo->lvds_setting_info->lcd_panel_hres = 800;
viaparinfo->lvds_setting_info->lcd_panel_vres = 480;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_IDA_800X480;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x9:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1024;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID2_1024X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0xA:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1024;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID2_1024X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0xB:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1024;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID2_1024X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0xC:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID3_1280X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0xD:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1024;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID4_1280X1024;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0xE:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1400;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1050;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID5_1400X1050;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0xF:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1600;
viaparinfo->lvds_setting_info->lcd_panel_vres = 1200;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID6_1600X1200;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0x10:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1366;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID7_1366X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0x11:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1024;
viaparinfo->lvds_setting_info->lcd_panel_vres = 600;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID8_1024X600;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x12:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID3_1280X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x13:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 800;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID9_1280X800;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
case 0x14:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1360;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_IDB_1360X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0x15:
viaparinfo->lvds_setting_info->lcd_panel_hres = 1280;
viaparinfo->lvds_setting_info->lcd_panel_vres = 768;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID3_1280X768;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 1;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
case 0x16:
viaparinfo->lvds_setting_info->lcd_panel_hres = 480;
viaparinfo->lvds_setting_info->lcd_panel_vres = 640;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_IDC_480X640;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
break;
@@ -382,16 +336,12 @@ static void __devinit fp_id_to_vindex(int panel_id)
/* OLPC XO-1.5 panel */
viaparinfo->lvds_setting_info->lcd_panel_hres = 1200;
viaparinfo->lvds_setting_info->lcd_panel_vres = 900;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_IDD_1200X900;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 0;
break;
default:
viaparinfo->lvds_setting_info->lcd_panel_hres = 800;
viaparinfo->lvds_setting_info->lcd_panel_vres = 600;
- viaparinfo->lvds_setting_info->lcd_panel_id - LCD_PANEL_ID1_800X600;
viaparinfo->lvds_setting_info->device_lcd_dualedge = 0;
viaparinfo->lvds_setting_info->LCDDithering = 1;
}
diff --git a/drivers/video/via/tblDPASetting.c b/drivers/video/via/tblDPASetting.c
index 0c4c8cc..73bb554 100644
--- a/drivers/video/via/tblDPASetting.c
+++ b/drivers/video/via/tblDPASetting.c
@@ -20,17 +20,6 @@
*/
#include "global.h"
-/* For VT3324: */
-struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3324[] = {
- /* Panel ID, CLK_SEL_ST1[09], CLK_SEL_ST2[08] */
- {LCD_PANEL_ID0_640X480, 0x00, 0x00}, /* For 640x480 */
- {LCD_PANEL_ID1_800X600, 0x00, 0x00}, /* For 800x600 */
- {LCD_PANEL_ID2_1024X768, 0x00, 0x00}, /* For 1024x768 */
- {LCD_PANEL_ID3_1280X768, 0x00, 0x00}, /* For 1280x768 */
- {LCD_PANEL_ID4_1280X1024, 0x00, 0x00}, /* For 1280x1024 */
- {LCD_PANEL_ID5_1400X1050, 0x00, 0x00}, /* For 1400x1050 */
- {LCD_PANEL_ID6_1600X1200, 0x0B, 0x03} /* For 1600x1200 */
-};
struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[] = {
/* ClkRange, DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1,
@@ -57,18 +46,6 @@ struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[] = {
0x00},
};
-/* For VT3327: */
-struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3327[] = {
- /* Panel ID, CLK_SEL_ST1[09], CLK_SEL_ST2[08] */
- {LCD_PANEL_ID0_640X480, 0x00, 0x00}, /* For 640x480 */
- {LCD_PANEL_ID1_800X600, 0x00, 0x00}, /* For 800x600 */
- {LCD_PANEL_ID2_1024X768, 0x00, 0x00}, /* For 1024x768 */
- {LCD_PANEL_ID3_1280X768, 0x00, 0x00}, /* For 1280x768 */
- {LCD_PANEL_ID4_1280X1024, 0x00, 0x00}, /* For 1280x1024 */
- {LCD_PANEL_ID5_1400X1050, 0x00, 0x00}, /* For 1400x1050 */
- {LCD_PANEL_ID6_1600X1200, 0x00, 0x00} /* For 1600x1200 */
-};
-
struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3327[] = {
/* ClkRange,DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1,
DVP1Driving, DFPHigh, DFPLow */
diff --git a/drivers/video/via/tblDPASetting.h b/drivers/video/via/tblDPASetting.h
index b065a83..6db6151 100644
--- a/drivers/video/via/tblDPASetting.h
+++ b/drivers/video/via/tblDPASetting.h
@@ -38,9 +38,7 @@ enum DPA_RANGE {
DPA_CLK_RANGE_150M
};
-extern struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3324[7];
extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[6];
-extern struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3327[7];
extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3327[];
extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3364[6];
diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c
index 60e4192..ee2903b 100644
--- a/drivers/video/via/vt1636.c
+++ b/drivers/video/via/vt1636.c
@@ -167,22 +167,6 @@ static int get_clk_range_index(u32 Clk)
return DPA_CLK_RANGE_150M;
}
-static int get_lvds_dpa_setting_index(int panel_size_id,
- struct VT1636_DPA_SETTING *p_vt1636_dpasetting_tbl,
- int tbl_size)
-{
- int i;
-
- for (i = 0; i < tbl_size; i++) {
- if (panel_size_id = p_vt1636_dpasetting_tbl->PanelSizeID)
- return i;
-
- p_vt1636_dpasetting_tbl++;
- }
-
- return 0;
-}
-
static void set_dpa_vt1636(struct lvds_setting_information
*plvds_setting_info, struct lvds_chip_information *plvds_chip_info,
struct VT1636_DPA_SETTING *p_vt1636_dpa_setting)
@@ -206,7 +190,9 @@ void viafb_vt1636_patch_skew_on_vt3324(
struct lvds_setting_information *plvds_setting_info,
struct lvds_chip_information *plvds_chip_info)
{
- int index, size;
+ struct VT1636_DPA_SETTING dpa = {0x00, 0x00}, dpa_16x12 = {0x0B, 0x03},
+ *pdpa;
+ int index;
DEBUG_MSG(KERN_INFO "viafb_vt1636_patch_skew_on_vt3324.\n");
@@ -216,19 +202,21 @@ void viafb_vt1636_patch_skew_on_vt3324(
&GFX_DPA_SETTING_TBL_VT3324[index]);
/* LVDS Transmitter DPA settings: */
- size = ARRAY_SIZE(VT1636_DPA_SETTING_TBL_VT3324);
- index - get_lvds_dpa_setting_index(plvds_setting_info->lcd_panel_id,
- VT1636_DPA_SETTING_TBL_VT3324, size);
- set_dpa_vt1636(plvds_setting_info, plvds_chip_info,
- &VT1636_DPA_SETTING_TBL_VT3324[index]);
+ if (plvds_setting_info->lcd_panel_hres = 1600 &&
+ plvds_setting_info->lcd_panel_vres = 1200)
+ pdpa = &dpa_16x12;
+ else
+ pdpa = &dpa;
+
+ set_dpa_vt1636(plvds_setting_info, plvds_chip_info, pdpa);
}
void viafb_vt1636_patch_skew_on_vt3327(
struct lvds_setting_information *plvds_setting_info,
struct lvds_chip_information *plvds_chip_info)
{
- int index, size;
+ struct VT1636_DPA_SETTING dpa = {0x00, 0x00};
+ int index;
DEBUG_MSG(KERN_INFO "viafb_vt1636_patch_skew_on_vt3327.\n");
@@ -238,12 +226,7 @@ void viafb_vt1636_patch_skew_on_vt3327(
&GFX_DPA_SETTING_TBL_VT3327[index]);
/* LVDS Transmitter DPA settings: */
- size = ARRAY_SIZE(VT1636_DPA_SETTING_TBL_VT3327);
- index - get_lvds_dpa_setting_index(plvds_setting_info->lcd_panel_id,
- VT1636_DPA_SETTING_TBL_VT3327, size);
- set_dpa_vt1636(plvds_setting_info, plvds_chip_info,
- &VT1636_DPA_SETTING_TBL_VT3327[index]);
+ set_dpa_vt1636(plvds_setting_info, plvds_chip_info, &dpa);
}
void viafb_vt1636_patch_skew_on_vt3364(
--
1.6.3.2
^ permalink raw reply related
* viafb cleanup patches
From: Florian Tobias Schandinat @ 2011-03-12 21:22 UTC (permalink / raw)
To: linux-fbdev; +Cc: linux-kernel
This patch series contains random cleanups like removing unused or
nearly unused variables, avoid artificial magic values as well as
some common initialization cleanups.
Really no interesting stuff and nothing that is expected to
introduce regressions.
Best regards,
Florian Tobias Schandinat
^ permalink raw reply
* Re: [PATCH] video via: make local variables static
From: Florian Tobias Schandinat @ 2011-03-12 15:34 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <20110303100008.2a288941@nehalam>
Stephen Hemminger schrieb:
> Many local variables should be declared static.
> Found by sparse, compile tested only.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied. Thanks,
Florian Tobias Schandinat
>
> ---
>
> drivers/video/via/hw.c | 2
> drivers/video/via/lcd.c | 10 ++--
> drivers/video/via/via_i2c.c | 2
> drivers/video/via/viafbdev.c | 6 +-
> drivers/video/via/viamode.c | 100 +++++++++++++++++++++----------------------
> 5 files changed, 61 insertions(+), 59 deletions(-)
>
> --- a/drivers/video/via/lcd.c 2011-03-03 09:43:23.529389476 -0800
> +++ b/drivers/video/via/lcd.c 2011-03-03 09:44:07.241570863 -0800
> @@ -26,10 +26,12 @@
>
> /* CLE266 Software Power Sequence */
> /* {Mask}, {Data}, {Delay} */
> -int PowerSequenceOn[3][3] = { {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06},
> - {0x19, 0x1FE, 0x01} };
> -int PowerSequenceOff[3][3] = { {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00},
> - {0xD2, 0x19, 0x01} };
> +static const int PowerSequenceOn[3][3] = {
> + {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06}, {0x19, 0x1FE, 0x01}
> +};
> +static const int PowerSequenceOff[3][3] = {
> + {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00}, {0xD2, 0x19, 0x01}
> +};
>
> static struct _lcd_scaling_factor lcd_scaling_factor = {
> /* LCD Horizontal Scaling Factor Register */
> --- a/drivers/video/via/hw.c 2011-03-03 09:09:10.536603676 -0800
> +++ b/drivers/video/via/hw.c 2011-03-03 09:44:07.241570863 -0800
> @@ -751,7 +751,7 @@ void viafb_unlock_crt(void)
> viafb_write_reg_mask(CR47, VIACR, 0, BIT0);
> }
>
> -void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
> +static void write_dac_reg(u8 index, u8 r, u8 g, u8 b)
> {
> outb(index, LUT_INDEX_WRITE);
> outb(r, LUT_DATA);
> --- a/drivers/video/via/via_i2c.c 2011-03-03 09:09:10.544604009 -0800
> +++ b/drivers/video/via/via_i2c.c 2011-03-03 09:44:07.245570884 -0800
> @@ -32,7 +32,7 @@
> */
> #define VIAFB_NUM_I2C 5
> static struct via_i2c_stuff via_i2c_par[VIAFB_NUM_I2C];
> -struct viafb_dev *i2c_vdev; /* Passed in from core */
> +static struct viafb_dev *i2c_vdev; /* Passed in from core */
>
> static void via_i2c_setscl(void *data, int state)
> {
> --- a/drivers/video/via/viafbdev.c 2011-03-03 09:09:10.528603482 -0800
> +++ b/drivers/video/via/viafbdev.c 2011-03-03 09:44:07.245570884 -0800
> @@ -43,11 +43,11 @@ static int viafb_second_size;
> static int viafb_accel = 1;
>
> /* Added for specifying active devices.*/
> -char *viafb_active_dev;
> +static char *viafb_active_dev;
>
> /*Added for specify lcd output port*/
> -char *viafb_lcd_port = "";
> -char *viafb_dvi_port = "";
> +static char *viafb_lcd_port = "";
> +static char *viafb_dvi_port = "";
>
> static void retrieve_device_setting(struct viafb_ioctl_setting
> *setting_info);
> --- a/drivers/video/via/viamode.c 2011-03-03 09:45:33.462159061 -0800
> +++ b/drivers/video/via/viamode.c 2011-03-03 09:46:28.826662504 -0800
> @@ -443,7 +443,7 @@ struct VPITTable VPIT = {
> /********************/
>
> /* 480x640 */
> -struct crt_mode_table CRTM480x640[] = {
> +static struct crt_mode_table CRTM480x640[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_25_175M, M480X640_R60_HSP, M480X640_R60_VSP,
> @@ -451,7 +451,7 @@ struct crt_mode_table CRTM480x640[] = {
> };
>
> /* 640x480*/
> -struct crt_mode_table CRTM640x480[] = {
> +static struct crt_mode_table CRTM640x480[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_25_175M, M640X480_R60_HSP, M640X480_R60_VSP,
> @@ -469,7 +469,7 @@ struct crt_mode_table CRTM640x480[] = {
> };
>
> /*720x480 (GTF)*/
> -struct crt_mode_table CRTM720x480[] = {
> +static struct crt_mode_table CRTM720x480[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_26_880M, M720X480_R60_HSP, M720X480_R60_VSP,
> @@ -478,7 +478,7 @@ struct crt_mode_table CRTM720x480[] = {
> };
>
> /*720x576 (GTF)*/
> -struct crt_mode_table CRTM720x576[] = {
> +static struct crt_mode_table CRTM720x576[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_32_668M, M720X576_R60_HSP, M720X576_R60_VSP,
> @@ -486,7 +486,7 @@ struct crt_mode_table CRTM720x576[] = {
> };
>
> /* 800x480 (CVT) */
> -struct crt_mode_table CRTM800x480[] = {
> +static struct crt_mode_table CRTM800x480[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_29_581M, M800X480_R60_HSP, M800X480_R60_VSP,
> @@ -494,7 +494,7 @@ struct crt_mode_table CRTM800x480[] = {
> };
>
> /* 800x600*/
> -struct crt_mode_table CRTM800x600[] = {
> +static struct crt_mode_table CRTM800x600[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_40_000M, M800X600_R60_HSP, M800X600_R60_VSP,
> @@ -512,7 +512,7 @@ struct crt_mode_table CRTM800x600[] = {
> };
>
> /* 848x480 (CVT) */
> -struct crt_mode_table CRTM848x480[] = {
> +static struct crt_mode_table CRTM848x480[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_31_500M, M848X480_R60_HSP, M848X480_R60_VSP,
> @@ -520,7 +520,7 @@ struct crt_mode_table CRTM848x480[] = {
> };
>
> /*856x480 (GTF) convert to 852x480*/
> -struct crt_mode_table CRTM852x480[] = {
> +static struct crt_mode_table CRTM852x480[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_31_728M, M852X480_R60_HSP, M852X480_R60_VSP,
> @@ -528,7 +528,7 @@ struct crt_mode_table CRTM852x480[] = {
> };
>
> /*1024x512 (GTF)*/
> -struct crt_mode_table CRTM1024x512[] = {
> +static struct crt_mode_table CRTM1024x512[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_41_291M, M1024X512_R60_HSP, M1024X512_R60_VSP,
> @@ -537,7 +537,7 @@ struct crt_mode_table CRTM1024x512[] = {
> };
>
> /* 1024x600*/
> -struct crt_mode_table CRTM1024x600[] = {
> +static struct crt_mode_table CRTM1024x600[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_48_875M, M1024X600_R60_HSP, M1024X600_R60_VSP,
> @@ -545,7 +545,7 @@ struct crt_mode_table CRTM1024x600[] = {
> };
>
> /* 1024x768*/
> -struct crt_mode_table CRTM1024x768[] = {
> +static struct crt_mode_table CRTM1024x768[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_65_000M, M1024X768_R60_HSP, M1024X768_R60_VSP,
> @@ -559,7 +559,7 @@ struct crt_mode_table CRTM1024x768[] = {
> };
>
> /* 1152x864*/
> -struct crt_mode_table CRTM1152x864[] = {
> +static struct crt_mode_table CRTM1152x864[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_75, CLK_108_000M, M1152X864_R75_HSP, M1152X864_R75_VSP,
> @@ -568,7 +568,7 @@ struct crt_mode_table CRTM1152x864[] = {
> };
>
> /* 1280x720 (HDMI 720P)*/
> -struct crt_mode_table CRTM1280x720[] = {
> +static struct crt_mode_table CRTM1280x720[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_74_481M, M1280X720_R60_HSP, M1280X720_R60_VSP,
> @@ -578,7 +578,7 @@ struct crt_mode_table CRTM1280x720[] = {
> };
>
> /*1280x768 (GTF)*/
> -struct crt_mode_table CRTM1280x768[] = {
> +static struct crt_mode_table CRTM1280x768[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_80_136M, M1280X768_R60_HSP, M1280X768_R60_VSP,
> @@ -588,7 +588,7 @@ struct crt_mode_table CRTM1280x768[] = {
> };
>
> /* 1280x800 (CVT) */
> -struct crt_mode_table CRTM1280x800[] = {
> +static struct crt_mode_table CRTM1280x800[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_83_375M, M1280X800_R60_HSP, M1280X800_R60_VSP,
> @@ -596,7 +596,7 @@ struct crt_mode_table CRTM1280x800[] = {
> };
>
> /*1280x960*/
> -struct crt_mode_table CRTM1280x960[] = {
> +static struct crt_mode_table CRTM1280x960[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_108_000M, M1280X960_R60_HSP, M1280X960_R60_VSP,
> @@ -604,7 +604,7 @@ struct crt_mode_table CRTM1280x960[] = {
> };
>
> /* 1280x1024*/
> -struct crt_mode_table CRTM1280x1024[] = {
> +static struct crt_mode_table CRTM1280x1024[] = {
> /*r_rate,vclk,,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_108_000M, M1280X1024_R60_HSP, M1280X1024_R60_VSP,
> @@ -618,7 +618,7 @@ struct crt_mode_table CRTM1280x1024[] > };
>
> /* 1368x768 (GTF) */
> -struct crt_mode_table CRTM1368x768[] = {
> +static struct crt_mode_table CRTM1368x768[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP,
> @@ -626,7 +626,7 @@ struct crt_mode_table CRTM1368x768[] = {
> };
>
> /*1440x1050 (GTF)*/
> -struct crt_mode_table CRTM1440x1050[] = {
> +static struct crt_mode_table CRTM1440x1050[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_125_104M, M1440X1050_R60_HSP, M1440X1050_R60_VSP,
> @@ -634,7 +634,7 @@ struct crt_mode_table CRTM1440x1050[] > };
>
> /* 1600x1200*/
> -struct crt_mode_table CRTM1600x1200[] = {
> +static struct crt_mode_table CRTM1600x1200[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_162_000M, M1600X1200_R60_HSP, M1600X1200_R60_VSP,
> @@ -646,7 +646,7 @@ struct crt_mode_table CRTM1600x1200[] > };
>
> /* 1680x1050 (CVT) */
> -struct crt_mode_table CRTM1680x1050[] = {
> +static struct crt_mode_table CRTM1680x1050[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_146_760M, M1680x1050_R60_HSP, M1680x1050_R60_VSP,
> @@ -657,7 +657,7 @@ struct crt_mode_table CRTM1680x1050[] > };
>
> /* 1680x1050 (CVT Reduce Blanking) */
> -struct crt_mode_table CRTM1680x1050_RB[] = {
> +static struct crt_mode_table CRTM1680x1050_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_119_000M, M1680x1050_RB_R60_HSP,
> @@ -666,7 +666,7 @@ struct crt_mode_table CRTM1680x1050_RB[]
> };
>
> /* 1920x1080 (CVT)*/
> -struct crt_mode_table CRTM1920x1080[] = {
> +static struct crt_mode_table CRTM1920x1080[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_172_798M, M1920X1080_R60_HSP, M1920X1080_R60_VSP,
> @@ -674,7 +674,7 @@ struct crt_mode_table CRTM1920x1080[] > };
>
> /* 1920x1080 (CVT with Reduce Blanking) */
> -struct crt_mode_table CRTM1920x1080_RB[] = {
> +static struct crt_mode_table CRTM1920x1080_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_138_400M, M1920X1080_RB_R60_HSP,
> @@ -683,7 +683,7 @@ struct crt_mode_table CRTM1920x1080_RB[]
> };
>
> /* 1920x1440*/
> -struct crt_mode_table CRTM1920x1440[] = {
> +static struct crt_mode_table CRTM1920x1440[] = {
> /*r_rate,vclk,hsp,vsp */
> /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_234_000M, M1920X1440_R60_HSP, M1920X1440_R60_VSP,
> @@ -694,7 +694,7 @@ struct crt_mode_table CRTM1920x1440[] > };
>
> /* 1400x1050 (CVT) */
> -struct crt_mode_table CRTM1400x1050[] = {
> +static struct crt_mode_table CRTM1400x1050[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_121_750M, M1400X1050_R60_HSP, M1400X1050_R60_VSP,
> @@ -705,7 +705,7 @@ struct crt_mode_table CRTM1400x1050[] > };
>
> /* 1400x1050 (CVT Reduce Blanking) */
> -struct crt_mode_table CRTM1400x1050_RB[] = {
> +static struct crt_mode_table CRTM1400x1050_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_101_000M, M1400X1050_RB_R60_HSP,
> @@ -714,7 +714,7 @@ struct crt_mode_table CRTM1400x1050_RB[]
> };
>
> /* 960x600 (CVT) */
> -struct crt_mode_table CRTM960x600[] = {
> +static struct crt_mode_table CRTM960x600[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_45_250M, M960X600_R60_HSP, M960X600_R60_VSP,
> @@ -722,7 +722,7 @@ struct crt_mode_table CRTM960x600[] = {
> };
>
> /* 1000x600 (GTF) */
> -struct crt_mode_table CRTM1000x600[] = {
> +static struct crt_mode_table CRTM1000x600[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_48_000M, M1000X600_R60_HSP, M1000X600_R60_VSP,
> @@ -730,7 +730,7 @@ struct crt_mode_table CRTM1000x600[] = {
> };
>
> /* 1024x576 (GTF) */
> -struct crt_mode_table CRTM1024x576[] = {
> +static struct crt_mode_table CRTM1024x576[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_46_996M, M1024X576_R60_HSP, M1024X576_R60_VSP,
> @@ -738,7 +738,7 @@ struct crt_mode_table CRTM1024x576[] = {
> };
>
> /* 1088x612 (CVT) */
> -struct crt_mode_table CRTM1088x612[] = {
> +static struct crt_mode_table CRTM1088x612[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_52_977M, M1088X612_R60_HSP, M1088X612_R60_VSP,
> @@ -746,7 +746,7 @@ struct crt_mode_table CRTM1088x612[] = {
> };
>
> /* 1152x720 (CVT) */
> -struct crt_mode_table CRTM1152x720[] = {
> +static struct crt_mode_table CRTM1152x720[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_66_750M, M1152X720_R60_HSP, M1152X720_R60_VSP,
> @@ -754,7 +754,7 @@ struct crt_mode_table CRTM1152x720[] = {
> };
>
> /* 1200x720 (GTF) */
> -struct crt_mode_table CRTM1200x720[] = {
> +static struct crt_mode_table CRTM1200x720[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_70_159M, M1200X720_R60_HSP, M1200X720_R60_VSP,
> @@ -762,7 +762,7 @@ struct crt_mode_table CRTM1200x720[] = {
> };
>
> /* 1200x900 (DCON) */
> -struct crt_mode_table DCON1200x900[] = {
> +static struct crt_mode_table DCON1200x900[] = {
> /* r_rate, vclk, hsp, vsp */
> {REFRESH_60, CLK_57_275M, M1200X900_R60_HSP, M1200X900_R60_VSP,
> /* The correct htotal is 1240, but this doesn't raster on VX855. */
> @@ -772,7 +772,7 @@ struct crt_mode_table DCON1200x900[] = {
> };
>
> /* 1280x600 (GTF) */
> -struct crt_mode_table CRTM1280x600[] = {
> +static struct crt_mode_table CRTM1280x600[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_61_500M, M1280x600_R60_HSP, M1280x600_R60_VSP,
> @@ -780,7 +780,7 @@ struct crt_mode_table CRTM1280x600[] = {
> };
>
> /* 1360x768 (CVT) */
> -struct crt_mode_table CRTM1360x768[] = {
> +static struct crt_mode_table CRTM1360x768[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_84_750M, M1360X768_R60_HSP, M1360X768_R60_VSP,
> @@ -788,7 +788,7 @@ struct crt_mode_table CRTM1360x768[] = {
> };
>
> /* 1360x768 (CVT Reduce Blanking) */
> -struct crt_mode_table CRTM1360x768_RB[] = {
> +static struct crt_mode_table CRTM1360x768_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_72_000M, M1360X768_RB_R60_HSP,
> @@ -797,7 +797,7 @@ struct crt_mode_table CRTM1360x768_RB[]
> };
>
> /* 1366x768 (GTF) */
> -struct crt_mode_table CRTM1366x768[] = {
> +static struct crt_mode_table CRTM1366x768[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP,
> @@ -807,7 +807,7 @@ struct crt_mode_table CRTM1366x768[] = {
> };
>
> /* 1440x900 (CVT) */
> -struct crt_mode_table CRTM1440x900[] = {
> +static struct crt_mode_table CRTM1440x900[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_106_500M, M1440X900_R60_HSP, M1440X900_R60_VSP,
> @@ -817,7 +817,7 @@ struct crt_mode_table CRTM1440x900[] = {
> };
>
> /* 1440x900 (CVT Reduce Blanking) */
> -struct crt_mode_table CRTM1440x900_RB[] = {
> +static struct crt_mode_table CRTM1440x900_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_88_750M, M1440X900_RB_R60_HSP,
> @@ -826,7 +826,7 @@ struct crt_mode_table CRTM1440x900_RB[]
> };
>
> /* 1600x900 (CVT) */
> -struct crt_mode_table CRTM1600x900[] = {
> +static struct crt_mode_table CRTM1600x900[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_118_840M, M1600X900_R60_HSP, M1600X900_R60_VSP,
> @@ -834,7 +834,7 @@ struct crt_mode_table CRTM1600x900[] = {
> };
>
> /* 1600x900 (CVT Reduce Blanking) */
> -struct crt_mode_table CRTM1600x900_RB[] = {
> +static struct crt_mode_table CRTM1600x900_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_97_750M, M1600X900_RB_R60_HSP,
> @@ -843,7 +843,7 @@ struct crt_mode_table CRTM1600x900_RB[]
> };
>
> /* 1600x1024 (GTF) */
> -struct crt_mode_table CRTM1600x1024[] = {
> +static struct crt_mode_table CRTM1600x1024[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_136_700M, M1600X1024_R60_HSP, M1600X1024_R60_VSP,
> @@ -851,7 +851,7 @@ struct crt_mode_table CRTM1600x1024[] > };
>
> /* 1792x1344 (DMT) */
> -struct crt_mode_table CRTM1792x1344[] = {
> +static struct crt_mode_table CRTM1792x1344[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_204_000M, M1792x1344_R60_HSP, M1792x1344_R60_VSP,
> @@ -859,7 +859,7 @@ struct crt_mode_table CRTM1792x1344[] > };
>
> /* 1856x1392 (DMT) */
> -struct crt_mode_table CRTM1856x1392[] = {
> +static struct crt_mode_table CRTM1856x1392[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_218_500M, M1856x1392_R60_HSP, M1856x1392_R60_VSP,
> @@ -867,7 +867,7 @@ struct crt_mode_table CRTM1856x1392[] > };
>
> /* 1920x1200 (CVT) */
> -struct crt_mode_table CRTM1920x1200[] = {
> +static struct crt_mode_table CRTM1920x1200[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_193_295M, M1920X1200_R60_HSP, M1920X1200_R60_VSP,
> @@ -875,7 +875,7 @@ struct crt_mode_table CRTM1920x1200[] > };
>
> /* 1920x1200 (CVT with Reduce Blanking) */
> -struct crt_mode_table CRTM1920x1200_RB[] = {
> +static struct crt_mode_table CRTM1920x1200_RB[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_153_920M, M1920X1200_RB_R60_HSP,
> @@ -884,14 +884,14 @@ struct crt_mode_table CRTM1920x1200_RB[]
> };
>
> /* 2048x1536 (CVT) */
> -struct crt_mode_table CRTM2048x1536[] = {
> +static struct crt_mode_table CRTM2048x1536[] = {
> /* r_rate, vclk, hsp, vsp */
> /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */
> {REFRESH_60, CLK_267_250M, M2048x1536_R60_HSP, M2048x1536_R60_VSP,
> {2800, 2048, 2048, 752, 2200, 224, 1592, 1536, 1536, 56, 1539, 4} }
> };
>
> -struct VideoModeTable viafb_modes[] = {
> +static struct VideoModeTable viafb_modes[] = {
> /* Display : 480x640 (GTF) */
> {CRTM480x640, ARRAY_SIZE(CRTM480x640)},
>
> @@ -1016,7 +1016,7 @@ struct VideoModeTable viafb_modes[] = {
> {CRTM1400x1050, ARRAY_SIZE(CRTM1400x1050)}
> };
>
> -struct VideoModeTable viafb_rb_modes[] = {
> +static struct VideoModeTable viafb_rb_modes[] = {
> /* Display : 1360x768 (CVT Reduce Blanking) */
> {CRTM1360x768_RB, ARRAY_SIZE(CRTM1360x768_RB)},
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH] video via: fix iomem access
From: Florian Tobias Schandinat @ 2011-03-12 15:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-fbdev, linux-kernel
In-Reply-To: <20110303095901.2a283be0@nehalam>
Stephen Hemminger schrieb:
> This driver is not respecting the iomem memory space restrictions
> and does direct access. This works on x86 but is non-portable and
> should not be done. Converted memcpy() of 2 to readw.
> Last post increment of romptr was unnecessary since pointer never
> used after that.
>
> Found by sparse, compile tested only.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied (although it does not make a difference as viafb is x86 only). Thanks,
Florian Tobias Schandinat
>
> ---
> drivers/video/via/lcd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/drivers/video/via/lcd.c 2011-03-03 09:09:10.552604209 -0800
> +++ b/drivers/video/via/lcd.c 2011-03-03 09:56:12.144398571 -0800
> @@ -1064,34 +1064,33 @@ static struct display_timing lcd_centeri
>
> bool viafb_lcd_get_mobile_state(bool *mobile)
> {
> - unsigned char *romptr, *tableptr;
> + unsigned char __iomem *romptr, *tableptr, *biosptr;
> u8 core_base;
> - unsigned char *biosptr;
> /* Rom address */
> - u32 romaddr = 0x000C0000;
> - u16 start_pattern = 0;
> + const u32 romaddr = 0x000C0000;
> + u16 start_pattern;
>
> biosptr = ioremap(romaddr, 0x10000);
> + start_pattern = readw(biosptr);
>
> - memcpy(&start_pattern, biosptr, 2);
> /* Compare pattern */
> if (start_pattern = 0xAA55) {
> /* Get the start of Table */
> /* 0x1B means BIOS offset position */
> romptr = biosptr + 0x1B;
> - tableptr = biosptr + *((u16 *) romptr);
> + tableptr = biosptr + readw(romptr);
>
> /* Get the start of biosver structure */
> /* 18 means BIOS version position. */
> romptr = tableptr + 18;
> - romptr = biosptr + *((u16 *) romptr);
> + romptr = biosptr + readw(romptr);
>
> /* The offset should be 44, but the
> actual image is less three char. */
> /* pRom += 44; */
> romptr += 41;
>
> - core_base = *romptr++;
> + core_base = readb(romptr);
>
> if (core_base & 0x8)
> *mobile = false;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH] video/via: drop deprecated (and unused) i2c_adapter.id
From: Florian Tobias Schandinat @ 2011-03-12 15:31 UTC (permalink / raw)
To: Peter Huewe; +Cc: linux-fbdev, linux-kernel, kernel-janitors, Jean Delvare
In-Reply-To: <1295991264-8640-1-git-send-email-peterhuewe@gmx.de>
Peter Huewe schrieb:
> This patch removes an assignment to the deprecated i2c_adapter.id
> field. Since the field isn't used anywhere else in the driver it is
> save to remove it.
>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Applied. Thanks,
Florian Tobias Schandinat
> ---
> drivers/video/via/via_i2c.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c
> index 3844b55..a172a31 100644
> --- a/drivers/video/via/via_i2c.c
> +++ b/drivers/video/via/via_i2c.c
> @@ -209,7 +209,6 @@ static int create_i2c_bus(struct i2c_adapter *adapter,
> sprintf(adapter->name, "viafb i2c io_port idx 0x%02x",
> adap_cfg->ioport_index);
> adapter->owner = THIS_MODULE;
> - adapter->id = 0x01FFFF;
> adapter->class = I2C_CLASS_DDC;
> adapter->algo_data = algo;
> if (pdev)
^ permalink raw reply
* framebuffer works with console, but not tty
From: Timur Tabi @ 2011-03-11 22:50 UTC (permalink / raw)
To: linux-fbdev
I have a framebuffer driver (drivers/video/fsl_diu_fb.c) that works fine as a
console. However, I cannot get any tty output to appear on my video device.
tty output appears on the serial port, as does the login prompt.
I'm pretty sure this is a problem with my root file system configuration, but I
can't find any information on how to get it to work. I've checked the fbdev
documentation, done numerous Google searches, and searched the archives of this
mailing list, but I can't even find any threads discussing the issue, let alone
answering it.
So what am I missing? What do I need to do in my rootfs to get tty output and
the login prompt to appear on my video device, and not the serial port?
Here's my kernel command line:
root=/dev/ram rw console=ttyS0,115200 console=tty0
video=fslfb:1280x1024-32@60,monitor=dvi panic=1 ramdisk_size\x131000 debug=1
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH v2] matroxfb: remove incorrect Matrox G200eV support
From: Gary Hade @ 2011-03-11 22:23 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: djwong, Linus Torvalds, Gary Hade, linux-fbdev, linux-kernel,
Krzysztof Helt, Petr Vandrovec, Andrew Morton, yannick_heneault
In-Reply-To: <1299488356.9759.2.camel@pasglop>
On Mon, Mar 07, 2011 at 07:59:16PM +1100, Benjamin Herrenschmidt wrote:
> On Fri, 2011-03-04 at 12:29 -0800, Darrick J. Wong wrote:
> > This is all quite strange -- 2.5 years ago when I wrote the patch it
> > seemed to
> > work ok. On newer revisions of the x3650M2 it seems broken. The
> > original
> > machine I wrote it for was cut up ages ago.
> >
> > I suppose we could simply blacklist any G200eV with a subsystem vendor
> > ID of
> > 0x1014 (IBM) until we figure out how to correct the driver. Our
> > customers will
> > be deprived, but as it seems to be broken across most of our product
> > lines I
> > doubt any of them are making serious use of it anyway. :)
> >
> > Something like this?
>
> Does X work with the open source drivers ?
Yes, X works fine on at least the IBM System x boxes that have
the Matrox G200eV.
> In that case a better
> approach would be to try to figure out what's different between the way
> the 2 drivers setup the card registers and fix matroxfb..
I suppose someone could attempt this but with vesafb available as
an alternate fb provider and no known demand for repaired G200eV
support in matroxfb, I am not sure what benefit it would provide.
Gary
^ permalink raw reply
* Re: [PATCH 1/4] ARM: PXA: PXAFB: rework pxafb overlay memory management
From: Vasily Khoruzhick @ 2011-03-11 21:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201103112234.10904.marek.vasut@gmail.com>
On Friday 11 March 2011 23:34:10 Marek Vasut wrote:
> > + if (ofb->usage++ = 0)
>
> TBH I don't like this notation, it feels hard to read. Can you split that
> ofb-
>
> >usage++ into two parts ?
>
> Cheers
It's not deprecated by kernel codestyle, looks ok and works ok, but I'll
change it if one more person argues against it :)
Regards
Vasily
^ permalink raw reply
* Re: [PATCH 3/4] ARM: PXA: PXAFB: Fix typo in ypos assignment
From: Marek Vasut @ 2011-03-11 21:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1299835250-11095-3-git-send-email-anarsoul@gmail.com>
On Friday 11 March 2011 10:20:49 Vasily Khoruzhick wrote:
> Sascha Hauer <s.hauer@pengutronix.de> pointed that
> ypos takes value of xpos due to typo.
You can mark this patch a resend if it already went through LAKML :)
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> drivers/video/pxafb.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
> index e2f643e..a3bdcc1 100644
> --- a/drivers/video/pxafb.c
> +++ b/drivers/video/pxafb.c
> @@ -761,7 +761,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo
> *var, int xpos, ypos, pfor, bpp;
>
> xpos = NONSTD_TO_XPOS(var->nonstd);
> - ypos = NONSTD_TO_XPOS(var->nonstd);
> + ypos = NONSTD_TO_YPOS(var->nonstd);
> pfor = NONSTD_TO_PFOR(var->nonstd);
>
> bpp = pxafb_var_to_bpp(var);
> @@ -842,7 +842,7 @@ static int overlayfb_set_par(struct fb_info *info)
>
> bpp = pxafb_var_to_bpp(var);
> xpos = NONSTD_TO_XPOS(var->nonstd);
> - ypos = NONSTD_TO_XPOS(var->nonstd);
> + ypos = NONSTD_TO_YPOS(var->nonstd);
> pfor = NONSTD_TO_PFOR(var->nonstd);
>
> ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
^ permalink raw reply
* Re: [PATCH 1/4] ARM: PXA: PXAFB: rework pxafb overlay memory management
From: Marek Vasut @ 2011-03-11 21:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1299835250-11095-1-git-send-email-anarsoul@gmail.com>
On Friday 11 March 2011 10:20:47 Vasily Khoruzhick wrote:
> PXAFB overlay memory management is something messy:
> - it allocates memory dynamically on open/release, and it results
> in memory allocation failure after ~1h of uptime (system does not have
> 115k of physically contiguous memory)
> - in release callback it tries to free memory even if it was not
> allocated.
>
> Also driver touches FDADR1 on main plane reconfiguration, and it can cause
> problems if overlay1 is enabled.
>
> This patch attempts to fix those issues.
>
> Patch is based on Russell King's work.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> drivers/video/pxafb.c | 121
> ++++++++++++++++++++++++++++++++----------------- drivers/video/pxafb.h |
> 3 +-
> 2 files changed, 81 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
> index 825b665..0764759 100644
> --- a/drivers/video/pxafb.c
> +++ b/drivers/video/pxafb.c
> @@ -627,7 +627,12 @@ static void overlay1fb_enable(struct pxafb_layer *ofb)
>
> static void overlay1fb_disable(struct pxafb_layer *ofb)
> {
> - uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);
> + uint32_t lccr5;
> +
> + if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
> + return;
> +
> + lccr5 = lcd_readl(ofb->fbi, LCCR5);
>
> lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
>
> @@ -685,7 +690,12 @@ static void overlay2fb_enable(struct pxafb_layer *ofb)
>
> static void overlay2fb_disable(struct pxafb_layer *ofb)
> {
> - uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);
> + uint32_t lccr5;
> +
> + if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
> + return;
> +
> + lccr5 = lcd_readl(ofb->fbi, LCCR5);
>
> lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
>
> @@ -720,12 +730,10 @@ static int overlayfb_open(struct fb_info *info, int
> user) if (user = 0)
> return -ENODEV;
>
> - /* allow only one user at a time */
> - if (atomic_inc_and_test(&ofb->usage))
> - return -EBUSY;
> + if (ofb->usage++ = 0)
TBH I don't like this notation, it feels hard to read. Can you split that ofb-
>usage++ into two parts ?
Cheers
> + /* unblank the base framebuffer */
> + fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
>
> - /* unblank the base framebuffer */
> - fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
> return 0;
> }
>
> @@ -733,12 +741,15 @@ static int overlayfb_release(struct fb_info *info,
> int user) {
> struct pxafb_layer *ofb = (struct pxafb_layer*) info;
>
> - atomic_dec(&ofb->usage);
> - ofb->ops->disable(ofb);
> + if (ofb->usage = 1) {
> + ofb->ops->disable(ofb);
> + ofb->fb.var.height = -1;
> + ofb->fb.var.width = -1;
> + ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
> + ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
>
> - free_pages_exact(ofb->video_mem, ofb->video_mem_size);
> - ofb->video_mem = NULL;
> - ofb->video_mem_size = 0;
> + ofb->usage--;
> + }
> return 0;
> }
>
> @@ -794,7 +805,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo
> *var, return 0;
> }
>
> -static int overlayfb_map_video_memory(struct pxafb_layer *ofb)
> +static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
> {
> struct fb_var_screeninfo *var = &ofb->fb.var;
> int pfor = NONSTD_TO_PFOR(var->nonstd);
> @@ -812,27 +823,11 @@ static int overlayfb_map_video_memory(struct
> pxafb_layer *ofb)
>
> size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
>
> - /* don't re-allocate if the original video memory is enough */
> if (ofb->video_mem) {
> if (ofb->video_mem_size >= size)
> return 0;
> -
> - free_pages_exact(ofb->video_mem, ofb->video_mem_size);
> }
> -
> - ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
> - if (ofb->video_mem = NULL)
> - return -ENOMEM;
> -
> - ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
> - ofb->video_mem_size = size;
> -
> - mutex_lock(&ofb->fb.mm_lock);
> - ofb->fb.fix.smem_start = ofb->video_mem_phys;
> - ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual;
> - mutex_unlock(&ofb->fb.mm_lock);
> - ofb->fb.screen_base = ofb->video_mem;
> - return 0;
> + return -EINVAL;
> }
>
> static int overlayfb_set_par(struct fb_info *info)
> @@ -841,7 +836,7 @@ static int overlayfb_set_par(struct fb_info *info)
> struct fb_var_screeninfo *var = &info->var;
> int xpos, ypos, pfor, bpp, ret;
>
> - ret = overlayfb_map_video_memory(ofb);
> + ret = overlayfb_check_video_memory(ofb);
> if (ret)
> return ret;
>
> @@ -891,7 +886,7 @@ static void __devinit init_pxafb_overlay(struct
> pxafb_info *fbi,
>
> ofb->id = id;
> ofb->ops = &ofb_ops[id];
> - atomic_set(&ofb->usage, 0);
> + ofb->usage = 0;
> ofb->fbi = fbi;
> init_completion(&ofb->branch_done);
> }
> @@ -904,20 +899,54 @@ static inline int pxafb_overlay_supported(void)
> return 0;
> }
>
> -static int __devinit pxafb_overlay_init(struct pxafb_info *fbi)
> +static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info
> *pxafb, + struct pxafb_layer *ofb)
> +{
> + /* We assume that user will use at most video_mem_size for overlay fb,
> + * anyway, it's useless to use 16bpp main plane and 24bpp overlay
> + */
> + ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
> + GFP_KERNEL | __GFP_ZERO);
> + if (ofb->video_mem = NULL)
> + return -ENOMEM;
> +
> + ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
> + ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
> +
> + mutex_lock(&ofb->fb.mm_lock);
> + ofb->fb.fix.smem_start = ofb->video_mem_phys;
> + ofb->fb.fix.smem_len = pxafb->video_mem_size;
> + mutex_unlock(&ofb->fb.mm_lock);
> +
> + ofb->fb.screen_base = ofb->video_mem;
> +
> + return 0;
> +}
> +
> +static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
> {
> int i, ret;
>
> if (!pxafb_overlay_supported())
> - return 0;
> + return;
>
> for (i = 0; i < 2; i++) {
> - init_pxafb_overlay(fbi, &fbi->overlay[i], i);
> - ret = register_framebuffer(&fbi->overlay[i].fb);
> + struct pxafb_layer *ofb = &fbi->overlay[i];
> + init_pxafb_overlay(fbi, ofb, i);
> + ret = register_framebuffer(&ofb->fb);
> if (ret) {
> dev_err(fbi->dev, "failed to register overlay %d\n", i);
> - return ret;
> + continue;
> + }
> + ret = pxafb_overlay_map_video_memory(fbi, ofb);
> + if (ret) {
> + dev_err(fbi->dev,
> + "failed to map video memory for overlay %d\n",
> + i);
> + unregister_framebuffer(&ofb->fb);
> + continue;
> }
> + ofb->registered = 1;
> }
>
> /* mask all IU/BS/EOF/SOF interrupts */
> @@ -926,7 +955,6 @@ static int __devinit pxafb_overlay_init(struct
> pxafb_info *fbi) /* place overlay(s) on top of base */
> fbi->lccr0 |= LCCR0_OUC;
> pr_info("PXA Overlay driver loaded successfully!\n");
> - return 0;
> }
>
> static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
> @@ -936,8 +964,15 @@ static void __devexit pxafb_overlay_exit(struct
> pxafb_info *fbi) if (!pxafb_overlay_supported())
> return;
>
> - for (i = 0; i < 2; i++)
> - unregister_framebuffer(&fbi->overlay[i].fb);
> + for (i = 0; i < 2; i++) {
> + struct pxafb_layer *ofb = &fbi->overlay[i];
> + if (ofb->registered) {
> + if (ofb->video_mem)
> + free_pages_exact(ofb->video_mem,
> + ofb->video_mem_size);
> + unregister_framebuffer(&ofb->fb);
> + }
> + }
> }
> #else
> static inline void pxafb_overlay_init(struct pxafb_info *fbi) {}
> @@ -1368,7 +1403,8 @@ static int pxafb_activate_var(struct
> fb_var_screeninfo *var, (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||
> (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) ||
> (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||
> - (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))
> + ((fbi->lccr0 & LCCR0_SDS) &&
> + (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])))
> pxafb_schedule_work(fbi, C_REENABLE);
>
> return 0;
> @@ -1420,7 +1456,8 @@ static void pxafb_enable_controller(struct pxafb_info
> *fbi) lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);
>
> lcd_writel(fbi, FDADR0, fbi->fdadr[0]);
> - lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
> + if (fbi->lccr0 & LCCR0_SDS)
> + lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
> lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);
> }
>
> diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
> index 2353521..26ba9fa 100644
> --- a/drivers/video/pxafb.h
> +++ b/drivers/video/pxafb.h
> @@ -92,7 +92,8 @@ struct pxafb_layer_ops {
> struct pxafb_layer {
> struct fb_info fb;
> int id;
> - atomic_t usage;
> + int registered;
> + uint32_t usage;
> uint32_t control[2];
>
> struct pxafb_layer_ops *ops;
^ permalink raw reply
* [PATCH 4/4] ARM: PXA: PXAFB: don't disable controller on cpufreq transition if overlay is in use
From: Vasily Khoruzhick @ 2011-03-11 9:20 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1299835250-11095-1-git-send-email-anarsoul@gmail.com>
It's not safe to disable controller if overlay(s) is enabled (results in
system hang). So we avoid to disable controller in this case. Userspace
should choose proper governor to avoid freq changing when overlay is in
use, otherwise LCD may blink.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/video/pxafb.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index a3bdcc1..a2e5b51 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1648,7 +1648,8 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
switch (val) {
case CPUFREQ_PRECHANGE:
- set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
+ if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
+ set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
break;
case CPUFREQ_POSTCHANGE:
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/4] ARM: PXA: PXAFB: Fix typo in ypos assignment
From: Vasily Khoruzhick @ 2011-03-11 9:20 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1299835250-11095-1-git-send-email-anarsoul@gmail.com>
Sascha Hauer <s.hauer@pengutronix.de> pointed that
ypos takes value of xpos due to typo.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/video/pxafb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index e2f643e..a3bdcc1 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -761,7 +761,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
int xpos, ypos, pfor, bpp;
xpos = NONSTD_TO_XPOS(var->nonstd);
- ypos = NONSTD_TO_XPOS(var->nonstd);
+ ypos = NONSTD_TO_YPOS(var->nonstd);
pfor = NONSTD_TO_PFOR(var->nonstd);
bpp = pxafb_var_to_bpp(var);
@@ -842,7 +842,7 @@ static int overlayfb_set_par(struct fb_info *info)
bpp = pxafb_var_to_bpp(var);
xpos = NONSTD_TO_XPOS(var->nonstd);
- ypos = NONSTD_TO_XPOS(var->nonstd);
+ ypos = NONSTD_TO_YPOS(var->nonstd);
pfor = NONSTD_TO_PFOR(var->nonstd);
ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/4] ARM: PXA: PXAFB: Fix plane Z-ordering problem
From: Vasily Khoruzhick @ 2011-03-11 9:20 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1299835250-11095-1-git-send-email-anarsoul@gmail.com>
pxafb_overlay_init is not right place to change Z-ordering,
move it to main plane initialization.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/video/pxafb.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 0764759..e2f643e 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -952,8 +952,6 @@ static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
/* mask all IU/BS/EOF/SOF interrupts */
lcd_writel(fbi, LCCR5, ~0);
- /* place overlay(s) on top of base */
- fbi->lccr0 |= LCCR0_OUC;
pr_info("PXA Overlay driver loaded successfully!\n");
}
@@ -1843,6 +1841,12 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
pxafb_decode_mach_info(fbi, inf);
+#ifdef CONFIG_FB_PXA_OVERLAY
+ /* place overlay(s) on top of base */
+ if (pxafb_overlay_supported())
+ fbi->lccr0 |= LCCR0_OUC;
+#endif
+
init_waitqueue_head(&fbi->ctrlr_wait);
INIT_WORK(&fbi->task, pxafb_task);
mutex_init(&fbi->ctrlr_lock);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 1/4] ARM: PXA: PXAFB: rework pxafb overlay memory management
From: Vasily Khoruzhick @ 2011-03-11 9:20 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201103060030.59584.anarsoul@gmail.com>
PXAFB overlay memory management is something messy:
- it allocates memory dynamically on open/release, and it results
in memory allocation failure after ~1h of uptime (system does not have
115k of physically contiguous memory)
- in release callback it tries to free memory even if it was not
allocated.
Also driver touches FDADR1 on main plane reconfiguration, and it can cause
problems if overlay1 is enabled.
This patch attempts to fix those issues.
Patch is based on Russell King's work.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/video/pxafb.c | 121 ++++++++++++++++++++++++++++++++-----------------
drivers/video/pxafb.h | 3 +-
2 files changed, 81 insertions(+), 43 deletions(-)
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 825b665..0764759 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -627,7 +627,12 @@ static void overlay1fb_enable(struct pxafb_layer *ofb)
static void overlay1fb_disable(struct pxafb_layer *ofb)
{
- uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);
+ uint32_t lccr5;
+
+ if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
+ return;
+
+ lccr5 = lcd_readl(ofb->fbi, LCCR5);
lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
@@ -685,7 +690,12 @@ static void overlay2fb_enable(struct pxafb_layer *ofb)
static void overlay2fb_disable(struct pxafb_layer *ofb)
{
- uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5);
+ uint32_t lccr5;
+
+ if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
+ return;
+
+ lccr5 = lcd_readl(ofb->fbi, LCCR5);
lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
@@ -720,12 +730,10 @@ static int overlayfb_open(struct fb_info *info, int user)
if (user = 0)
return -ENODEV;
- /* allow only one user at a time */
- if (atomic_inc_and_test(&ofb->usage))
- return -EBUSY;
+ if (ofb->usage++ = 0)
+ /* unblank the base framebuffer */
+ fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
- /* unblank the base framebuffer */
- fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
return 0;
}
@@ -733,12 +741,15 @@ static int overlayfb_release(struct fb_info *info, int user)
{
struct pxafb_layer *ofb = (struct pxafb_layer*) info;
- atomic_dec(&ofb->usage);
- ofb->ops->disable(ofb);
+ if (ofb->usage = 1) {
+ ofb->ops->disable(ofb);
+ ofb->fb.var.height = -1;
+ ofb->fb.var.width = -1;
+ ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
+ ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
- free_pages_exact(ofb->video_mem, ofb->video_mem_size);
- ofb->video_mem = NULL;
- ofb->video_mem_size = 0;
+ ofb->usage--;
+ }
return 0;
}
@@ -794,7 +805,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
return 0;
}
-static int overlayfb_map_video_memory(struct pxafb_layer *ofb)
+static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
{
struct fb_var_screeninfo *var = &ofb->fb.var;
int pfor = NONSTD_TO_PFOR(var->nonstd);
@@ -812,27 +823,11 @@ static int overlayfb_map_video_memory(struct pxafb_layer *ofb)
size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
- /* don't re-allocate if the original video memory is enough */
if (ofb->video_mem) {
if (ofb->video_mem_size >= size)
return 0;
-
- free_pages_exact(ofb->video_mem, ofb->video_mem_size);
}
-
- ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
- if (ofb->video_mem = NULL)
- return -ENOMEM;
-
- ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
- ofb->video_mem_size = size;
-
- mutex_lock(&ofb->fb.mm_lock);
- ofb->fb.fix.smem_start = ofb->video_mem_phys;
- ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual;
- mutex_unlock(&ofb->fb.mm_lock);
- ofb->fb.screen_base = ofb->video_mem;
- return 0;
+ return -EINVAL;
}
static int overlayfb_set_par(struct fb_info *info)
@@ -841,7 +836,7 @@ static int overlayfb_set_par(struct fb_info *info)
struct fb_var_screeninfo *var = &info->var;
int xpos, ypos, pfor, bpp, ret;
- ret = overlayfb_map_video_memory(ofb);
+ ret = overlayfb_check_video_memory(ofb);
if (ret)
return ret;
@@ -891,7 +886,7 @@ static void __devinit init_pxafb_overlay(struct pxafb_info *fbi,
ofb->id = id;
ofb->ops = &ofb_ops[id];
- atomic_set(&ofb->usage, 0);
+ ofb->usage = 0;
ofb->fbi = fbi;
init_completion(&ofb->branch_done);
}
@@ -904,20 +899,54 @@ static inline int pxafb_overlay_supported(void)
return 0;
}
-static int __devinit pxafb_overlay_init(struct pxafb_info *fbi)
+static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,
+ struct pxafb_layer *ofb)
+{
+ /* We assume that user will use at most video_mem_size for overlay fb,
+ * anyway, it's useless to use 16bpp main plane and 24bpp overlay
+ */
+ ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
+ GFP_KERNEL | __GFP_ZERO);
+ if (ofb->video_mem = NULL)
+ return -ENOMEM;
+
+ ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
+ ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
+
+ mutex_lock(&ofb->fb.mm_lock);
+ ofb->fb.fix.smem_start = ofb->video_mem_phys;
+ ofb->fb.fix.smem_len = pxafb->video_mem_size;
+ mutex_unlock(&ofb->fb.mm_lock);
+
+ ofb->fb.screen_base = ofb->video_mem;
+
+ return 0;
+}
+
+static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
{
int i, ret;
if (!pxafb_overlay_supported())
- return 0;
+ return;
for (i = 0; i < 2; i++) {
- init_pxafb_overlay(fbi, &fbi->overlay[i], i);
- ret = register_framebuffer(&fbi->overlay[i].fb);
+ struct pxafb_layer *ofb = &fbi->overlay[i];
+ init_pxafb_overlay(fbi, ofb, i);
+ ret = register_framebuffer(&ofb->fb);
if (ret) {
dev_err(fbi->dev, "failed to register overlay %d\n", i);
- return ret;
+ continue;
+ }
+ ret = pxafb_overlay_map_video_memory(fbi, ofb);
+ if (ret) {
+ dev_err(fbi->dev,
+ "failed to map video memory for overlay %d\n",
+ i);
+ unregister_framebuffer(&ofb->fb);
+ continue;
}
+ ofb->registered = 1;
}
/* mask all IU/BS/EOF/SOF interrupts */
@@ -926,7 +955,6 @@ static int __devinit pxafb_overlay_init(struct pxafb_info *fbi)
/* place overlay(s) on top of base */
fbi->lccr0 |= LCCR0_OUC;
pr_info("PXA Overlay driver loaded successfully!\n");
- return 0;
}
static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
@@ -936,8 +964,15 @@ static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
if (!pxafb_overlay_supported())
return;
- for (i = 0; i < 2; i++)
- unregister_framebuffer(&fbi->overlay[i].fb);
+ for (i = 0; i < 2; i++) {
+ struct pxafb_layer *ofb = &fbi->overlay[i];
+ if (ofb->registered) {
+ if (ofb->video_mem)
+ free_pages_exact(ofb->video_mem,
+ ofb->video_mem_size);
+ unregister_framebuffer(&ofb->fb);
+ }
+ }
}
#else
static inline void pxafb_overlay_init(struct pxafb_info *fbi) {}
@@ -1368,7 +1403,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
(lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||
(lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) ||
(lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||
- (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))
+ ((fbi->lccr0 & LCCR0_SDS) &&
+ (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])))
pxafb_schedule_work(fbi, C_REENABLE);
return 0;
@@ -1420,7 +1456,8 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);
lcd_writel(fbi, FDADR0, fbi->fdadr[0]);
- lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
+ if (fbi->lccr0 & LCCR0_SDS)
+ lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);
}
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index 2353521..26ba9fa 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -92,7 +92,8 @@ struct pxafb_layer_ops {
struct pxafb_layer {
struct fb_info fb;
int id;
- atomic_t usage;
+ int registered;
+ uint32_t usage;
uint32_t control[2];
struct pxafb_layer_ops *ops;
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH v2] fbdev: sh_mobile_lcdc: Add YUV input support
From: Paul Mundt @ 2011-03-11 4:54 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <1298526433-6621-1-git-send-email-dhobsong@igel.co.jp>
On Wed, Mar 02, 2011 at 03:42:13PM +0900, Damian wrote:
> Supports YCbCr420sp, YCbCr422sp, and YCbCr44sp, formats
> (bpp = 12, 16, and 24) respectively.
>
> When double-buffering both Y planes appear before the C planes (Y-Y-C-C),
> as opposed to Y-C-Y-C.
> Set .nonstd in struct sh_mobile_lcdc_chan_cfg to enable YUV mode, and use
> .bpp to distiguish between the 3 modes.
> The value of .nonstd is copied to bits 16-31 of LDDFR in the LCDC and
> should be set accordingly.
> .nonstd must be set to 0 for RGB mode.
>
> Due to the encoding of YUV data, the framebuffer will clear to green
> instead of black.
>
> In YUV 420 mode, panning is only possible in 2 line increments.
> Additionally in YUV 420 mode the vertical resolution of the framebuffer
> must be an even number.
>
> Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
This version of the patch was horribly line-wrapped, but the previous one
'fbdev: sh_mobile_lcdc: Add YUV framebuffer support' which seemed to have
an identical description and versioning looked fine, so I've taken that
one in to the fbdev tree.
You may wish to double check to make sure that what has been merged is in
sync with your latest changes.
^ permalink raw reply
* Re: [PATCH 0/6] OMAP: DSS2: DSI: IRQ restructuring
From: Tomi Valkeinen @ 2011-03-09 14:45 UTC (permalink / raw)
To: Taneja, Archit; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <4D77868A.7020700@ti.com>
On Wed, 2011-03-09 at 07:54 -0600, Taneja, Archit wrote:
> On Wednesday 09 March 2011 12:51 PM, Valkeinen, Tomi wrote:
> > Hi,
> >
> > In the future we will have more features using the DSI interrupts, like ULPS
> > handling, and making use-case specific hooks into the main IRQ handler would
> > become burdensome.
> >
> > This patch set cleans up the DSI IRQ handling a bit by implementing a generic
> > way to register/unregister interrupt service routines. This allows us to remove
> > the use-case specific callbacks from the main IRQ handler.
> >
>
> Would this make it more easy/difficult to migrate to irq_chip(if needed)
> later on? I guess it will atleast bring dispc and dsi irq
> requesting/handling in a similar state, hence the changes needed to move
> to irq_chip would be the same for both.
Well, I'm not really familiar with irq_chip, but I don't see how this
could make it more difficult. It divides the code in cleaner way,
removing irq specific callbacks in the irq handler, so it should make
migrating easier, if anything.
Tomi
^ permalink raw reply
* Re: [PATCH 0/6] OMAP: DSS2: DSI: IRQ restructuring
From: archit taneja @ 2011-03-09 13:50 UTC (permalink / raw)
To: Valkeinen, Tomi; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
On Wednesday 09 March 2011 12:51 PM, Valkeinen, Tomi wrote:
> Hi,
>
> In the future we will have more features using the DSI interrupts, like ULPS
> handling, and making use-case specific hooks into the main IRQ handler would
> become burdensome.
>
> This patch set cleans up the DSI IRQ handling a bit by implementing a generic
> way to register/unregister interrupt service routines. This allows us to remove
> the use-case specific callbacks from the main IRQ handler.
>
Would this make it more easy/difficult to migrate to irq_chip(if needed)
later on? I guess it will atleast bring dispc and dsi irq
requesting/handling in a similar state, hence the changes needed to move
to irq_chip would be the same for both.
Archit
> Tomi
>
> Tomi Valkeinen (6):
> OMAP: DSS2: DSI: Restructure IRQ handler
> OMAP: DSS2: DSI: Add ISR support
> OMAP: DSS2: DSI: use ISR in send_bta_sync
> OMAP: DSS2: DSI: use ISR for BTA in framedone
> OMAP: DSS2: DSI: catch DSI errors in send_bta_sync
> OMAP: DSS2: DSI: fix IRQ debug prints
>
> drivers/video/omap2/dss/dsi.c | 523 ++++++++++++++++++++++++++++++++---------
> 1 files changed, 408 insertions(+), 115 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH 6/6] OMAP: DSS2: DSI: fix IRQ debug prints
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
print_irq_status functions can be called with empty irq status when full
irq debugging is enabled. This patch makes print_irq_status functions
return immediately when given an empty irq status to lessen the debug
spam slightly.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ec5b879..f6733b5 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -412,6 +412,9 @@ static void dsi_perf_show(const char *name)
static void print_irq_status(u32 status)
{
+ if (status = 0)
+ return;
+
#ifndef VERBOSE_IRQ
if ((status & ~DSI_IRQ_CHANNEL_MASK) = 0)
return;
@@ -447,6 +450,9 @@ static void print_irq_status(u32 status)
static void print_irq_status_vc(int channel, u32 status)
{
+ if (status = 0)
+ return;
+
#ifndef VERBOSE_IRQ
if ((status & ~DSI_VC_IRQ_PACKET_SENT) = 0)
return;
@@ -473,6 +479,9 @@ static void print_irq_status_vc(int channel, u32 status)
static void print_irq_status_cio(u32 status)
{
+ if (status = 0)
+ return;
+
printk(KERN_DEBUG "DSI CIO IRQ 0x%x: ", status);
#define PIS(x) \
--
1.7.1
^ permalink raw reply related
* [PATCH 5/6] OMAP: DSS2: DSI: catch DSI errors in send_bta_sync
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
dsi_vc_send_bta_sync() waits for BTA interrupt with a 500ms timeout. If
a DSI error happens, no BTA is received and the timeout triggers. This
could be handled much faster by listening to DSI errors also.
This patch uses the ISR support to notice DSI errors while waiting for
the BTA, thus speeding up the fail-path considerably.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 5672e40..ec5b879 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2230,24 +2230,31 @@ int dsi_vc_send_bta_sync(int channel)
if (r)
goto err0;
- r = dsi_vc_send_bta(channel);
+ r = dsi_register_isr(dsi_completion_handler, &completion,
+ DSI_IRQ_ERROR_MASK);
if (r)
goto err1;
+ r = dsi_vc_send_bta(channel);
+ if (r)
+ goto err2;
+
if (wait_for_completion_timeout(&completion,
msecs_to_jiffies(500)) = 0) {
DSSERR("Failed to receive BTA\n");
r = -EIO;
- goto err1;
+ goto err2;
}
err = dsi_get_errors();
if (err) {
DSSERR("Error while sending BTA: %x\n", err);
r = -EIO;
- goto err1;
+ goto err2;
}
-
+err2:
+ dsi_unregister_isr(dsi_completion_handler, &completion,
+ DSI_IRQ_ERROR_MASK);
err1:
dsi_unregister_isr_vc(channel, dsi_completion_handler,
&completion, DSI_VC_IRQ_BTA);
--
1.7.1
^ permalink raw reply related
* [PATCH 4/6] OMAP: DSS2: DSI: use ISR for BTA in framedone
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
Remove bta_callback from the interrupt handler, and use ISR support
instead.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 57 +++++++++++------------------------------
1 files changed, 15 insertions(+), 42 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a4d47dd..5672e40 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -257,8 +257,6 @@ static struct
unsigned pll_locked;
- void (*bta_callback)(void);
-
spinlock_t irq_lock;
struct dsi_isr_tables isr_tables;
/* space for a copy used by the interrupt handler */
@@ -641,16 +639,6 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
del_timer(&dsi.te_timer);
#endif
- for (i = 0; i < 4; ++i) {
- if (vcstatus[i] = 0)
- continue;
-
- if (vcstatus[i] & DSI_VC_IRQ_BTA) {
- if (dsi.bta_callback)
- dsi.bta_callback();
- }
- }
-
/* make a copy and unlock, so that isrs can unregister
* themselves */
memcpy(&dsi.isr_tables_copy, &dsi.isr_tables, sizeof(dsi.isr_tables));
@@ -924,26 +912,6 @@ static u32 dsi_get_errors(void)
return e;
}
-static void dsi_vc_enable_bta_irq(int channel)
-{
- u32 l;
-
- dsi_write_reg(DSI_VC_IRQSTATUS(channel), DSI_VC_IRQ_BTA);
-
- l = dsi_read_reg(DSI_VC_IRQENABLE(channel));
- l |= DSI_VC_IRQ_BTA;
- dsi_write_reg(DSI_VC_IRQENABLE(channel), l);
-}
-
-static void dsi_vc_disable_bta_irq(int channel)
-{
- u32 l;
-
- l = dsi_read_reg(DSI_VC_IRQENABLE(channel));
- l &= ~DSI_VC_IRQ_BTA;
- dsi_write_reg(DSI_VC_IRQENABLE(channel), l);
-}
-
/* DSI func clock. this could also be dsi_pll_hsdiv_dsi_clk */
static inline void enable_clocks(bool enable)
{
@@ -3097,19 +3065,20 @@ static void dsi_te_timeout(unsigned long arg)
}
#endif
+static void dsi_framedone_bta_callback(void *data, u32 mask);
+
static void dsi_handle_framedone(int error)
{
const int channel = dsi.update_channel;
- cancel_delayed_work(&dsi.framedone_timeout_work);
+ dsi_unregister_isr_vc(channel, dsi_framedone_bta_callback,
+ NULL, DSI_VC_IRQ_BTA);
- dsi_vc_disable_bta_irq(channel);
+ cancel_delayed_work(&dsi.framedone_timeout_work);
/* SIDLEMODE back to smart-idle */
dispc_enable_sidle();
- dsi.bta_callback = NULL;
-
if (dsi.te_enabled) {
/* enable LP_RX_TO again after the TE */
REG_FLD_MOD(DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */
@@ -3143,7 +3112,7 @@ static void dsi_framedone_timeout_work_callback(struct work_struct *work)
dsi_handle_framedone(-ETIMEDOUT);
}
-static void dsi_framedone_bta_callback(void)
+static void dsi_framedone_bta_callback(void *data, u32 mask)
{
dsi_handle_framedone(0);
@@ -3183,15 +3152,19 @@ static void dsi_framedone_irq_callback(void *data, u32 mask)
* asynchronously.
* */
- dsi.bta_callback = dsi_framedone_bta_callback;
-
- barrier();
-
- dsi_vc_enable_bta_irq(channel);
+ r = dsi_register_isr_vc(channel, dsi_framedone_bta_callback,
+ NULL, DSI_VC_IRQ_BTA);
+ if (r) {
+ DSSERR("Failed to register BTA ISR\n");
+ dsi_handle_framedone(-EIO);
+ return;
+ }
r = dsi_vc_send_bta(channel);
if (r) {
DSSERR("BTA after framedone failed\n");
+ dsi_unregister_isr_vc(channel, dsi_framedone_bta_callback,
+ NULL, DSI_VC_IRQ_BTA);
dsi_handle_framedone(-EIO);
}
}
--
1.7.1
^ permalink raw reply related
* [PATCH 3/6] OMAP: DSS2: DSI: use ISR in send_bta_sync
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
Remove bta_completion handling from the interrupt handler, and use ISR
support instead.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9aea9a7..a4d47dd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -257,7 +257,6 @@ static struct
unsigned pll_locked;
- struct completion bta_completion;
void (*bta_callback)(void);
spinlock_t irq_lock;
@@ -341,6 +340,11 @@ static bool dsi_bus_is_locked(void)
return dsi.bus_lock.count = 0;
}
+static void dsi_completion_handler(void *data, u32 mask)
+{
+ complete((struct completion *)data);
+}
+
static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum,
int value)
{
@@ -642,8 +646,6 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
continue;
if (vcstatus[i] & DSI_VC_IRQ_BTA) {
- complete(&dsi.bta_completion);
-
if (dsi.bta_callback)
dsi.bta_callback();
}
@@ -2251,33 +2253,37 @@ static int dsi_vc_send_bta(int channel)
int dsi_vc_send_bta_sync(int channel)
{
+ DECLARE_COMPLETION_ONSTACK(completion);
int r = 0;
u32 err;
- INIT_COMPLETION(dsi.bta_completion);
-
- dsi_vc_enable_bta_irq(channel);
+ r = dsi_register_isr_vc(channel, dsi_completion_handler,
+ &completion, DSI_VC_IRQ_BTA);
+ if (r)
+ goto err0;
r = dsi_vc_send_bta(channel);
if (r)
- goto err;
+ goto err1;
- if (wait_for_completion_timeout(&dsi.bta_completion,
+ if (wait_for_completion_timeout(&completion,
msecs_to_jiffies(500)) = 0) {
DSSERR("Failed to receive BTA\n");
r = -EIO;
- goto err;
+ goto err1;
}
err = dsi_get_errors();
if (err) {
DSSERR("Error while sending BTA: %x\n", err);
r = -EIO;
- goto err;
+ goto err1;
}
-err:
- dsi_vc_disable_bta_irq(channel);
+err1:
+ dsi_unregister_isr_vc(channel, dsi_completion_handler,
+ &completion, DSI_VC_IRQ_BTA);
+err0:
return r;
}
EXPORT_SYMBOL(dsi_vc_send_bta_sync);
@@ -3647,8 +3653,6 @@ static int dsi_init(struct platform_device *pdev)
dsi.irq_stats.last_reset = jiffies;
#endif
- init_completion(&dsi.bta_completion);
-
mutex_init(&dsi.lock);
sema_init(&dsi.bus_lock, 1);
--
1.7.1
^ permalink raw reply related
* [PATCH 2/6] OMAP: DSS2: DSI: Add ISR support
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
Add generic ISR support for DSI interrupts. ISRs can be used instead of
custom hooks in the interrupt handler.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 325 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 301 insertions(+), 24 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a0881da..9aea9a7 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -193,6 +193,16 @@ struct dsi_reg { u16 idx; };
#define REGM_DSI_MAX (1 << 4)
#define LP_DIV_MAX ((1 << 13) - 1)
+typedef void (*omap_dsi_isr_t) (void *arg, u32 mask);
+
+#define DSI_MAX_NR_ISRS 2
+
+struct dsi_isr_data {
+ omap_dsi_isr_t isr;
+ void *arg;
+ u32 mask;
+};
+
enum fifo_size {
DSI_FIFO_SIZE_0 = 0,
DSI_FIFO_SIZE_32 = 1,
@@ -219,6 +229,12 @@ struct dsi_irq_stats {
unsigned cio_irqs[32];
};
+struct dsi_isr_tables {
+ struct dsi_isr_data isr_table[DSI_MAX_NR_ISRS];
+ struct dsi_isr_data isr_table_vc[4][DSI_MAX_NR_ISRS];
+ struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
+};
+
static struct
{
struct platform_device *pdev;
@@ -244,6 +260,11 @@ static struct
struct completion bta_completion;
void (*bta_callback)(void);
+ spinlock_t irq_lock;
+ struct dsi_isr_tables isr_tables;
+ /* space for a copy used by the interrupt handler */
+ struct dsi_isr_tables isr_tables_copy;
+
int update_channel;
struct dsi_update_region update_region;
@@ -535,11 +556,49 @@ static void dsi_handle_irq_errors(u32 irqstatus, u32 *vcstatus, u32 ciostatus)
}
}
+static void dsi_call_isrs(struct dsi_isr_data *isr_array,
+ unsigned isr_array_size, u32 irqstatus)
+{
+ struct dsi_isr_data *isr_data;
+ int i;
+
+ for (i = 0; i < isr_array_size; i++) {
+ isr_data = &isr_array[i];
+ if (isr_data->isr && isr_data->mask & irqstatus)
+ isr_data->isr(isr_data->arg, irqstatus);
+ }
+}
+
+static void dsi_handle_isrs(struct dsi_isr_tables *isr_tables,
+ u32 irqstatus, u32 *vcstatus, u32 ciostatus)
+{
+ int i;
+
+ dsi_call_isrs(isr_tables->isr_table,
+ ARRAY_SIZE(isr_tables->isr_table),
+ irqstatus);
+
+ for (i = 0; i < 4; ++i) {
+ if (vcstatus[i] = 0)
+ continue;
+ dsi_call_isrs(isr_tables->isr_table_vc[i],
+ ARRAY_SIZE(isr_tables->isr_table_vc[i]),
+ vcstatus[i]);
+ }
+
+ if (ciostatus != 0)
+ dsi_call_isrs(isr_tables->isr_table_cio,
+ ARRAY_SIZE(isr_tables->isr_table_cio),
+ ciostatus);
+}
+
static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
{
u32 irqstatus, vcstatus[4], ciostatus;
int i;
+ spin_lock(&dsi.irq_lock);
+
irqstatus = dsi_read_reg(DSI_IRQSTATUS);
/* IRQ is not for us */
@@ -590,6 +649,14 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
}
}
+ /* make a copy and unlock, so that isrs can unregister
+ * themselves */
+ memcpy(&dsi.isr_tables_copy, &dsi.isr_tables, sizeof(dsi.isr_tables));
+
+ spin_unlock(&dsi.irq_lock);
+
+ dsi_handle_isrs(&dsi.isr_tables_copy, irqstatus, vcstatus, ciostatus);
+
dsi_handle_irq_errors(irqstatus, vcstatus, ciostatus);
dsi_collect_irq_stats(irqstatus, vcstatus, ciostatus);
@@ -597,42 +664,251 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
return IRQ_HANDLED;
}
-static void _dsi_initialize_irq(void)
+/* dsi.irq_lock has to be locked by the caller */
+static void _omap_dsi_configure_irqs(struct dsi_isr_data *isr_array,
+ unsigned isr_array_size, u32 default_mask,
+ const struct dsi_reg enable_reg,
+ const struct dsi_reg status_reg)
{
- u32 l;
+ struct dsi_isr_data *isr_data;
+ u32 mask;
+ u32 old_mask;
int i;
- /* disable all interrupts */
- dsi_write_reg(DSI_IRQENABLE, 0);
- for (i = 0; i < 4; ++i)
- dsi_write_reg(DSI_VC_IRQENABLE(i), 0);
- dsi_write_reg(DSI_COMPLEXIO_IRQ_ENABLE, 0);
+ mask = default_mask;
- /* clear interrupt status */
- l = dsi_read_reg(DSI_IRQSTATUS);
- dsi_write_reg(DSI_IRQSTATUS, l & ~DSI_IRQ_CHANNEL_MASK);
+ for (i = 0; i < isr_array_size; i++) {
+ isr_data = &isr_array[i];
- for (i = 0; i < 4; ++i) {
- l = dsi_read_reg(DSI_VC_IRQSTATUS(i));
- dsi_write_reg(DSI_VC_IRQSTATUS(i), l);
+ if (isr_data->isr = NULL)
+ continue;
+
+ mask |= isr_data->mask;
}
- l = dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
- dsi_write_reg(DSI_COMPLEXIO_IRQ_STATUS, l);
+ old_mask = dsi_read_reg(enable_reg);
+ /* clear the irqstatus for newly enabled irqs */
+ dsi_write_reg(status_reg, (mask ^ old_mask) & mask);
+ dsi_write_reg(enable_reg, mask);
+
+ /* flush posted writes */
+ dsi_read_reg(enable_reg);
+ dsi_read_reg(status_reg);
+}
- /* enable error irqs */
- l = DSI_IRQ_ERROR_MASK;
+/* dsi.irq_lock has to be locked by the caller */
+static void _omap_dsi_set_irqs(void)
+{
+ u32 mask = DSI_IRQ_ERROR_MASK;
#ifdef DSI_CATCH_MISSING_TE
- l |= DSI_IRQ_TE_TRIGGER;
+ mask |= DSI_IRQ_TE_TRIGGER;
#endif
- dsi_write_reg(DSI_IRQENABLE, l);
+ _omap_dsi_configure_irqs(dsi.isr_tables.isr_table,
+ ARRAY_SIZE(dsi.isr_tables.isr_table), mask,
+ DSI_IRQENABLE, DSI_IRQSTATUS);
+}
- l = DSI_VC_IRQ_ERROR_MASK;
- for (i = 0; i < 4; ++i)
- dsi_write_reg(DSI_VC_IRQENABLE(i), l);
+/* dsi.irq_lock has to be locked by the caller */
+static void _omap_dsi_set_irqs_vc(int vc)
+{
+ _omap_dsi_configure_irqs(dsi.isr_tables.isr_table_vc[vc],
+ ARRAY_SIZE(dsi.isr_tables.isr_table_vc[vc]),
+ DSI_VC_IRQ_ERROR_MASK,
+ DSI_VC_IRQENABLE(vc), DSI_VC_IRQSTATUS(vc));
+}
+
+/* dsi.irq_lock has to be locked by the caller */
+static void _omap_dsi_set_irqs_cio(void)
+{
+ _omap_dsi_configure_irqs(dsi.isr_tables.isr_table_cio,
+ ARRAY_SIZE(dsi.isr_tables.isr_table_cio),
+ DSI_CIO_IRQ_ERROR_MASK,
+ DSI_COMPLEXIO_IRQ_ENABLE, DSI_COMPLEXIO_IRQ_STATUS);
+}
+
+static void _dsi_initialize_irq(void)
+{
+ unsigned long flags;
+ int vc;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ memset(&dsi.isr_tables, 0, sizeof(dsi.isr_tables));
+
+ _omap_dsi_set_irqs();
+ for (vc = 0; vc < 4; ++vc)
+ _omap_dsi_set_irqs_vc(vc);
+ _omap_dsi_set_irqs_cio();
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+}
+
+static int _dsi_register_isr(omap_dsi_isr_t isr, void *arg, u32 mask,
+ struct dsi_isr_data *isr_array, unsigned isr_array_size)
+{
+ struct dsi_isr_data *isr_data;
+ int free_idx;
+ int i;
+
+ BUG_ON(isr = NULL);
+
+ /* check for duplicate entry and find a free slot */
+ free_idx = -1;
+ for (i = 0; i < isr_array_size; i++) {
+ isr_data = &isr_array[i];
+
+ if (isr_data->isr = isr && isr_data->arg = arg &&
+ isr_data->mask = mask) {
+ return -EINVAL;
+ }
+
+ if (isr_data->isr = NULL && free_idx = -1)
+ free_idx = i;
+ }
+
+ if (free_idx = -1)
+ return -EBUSY;
+
+ isr_data = &isr_array[free_idx];
+ isr_data->isr = isr;
+ isr_data->arg = arg;
+ isr_data->mask = mask;
+
+ return 0;
+}
+
+static int _dsi_unregister_isr(omap_dsi_isr_t isr, void *arg, u32 mask,
+ struct dsi_isr_data *isr_array, unsigned isr_array_size)
+{
+ struct dsi_isr_data *isr_data;
+ int i;
+
+ for (i = 0; i < isr_array_size; i++) {
+ isr_data = &isr_array[i];
+ if (isr_data->isr != isr || isr_data->arg != arg ||
+ isr_data->mask != mask)
+ continue;
+
+ isr_data->isr = NULL;
+ isr_data->arg = NULL;
+ isr_data->mask = 0;
+
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
+static int dsi_register_isr(omap_dsi_isr_t isr, void *arg, u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_register_isr(isr, arg, mask, dsi.isr_tables.isr_table,
+ ARRAY_SIZE(dsi.isr_tables.isr_table));
+
+ if (r = 0)
+ _omap_dsi_set_irqs();
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
+}
+
+static int dsi_unregister_isr(omap_dsi_isr_t isr, void *arg, u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_unregister_isr(isr, arg, mask, dsi.isr_tables.isr_table,
+ ARRAY_SIZE(dsi.isr_tables.isr_table));
+
+ if (r = 0)
+ _omap_dsi_set_irqs();
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
+}
+
+static int dsi_register_isr_vc(int channel, omap_dsi_isr_t isr, void *arg,
+ u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_register_isr(isr, arg, mask,
+ dsi.isr_tables.isr_table_vc[channel],
+ ARRAY_SIZE(dsi.isr_tables.isr_table_vc[channel]));
+
+ if (r = 0)
+ _omap_dsi_set_irqs_vc(channel);
- l = DSI_CIO_IRQ_ERROR_MASK;
- dsi_write_reg(DSI_COMPLEXIO_IRQ_ENABLE, l);
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
+}
+
+static int dsi_unregister_isr_vc(int channel, omap_dsi_isr_t isr, void *arg,
+ u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_unregister_isr(isr, arg, mask,
+ dsi.isr_tables.isr_table_vc[channel],
+ ARRAY_SIZE(dsi.isr_tables.isr_table_vc[channel]));
+
+ if (r = 0)
+ _omap_dsi_set_irqs_vc(channel);
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
+}
+
+static int dsi_register_isr_cio(omap_dsi_isr_t isr, void *arg, u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_register_isr(isr, arg, mask, dsi.isr_tables.isr_table_cio,
+ ARRAY_SIZE(dsi.isr_tables.isr_table_cio));
+
+ if (r = 0)
+ _omap_dsi_set_irqs_cio();
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
+}
+
+static int dsi_unregister_isr_cio(omap_dsi_isr_t isr, void *arg, u32 mask)
+{
+ unsigned long flags;
+ int r;
+
+ spin_lock_irqsave(&dsi.irq_lock, flags);
+
+ r = _dsi_unregister_isr(isr, arg, mask, dsi.isr_tables.isr_table_cio,
+ ARRAY_SIZE(dsi.isr_tables.isr_table_cio));
+
+ if (r = 0)
+ _omap_dsi_set_irqs_cio();
+
+ spin_unlock_irqrestore(&dsi.irq_lock, flags);
+
+ return r;
}
static u32 dsi_get_errors(void)
@@ -3362,6 +3638,7 @@ static int dsi_init(struct platform_device *pdev)
int r, i;
struct resource *dsi_mem;
+ spin_lock_init(&dsi.irq_lock);
spin_lock_init(&dsi.errors_lock);
dsi.errors = 0;
--
1.7.1
^ permalink raw reply related
* [PATCH 1/6] OMAP: DSS2: DSI: Restructure IRQ handler
From: Tomi Valkeinen @ 2011-03-09 7:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1299655288-7121-1-git-send-email-tomi.valkeinen@ti.com>
Clean up the IRQ handler a bit by separating collection of IRQ stats and
handling of IRQ errors to separate functions.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 123 ++++++++++++++++++++++++-----------------
1 files changed, 73 insertions(+), 50 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index be7694f..a0881da 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -480,26 +480,33 @@ static void print_irq_status_cio(u32 status)
printk("\n");
}
-static int debug_irq;
-
-/* called from dss */
-static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+static void dsi_collect_irq_stats(u32 irqstatus, u32 *vcstatus, u32 ciostatus)
{
- u32 irqstatus, vcstatus, ciostatus;
int i;
- irqstatus = dsi_read_reg(DSI_IRQSTATUS);
-
- /* IRQ is not for us */
- if (!irqstatus)
- return IRQ_NONE;
-
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
spin_lock(&dsi.irq_stats_lock);
+
dsi.irq_stats.irq_count++;
dss_collect_irq_stats(irqstatus, dsi.irq_stats.dsi_irqs);
+
+ for (i = 0; i < 4; ++i)
+ dss_collect_irq_stats(vcstatus[i], dsi.irq_stats.vc_irqs[i]);
+
+ dss_collect_irq_stats(ciostatus, dsi.irq_stats.cio_irqs);
+
+ spin_unlock(&dsi.irq_stats_lock);
+}
+#else
+#define dsi_collect_irq_stats(irqstatus, vcstatus, ciostatus)
#endif
+static int debug_irq;
+
+static void dsi_handle_irq_errors(u32 irqstatus, u32 *vcstatus, u32 ciostatus)
+{
+ int i;
+
if (irqstatus & DSI_IRQ_ERROR_MASK) {
DSSERR("DSI error, irqstatus %x\n", irqstatus);
print_irq_status(irqstatus);
@@ -510,37 +517,48 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
print_irq_status(irqstatus);
}
-#ifdef DSI_CATCH_MISSING_TE
- if (irqstatus & DSI_IRQ_TE_TRIGGER)
- del_timer(&dsi.te_timer);
-#endif
-
for (i = 0; i < 4; ++i) {
- if ((irqstatus & (1<<i)) = 0)
- continue;
+ if (vcstatus[i] & DSI_VC_IRQ_ERROR_MASK) {
+ DSSERR("DSI VC(%d) error, vc irqstatus %x\n",
+ i, vcstatus[i]);
+ print_irq_status_vc(i, vcstatus[i]);
+ } else if (debug_irq) {
+ print_irq_status_vc(i, vcstatus[i]);
+ }
+ }
- vcstatus = dsi_read_reg(DSI_VC_IRQSTATUS(i));
+ if (ciostatus & DSI_CIO_IRQ_ERROR_MASK) {
+ DSSERR("DSI CIO error, cio irqstatus %x\n", ciostatus);
+ print_irq_status_cio(ciostatus);
+ } else if (debug_irq) {
+ print_irq_status_cio(ciostatus);
+ }
+}
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
- dss_collect_irq_stats(vcstatus, dsi.irq_stats.vc_irqs[i]);
-#endif
+static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
+{
+ u32 irqstatus, vcstatus[4], ciostatus;
+ int i;
- if (vcstatus & DSI_VC_IRQ_BTA) {
- complete(&dsi.bta_completion);
+ irqstatus = dsi_read_reg(DSI_IRQSTATUS);
- if (dsi.bta_callback)
- dsi.bta_callback();
- }
+ /* IRQ is not for us */
+ if (!irqstatus)
+ return IRQ_NONE;
- if (vcstatus & DSI_VC_IRQ_ERROR_MASK) {
- DSSERR("DSI VC(%d) error, vc irqstatus %x\n",
- i, vcstatus);
- print_irq_status_vc(i, vcstatus);
- } else if (debug_irq) {
- print_irq_status_vc(i, vcstatus);
+ dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK);
+ /* flush posted write */
+ dsi_read_reg(DSI_IRQSTATUS);
+
+ for (i = 0; i < 4; ++i) {
+ if ((irqstatus & (1 << i)) = 0) {
+ vcstatus[i] = 0;
+ continue;
}
- dsi_write_reg(DSI_VC_IRQSTATUS(i), vcstatus);
+ vcstatus[i] = dsi_read_reg(DSI_VC_IRQSTATUS(i));
+
+ dsi_write_reg(DSI_VC_IRQSTATUS(i), vcstatus[i]);
/* flush posted write */
dsi_read_reg(DSI_VC_IRQSTATUS(i));
}
@@ -548,29 +566,34 @@ static irqreturn_t omap_dsi_irq_handler(int irq, void *arg)
if (irqstatus & DSI_IRQ_COMPLEXIO_ERR) {
ciostatus = dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
- dss_collect_irq_stats(ciostatus, dsi.irq_stats.cio_irqs);
-#endif
-
dsi_write_reg(DSI_COMPLEXIO_IRQ_STATUS, ciostatus);
/* flush posted write */
dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
+ } else {
+ ciostatus = 0;
+ }
- if (ciostatus & DSI_CIO_IRQ_ERROR_MASK) {
- DSSERR("DSI CIO error, cio irqstatus %x\n", ciostatus);
- print_irq_status_cio(ciostatus);
- } else if (debug_irq) {
- print_irq_status_cio(ciostatus);
+#ifdef DSI_CATCH_MISSING_TE
+ if (irqstatus & DSI_IRQ_TE_TRIGGER)
+ del_timer(&dsi.te_timer);
+#endif
+
+ for (i = 0; i < 4; ++i) {
+ if (vcstatus[i] = 0)
+ continue;
+
+ if (vcstatus[i] & DSI_VC_IRQ_BTA) {
+ complete(&dsi.bta_completion);
+
+ if (dsi.bta_callback)
+ dsi.bta_callback();
}
}
- dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK);
- /* flush posted write */
- dsi_read_reg(DSI_IRQSTATUS);
+ dsi_handle_irq_errors(irqstatus, vcstatus, ciostatus);
+
+ dsi_collect_irq_stats(irqstatus, vcstatus, ciostatus);
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
- spin_unlock(&dsi.irq_stats_lock);
-#endif
return IRQ_HANDLED;
}
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox