struct fb_videomode *mode;
size_t i;
+ mutex_lock(&dsp->lock);
if (!memcmp(buf, "auto", 4)) {
if (dsp->ops && dsp->ops->setmode)
dsp->ops->setmode(dsp, NULL);
+ mutex_unlock(&dsp->lock);
return count;
}
if (dsp->ops && dsp->ops->getmodelist) {
if (dsp->ops && dsp->ops->getmodelist) {
- if (dsp->ops->getmodelist(dsp, &modelist))
+ if (dsp->ops->getmodelist(dsp, &modelist)) {
+ mutex_unlock(&dsp->lock);
return -EINVAL;
+ }
}
list_for_each(pos, modelist) {
display_modelist = list_entry(pos,
if (strncmp(mstr, buf, max(count, i)) == 0) {
if (dsp->ops && dsp->ops->setmode)
dsp->ops->setmode(dsp, mode);
+ mutex_unlock(&dsp->lock);
return count;
}
}
}
+ mutex_unlock(&dsp->lock);
return -EINVAL;
}
char mode_str[128];
int mode_strlen, format_3d;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->getmodelist) {
- if (dsp->ops->getmodelist(dsp, &modelist))
+ if (dsp->ops->getmodelist(dsp, &modelist)) {
+ mutex_unlock(&dsp->lock);
return -EINVAL;
+ }
} else {
+ mutex_unlock(&dsp->lock);
return 0;
}
if (dsp->ops && dsp->ops->getmode) {
- if (dsp->ops->getmode(dsp, &mode))
+ if (dsp->ops->getmode(dsp, &mode)) {
+ mutex_unlock(&dsp->lock);
return -EINVAL;
+ }
} else {
+ mutex_unlock(&dsp->lock);
return 0;
}
i += snprintf(buf+i, PAGE_SIZE, "%s,%d\n",
mode_str, format_3d);
}
+ mutex_unlock(&dsp->lock);
return i;
}
struct rk_display_device *dsp = dev_get_drvdata(dev);
int mode;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->set3dmode) {
if (!kstrtoint(buf, 0, &mode))
dsp->ops->set3dmode(dsp, mode);
+ mutex_unlock(&dsp->lock);
return count;
}
+ mutex_unlock(&dsp->lock);
return -EINVAL;
}
struct device_attribute *attr, char *buf)
{
struct rk_display_device *dsp = dev_get_drvdata(dev);
+ int ret = 0;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->getcolor)
- return dsp->ops->getcolor(dsp, buf);
- else
- return 0;
+ ret = dsp->ops->getcolor(dsp, buf);
+ mutex_unlock(&dsp->lock);
+ return ret;
}
static ssize_t display_store_color(struct device *dev,
{
struct rk_display_device *dsp = dev_get_drvdata(dev);
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->setcolor) {
- if (!dsp->ops->setcolor(dsp, buf, count))
+ if (!dsp->ops->setcolor(dsp, buf, count)) {
+ mutex_unlock(&dsp->lock);
return count;
+ }
}
+ mutex_unlock(&dsp->lock);
return -EINVAL;
}
char audioinfo[200];
int ret = 0;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->getedidaudioinfo) {
ret = dsp->ops->getedidaudioinfo(dsp, audioinfo, 200);
- if (!ret)
+ if (!ret) {
+ mutex_unlock(&dsp->lock);
return snprintf(buf, PAGE_SIZE, "%s\n", audioinfo);
+ }
}
+ mutex_unlock(&dsp->lock);
return -EINVAL;
}
struct fb_monspecs monspecs;
int ret = 0;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->getmonspecs) {
ret = dsp->ops->getmonspecs(dsp, &monspecs);
if (!ret) {
+ mutex_unlock(&dsp->lock);
memcpy(buf, &monspecs, sizeof(struct fb_monspecs));
return sizeof(struct fb_monspecs);
}
}
+ mutex_unlock(&dsp->lock);
return -EINVAL;
}
struct device_attribute *attr, char *buf)
{
struct rk_display_device *dsp = dev_get_drvdata(dev);
+ int ret = -EINVAL;
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->getdebug)
- return dsp->ops->getdebug(dsp, buf);
- else
- return -EINVAL;
+ ret = dsp->ops->getdebug(dsp, buf);
+ mutex_unlock(&dsp->lock);
+ return ret;
}
static ssize_t display_store_debug(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- int cmd;
+ int cmd, ret = -EINVAL;
struct rk_display_device *dsp = dev_get_drvdata(dev);
+ mutex_lock(&dsp->lock);
if (dsp->ops && dsp->ops->setdebug) {
if (kstrtoint(buf, 0, &cmd) == 0)
dsp->ops->setdebug(dsp, cmd);
- return count;
+ ret = count;
}
- return -EINVAL;
+ mutex_unlock(&dsp->lock);
+ return ret;
}
static struct device_attribute display_attrs[] = {
DBG("%s\n", __func__);
- video.vic = hdmi->vic & HDMI_VIC_MASK;
video.sink_hdmi = hdmi->edid.sink_hdmi;
video.format_3d = hdmi->mode_3d;
video.colorimetry = hdmi->colorimetry;
}
hdmi->colormode_input = video.color_input;
hdmi_set_lcdc(hdmi);
+ video.vic = hdmi->vic & HDMI_VIC_MASK;
if (hdmi->ops->setvideo)
hdmi->ops->setvideo(hdmi, &video);
}
#ifdef CONFIG_SWITCH
switch_set_state(&(hdmi->switchdev), 0);
#endif
- mutex_lock(&hdmi->ddev->lock);
list_for_each_safe(pos, n, &hdmi->edid.modelist) {
list_del(pos);
kfree(pos);
}
- mutex_unlock(&hdmi->ddev->lock);
for (i = 0; i < HDMI_MAX_EDID_BLOCK; i++)
kfree(hdmi->edid.raw[i]);
kfree(hdmi->edid.audio);
int event = hdmi_w->event;
int hpd = HDMI_HPD_REMOVED;
- mutex_lock(&hdmi->lock);
+ mutex_lock(&hdmi->ddev->lock);
DBG("\nhdmi_work_queue() - evt= %x %d\n",
(event & 0xFF00) >> 8,
DBG("\nhdmi_work_queue() - exit evt= %x %d\n",
(event & 0xFF00) >> 8,
event & 0xFF);
- mutex_unlock(&hdmi->lock);
+ mutex_unlock(&hdmi->ddev->lock);
}
struct hdmi *rockchip_hdmi_register(struct hdmi_property *property,
container_of(mode, struct display_modelist, mode);
int vic = 0;
- mutex_lock(&hdmi->lock);
if (mode == NULL) {
hdmi->autoset = 1;
vic = hdmi_find_best_mode(hdmi, 0);
if (hdmi->hotplug == HDMI_HPD_ACTIVED)
hdmi_submit_work(hdmi, HDMI_SET_VIDEO, 0, NULL);
}
- mutex_unlock(&hdmi->lock);
return 0;
}
if (!hdmi)
return -1;
- mutex_lock(&hdmi->lock);
+
modelist = &hdmi->edid.modelist;
list_for_each(pos, modelist) {
display_modelist =
else
display_modelist = NULL;
}
- mutex_unlock(&hdmi->lock);
if (!display_modelist)
return -1;
return -1;
memset(audioinfo, 0x00, len);
- mutex_lock(&hdmi->lock);
/*printk("hdmi:edid: audio_num: %d\n", hdmi->edid.audio_num);*/
for (i = 0; i < hdmi->edid.audio_num; i++) {
audio = &(hdmi->edid.audio[i]);
audioinfo[size] = ',';
audioinfo += (size+1);
}
- mutex_unlock(&hdmi->lock);
return 0;
}
struct hdmi *hdmi = device->priv_data;
int i, mode;
- mutex_lock(&hdmi->lock);
mode = (1 << HDMI_COLOR_RGB_0_255);
if (hdmi->edid.sink_hdmi) {
mode |= (1 << HDMI_COLOR_RGB_16_235);
"Supported Colorimetry: %d\n", hdmi->edid.colorimetry);
i += snprintf(buf + i, PAGE_SIZE - i,
"Current Colorimetry: %d\n", hdmi->colorimetry);
- mutex_unlock(&hdmi->lock);
return i;
}
if (!hdmi)
return -1;
- mutex_lock(&hdmi->lock);
if (hdmi->edid.specs)
*monspecs = *(hdmi->edid.specs);
- mutex_unlock(&hdmi->lock);
return 0;
}
len += snprintf(buf+len, PAGE_SIZE - len, "EDID status:%s\n",
hdmi->edid.status ? "False" : "Okay");
len += snprintf(buf+len, PAGE_SIZE - len, "Raw Data:");
- mutex_lock(&hdmi->lock);
for (i = 0; i < HDMI_MAX_EDID_BLOCK; i++) {
if (!hdmi->edid.raw[i])
break;
len += snprintf(buf+len, PAGE_SIZE, "\n");
if (!hdmi->edid.status)
len += hdmi_show_sink_info(hdmi, buf, len);
- mutex_unlock(&hdmi->lock);
return len;
}