[DCCP]: fix memory leak and clean up style - dccp_feat_empty_confirm()
[cascardo/linux.git] / drivers / ps3 / ps3av_cmd.c
index bc70e81..f72f5dd 100644 (file)
@@ -143,6 +143,14 @@ static u32 ps3av_vid_video2av(int vid)
        return PS3AV_CMD_AV_VID_480P;
 }
 
+static int ps3av_hdmi_range(void)
+{
+       if (ps3_compare_firmware_version(1, 8, 0) < 0)
+               return 0;
+       else
+               return 1; /* supported */
+}
+
 int ps3av_cmd_init(void)
 {
        int res;
@@ -350,6 +358,10 @@ u32 ps3av_cmd_set_av_video_cs(void *p, u32 avport, int video_vid, int cs_out,
        /* should be same as video_mode.video_cs_out */
        av_video_cs->av_cs_in = ps3av_cs_video2av(PS3AV_CMD_VIDEO_CS_RGB_8);
        av_video_cs->bitlen_out = ps3av_cs_video2av_bitlen(cs_out);
+       if ((id & PS3AV_MODE_WHITE) && ps3av_hdmi_range())
+               av_video_cs->super_white = PS3AV_CMD_AV_SUPER_WHITE_ON;
+       else /* default off */
+               av_video_cs->super_white = PS3AV_CMD_AV_SUPER_WHITE_OFF;
        av_video_cs->aspect = aspect;
        if (id & PS3AV_MODE_DITHER) {
                av_video_cs->dither = PS3AV_CMD_AV_DITHER_ON
@@ -392,10 +404,14 @@ u32 ps3av_cmd_set_video_mode(void *p, u32 head, int video_vid, int video_fmt,
        video_mode->pitch = video_mode->width * 4;      /* line_length */
        video_mode->video_out_format = PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT;
        video_mode->video_format = ps3av_video_fmt_table[video_fmt].format;
+       if ((id & PS3AV_MODE_COLOR) && ps3av_hdmi_range())
+               video_mode->video_cl_cnv = PS3AV_CMD_VIDEO_CL_CNV_DISABLE_LUT;
+       else /* default enable */
+               video_mode->video_cl_cnv = PS3AV_CMD_VIDEO_CL_CNV_ENABLE_LUT;
        video_mode->video_order = ps3av_video_fmt_table[video_fmt].order;
 
        pr_debug("%s: video_mode:vid:%x width:%d height:%d pitch:%d out_format:%d format:%x order:%x\n",
-               __FUNCTION__, video_vid, video_mode->width, video_mode->height,
+               __func__, video_vid, video_mode->width, video_mode->height,
                video_mode->pitch, video_mode->video_out_format,
                video_mode->video_format, video_mode->video_order);
        return sizeof(*video_mode);
@@ -477,7 +493,7 @@ static u8 ps3av_cnv_mclk(u32 fs)
                if (ps3av_cnv_mclk_table[i].fs == fs)
                        return ps3av_cnv_mclk_table[i].mclk;
 
-       printk(KERN_ERR "%s failed, fs:%x\n", __FUNCTION__, fs);
+       printk(KERN_ERR "%s failed, fs:%x\n", __func__, fs);
        return 0;
 }
 
@@ -526,13 +542,12 @@ static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid)
                d = 4;
                break;
        default:
-               printk(KERN_ERR "%s failed, vid:%x\n", __FUNCTION__,
-                      video_vid);
+               printk(KERN_ERR "%s failed, vid:%x\n", __func__, video_vid);
                break;
        }
 
        if (fs < PS3AV_CMD_AUDIO_FS_44K || fs > PS3AV_CMD_AUDIO_FS_192K)
-               printk(KERN_ERR "%s failed, fs:%x\n", __FUNCTION__, fs);
+               printk(KERN_ERR "%s failed, fs:%x\n", __func__, fs);
        else
                ns_val = ps3av_ns_table[PS3AV_CMD_AUDIO_FS_44K-BASE][d];
 
@@ -555,8 +570,7 @@ static u8 ps3av_cnv_enable(u32 source, const u8 *enable)
                ret = ((p[0] << 4) + (p[1] << 5) + (p[2] << 6) + (p[3] << 7)) |
                      0x01;
        } else
-               printk(KERN_ERR "%s failed, source:%x\n", __FUNCTION__,
-                      source);
+               printk(KERN_ERR "%s failed, source:%x\n", __func__, source);
        return ret;
 }
 
@@ -585,7 +599,7 @@ static u8 ps3av_cnv_inputlen(u32 word_bits)
                ret = PS3AV_CMD_AV_INPUTLEN_24;
                break;
        default:
-               printk(KERN_ERR "%s failed, word_bits:%x\n", __FUNCTION__,
+               printk(KERN_ERR "%s failed, word_bits:%x\n", __func__,
                       word_bits);
                break;
        }
@@ -595,7 +609,7 @@ static u8 ps3av_cnv_inputlen(u32 word_bits)
 static u8 ps3av_cnv_layout(u32 num_of_ch)
 {
        if (num_of_ch > PS3AV_CMD_AUDIO_NUM_OF_CH_8) {
-               printk(KERN_ERR "%s failed, num_of_ch:%x\n", __FUNCTION__,
+               printk(KERN_ERR "%s failed, num_of_ch:%x\n", __func__,
                       num_of_ch);
                return 0;
        }
@@ -854,7 +868,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
 {
        int res;
 
-       ps3fb_flip_ctl(0);      /* flip off */
+       ps3av_flip_ctl(0);      /* flip off */
 
        /* avb packet */
        res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
@@ -864,11 +878,11 @@ int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *avb, u32 send_len)
 
        res = get_status(avb);
        if (res)
-               pr_debug("%s: PS3AV_CID_AVB_PARAM: failed %x\n", __FUNCTION__,
+               pr_debug("%s: PS3AV_CID_AVB_PARAM: failed %x\n", __func__,
                         res);
 
       out:
-       ps3fb_flip_ctl(1);      /* flip on */
+       ps3av_flip_ctl(1);      /* flip on */
        return res;
 }
 
@@ -989,34 +1003,3 @@ void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *
                | PS3AV_CMD_AV_LAYOUT_176 \
                | PS3AV_CMD_AV_LAYOUT_192)
 
-/************************* vuart ***************************/
-
-#define POLLING_INTERVAL  25   /* in msec */
-
-int ps3av_vuart_write(struct ps3_vuart_port_device *dev, const void *buf,
-                     unsigned long size)
-{
-       int error = ps3_vuart_write(dev, buf, size);
-       return error ? error : size;
-}
-
-int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
-                    unsigned long size, int timeout)
-{
-       int error;
-       int loopcnt = 0;
-
-       timeout = (timeout + POLLING_INTERVAL - 1) / POLLING_INTERVAL;
-       while (loopcnt++ <= timeout) {
-               error = ps3_vuart_read(dev, buf, size);
-               if (!error)
-                       return size;
-               if (error != -EAGAIN) {
-                       printk(KERN_ERR "%s: ps3_vuart_read failed %d\n",
-                              __FUNCTION__, error);
-                       return error;
-               }
-               msleep(POLLING_INTERVAL);
-       }
-       return -EWOULDBLOCK;
-}