diff options
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 136 |
1 files changed, 13 insertions, 123 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 203b18bbddae..41cdefbaf7f3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -3106,18 +3106,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
3106 | dsi_if_enable(1); | 3106 | dsi_if_enable(1); |
3107 | dsi_force_tx_stop_mode_io(); | 3107 | dsi_force_tx_stop_mode_io(); |
3108 | 3108 | ||
3109 | if (dssdev->driver->enable) { | ||
3110 | r = dssdev->driver->enable(dssdev); | ||
3111 | if (r) | ||
3112 | goto err4; | ||
3113 | } | ||
3114 | |||
3115 | /* enable high-speed after initial config */ | ||
3116 | omapdss_dsi_vc_enable_hs(0, 1); | ||
3117 | |||
3118 | return 0; | 3109 | return 0; |
3119 | err4: | ||
3120 | dsi_if_enable(0); | ||
3121 | err3: | 3110 | err3: |
3122 | dsi_complexio_uninit(); | 3111 | dsi_complexio_uninit(); |
3123 | err2: | 3112 | err2: |
@@ -3131,9 +3120,6 @@ err0: | |||
3131 | 3120 | ||
3132 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) | 3121 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) |
3133 | { | 3122 | { |
3134 | if (dssdev->driver->disable) | ||
3135 | dssdev->driver->disable(dssdev); | ||
3136 | |||
3137 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); | 3123 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3138 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); | 3124 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3139 | dsi_complexio_uninit(); | 3125 | dsi_complexio_uninit(); |
@@ -3156,14 +3142,15 @@ static int dsi_core_init(void) | |||
3156 | return 0; | 3142 | return 0; |
3157 | } | 3143 | } |
3158 | 3144 | ||
3159 | static int dsi_display_enable(struct omap_dss_device *dssdev) | 3145 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) |
3160 | { | 3146 | { |
3161 | int r = 0; | 3147 | int r = 0; |
3162 | 3148 | ||
3163 | DSSDBG("dsi_display_enable\n"); | 3149 | DSSDBG("dsi_display_enable\n"); |
3164 | 3150 | ||
3151 | WARN_ON(!dsi_bus_is_locked()); | ||
3152 | |||
3165 | mutex_lock(&dsi.lock); | 3153 | mutex_lock(&dsi.lock); |
3166 | dsi_bus_lock(); | ||
3167 | 3154 | ||
3168 | r = omap_dss_start_device(dssdev); | 3155 | r = omap_dss_start_device(dssdev); |
3169 | if (r) { | 3156 | if (r) { |
@@ -3171,90 +3158,49 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) | |||
3171 | goto err0; | 3158 | goto err0; |
3172 | } | 3159 | } |
3173 | 3160 | ||
3174 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
3175 | DSSERR("dssdev already enabled\n"); | ||
3176 | r = -EINVAL; | ||
3177 | goto err1; | ||
3178 | } | ||
3179 | |||
3180 | enable_clocks(1); | 3161 | enable_clocks(1); |
3181 | dsi_enable_pll_clock(1); | 3162 | dsi_enable_pll_clock(1); |
3182 | 3163 | ||
3183 | r = _dsi_reset(); | 3164 | r = _dsi_reset(); |
3184 | if (r) | 3165 | if (r) |
3185 | goto err2; | 3166 | goto err1; |
3186 | 3167 | ||
3187 | dsi_core_init(); | 3168 | dsi_core_init(); |
3188 | 3169 | ||
3189 | r = dsi_display_init_dispc(dssdev); | 3170 | r = dsi_display_init_dispc(dssdev); |
3190 | if (r) | 3171 | if (r) |
3191 | goto err2; | 3172 | goto err1; |
3192 | 3173 | ||
3193 | r = dsi_display_init_dsi(dssdev); | 3174 | r = dsi_display_init_dsi(dssdev); |
3194 | if (r) | 3175 | if (r) |
3195 | goto err3; | 3176 | goto err2; |
3196 | |||
3197 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3198 | 3177 | ||
3199 | dsi.use_ext_te = dssdev->phy.dsi.ext_te; | 3178 | dsi.use_ext_te = dssdev->phy.dsi.ext_te; |
3200 | 3179 | ||
3201 | dsi_bus_unlock(); | ||
3202 | mutex_unlock(&dsi.lock); | 3180 | mutex_unlock(&dsi.lock); |
3203 | 3181 | ||
3204 | return 0; | 3182 | return 0; |
3205 | 3183 | ||
3206 | err3: | ||
3207 | dsi_display_uninit_dispc(dssdev); | ||
3208 | err2: | 3184 | err2: |
3185 | dsi_display_uninit_dispc(dssdev); | ||
3186 | err1: | ||
3209 | enable_clocks(0); | 3187 | enable_clocks(0); |
3210 | dsi_enable_pll_clock(0); | 3188 | dsi_enable_pll_clock(0); |
3211 | err1: | ||
3212 | omap_dss_stop_device(dssdev); | 3189 | omap_dss_stop_device(dssdev); |
3213 | err0: | 3190 | err0: |
3214 | dsi_bus_unlock(); | ||
3215 | mutex_unlock(&dsi.lock); | 3191 | mutex_unlock(&dsi.lock); |
3216 | DSSDBG("dsi_display_enable FAILED\n"); | 3192 | DSSDBG("dsi_display_enable FAILED\n"); |
3217 | return r; | 3193 | return r; |
3218 | } | 3194 | } |
3195 | EXPORT_SYMBOL(omapdss_dsi_display_enable); | ||
3219 | 3196 | ||
3220 | static void dsi_display_disable(struct omap_dss_device *dssdev) | 3197 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev) |
3221 | { | 3198 | { |
3222 | DSSDBG("dsi_display_disable\n"); | 3199 | DSSDBG("dsi_display_disable\n"); |
3223 | 3200 | ||
3224 | mutex_lock(&dsi.lock); | 3201 | WARN_ON(!dsi_bus_is_locked()); |
3225 | dsi_bus_lock(); | ||
3226 | |||
3227 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3228 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3229 | goto end; | ||
3230 | |||
3231 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
3232 | |||
3233 | dsi_display_uninit_dispc(dssdev); | ||
3234 | |||
3235 | dsi_display_uninit_dsi(dssdev); | ||
3236 | |||
3237 | enable_clocks(0); | ||
3238 | dsi_enable_pll_clock(0); | ||
3239 | |||
3240 | omap_dss_stop_device(dssdev); | ||
3241 | end: | ||
3242 | dsi_bus_unlock(); | ||
3243 | mutex_unlock(&dsi.lock); | ||
3244 | } | ||
3245 | |||
3246 | static int dsi_display_suspend(struct omap_dss_device *dssdev) | ||
3247 | { | ||
3248 | DSSDBG("dsi_display_suspend\n"); | ||
3249 | 3202 | ||
3250 | mutex_lock(&dsi.lock); | 3203 | mutex_lock(&dsi.lock); |
3251 | dsi_bus_lock(); | ||
3252 | |||
3253 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3254 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3255 | goto end; | ||
3256 | |||
3257 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
3258 | 3204 | ||
3259 | dsi_display_uninit_dispc(dssdev); | 3205 | dsi_display_uninit_dispc(dssdev); |
3260 | 3206 | ||
@@ -3262,63 +3208,12 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) | |||
3262 | 3208 | ||
3263 | enable_clocks(0); | 3209 | enable_clocks(0); |
3264 | dsi_enable_pll_clock(0); | 3210 | dsi_enable_pll_clock(0); |
3265 | end: | ||
3266 | dsi_bus_unlock(); | ||
3267 | mutex_unlock(&dsi.lock); | ||
3268 | 3211 | ||
3269 | return 0; | 3212 | omap_dss_stop_device(dssdev); |
3270 | } | ||
3271 | |||
3272 | static int dsi_display_resume(struct omap_dss_device *dssdev) | ||
3273 | { | ||
3274 | int r; | ||
3275 | |||
3276 | DSSDBG("dsi_display_resume\n"); | ||
3277 | |||
3278 | mutex_lock(&dsi.lock); | ||
3279 | dsi_bus_lock(); | ||
3280 | |||
3281 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
3282 | DSSERR("dssdev not suspended\n"); | ||
3283 | r = -EINVAL; | ||
3284 | goto err0; | ||
3285 | } | ||
3286 | |||
3287 | enable_clocks(1); | ||
3288 | dsi_enable_pll_clock(1); | ||
3289 | |||
3290 | r = _dsi_reset(); | ||
3291 | if (r) | ||
3292 | goto err1; | ||
3293 | |||
3294 | dsi_core_init(); | ||
3295 | |||
3296 | r = dsi_display_init_dispc(dssdev); | ||
3297 | if (r) | ||
3298 | goto err1; | ||
3299 | |||
3300 | r = dsi_display_init_dsi(dssdev); | ||
3301 | if (r) | ||
3302 | goto err2; | ||
3303 | |||
3304 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3305 | |||
3306 | dsi_bus_unlock(); | ||
3307 | mutex_unlock(&dsi.lock); | ||
3308 | |||
3309 | return 0; | ||
3310 | 3213 | ||
3311 | err2: | ||
3312 | dsi_display_uninit_dispc(dssdev); | ||
3313 | err1: | ||
3314 | enable_clocks(0); | ||
3315 | dsi_enable_pll_clock(0); | ||
3316 | err0: | ||
3317 | dsi_bus_unlock(); | ||
3318 | mutex_unlock(&dsi.lock); | 3214 | mutex_unlock(&dsi.lock); |
3319 | DSSDBG("dsi_display_resume FAILED\n"); | ||
3320 | return r; | ||
3321 | } | 3215 | } |
3216 | EXPORT_SYMBOL(omapdss_dsi_display_disable); | ||
3322 | 3217 | ||
3323 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) | 3218 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) |
3324 | { | 3219 | { |
@@ -3344,11 +3239,6 @@ int dsi_init_display(struct omap_dss_device *dssdev) | |||
3344 | { | 3239 | { |
3345 | DSSDBG("DSI init\n"); | 3240 | DSSDBG("DSI init\n"); |
3346 | 3241 | ||
3347 | dssdev->enable = dsi_display_enable; | ||
3348 | dssdev->disable = dsi_display_disable; | ||
3349 | dssdev->suspend = dsi_display_suspend; | ||
3350 | dssdev->resume = dsi_display_resume; | ||
3351 | |||
3352 | /* XXX these should be figured out dynamically */ | 3242 | /* XXX these should be figured out dynamically */ |
3353 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | | 3243 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | |
3354 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; | 3244 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; |