static void ps3av_set_videomode_packet(u32 id) { struct ps3av_pkt_avb_param avb_param; unsigned int i; u32 len = 0, av_video_cs; const struct avset_video_mode *video_mode; int res; video_mode = &video_mode_table[id & PS3AV_MODE_MASK]; avb_param.num_of_video_pkt = PS3AV_AVB_NUM_VIDEO; /* num of head */ avb_param.num_of_audio_pkt = 0; avb_param.num_of_av_video_pkt = ps3av->av_hw_conf.num_of_hdmi + ps3av->av_hw_conf.num_of_avmulti; avb_param.num_of_av_audio_pkt = 0; /* video_pkt */ for (i = 0; i < avb_param.num_of_video_pkt; i++) len += ps3av_cmd_set_video_mode(&avb_param.buf[len], ps3av->head[i], video_mode->vid, video_mode->fmt, id); /* av_video_pkt */ for (i = 0; i < avb_param.num_of_av_video_pkt; i++) { if (id & PS3AV_MODE_DVI || id & PS3AV_MODE_RGB) av_video_cs = RGB8; else av_video_cs = video_mode->cs; #ifndef PS3AV_HDMI_YUV if (ps3av->av_port[i] == PS3AV_CMD_AVPORT_HDMI_0 || ps3av->av_port[i] == PS3AV_CMD_AVPORT_HDMI_1) av_video_cs = RGB8; /* use RGB for HDMI */ #endif len += ps3av_cmd_set_av_video_cs(&avb_param.buf[len], ps3av->av_port[i], video_mode->vid, av_video_cs, video_mode->aspect, id); } /* send command using avb pkt */ len += offsetof(struct ps3av_pkt_avb_param, buf); res = ps3av_cmd_avb_param(&avb_param, len); if (res == PS3AV_STATUS_NO_SYNC_HEAD) printk(KERN_WARNING "%s: Command failed. Please try your request again. \n", __func__); else if (res) dev_dbg(&ps3av->dev->core, "ps3av_cmd_avb_param failed\n"); }
int ps3av_set_audio_mode(u32 ch, u32 fs, u32 word_bits, u32 format, u32 source) { struct ps3av_pkt_avb_param avb_param; int i, num_of_audio, vid, res; struct ps3av_pkt_audio_mode audio_mode; u32 len = 0; num_of_audio = ps3av->av_hw_conf.num_of_hdmi + ps3av->av_hw_conf.num_of_avmulti + ps3av->av_hw_conf.num_of_spdif; avb_param.num_of_video_pkt = 0; avb_param.num_of_audio_pkt = PS3AV_AVB_NUM_AUDIO; /* always 0 */ avb_param.num_of_av_video_pkt = 0; avb_param.num_of_av_audio_pkt = ps3av->av_hw_conf.num_of_hdmi; vid = video_mode_table[ps3av->ps3av_mode].vid; /* audio mute */ ps3av_set_audio_mute(PS3AV_CMD_MUTE_ON); /* audio inactive */ res = ps3av_cmd_audio_active(0, ps3av->audio_port); if (res < 0) dev_dbg(&ps3av->dev->core, "ps3av_cmd_audio_active OFF failed\n"); /* audio_pkt */ for (i = 0; i < num_of_audio; i++) { ps3av_cmd_set_audio_mode(&audio_mode, ps3av->av_port[i], ch, fs, word_bits, format, source); if (i < ps3av->av_hw_conf.num_of_hdmi) { /* hdmi only */ len += ps3av_cmd_set_av_audio_param(&avb_param.buf[len], ps3av->av_port[i], &audio_mode, vid); } /* audio_mode pkt should be sent separately */ res = ps3av_cmd_audio_mode(&audio_mode); if (res < 0) dev_dbg(&ps3av->dev->core, "ps3av_cmd_audio_mode failed, port:%x\n", i); } /* send command using avb pkt */ len += offsetof(struct ps3av_pkt_avb_param, buf); res = ps3av_cmd_avb_param(&avb_param, len); if (res < 0) dev_dbg(&ps3av->dev->core, "ps3av_cmd_avb_param failed\n"); /* audio mute */ ps3av_set_audio_mute(PS3AV_CMD_MUTE_OFF); /* audio active */ res = ps3av_cmd_audio_active(1, ps3av->audio_port); if (res < 0) dev_dbg(&ps3av->dev->core, "ps3av_cmd_audio_active ON failed\n"); return 0; }
static void ps3av_set_videomode_cont(u32 id, u32 old_id) { struct ps3av_pkt_avb_param avb_param; int i; u32 len = 0, av_video_cs; const struct avset_video_mode *video_mode; int res; video_mode = &video_mode_table[id & PS3AV_MODE_MASK]; avb_param.num_of_video_pkt = PS3AV_AVB_NUM_VIDEO; /* num of head */ avb_param.num_of_audio_pkt = 0; avb_param.num_of_av_video_pkt = ps3av->av_hw_conf.num_of_hdmi + ps3av->av_hw_conf.num_of_avmulti; avb_param.num_of_av_audio_pkt = 0; /* video signal off */ ps3av_set_video_disable_sig(); /* Retail PS3 product doesn't support this */ if (id & PS3AV_MODE_HDCP_OFF) { res = ps3av_cmd_av_hdmi_mode(PS3AV_CMD_AV_HDMI_HDCP_OFF); if (res == PS3AV_STATUS_UNSUPPORTED_HDMI_MODE) dev_dbg(&ps3av->dev->core, "Not supported\n"); else if (res) dev_dbg(&ps3av->dev->core, "ps3av_cmd_av_hdmi_mode failed\n"); } else if (old_id & PS3AV_MODE_HDCP_OFF) { res = ps3av_cmd_av_hdmi_mode(PS3AV_CMD_AV_HDMI_MODE_NORMAL); if (res < 0 && res != PS3AV_STATUS_UNSUPPORTED_HDMI_MODE) dev_dbg(&ps3av->dev->core, "ps3av_cmd_av_hdmi_mode failed\n"); } /* video_pkt */ for (i = 0; i < avb_param.num_of_video_pkt; i++) len += ps3av_cmd_set_video_mode(&avb_param.buf[len], ps3av->head[i], video_mode->vid, video_mode->fmt, id); /* av_video_pkt */ for (i = 0; i < avb_param.num_of_av_video_pkt; i++) { if (id & PS3AV_MODE_DVI || id & PS3AV_MODE_RGB) av_video_cs = RGB8; else av_video_cs = video_mode->cs; #ifndef PS3AV_HDMI_YUV if (ps3av->av_port[i] == PS3AV_CMD_AVPORT_HDMI_0 || ps3av->av_port[i] == PS3AV_CMD_AVPORT_HDMI_1) av_video_cs = RGB8; /* use RGB for HDMI */ #endif len += ps3av_cmd_set_av_video_cs(&avb_param.buf[len], ps3av->av_port[i], video_mode->vid, av_video_cs, video_mode->aspect, id); } /* send command using avb pkt */ len += offsetof(struct ps3av_pkt_avb_param, buf); res = ps3av_cmd_avb_param(&avb_param, len); if (res == PS3AV_STATUS_NO_SYNC_HEAD) printk(KERN_WARNING "%s: Command failed. Please try your request again. \n", __func__); else if (res) dev_dbg(&ps3av->dev->core, "ps3av_cmd_avb_param failed\n"); msleep(1500); /* av video mute */ ps3av_set_av_video_mute(PS3AV_CMD_MUTE_OFF); }