summaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
AgeCommit message (Collapse)Author
2012-01-02OMAPDSS: APPLY: move check functionsTomi Valkeinen
The functions dss_ovl_check, dss_mgr_check_zorder, dss_mgr_check in apply.c are not really part of the apply mechanism, and can be moved to overlay.c and manager.c. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2012-01-02OMAPDSS: APPLY: remove unused variablesTomi Valkeinen
dss_mgr_check_zorder() has two unused variables. Remove them. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: write fifo thresholds only if changedTomi Valkeinen
Current code will always write fifo threshold values to the register, even if they are the same as previously. Separate the setting of fifo fields into a separate function, and only set new values if they are different than the old ones. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add dss_setup_fifosTomi Valkeinen
Currently fifo threshold configuration is done per overlay or per manager. However, when a fifo size configuration is added, we need to always configure the thresholds for all overlays. This patch prepares for that by changing the fifo threshold configuration to always handle all overlays. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: simplify dss_mgr_enableTomi Valkeinen
dss_mgr_enable() has some extra assigns to mp->enabled, which can be removed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add op->enablingTomi Valkeinen
When we are enabling an overlay, there's a point in time when the overlay is not actually enabled yet (nor do we want it to be enabled), but we do want to check if the configuration for the overlay is valid, and to calculate correct fifo thresholds for the soon-to-be-enabled overlay. Current code handled this in a hacky way, setting op->enabled to true temporarily when calling functions that need to consider the state when the overlay is enabled. This patch makes this a bit cleaner, adding "enabling" field, which is set when the overlay is not yet enabled but should be considered in the checks and calculations. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: cleanup extra_info_update_ongoingTomi Valkeinen
Trivial cleanup for extra_info_update_ongoing(), making the function a bit cleaner. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add dss_set_go_bits()Tomi Valkeinen
Currently dss_write_regs() implicitely sets the GO bits for all managers with shadow dirty flags set. This is a bit misleading, as one does not presume "write registers" function to also set the GO bit. Thus this patch splits the setting of GO bits into a separate function, dss_set_go_bits, which is used after writing the registers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: clear shadow dirty flags only if GO had been setTomi Valkeinen
In the apply irq handler the code currently clears the shadow dirty flags whenever the manager in question is not busy (i.e. GO bit is down). However, this is not quite right, as the GO bit may have never been set. While not done in the current code, the above would cause bug in scenario where the registers are written, and thus shadow_dirty flag is set, but the GO bit will be set only later. In this case the shadow_dirty flags would be cleared, even if the HW is not using the new configurations. This patch fixes the issue by clearing the shadow flags only when the GO bit is clear, and the GO bit had been set. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: fix need_isrTomi Valkeinen
need_isr() should return true whenever there's work that needs to be handled in the VSYNC/FRAMEDONE irq handler. However, need_isr() is missing some cases where we need the irq handler. This patch adds checks for shadow dirty flags, so that the irq handler is started/kept running while shadow dirty flags are set. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: fix extra_info_update_ongoingTomi Valkeinen
extra_info_update_ongoing() skipped checks for overlays that were marked as disabled. This doesn't work, as the enable status of an overlay is in the extra_info group, and thus extra_info_update_ongoing() reports false when we are disabling an overlay. This causes wait_pending_extra_info_updates() to not wait for the ongoing overlay disable. This patch changes extra_info_update_ongoing() to check the state of overlays marked as disabled. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: check the return value of dss_mgr_enable()Tomi Valkeinen
Now that dss_mgr_enable returns an error value, check it in all the places dss_mgr_enable is used, and bail out properly. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add return value to dss_mgr_enable()Tomi Valkeinen
Now that dss_mgr_enable() can fail due to checks, make it return the error value. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add checking of ovls/mgrs settingsTomi Valkeinen
Add checks for overlay and manager settings. The checks are a bit complex, as we need to observe the bigger picture instead of overlays and managers independently. Things like the used display and the zorder of other overlays affect the validity of the settings. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add dss_mgr_simple_check()Tomi Valkeinen
Add dss_mgr_simple_check() which is used to check the validity of certain manager attributes. Only attributes that can be checked independently, without knowing the display being used, is done here (thus "simple"). We can use this function in dss_mgr_set_info(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add dss_ovl_simple_check()Tomi Valkeinen
Add dss_ovl_simple_check() which is used to check the validity of certain overlay attributes. Only attributes that can be checked independently, without knowing the display being used, is done here (thus "simple"). We can use this function in dss_ovl_set_info(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: remove runtime_getTomi Valkeinen
apply.c no longer touches any registers if an output is not enabled. This means that we don't need to do dispc_runtime_get() anymore, and the calls can be removed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add wait_pending_extra_info_updates()Tomi Valkeinen
Add wait_pending_extra_info_updates() function which can be used to wait until any extra_info changes have been taken into use by the hardware. This can be only called when holding the apply mutex, so that other threads cannot insert new extra_info changes. This will be used to handle fifo-configurations. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: skip enable/disable if already enabled/disabledTomi Valkeinen
Add checks to dss_mgr_enable, dss_mgr_disable, dss_ovl_enable, dss_ovl_disable that check if the state is already the same as given in the parameters, and exit if so. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add dss_apply_ovl_enable()Tomi Valkeinen
Add a helper function dss_apply_ovl_enable(), which is similar to the main apply() function: dss_apply_ovl_enable() applies the given overlay enable-status to ovl_priv_data, and sets the dirty flag. The difference between the helper function and the previous direct use of the fields is that the helper function will not do anything if the enable state is already the same as given in the parameter. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: remove device_changed fieldTomi Valkeinen
omap_overlay_manager contains device_changed field, which no longer has any use. So remove the field and the few places where it is touched. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rename dirty & shadow_dirtyTomi Valkeinen
Rename ovl_priv_data's and mgr_priv_data's dirty and shadow_dirty fields to info_dirty and shadow_info_dirty to better reflect what they mean. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move fifo thresholds to extra_info setTomi Valkeinen
Setting overlay's fifo thresholds is currently handled at the same time as other overlay attributes. This is not right, as the normal attributes should only affect one overlay and manager, but changing the fifo thresholds are needed in cases like fifo-merge, where multiple managers are affected. This patch moves the channel field into the "extra_info" set, handled together with channel and enabled-status. This also lets us to calculate the fifos only when needed, specifically, when an overlay or a manager is enabled. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move channel-field to extra_info setTomi Valkeinen
Setting overlay's output channel is currently handled at the same time as other overlay attributes. This is not right, as the normal attributes should only affect one overlay and manager, but changing the channel affects two managers. This patch moves the channel field into the "extra_info" set, handled together with enabled-status. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move ovl->info to apply.cTomi Valkeinen
struct omap_overlayr contains info and info_dirty fields, both of which should be internal to apply.c. This patch moves those fields into ovl_priv data, and names them user_info and user_info_dirty. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move mgr->info to apply.cTomi Valkeinen
struct omap_overlay_manager contains info and info_dirty fields, both of which should be internal to apply.c. This patch moves those fields into mgr_priv data, and names them user_info and user_info_dirty. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: clean up isr_handlerTomi Valkeinen
Add a helper function mgr_clear_shadow_dirty(), which clears the shadow_dirty flags for the given manager and for the overlays on that manager. This lets us simplify the code in the dss_apply_irq_handler(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add updating flagTomi Valkeinen
Add "updating" flag to mgr_priv_data, which is used to track whether the manager is currently actively working, i.e. updating the screen. For auto-update displays updating is always true when the display is enabled, but for manual update displays the flag is true only during frame transfers. The flag is used to manage registers properly, for example when updating is false and a register for a manager is written, there's no need to set shadow_dirty flag nor set the GO bit, as the settings will be taken into use by the HW automatically when the output is enabled. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: DISPC: add dispc_mgr_get_framedone_irqTomi Valkeinen
Add dispc_mgr_get_framedone_irq() which returns the irq number for FRAMEDONE for the given channel. Note that the function returns always 0 for DIGIT channel, even if OMAP4 does have FRAMEDONE_TV interrupt. The reason for this is that this function is currently used only to track manual updates, and thus FRAMEDONE_TV is not needed. If there's need in the future to also get the FRAMEDONE_TV this needs revisiting. However, as FRAMEDONE_TV doesn't exist on OMAP2/3, the use of this function for that purpose needs some extra code to handle the OMAP2/3 case. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rewrite register writingTomi Valkeinen
The functions writing to the DISPC registers in apply.c are more complex than needed. This patch cleans things up. Two helper functions are added: need_isr(), which returns if an isr for VSYNC is needed, and need_go(), which tells if there has been a write to the shadow registers and we need to set the GO bit. The functions that call the actual dispc write functions will set the dirty and shadow_dirty flags themselves, instead of that being done on the caller side. The writing functions also check if the dirty flag is even set, and return immediately if not. This allows us to clean up dss_write_regs(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rewrite overlay enable/disableTomi Valkeinen
Overlays are currently enabled and disabled with a boolean in the struct omap_overlay_info. The overlay info is set with ovl->set_overlay_info(), and made into use with mgr->apply(). This doesn't work properly, as the enable/disable status may affect also other overlays, for example when using fifo-merge. Thus the enabling and disabling of the overlay needs to be done outside the normal overlay configuration. This patch achieves that by doing the following things: 1) Add function pointers to struct omap_overlay: enable(), disable() and is_enabled(). These are used to do the obvious. The functions may block. 2) Move the "enabled" field from struct omap_overlay to ovl_priv_data. 3) Add a new route for settings to be applied to the HW, called "extra_info". The status of the normal info and extra_info are tracked separately. The point here is to allow the normal info to be changed and applied in non-blocking matter, whereas the extra_info can only be changed when holding the mutex. This makes it possible to, for example, set the overlay enable flag, apply it, and wait until the HW has taken the flag into use. This is not possible if the enable flag would be in the normal info, as a new value for the flag could be set at any time from the users of omapdss. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add busy field to mgr_priv_dataTomi Valkeinen
Add a new field to mgr_priv data, "busy", which is used to track the status of GO bit with the manager. As manual update displays never use the GO bit, the field is always false for managers used for manual update displays. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move mgr->enabled to mgr_priv_dataTomi Valkeinen
struct omap_overlay_manager contains "enabled"-field, used to track if the manager is enabled or not. This field should be internal to apply.c. This patch moves the field to mgr_priv_data, and applies the necessary locking when accessing the field. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: DSI: call mgr_enable/disable for cmd mode displaysTomi Valkeinen
The current code uses dsi_video_mode_enable/disable functions to enable/disable DISPC output for video mode displays. For command mode displays we have no notion in the DISPC side of whether the panel is enabled, except when a dss_mgr_start_update() call is made. However, to properly maintain the DISPC state in apply.c, we need to know if a manager used for a manual update display is currently in use. This patch achieves that by changing dsi_video_mode_enable/disable to dsi_enable/disable_video_output, which is called by both video and command mode displays. For video mode displays it starts the actual pixel stream, as it did before. For command mode displays it doesn't do anything else than mark that the manager is currently in use. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add missing uses of spinlockTomi Valkeinen
The functions in apply.c, called mostly via function pointers in overlay and overlay_manager structs, will be divided into two groups. The other group will not sleep and can be called from interrupts, and the other group may sleep. The idea is that the non-sleeping functions may only change certain settings in overlays and managers, and those settings may only affect the particular overlay/manager. For example, set the base address of the overlay. The blocking functions, however, will handle more complex configuration changes. For example, when an overlay is enabled and fifo-merge feature is used, we need to do the enable in multiple steps, waiting in between, and the change affects multiple overlays and managers. apply.c already contains a spinlock, which has been used to protect (badly) the dss_data. This patch adds locks/unlocks of the spinlock to the missing places, and the lock should now properly protect dss_data. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: add mutexTomi Valkeinen
The functions in apply.c, called mostly via function pointers in overlay and overlay_manager structs, will be divided into two groups. The first group will not sleep and can be called from interrupts, and the second group may sleep. The idea is that the non-sleeping functions may only change certain settings in overlays and managers, and those settings may only affect the particular overlay/manager. For example, set the base address of the overlay. The blocking functions, however, will handle more complex configuration changes. For example, when an overlay is enabled and fifo-merge feature is used, we need to do the enable in multiple steps, waiting in between, and the change affects multiple overlays and managers. This patch adds the mutex which is used in the blocking functions to have exclusive access to overlays and overlay managers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: remove ovl/mgr check-code temporarilyTomi Valkeinen
DSS currently tries to check that the given overlay and overlay manager settings are acceptable, but the code does not work quite properly. Things may change between the check and the actual use of the settings. Furthermore, the following patches will rewrite how settings are configured and managed, and trying to keep the (broken) settings checking working during the rewrite would be very difficult. This patch removes the checking code, and a working version of checking will be added back after the settings rewrite has been done. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move mgr funcs to apply.cTomi Valkeinen
apply.c will handle the management of dispc in the future patches. This patch moves overlay manager related functions to apply.c so that they will have access to the private data and functions of apply.c. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move ovl funcs to apply.cTomi Valkeinen
apply.c will handle the management of dispc in the future patches. This patch moves overlay related functions to apply.c so that they will have access to the private data and functions of apply.c. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rename dss_cache to dss_dataTomi Valkeinen
dss_cache struct contains private data used to manage dispc. "cache" is not a good word for it, so rename it to dss_data. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: move spinlock outside the structTomi Valkeinen
dss_cache struct contains a spinlock used to protect the struct. A more logical place for the spinlock is outside the struct that it is protecting. So move it there. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rename manager_cache_dataTomi Valkeinen
manager_cache_data is not a suitable name for the struct. It is more of a private data for the manager. Rename the struct to mgr_priv_data, and add a function, get_mgr_priv(mgr), to get a pointer to the data. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: rename overlay_cache_dataTomi Valkeinen
overlay_cache_data is not a suitable name for the struct. It is more of a private data for the overlay. Rename the struct to ovl_priv_data, and add a function, get_ovl_priv(ovl), to get a pointer to the data. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: configure_* funcs take ovl/manager as argsTomi Valkeinen
Make configure_overlay() and configure_manager() take overlay/manager pointer as an argument, instead of the ovl/mgr id. This will be useful with the future patches. Also rename the functions to be a bit more informative: dss_ovl_write_regs, dss_mgr_write_regs, dss_write_regs. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: use dispc_mgr_get_vsync_irq()Tomi Valkeinen
Use dispc_mgr_get_vsync_irq() to get the interrupt numbers for vsync, instead of hardcoding the values depending on the display type. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: DISPC: Add dispc_mgr_get_vsync_irq()Tomi Valkeinen
Add dispc_mgr_get_vsync_irq() which returns the irq number for vsync on the given channel. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: APPLY: separate vsync isr register/unregisterTomi Valkeinen
Create separate functions for the vsync isr register/unregister code for cleaner code. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: store overlays in a list for each managerTomi Valkeinen
Current way of handling overlay-manager links is a bit strange: each manager has a static array, containing pointers to all the overlays (even those used by other managers). The overlays contain a pointer to the manager being used. This patch makes the system a bit saner: each manager has a linked list of overlays, and only the overlays linked to that manager are in the list. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: store managers in an arrayTomi Valkeinen
Overlay managers are stored in a linked list. There's no need for this list, as an array would do just as fine. This patch changes the code to use an array for overlay managers. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2011-12-02OMAPDSS: store overlays in an arrayTomi Valkeinen
Overlays are stored in a linked list. There's no need for this list, as an array would do just as fine. This patch changes the code to use an array for overlays. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>