diff options
author | Archit Taneja <archit@ti.com> | 2011-08-25 09:05:58 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-09-30 09:16:26 -0400 |
commit | 6ff8aa3182db248db4d91e574254316025c0243c (patch) | |
tree | 03ad061561dd89a1e8ee59ee422667f73dd798fd | |
parent | 7e951ee9955f3df0c41e523a199cc3b9372cdb9f (diff) |
OMAP: DSS2: DSI: Introduce generic write functions
Intoduce enum "dss_dsi_content_type" to differentiate between DCS and generic
content types.
Introduce short and long packet write functions which use generic
Processor-to-Peripheral transaction types. These are needed by some devices
which may not support corresponding DCS commands. Create common write functions
which allow code reuse between DCS and generic write functions.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 84 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 5 | ||||
-rw-r--r-- | include/video/omapdss.h | 12 |
3 files changed, 87 insertions, 14 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index d3bffe8b2a38..bb5588932b02 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -3065,38 +3065,60 @@ int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel) | |||
3065 | } | 3065 | } |
3066 | EXPORT_SYMBOL(dsi_vc_send_null); | 3066 | EXPORT_SYMBOL(dsi_vc_send_null); |
3067 | 3067 | ||
3068 | int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, | 3068 | static int dsi_vc_write_nosync_common(struct omap_dss_device *dssdev, |
3069 | u8 *data, int len) | 3069 | int channel, u8 *data, int len, enum dss_dsi_content_type type) |
3070 | { | 3070 | { |
3071 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 3071 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
3072 | int r; | 3072 | int r; |
3073 | 3073 | ||
3074 | BUG_ON(len == 0); | 3074 | if (len == 0) { |
3075 | 3075 | BUG_ON(type == DSS_DSI_CONTENT_DCS); | |
3076 | if (len == 1) { | ||
3077 | r = dsi_vc_send_short(dsidev, channel, | 3076 | r = dsi_vc_send_short(dsidev, channel, |
3077 | MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0); | ||
3078 | } else if (len == 1) { | ||
3079 | r = dsi_vc_send_short(dsidev, channel, | ||
3080 | type == DSS_DSI_CONTENT_GENERIC ? | ||
3081 | MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM : | ||
3078 | MIPI_DSI_DCS_SHORT_WRITE, data[0], 0); | 3082 | MIPI_DSI_DCS_SHORT_WRITE, data[0], 0); |
3079 | } else if (len == 2) { | 3083 | } else if (len == 2) { |
3080 | r = dsi_vc_send_short(dsidev, channel, | 3084 | r = dsi_vc_send_short(dsidev, channel, |
3085 | type == DSS_DSI_CONTENT_GENERIC ? | ||
3086 | MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM : | ||
3081 | MIPI_DSI_DCS_SHORT_WRITE_PARAM, | 3087 | MIPI_DSI_DCS_SHORT_WRITE_PARAM, |
3082 | data[0] | (data[1] << 8), 0); | 3088 | data[0] | (data[1] << 8), 0); |
3083 | } else { | 3089 | } else { |
3084 | /* 0x39 = DCS Long Write */ | 3090 | r = dsi_vc_send_long(dsidev, channel, |
3085 | r = dsi_vc_send_long(dsidev, channel, MIPI_DSI_DCS_LONG_WRITE, | 3091 | type == DSS_DSI_CONTENT_GENERIC ? |
3086 | data, len, 0); | 3092 | MIPI_DSI_GENERIC_LONG_WRITE : |
3093 | MIPI_DSI_DCS_LONG_WRITE, data, len, 0); | ||
3087 | } | 3094 | } |
3088 | 3095 | ||
3089 | return r; | 3096 | return r; |
3090 | } | 3097 | } |
3098 | |||
3099 | int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, | ||
3100 | u8 *data, int len) | ||
3101 | { | ||
3102 | return dsi_vc_write_nosync_common(dssdev, channel, data, len, | ||
3103 | DSS_DSI_CONTENT_DCS); | ||
3104 | } | ||
3091 | EXPORT_SYMBOL(dsi_vc_dcs_write_nosync); | 3105 | EXPORT_SYMBOL(dsi_vc_dcs_write_nosync); |
3092 | 3106 | ||
3093 | int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, | 3107 | int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel, |
3094 | int len) | 3108 | u8 *data, int len) |
3109 | { | ||
3110 | return dsi_vc_write_nosync_common(dssdev, channel, data, len, | ||
3111 | DSS_DSI_CONTENT_GENERIC); | ||
3112 | } | ||
3113 | EXPORT_SYMBOL(dsi_vc_generic_write_nosync); | ||
3114 | |||
3115 | static int dsi_vc_write_common(struct omap_dss_device *dssdev, int channel, | ||
3116 | u8 *data, int len, enum dss_dsi_content_type type) | ||
3095 | { | 3117 | { |
3096 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 3118 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
3097 | int r; | 3119 | int r; |
3098 | 3120 | ||
3099 | r = dsi_vc_dcs_write_nosync(dssdev, channel, data, len); | 3121 | r = dsi_vc_write_nosync_common(dssdev, channel, data, len, type); |
3100 | if (r) | 3122 | if (r) |
3101 | goto err; | 3123 | goto err; |
3102 | 3124 | ||
@@ -3114,18 +3136,39 @@ int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, | |||
3114 | 3136 | ||
3115 | return 0; | 3137 | return 0; |
3116 | err: | 3138 | err: |
3117 | DSSERR("dsi_vc_dcs_write(ch %d, cmd 0x%02x, len %d) failed\n", | 3139 | DSSERR("dsi_vc_write_common(ch %d, cmd 0x%02x, len %d) failed\n", |
3118 | channel, data[0], len); | 3140 | channel, data[0], len); |
3119 | return r; | 3141 | return r; |
3120 | } | 3142 | } |
3143 | |||
3144 | int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, | ||
3145 | int len) | ||
3146 | { | ||
3147 | return dsi_vc_write_common(dssdev, channel, data, len, | ||
3148 | DSS_DSI_CONTENT_DCS); | ||
3149 | } | ||
3121 | EXPORT_SYMBOL(dsi_vc_dcs_write); | 3150 | EXPORT_SYMBOL(dsi_vc_dcs_write); |
3122 | 3151 | ||
3152 | int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data, | ||
3153 | int len) | ||
3154 | { | ||
3155 | return dsi_vc_write_common(dssdev, channel, data, len, | ||
3156 | DSS_DSI_CONTENT_GENERIC); | ||
3157 | } | ||
3158 | EXPORT_SYMBOL(dsi_vc_generic_write); | ||
3159 | |||
3123 | int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd) | 3160 | int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd) |
3124 | { | 3161 | { |
3125 | return dsi_vc_dcs_write(dssdev, channel, &dcs_cmd, 1); | 3162 | return dsi_vc_dcs_write(dssdev, channel, &dcs_cmd, 1); |
3126 | } | 3163 | } |
3127 | EXPORT_SYMBOL(dsi_vc_dcs_write_0); | 3164 | EXPORT_SYMBOL(dsi_vc_dcs_write_0); |
3128 | 3165 | ||
3166 | int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel) | ||
3167 | { | ||
3168 | return dsi_vc_generic_write(dssdev, channel, NULL, 0); | ||
3169 | } | ||
3170 | EXPORT_SYMBOL(dsi_vc_generic_write_0); | ||
3171 | |||
3129 | int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 3172 | int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, |
3130 | u8 param) | 3173 | u8 param) |
3131 | { | 3174 | { |
@@ -3136,6 +3179,23 @@ int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | |||
3136 | } | 3179 | } |
3137 | EXPORT_SYMBOL(dsi_vc_dcs_write_1); | 3180 | EXPORT_SYMBOL(dsi_vc_dcs_write_1); |
3138 | 3181 | ||
3182 | int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel, | ||
3183 | u8 param) | ||
3184 | { | ||
3185 | return dsi_vc_generic_write(dssdev, channel, ¶m, 1); | ||
3186 | } | ||
3187 | EXPORT_SYMBOL(dsi_vc_generic_write_1); | ||
3188 | |||
3189 | int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel, | ||
3190 | u8 param1, u8 param2) | ||
3191 | { | ||
3192 | u8 buf[2]; | ||
3193 | buf[0] = param1; | ||
3194 | buf[1] = param2; | ||
3195 | return dsi_vc_generic_write(dssdev, channel, buf, 2); | ||
3196 | } | ||
3197 | EXPORT_SYMBOL(dsi_vc_generic_write_2); | ||
3198 | |||
3139 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 3199 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, |
3140 | u8 *buf, int buflen) | 3200 | u8 *buf, int buflen) |
3141 | { | 3201 | { |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index a095a62c64e8..3ec8dd7066a2 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -108,6 +108,11 @@ enum dss_hdmi_venc_clk_source_select { | |||
108 | DSS_HDMI_M_PCLK = 1, | 108 | DSS_HDMI_M_PCLK = 1, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | enum dss_dsi_content_type { | ||
112 | DSS_DSI_CONTENT_DCS, | ||
113 | DSS_DSI_CONTENT_GENERIC, | ||
114 | }; | ||
115 | |||
111 | struct dss_clock_info { | 116 | struct dss_clock_info { |
112 | /* rates that we get with dividers below */ | 117 | /* rates that we get with dividers below */ |
113 | unsigned long fck; | 118 | unsigned long fck; |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index aeadbc880e38..49ffdd201c2d 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -225,12 +225,20 @@ void dsi_bus_lock(struct omap_dss_device *dssdev); | |||
225 | void dsi_bus_unlock(struct omap_dss_device *dssdev); | 225 | void dsi_bus_unlock(struct omap_dss_device *dssdev); |
226 | int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, | 226 | int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, |
227 | int len); | 227 | int len); |
228 | int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, | 228 | int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data, |
229 | u8 dcs_cmd); | 229 | int len); |
230 | int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd); | ||
231 | int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel); | ||
230 | int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 232 | int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, |
231 | u8 param); | 233 | u8 param); |
234 | int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel, | ||
235 | u8 param); | ||
236 | int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel, | ||
237 | u8 param1, u8 param2); | ||
232 | int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, | 238 | int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, |
233 | u8 *data, int len); | 239 | u8 *data, int len); |
240 | int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel, | ||
241 | u8 *data, int len); | ||
234 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 242 | int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, |
235 | u8 *buf, int buflen); | 243 | u8 *buf, int buflen); |
236 | int dsi_vc_dcs_read_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | 244 | int dsi_vc_dcs_read_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, |