From b8dde009aaf3921e028a839a297d34433aa0b649 Mon Sep 17 00:00:00 2001 From: Antti Koskipaa Date: Tue, 31 Jan 2012 17:12:37 +0200 Subject: [PATCH] gfx: drv: Move stuff around Move a function to where it belongs so that panel register definitions need not to be declared globally. Signed-off-by: Antti Koskipaa Signed-off-by: Kirill A. Shutemov --- drivers/staging/mrst/drv/mdfld_dsi_output.c | 26 +------------------------- drivers/staging/mrst/drv/mdfld_dsi_output.h | 1 + drivers/staging/mrst/drv/tc35876x-dsi-lvds.c | 23 +++++++++++++++++++++++ drivers/staging/mrst/drv/tc35876x-dsi-lvds.h | 1 + 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/staging/mrst/drv/mdfld_dsi_output.c b/drivers/staging/mrst/drv/mdfld_dsi_output.c index 32d2cb4..6c1d677 100644 --- a/drivers/staging/mrst/drv/mdfld_dsi_output.c +++ b/drivers/staging/mrst/drv/mdfld_dsi_output.c @@ -30,11 +30,10 @@ #include "mdfld_dsi_dpi.h" #include "mdfld_output.h" #include "mdfld_dsi_pkg_sender.h" +#include "tc35876x-dsi-lvds.h" #include #include -#define MDFLD_DSI_BRIGHTNESS_MAX_LEVEL 100 - /* get the CABC LABC from command line. */ static int CABC_control = 1; static int LABC_control = 1; @@ -202,29 +201,6 @@ void mdfld_dsi_brightness_init (struct mdfld_dsi_config * dsi_config, int pipe) mdfld_dsi_send_mcs_short(sender, write_ctrl_cabc, UI_IMAGE, 1, true); } -/** - * Manage the mipi display brightness. - * TODO: refine this interface later - */ -#define PWM0DUTYCYCLE 0x67 -static void tc35876x_brightness_control(struct drm_device *dev, int pipe, - int level) -{ - int ret; - u8 duty_val; - - level = clamp(level, 0, MDFLD_DSI_BRIGHTNESS_MAX_LEVEL); - - /* PWM duty cycle 0x00...0x63 corresponds to 0...99% */ - duty_val = level * 0x63 / MDFLD_DSI_BRIGHTNESS_MAX_LEVEL; - - PSB_DEBUG_ENTRY("level = %d, duty_val = %d\n", level, duty_val); - - ret = intel_scu_ipc_iowrite8(PWM0DUTYCYCLE, duty_val); - if (ret) - printk(KERN_ERR "[DISPLAY] %s: ipc write fail\n", __func__); -} - void mdfld_dsi_brightness_control (struct drm_device *dev, int pipe, int level) { struct mdfld_dsi_pkg_sender * sender; diff --git a/drivers/staging/mrst/drv/mdfld_dsi_output.h b/drivers/staging/mrst/drv/mdfld_dsi_output.h index c6c2317..3a48255 100644 --- a/drivers/staging/mrst/drv/mdfld_dsi_output.h +++ b/drivers/staging/mrst/drv/mdfld_dsi_output.h @@ -43,6 +43,7 @@ #include +#define MDFLD_DSI_BRIGHTNESS_MAX_LEVEL 100 #ifdef DEBUG #define CHECK_PIPE(pipe) ({ \ diff --git a/drivers/staging/mrst/drv/tc35876x-dsi-lvds.c b/drivers/staging/mrst/drv/tc35876x-dsi-lvds.c index 61236d4..dc40286 100644 --- a/drivers/staging/mrst/drv/tc35876x-dsi-lvds.c +++ b/drivers/staging/mrst/drv/tc35876x-dsi-lvds.c @@ -27,6 +27,8 @@ #include "mdfld_dsi_pkg_sender.h" #include "tc35876x-dsi-lvds.h" #include +#include +#include static struct i2c_client *tc35876x_client; static struct i2c_client *cmi_lcd_i2c_client; @@ -420,6 +422,27 @@ void tc35876x_configure_lvds_bridge(struct drm_device *dev) tc35876x_regw(i2c, DSI_INTCLR, FLD_MASK(31, 30) | FLD_MASK(22, 0)); } +#define PWM0DUTYCYCLE 0x67 + +void tc35876x_brightness_control(struct drm_device *dev, int pipe, + int level) +{ + int ret; + u8 duty_val; + + level = clamp(level, 0, MDFLD_DSI_BRIGHTNESS_MAX_LEVEL); + + /* PWM duty cycle 0x00...0x63 corresponds to 0...99% */ + duty_val = level * 0x63 / MDFLD_DSI_BRIGHTNESS_MAX_LEVEL; + + printk(KERN_DEBUG "[DISPLAY] %s: level = %d, duty_val = %d\n", __func__, + level, duty_val); + + ret = intel_scu_ipc_iowrite8(PWM0DUTYCYCLE, duty_val); + if (ret) + printk(KERN_ERR "[DISPLAY] %s: ipc write fail\n", __func__); +} + void tc35876x_toshiba_bridge_panel_off(void) { struct tc35876x_platform_data *pdata; diff --git a/drivers/staging/mrst/drv/tc35876x-dsi-lvds.h b/drivers/staging/mrst/drv/tc35876x-dsi-lvds.h index fe6c4dd..6d76f03 100644 --- a/drivers/staging/mrst/drv/tc35876x-dsi-lvds.h +++ b/drivers/staging/mrst/drv/tc35876x-dsi-lvds.h @@ -27,6 +27,7 @@ void tc35876x_set_bridge_reset_state(int state); void tc35876x_configure_lvds_bridge(struct drm_device *dev); +void tc35876x_brightness_control(struct drm_device *dev, int pipe, int level); void tc35876x_toshiba_bridge_panel_off(void); void tc35876x_toshiba_bridge_panel_on(void); void tc35876x_init(struct drm_device *dev, struct panel_funcs *pf); -- 2.7.4