diff options
Diffstat (limited to 'include/video')
-rw-r--r-- | include/video/of_display_timing.h | 3 | ||||
-rw-r--r-- | include/video/omap-panel-data.h | 209 | ||||
-rw-r--r-- | include/video/omapdss.h | 293 |
3 files changed, 463 insertions, 42 deletions
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h index 8016eb727cf3..79e6697af6cf 100644 --- a/include/video/of_display_timing.h +++ b/include/video/of_display_timing.h @@ -10,10 +10,13 @@ #define __LINUX_OF_DISPLAY_TIMING_H struct device_node; +struct display_timing; struct display_timings; #define OF_USE_NATIVE_MODE -1 +int of_get_display_timing(struct device_node *np, const char *name, + struct display_timing *dt); struct display_timings *of_get_display_timings(struct device_node *np); int of_display_timings_exist(struct device_node *np); diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h index 0c3b46d3daf3..6b2366fb6e53 100644 --- a/include/video/omap-panel-data.h +++ b/include/video/omap-panel-data.h @@ -27,6 +27,9 @@ #ifndef __OMAP_PANEL_DATA_H #define __OMAP_PANEL_DATA_H +#include <video/omapdss.h> +#include <video/display_timing.h> + struct omap_dss_device; /** @@ -147,4 +150,210 @@ struct panel_tpo_td043_data { int nreset_gpio; }; +/** + * encoder_tfp410 platform data + * @name: name for this display entity + * @power_down_gpio: gpio number for PD pin (or -1 if not available) + * @data_lines: number of DPI datalines + */ +struct encoder_tfp410_platform_data { + const char *name; + const char *source; + int power_down_gpio; + int data_lines; +}; + +/** + * encoder_tpd12s015 platform data + * @name: name for this display entity + * @ct_cp_hpd_gpio: CT_CP_HPD gpio number + * @ls_oe_gpio: LS_OE gpio number + * @hpd_gpio: HPD gpio number + */ +struct encoder_tpd12s015_platform_data { + const char *name; + const char *source; + + int ct_cp_hpd_gpio; + int ls_oe_gpio; + int hpd_gpio; +}; + +/** + * connector_dvi platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @i2c_bus_num: i2c bus number to be used for reading EDID + */ +struct connector_dvi_platform_data { + const char *name; + const char *source; + int i2c_bus_num; +}; + +/** + * connector_hdmi platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + */ +struct connector_hdmi_platform_data { + const char *name; + const char *source; +}; + +/** + * connector_atv platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @connector_type: composite/svideo + * @invert_polarity: invert signal polarity + */ +struct connector_atv_platform_data { + const char *name; + const char *source; + + enum omap_dss_venc_type connector_type; + bool invert_polarity; +}; + +/** + * panel_dpi platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @data_lines: number of DPI datalines + * @display_timing: timings for this panel + * @backlight_gpio: gpio to enable/disable the backlight (or -1) + * @enable_gpio: gpio to enable/disable the panel (or -1) + */ +struct panel_dpi_platform_data { + const char *name; + const char *source; + + int data_lines; + + const struct display_timing *display_timing; + + int backlight_gpio; + int enable_gpio; +}; + +/** + * panel_dsicm platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @reset_gpio: gpio to reset the panel (or -1) + * @use_ext_te: use external TE GPIO + * @ext_te_gpio: external TE GPIO + * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) + * @use_dsi_backlight: true if panel uses DSI command to control backlight + * @pin_config: DSI pin configuration + */ +struct panel_dsicm_platform_data { + const char *name; + const char *source; + + int reset_gpio; + + bool use_ext_te; + int ext_te_gpio; + + unsigned ulps_timeout; + + bool use_dsi_backlight; + + struct omap_dsi_pin_config pin_config; +}; + +/** + * panel_acx565akm platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @reset_gpio: gpio to reset the panel (or -1) + * @datapairs: number of SDI datapairs + */ +struct panel_acx565akm_platform_data { + const char *name; + const char *source; + + int reset_gpio; + + int datapairs; +}; + +/** + * panel_lb035q02 platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @data_lines: number of DPI datalines + * @backlight_gpio: gpio to enable/disable the backlight (or -1) + * @enable_gpio: gpio to enable/disable the panel (or -1) + */ +struct panel_lb035q02_platform_data { + const char *name; + const char *source; + + int data_lines; + + int backlight_gpio; + int enable_gpio; +}; + +/** + * panel_sharp_ls037v7dw01 platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @data_lines: number of DPI datalines + * @resb_gpio: reset signal GPIO + * @ini_gpio: power on control GPIO + * @mo_gpio: selection for resolution(VGA/QVGA) GPIO + * @lr_gpio: selection for horizontal scanning direction GPIO + * @ud_gpio: selection for vertical scanning direction GPIO + */ +struct panel_sharp_ls037v7dw01_platform_data { + const char *name; + const char *source; + + int data_lines; + + int resb_gpio; + int ini_gpio; + int mo_gpio; + int lr_gpio; + int ud_gpio; +}; + +/** + * panel-tpo-td043mtea1 platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @data_lines: number of DPI datalines + * @nreset_gpio: reset signal + */ +struct panel_tpo_td043mtea1_platform_data { + const char *name; + const char *source; + + int data_lines; + + int nreset_gpio; +}; + +/** + * panel-nec-nl8048hl11 platform data + * @name: name for this display entity + * @source: name of the display entity used as a video source + * @data_lines: number of DPI datalines + * @res_gpio: reset signal + * @qvga_gpio: selection for resolution(QVGA/WVGA) + */ +struct panel_nec_nl8048hl11_platform_data { + const char *name; + const char *source; + + int data_lines; + + int res_gpio; + int qvga_gpio; +}; + #endif /* __OMAP_PANEL_DATA_H */ diff --git a/include/video/omapdss.h b/include/video/omapdss.h index aeb4e9a0c5d1..b39463553845 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -23,6 +23,8 @@ #include <linux/device.h> #include <linux/interrupt.h> +#include <video/videomode.h> + #define DISPC_IRQ_FRAMEDONE (1 << 0) #define DISPC_IRQ_VSYNC (1 << 1) #define DISPC_IRQ_EVSYNC_EVEN (1 << 2) @@ -68,6 +70,7 @@ enum omap_display_type { OMAP_DISPLAY_TYPE_DSI = 1 << 3, OMAP_DISPLAY_TYPE_VENC = 1 << 4, OMAP_DISPLAY_TYPE_HDMI = 1 << 5, + OMAP_DISPLAY_TYPE_DVI = 1 << 6, }; enum omap_plane { @@ -169,6 +172,11 @@ enum omap_dss_audio_state { OMAP_DSS_AUDIO_PLAYING, }; +struct omap_dss_audio { + struct snd_aes_iec958 *iec; + struct snd_cea_861_aud_if *cea; +}; + enum omap_dss_rotation_type { OMAP_DSS_ROT_DMA = 1 << 0, OMAP_DSS_ROT_VRFB = 1 << 1, @@ -365,6 +373,7 @@ struct omap_dss_board_info { int num_devices; struct omap_dss_device **devices; struct omap_dss_device *default_device; + const char *default_display_name; int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); int (*set_min_bus_tput)(struct device *dev, unsigned long r); @@ -512,7 +521,7 @@ struct omap_overlay_manager { enum omap_dss_output_id supported_outputs; /* dynamic fields */ - struct omap_dss_output *output; + struct omap_dss_device *output; /* * The following functions do not block: @@ -526,7 +535,7 @@ struct omap_overlay_manager { */ int (*set_output)(struct omap_overlay_manager *mgr, - struct omap_dss_output *output); + struct omap_dss_device *output); int (*unset_output)(struct omap_overlay_manager *mgr); int (*set_manager_info)(struct omap_overlay_manager *mgr, @@ -569,33 +578,192 @@ struct omap_dss_writeback_info { u8 pre_mult_alpha; }; -struct omap_dss_output { - struct list_head list; +struct omapdss_dpi_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); - const char *name; + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); - /* display type supported by the output */ - enum omap_display_type type; + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); - /* DISPC channel for this output */ - enum omap_channel dispc_channel; + void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines); +}; - /* output instance */ - enum omap_dss_output_id id; +struct omapdss_sdi_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); - /* output's platform device pointer */ - struct platform_device *pdev; + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); - /* dynamic fields */ - struct omap_overlay_manager *manager; + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); - struct omap_dss_device *device; + void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs); +}; + +struct omapdss_dvi_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); + + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); +}; + +struct omapdss_atv_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); + + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + + void (*set_type)(struct omap_dss_device *dssdev, + enum omap_dss_venc_type type); + void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev, + bool invert_polarity); + + int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); + u32 (*get_wss)(struct omap_dss_device *dssdev); +}; + +struct omapdss_hdmi_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); + + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + + int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); + bool (*detect)(struct omap_dss_device *dssdev); + + /* + * Note: These functions might sleep. Do not call while + * holding a spinlock/readlock. + */ + int (*audio_enable)(struct omap_dss_device *dssdev); + void (*audio_disable)(struct omap_dss_device *dssdev); + bool (*audio_supported)(struct omap_dss_device *dssdev); + int (*audio_config)(struct omap_dss_device *dssdev, + struct omap_dss_audio *audio); + /* Note: These functions may not sleep */ + int (*audio_start)(struct omap_dss_device *dssdev); + void (*audio_stop)(struct omap_dss_device *dssdev); +}; + +struct omapdss_dsi_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes, + bool enter_ulps); + + /* bus configuration */ + int (*set_config)(struct omap_dss_device *dssdev, + const struct omap_dss_dsi_config *cfg); + int (*configure_pins)(struct omap_dss_device *dssdev, + const struct omap_dsi_pin_config *pin_cfg); + + void (*enable_hs)(struct omap_dss_device *dssdev, int channel, + bool enable); + int (*enable_te)(struct omap_dss_device *dssdev, bool enable); + + int (*update)(struct omap_dss_device *dssdev, int channel, + void (*callback)(int, void *), void *data); + + void (*bus_lock)(struct omap_dss_device *dssdev); + void (*bus_unlock)(struct omap_dss_device *dssdev); + + int (*enable_video_output)(struct omap_dss_device *dssdev, int channel); + void (*disable_video_output)(struct omap_dss_device *dssdev, + int channel); + + int (*request_vc)(struct omap_dss_device *dssdev, int *channel); + int (*set_vc_id)(struct omap_dss_device *dssdev, int channel, + int vc_id); + void (*release_vc)(struct omap_dss_device *dssdev, int channel); + + /* data transfer */ + int (*dcs_write)(struct omap_dss_device *dssdev, int channel, + u8 *data, int len); + int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel, + u8 *data, int len); + int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, + u8 *data, int len); + + int (*gen_write)(struct omap_dss_device *dssdev, int channel, + u8 *data, int len); + int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel, + u8 *data, int len); + int (*gen_read)(struct omap_dss_device *dssdev, int channel, + u8 *reqdata, int reqlen, + u8 *data, int len); + + int (*bta_sync)(struct omap_dss_device *dssdev, int channel); + + int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev, + int channel, u16 plen); }; struct omap_dss_device { - struct device dev; + /* old device, to be removed */ + struct device old_dev; + + /* new device, pointer to panel device */ + struct device *dev; + + struct module *owner; + + struct list_head panel_list; + + /* alias in the form of "display%d" */ + char alias[16]; enum omap_display_type type; + enum omap_display_type output_type; /* obsolete, to be removed */ enum omap_channel channel; @@ -616,9 +784,6 @@ struct omap_dss_device { struct { int module; - - bool ext_te; - u8 ext_te_gpio; } dsi; struct { @@ -639,10 +804,6 @@ struct omap_dss_device { struct rfbi_timings rfbi_timings; } ctrl; - int reset_gpio; - - int max_backlight_level; - const char *name; /* used to match device to driver */ @@ -652,22 +813,40 @@ struct omap_dss_device { struct omap_dss_driver *driver; + union { + const struct omapdss_dpi_ops *dpi; + const struct omapdss_sdi_ops *sdi; + const struct omapdss_dvi_ops *dvi; + const struct omapdss_hdmi_ops *hdmi; + const struct omapdss_atv_ops *atv; + const struct omapdss_dsi_ops *dsi; + } ops; + /* helper variable for driver suspend/resume */ bool activate_after_resume; enum omap_display_caps caps; - struct omap_dss_output *output; + struct omap_dss_device *output; enum omap_dss_display_state state; enum omap_dss_audio_state audio_state; - /* platform specific */ - int (*platform_enable)(struct omap_dss_device *dssdev); - void (*platform_disable)(struct omap_dss_device *dssdev); - int (*set_backlight)(struct omap_dss_device *dssdev, int level); - int (*get_backlight)(struct omap_dss_device *dssdev); + /* OMAP DSS output specific fields */ + + struct list_head list; + + /* DISPC channel for this output */ + enum omap_channel dispc_channel; + + /* output instance */ + enum omap_dss_output_id id; + + /* dynamic fields */ + struct omap_overlay_manager *manager; + + struct omap_dss_device *device; }; struct omap_dss_hdmi_data @@ -677,17 +856,15 @@ struct omap_dss_hdmi_data int hpd_gpio; }; -struct omap_dss_audio { - struct snd_aes_iec958 *iec; - struct snd_cea_861_aud_if *cea; -}; - struct omap_dss_driver { struct device_driver driver; int (*probe)(struct omap_dss_device *); void (*remove)(struct omap_dss_device *); + int (*connect)(struct omap_dss_device *dssdev); + void (*disconnect)(struct omap_dss_device *dssdev); + int (*enable)(struct omap_dss_device *display); void (*disable)(struct omap_dss_device *display); int (*run_test)(struct omap_dss_device *display, int test); @@ -753,7 +930,10 @@ bool omapdss_is_initialized(void); int omap_dss_register_driver(struct omap_dss_driver *); void omap_dss_unregister_driver(struct omap_dss_driver *); -void omap_dss_get_device(struct omap_dss_device *dssdev); +int omapdss_register_display(struct omap_dss_device *dssdev); +void omapdss_unregister_display(struct omap_dss_device *dssdev); + +struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev); void omap_dss_put_device(struct omap_dss_device *dssdev); #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL) struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); @@ -761,8 +941,10 @@ struct omap_dss_device *omap_dss_find_device(void *data, int (*match)(struct omap_dss_device *dssdev, void *data)); const char *omapdss_get_default_display_name(void); -int omap_dss_start_device(struct omap_dss_device *dssdev); -void omap_dss_stop_device(struct omap_dss_device *dssdev); +void videomode_to_omap_video_timings(const struct videomode *vm, + struct omap_video_timings *ovt); +void omap_video_timings_to_videomode(const struct omap_video_timings *ovt, + struct videomode *vm); int dss_feat_get_num_mgrs(void); int dss_feat_get_num_ovls(void); @@ -778,10 +960,17 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num); int omap_dss_get_num_overlays(void); struct omap_overlay *omap_dss_get_overlay(int num); -struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); -int omapdss_output_set_device(struct omap_dss_output *out, +int omapdss_register_output(struct omap_dss_device *output); +void omapdss_unregister_output(struct omap_dss_device *output); +struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id); +struct omap_dss_device *omap_dss_find_output(const char *name); +struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node); +int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev); -int omapdss_output_unset_device(struct omap_dss_output *out); +int omapdss_output_unset_device(struct omap_dss_device *out); + +struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev); +struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev); void omapdss_default_get_resolution(struct omap_dss_device *dssdev, u16 *xres, u16 *yres); @@ -832,7 +1021,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, bool mem_to_mem); #define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) -#define to_dss_device(x) container_of((x), struct omap_dss_device, dev) +#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev) void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, bool enable); @@ -883,6 +1072,11 @@ int omapdss_compat_init(void); void omapdss_compat_uninit(void); struct dss_mgr_ops { + int (*connect)(struct omap_overlay_manager *mgr, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_overlay_manager *mgr, + struct omap_dss_device *dst); + void (*start_update)(struct omap_overlay_manager *mgr); int (*enable)(struct omap_overlay_manager *mgr); void (*disable)(struct omap_overlay_manager *mgr); @@ -899,6 +1093,10 @@ struct dss_mgr_ops { int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); void dss_uninstall_mgr_ops(void); +int dss_mgr_connect(struct omap_overlay_manager *mgr, + struct omap_dss_device *dst); +void dss_mgr_disconnect(struct omap_overlay_manager *mgr, + struct omap_dss_device *dst); void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings); void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, @@ -910,4 +1108,15 @@ int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data); void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, void (*handler)(void *), void *data); + +static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev) +{ + return dssdev->output; +} + +static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) +{ + return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE; +} + #endif |