in ps3av.c [922:996]
static int ps3av_probe(struct ps3_system_bus_device *dev)
{
int res;
int id;
dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
dev_dbg(&dev->core, " timeout=%d\n", timeout);
if (ps3av) {
dev_err(&dev->core, "Only one ps3av device is supported\n");
return -EBUSY;
}
ps3av = kzalloc(sizeof(*ps3av), GFP_KERNEL);
if (!ps3av)
return -ENOMEM;
mutex_init(&ps3av->mutex);
ps3av->ps3av_mode = PS3AV_MODE_AUTO;
ps3av->dev = dev;
INIT_WORK(&ps3av->work, ps3avd);
init_completion(&ps3av->done);
complete(&ps3av->done);
switch (ps3_os_area_get_av_multi_out()) {
case PS3_PARAM_AV_MULTI_OUT_NTSC:
ps3av->region = PS3AV_REGION_60;
break;
case PS3_PARAM_AV_MULTI_OUT_PAL_YCBCR:
case PS3_PARAM_AV_MULTI_OUT_SECAM:
ps3av->region = PS3AV_REGION_50;
break;
case PS3_PARAM_AV_MULTI_OUT_PAL_RGB:
ps3av->region = PS3AV_REGION_50 | PS3AV_REGION_RGB;
break;
default:
ps3av->region = PS3AV_REGION_60;
break;
}
/* init avsetting modules */
res = ps3av_cmd_init();
if (res < 0)
printk(KERN_ERR "%s: ps3av_cmd_init failed %d\n", __func__,
res);
ps3av_get_hw_conf(ps3av);
#ifdef CONFIG_FB
if (fb_mode_option && !strcmp(fb_mode_option, "safe"))
safe_mode = 1;
#endif /* CONFIG_FB */
id = ps3av_auto_videomode(&ps3av->av_hw_conf);
if (id < 0) {
printk(KERN_ERR "%s: invalid id :%d\n", __func__, id);
res = -EINVAL;
goto fail;
}
safe_mode = 0;
mutex_lock(&ps3av->mutex);
ps3av->ps3av_mode = id;
mutex_unlock(&ps3av->mutex);
dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
return 0;
fail:
kfree(ps3av);
ps3av = NULL;
return res;
}