Merge branch 'torvalds/master'
[firefly-linux-kernel-4.4.55.git] / drivers / video / rockchip / hdmi / rockchip-hdmi-sysfs.c
1 #include <linux/ctype.h>
2 #include <linux/string.h>
3 #include <linux/display-sys.h>
4 #include <linux/interrupt.h>
5 #include "rockchip-hdmi.h"
6
7 static int hdmi_get_enable(struct rk_display_device *device)
8 {
9         struct hdmi *hdmi = device->priv_data;
10         int enable;
11
12         enable = hdmi->enable;
13         return enable;
14 }
15
16 static int hdmi_set_enable(struct rk_display_device *device, int enable)
17 {
18         struct hdmi *hdmi = device->priv_data;
19
20         if (enable == 0)
21                 hdmi_submit_work(hdmi, HDMI_DISABLE_CTL, 0, 0);
22         else
23                 hdmi_submit_work(hdmi, HDMI_ENABLE_CTL, 0, 0);
24         return 0;
25 }
26
27 static int hdmi_get_status(struct rk_display_device *device)
28 {
29         struct hdmi *hdmi = device->priv_data;
30
31         if (hdmi->hotplug == HDMI_HPD_ACTIVED)
32                 return 1;
33         else
34                 return 0;
35 }
36
37 static int hdmi_get_modelist(struct rk_display_device *device,
38                              struct list_head **modelist)
39 {
40         struct hdmi *hdmi = device->priv_data;
41
42         *modelist = &hdmi->edid.modelist;
43         return 0;
44 }
45
46 static int hdmi_set_mode(struct rk_display_device *device,
47                          struct fb_videomode *mode)
48 {
49         struct hdmi *hdmi = device->priv_data;
50         struct display_modelist *display_modelist =
51                         container_of(mode, struct display_modelist, mode);
52         int vic = 0;
53
54         if (mode == NULL) {
55                 hdmi->autoset = 1;
56                 vic = hdmi_find_best_mode(hdmi, 0);
57         } else {
58                 hdmi->autoset = 0;
59                 vic = display_modelist->vic;
60         }
61
62         if (vic && hdmi->vic != vic) {
63                 hdmi->vic = vic;
64                 if (hdmi->hotplug == HDMI_HPD_ACTIVED)
65                         hdmi_submit_work(hdmi, HDMI_SET_VIDEO, 0, 0);
66         }
67         return 0;
68 }
69
70 static int hdmi_get_mode(struct rk_display_device *device,
71                          struct fb_videomode *mode)
72 {
73         struct hdmi *hdmi = device->priv_data;
74         struct fb_videomode *vmode;
75
76         if (mode == NULL)
77                 return -1;
78
79         if (hdmi->vic) {
80                 vmode = (struct fb_videomode *)
81                         hdmi_vic_to_videomode(hdmi->vic);
82                 if (unlikely(vmode == NULL))
83                         return -1;
84                 *mode = *vmode;
85                 if (hdmi->vic & HDMI_VIDEO_YUV420)
86                         mode->flag = 1;
87         } else {
88                 memset(mode, 0, sizeof(struct fb_videomode));
89         }
90         return 0;
91 }
92
93 static int hdmi_set_3dmode(struct rk_display_device *device, int mode)
94 {
95         struct hdmi *hdmi = device->priv_data;
96         struct list_head *modelist, *pos;
97         struct display_modelist *display_modelist = NULL;
98
99         if (!hdmi)
100                 return -1;
101
102         modelist = &hdmi->edid.modelist;
103         list_for_each(pos, modelist) {
104                 display_modelist =
105                         list_entry(pos, struct display_modelist, list);
106                 if (hdmi->vic == display_modelist->vic)
107                         break;
108                 else
109                         display_modelist = NULL;
110         }
111         if (!display_modelist)
112                 return -1;
113
114         if ((mode != HDMI_3D_NONE) &&
115             ((display_modelist->format_3d & (1 << mode)) == 0))
116                 pr_warn("warning: sink not support input 3d mode %d", mode);
117
118         if (hdmi->mode_3d != mode) {
119                 hdmi->mode_3d = mode;
120                 if (hdmi->hotplug == HDMI_HPD_ACTIVED)
121                         hdmi_submit_work(hdmi, HDMI_SET_3D, 0, 0);
122         }
123         return 0;
124 }
125
126 static int hdmi_get_3dmode(struct rk_display_device *device)
127 {
128         struct hdmi *hdmi = device->priv_data;
129
130         if (!hdmi)
131                 return -1;
132         else
133                 return hdmi->mode_3d;
134 }
135
136 /*CEA 861-E: Audio Coding Type
137   sync width enum hdmi_audio_type
138 */
139 static const char * const audioformatstr[] = {
140         "",
141         "LPCM",         /*HDMI_AUDIO_LPCM = 1,*/
142         "AC3",          /*HDMI_AUDIO_AC3,*/
143         "MPEG1",        /*HDMI_AUDIO_MPEG1,*/
144         "MP3",          /*HDMI_AUDIO_MP3,*/
145         "MPEG2",        /*HDMI_AUDIO_MPEG2,*/
146         "AAC-LC",       /*HDMI_AUDIO_AAC_LC, AAC*/
147         "DTS",          /*HDMI_AUDIO_DTS,*/
148         "ATARC",        /*HDMI_AUDIO_ATARC,*/
149         "DSD",          /*HDMI_AUDIO_DSD, One bit Audio */
150         "E-AC3",        /*HDMI_AUDIO_E_AC3,*/
151         "DTS-HD",       /*HDMI_AUDIO_DTS_HD,*/
152         "MLP",          /*HDMI_AUDIO_MLP,*/
153         "DST",          /*HDMI_AUDIO_DST,*/
154         "WMA-PRO",      /*HDMI_AUDIO_WMA_PRO*/
155 };
156
157 static int hdmi_get_edidaudioinfo(struct rk_display_device *device,
158                                   char *audioinfo, int len)
159 {
160         struct hdmi *hdmi = device->priv_data;
161         int i = 0, size = 0;
162         struct hdmi_audio *audio;
163
164         if (!hdmi)
165                 return -1;
166
167         memset(audioinfo, 0x00, len);
168         /*printk("hdmi:edid: audio_num: %d\n", hdmi->edid.audio_num);*/
169         for (i = 0; i < hdmi->edid.audio_num; i++) {
170                 audio = &(hdmi->edid.audio[i]);
171                 if (audio->type < 1 || audio->type > HDMI_AUDIO_WMA_PRO) {
172                         pr_info("audio type: unsupported.");
173                         continue;
174                 }
175                 size = strlen(audioformatstr[audio->type]);
176                 memcpy(audioinfo, audioformatstr[audio->type], size);
177                 audioinfo[size] = ',';
178                 audioinfo += (size+1);
179         }
180         return 0;
181 }
182
183 static int hdmi_get_color(struct rk_display_device *device, char *buf)
184 {
185         struct hdmi *hdmi = device->priv_data;
186         int i, mode;
187
188         mode = (1 << HDMI_COLOR_RGB_0_255);
189         if (hdmi->edid.sink_hdmi) {
190                 mode |= (1 << HDMI_COLOR_RGB_16_235);
191                 if (hdmi->edid.ycbcr422)
192                         mode |= (1 << HDMI_COLOR_YCBCR422);
193                 if (hdmi->edid.ycbcr444)
194                         mode |= (1 << HDMI_COLOR_YCBCR444);
195         }
196         i = snprintf(buf, PAGE_SIZE,
197                      "Supported Color Mode: %d\n", mode);
198         i += snprintf(buf + i, PAGE_SIZE - i,
199                       "Current Color Mode: %d\n", hdmi->colormode);
200
201         mode = (1 << 1); /* 24 bit*/
202         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_30BITS &&
203             hdmi->property->feature & SUPPORT_DEEP_10BIT)
204                 mode |= (1 << HDMI_DEEP_COLOR_30BITS);
205         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_36BITS &&
206             hdmi->property->feature & SUPPORT_DEEP_12BIT)
207                 mode |= (1 << HDMI_DEEP_COLOR_36BITS);
208         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_48BITS &&
209             hdmi->property->feature & SUPPORT_DEEP_16BIT)
210                 mode |= (1 << HDMI_DEEP_COLOR_48BITS);
211         i += snprintf(buf + i, PAGE_SIZE - i,
212                       "Supported Color Depth: %d\n", mode);
213         i += snprintf(buf + i, PAGE_SIZE - i,
214                       "Current Color Depth: %d\n", hdmi->colordepth);
215         i += snprintf(buf + i, PAGE_SIZE - i,
216                       "Supported Colorimetry: %d\n", hdmi->edid.colorimetry);
217         i += snprintf(buf + i, PAGE_SIZE - i,
218                       "Current Colorimetry: %d\n", hdmi->colorimetry);
219         return i;
220 }
221
222 static int hdmi_set_color(struct rk_display_device *device,
223                           const char *buf, int len)
224 {
225         struct hdmi *hdmi = device->priv_data;
226         int value;
227
228         if (!strncmp(buf, "mode", 4)) {
229                 if (sscanf(buf, "mode=%d", &value) == -1)
230                         return -1;
231                 pr_debug("current mode is %d input mode is %d\n",
232                          hdmi->colormode, value);
233                 if (hdmi->colormode != value)
234                         hdmi->colormode = value;
235         } else if (!strncmp(buf, "depth", 5)) {
236                 if (sscanf(buf, "depth=%d", &value) == -1)
237                         return -1;
238                 pr_debug("current depth is %d input mode is %d\n",
239                          hdmi->colordepth, value);
240                 if (hdmi->colordepth != value)
241                         hdmi->colordepth = value;
242         } else if (!strncmp(buf, "colorimetry", 11)) {
243                 if (sscanf(buf, "colorimetry=%d", &value) == -1)
244                         return -1;
245                 pr_debug("current colorimetry is %d input colorimetry is %d\n",
246                          hdmi->colorimetry, value);
247                 if (hdmi->colorimetry != value)
248                         hdmi->colorimetry = value;
249         } else {
250                 pr_err("%s unkown event\n", __func__);
251                 return -1;
252         }
253         if (hdmi->hotplug == HDMI_HPD_ACTIVED)
254                 hdmi_submit_work(hdmi, HDMI_SET_COLOR, 0, 0);
255         return 0;
256 }
257
258 static int hdmi_set_scale(struct rk_display_device *device, int direction,
259                           int value)
260 {
261         struct hdmi *hdmi = device->priv_data;
262
263         if (!hdmi || value < 0 || value > 100)
264                 return -1;
265
266         if (!hdmi->hotplug)
267                 return 0;
268
269         if (direction == DISPLAY_SCALE_X)
270                 hdmi->xscale = value;
271         else if (direction == DISPLAY_SCALE_Y)
272                 hdmi->yscale = value;
273         else
274                 return -1;
275         rk_fb_disp_scale(hdmi->xscale, hdmi->yscale, hdmi->lcdc->id);
276         return 0;
277 }
278
279 static int hdmi_get_scale(struct rk_display_device *device, int direction)
280 {
281         struct hdmi *hdmi = device->priv_data;
282
283         if (!hdmi)
284                 return -1;
285
286         if (direction == DISPLAY_SCALE_X)
287                 return hdmi->xscale;
288         else if (direction == DISPLAY_SCALE_Y)
289                 return hdmi->yscale;
290         else
291                 return -1;
292 }
293
294 static int hdmi_get_monspecs(struct rk_display_device *device,
295                              struct fb_monspecs *monspecs)
296 {
297         struct hdmi *hdmi = device->priv_data;
298
299         if (!hdmi)
300                 return -1;
301
302         if (hdmi->edid.specs)
303                 *monspecs = *(hdmi->edid.specs);
304         return 0;
305 }
306
307 /**
308  * hdmi_show_sink_info: show hdmi sink device infomation
309  * @hdmi: handle of hdmi
310  */
311 static int hdmi_show_sink_info(struct hdmi *hdmi, char *buf, int len)
312 {
313         struct list_head *pos, *head = &hdmi->edid.modelist;
314         struct display_modelist *modelist;
315         struct fb_videomode *m;
316         struct hdmi_audio *audio;
317         int i, lens = len;
318
319         lens += snprintf(buf + lens, PAGE_SIZE - lens,
320                         "******** Show Sink Info ********\n");
321         lens += snprintf(buf + lens, PAGE_SIZE - lens,
322                          "Max tmds clk is %u\n",
323                          hdmi->edid.maxtmdsclock);
324         if (hdmi->edid.hf_vsdb_version)
325                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
326                                  "Support HFVSDB\n");
327         if (hdmi->edid.scdc_present)
328                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
329                                  "Support SCDC\n");
330         lens += snprintf(buf + lens, PAGE_SIZE - lens,
331                          "Support video mode:\n");
332         list_for_each(pos, head) {
333                 modelist = list_entry(pos, struct display_modelist, list);
334                 m = &modelist->mode;
335                 if (m->flag)
336                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
337                                          "\t%s(YCbCr420)\n", m->name);
338                 else
339                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
340                                          "\t%s\n", m->name);
341         }
342         lens += snprintf(buf + lens, PAGE_SIZE - lens,
343                          "Support video color mode:");
344         lens += snprintf(buf + lens, PAGE_SIZE - lens, " RGB");
345         if (hdmi->edid.ycbcr420)
346                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
347                                  " YCbCr420");
348         if (hdmi->edid.ycbcr422)
349                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
350                                  " YCbCr422");
351         if (hdmi->edid.ycbcr444)
352                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
353                                  " YCbCr444");
354         lens += snprintf(buf + lens, PAGE_SIZE - lens,
355                          "\nSupport video color depth:");
356         lens += snprintf(buf + lens, PAGE_SIZE - lens, " 24bit");
357         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_30BITS)
358                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 30bit");
359         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_36BITS)
360                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 36bit");
361         if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_48BITS)
362                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 48bit");
363         if (hdmi->edid.ycbcr420)
364                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_24bit");
365         if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_30BITS)
366                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_30bit");
367         if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_36BITS)
368                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_36bit");
369         if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_48BITS)
370                 lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_48bit");
371         if (hdmi->edid.colorimetry) {
372                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
373                                  "\nExtended Colorimetry:");
374                 if (hdmi->edid.colorimetry &
375                     (1 << (HDMI_COLORIMETRY_EXTEND_XVYCC_601 - 3)))
376                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
377                                          " xvYCC601");
378                 if (hdmi->edid.colorimetry &
379                     (1 << (HDMI_COLORIMETRY_EXTEND_XVYCC_709 - 3)))
380                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
381                                          " xvYCC709");
382                 if (hdmi->edid.colorimetry &
383                     (1 << (HDMI_COLORIMETRY_EXTEND_SYCC_601 - 3)))
384                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
385                                          " sYCC601");
386                 if (hdmi->edid.colorimetry &
387                     (1 << (HDMI_COLORIMETRY_EXTEND_ADOBE_YCC601 - 3)))
388                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
389                                          " AdobeYCC601");
390                 if (hdmi->edid.colorimetry &
391                     (1 << (HDMI_COLORIMETRY_EXTEND_ADOBE_RGB - 3)))
392                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
393                                          " AdobeRGB");
394                 if (hdmi->edid.colorimetry &
395                     (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_YCC_C - 3)))
396                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
397                                          " BT2020cYCC");
398                 if (hdmi->edid.colorimetry &
399                     (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_YCC - 3)))
400                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
401                                          " BT2020YCC");
402                 if (hdmi->edid.colorimetry &
403                     (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_RGB - 3)))
404                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
405                                          " BT2020RGB");
406         }
407         lens += snprintf(buf + lens, PAGE_SIZE - lens,
408                          "\nSupport audio type:");
409         for (i = 0; i < hdmi->edid.audio_num; i++) {
410                 audio = &(hdmi->edid.audio[i]);
411                 switch (audio->type) {
412                 case HDMI_AUDIO_LPCM:
413                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
414                                 " LPCM\n");
415                         break;
416                 case HDMI_AUDIO_AC3:
417                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
418                                          " AC3");
419                         break;
420                 case HDMI_AUDIO_MPEG1:
421                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
422                                          " MPEG1");
423                         break;
424                 case HDMI_AUDIO_MP3:
425                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
426                                          " MP3");
427                         break;
428                 case HDMI_AUDIO_MPEG2:
429                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
430                                          " MPEG2");
431                         break;
432                 case HDMI_AUDIO_AAC_LC:
433                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
434                                          " AAC");
435                         break;
436                 case HDMI_AUDIO_DTS:
437                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
438                                          " DTS");
439                         break;
440                 case HDMI_AUDIO_ATARC:
441                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
442                                          " ATARC");
443                         break;
444                 case HDMI_AUDIO_DSD:
445                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
446                                          " DSD");
447                         break;
448                 case HDMI_AUDIO_E_AC3:
449                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
450                                          " E-AC3");
451                         break;
452                 case HDMI_AUDIO_DTS_HD:
453                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
454                                          " DTS-HD");
455                         break;
456                 case HDMI_AUDIO_MLP:
457                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
458                                          " MLP");
459                         break;
460                 case HDMI_AUDIO_DST:
461                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
462                                          " DST");
463                         break;
464                 case HDMI_AUDIO_WMA_PRO:
465                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
466                                          " WMP-PRO");
467                         break;
468                 default:
469                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
470                                          " Unkown");
471                         break;
472                 }
473                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
474                                  "Support max audio channel is %d\n",
475                                  audio->channel);
476                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
477                                  "Support audio sample rate:");
478                 if (audio->rate & HDMI_AUDIO_FS_32000)
479                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
480                                          " 32000");
481                 if (audio->rate & HDMI_AUDIO_FS_44100)
482                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
483                                          " 44100");
484                 if (audio->rate & HDMI_AUDIO_FS_48000)
485                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
486                                          " 48000");
487                 if (audio->rate & HDMI_AUDIO_FS_88200)
488                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
489                                          " 88200");
490                 if (audio->rate & HDMI_AUDIO_FS_96000)
491                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
492                                          " 96000");
493                 if (audio->rate & HDMI_AUDIO_FS_176400)
494                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
495                                          " 176400");
496                 if (audio->rate & HDMI_AUDIO_FS_192000)
497                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
498                                          " 192000");
499                 lens += snprintf(buf + lens, PAGE_SIZE - lens,
500                                  "\nSupport audio word lenght:");
501                 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_16bit)
502                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
503                                          " 16bit");
504                 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_20bit)
505                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
506                                          " 20bit");
507                 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_24bit)
508                         lens += snprintf(buf + lens, PAGE_SIZE - lens,
509                                          " 24bit");
510                 lens += snprintf(buf + lens, PAGE_SIZE - lens, "\n");
511         }
512         return lens;
513 }
514
515 static int hdmi_get_debug(struct rk_display_device *device, char *buf)
516 {
517         struct hdmi *hdmi = device->priv_data;
518         char *buff;
519         int i, j, len = 0;
520
521         if (!hdmi)
522                 return 0;
523         len += snprintf(buf+len, PAGE_SIZE - len, "EDID status:%s\n",
524                         hdmi->edid.status ? "False" : "Okay");
525         len += snprintf(buf+len, PAGE_SIZE - len, "Raw Data:");
526         for (i = 0; i < HDMI_MAX_EDID_BLOCK; i++) {
527                 if (!hdmi->edid.raw[i])
528                         break;
529                 buff = hdmi->edid.raw[i];
530                 for (j = 0; j < HDMI_EDID_BLOCK_SIZE; j++) {
531                         if (j % 16 == 0)
532                                 len += snprintf(buf + len,
533                                                 PAGE_SIZE - len, "\n");
534                         len += snprintf(buf+len, PAGE_SIZE - len, "0x%02x, ",
535                                         buff[j]);
536                 }
537         }
538         len += snprintf(buf+len, PAGE_SIZE, "\n");
539         if (!hdmi->edid.status)
540                 len += hdmi_show_sink_info(hdmi, buf, len);
541         return len;
542 }
543
544 static struct rk_display_ops hdmi_display_ops = {
545         .setenable = hdmi_set_enable,
546         .getenable = hdmi_get_enable,
547         .getstatus = hdmi_get_status,
548         .getmodelist = hdmi_get_modelist,
549         .setmode = hdmi_set_mode,
550         .getmode = hdmi_get_mode,
551         .set3dmode = hdmi_set_3dmode,
552         .get3dmode = hdmi_get_3dmode,
553         .getedidaudioinfo = hdmi_get_edidaudioinfo,
554         .setcolor = hdmi_set_color,
555         .getcolor = hdmi_get_color,
556         .getmonspecs = hdmi_get_monspecs,
557         .setscale = hdmi_set_scale,
558         .getscale = hdmi_get_scale,
559         .getdebug = hdmi_get_debug,
560 };
561
562 static int hdmi_display_probe(struct rk_display_device *device, void *devdata)
563 {
564         struct hdmi *hdmi = devdata;
565
566         device->owner = THIS_MODULE;
567         strcpy(device->type, "HDMI");
568         device->priority = DISPLAY_PRIORITY_HDMI;
569         device->name = hdmi->property->name;
570         device->property = hdmi->property->display;
571         device->priv_data = devdata;
572         device->ops = &hdmi_display_ops;
573         return 1;
574 }
575
576 static struct rk_display_driver display_hdmi = {
577         .probe = hdmi_display_probe,
578 };
579
580 struct rk_display_device *hdmi_register_display_sysfs(struct hdmi *hdmi,
581                                                       struct device *parent)
582 {
583         return rk_display_device_register(&display_hdmi, parent, hdmi);
584 }
585
586 void hdmi_unregister_display_sysfs(struct hdmi *hdmi)
587 {
588         if (hdmi->ddev)
589                 rk_display_device_unregister(hdmi->ddev);
590 }