diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-11-28 19:46:12 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-12 17:40:54 -0400 |
commit | 13f80eea562be6cd58b5bdefc224c87cc0d9288d (patch) | |
tree | db1735b8c88e038ace48cd8eef11e90557b999b6 /drivers | |
parent | d30555d24e462edf439a1057114e1b0df76c89ef (diff) |
fbdev: sh_mobile_hdmi: Don't access LCDC fb_info
The LCDC fb_info structure is only used to retrieve the default video
mode in case none of the modes advertised by EDID information is
acceptable. Pass a pointer to the default mode through the
sh_mobile_lcdc_entity structure instead.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/sh_mobile_hdmi.c | 34 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 24 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.h | 1 |
3 files changed, 28 insertions, 31 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 37f935fd5a10..eafb19da2c07 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -734,12 +734,11 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, | |||
734 | unsigned long *parent_rate) | 734 | unsigned long *parent_rate) |
735 | { | 735 | { |
736 | struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc; | 736 | struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc; |
737 | struct fb_info *info = ch ? ch->info : NULL; | ||
738 | const struct fb_videomode *mode, *found = NULL; | 737 | const struct fb_videomode *mode, *found = NULL; |
739 | const struct fb_modelist *modelist = NULL; | ||
740 | unsigned int f_width = 0, f_height = 0, f_refresh = 0; | 738 | unsigned int f_width = 0, f_height = 0, f_refresh = 0; |
741 | unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */ | 739 | unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */ |
742 | bool scanning = false, preferred_bad = false; | 740 | bool scanning = false, preferred_bad = false; |
741 | bool use_edid_mode = false; | ||
743 | u8 edid[128]; | 742 | u8 edid[128]; |
744 | char *forced; | 743 | char *forced; |
745 | int i; | 744 | int i; |
@@ -864,25 +863,19 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, | |||
864 | 863 | ||
865 | found = mode; | 864 | found = mode; |
866 | found_rate_error = rate_error; | 865 | found_rate_error = rate_error; |
866 | use_edid_mode = true; | ||
867 | } | 867 | } |
868 | 868 | ||
869 | /* | 869 | /* |
870 | * TODO 1: if no ->info is present, postpone running the config until | 870 | * TODO 1: if no default mode is present, postpone running the config |
871 | * after ->info first gets registered. | 871 | * until after the LCDC channel is initialized. |
872 | * TODO 2: consider registering the HDMI platform device from the LCDC | 872 | * TODO 2: consider registering the HDMI platform device from the LCDC |
873 | * driver, and passing ->info with HDMI platform data. | 873 | * driver. |
874 | */ | 874 | */ |
875 | if (info && !found) { | 875 | if (!found && hdmi->entity.def_mode.xres != 0) { |
876 | modelist = info->modelist.next && | 876 | found = &hdmi->entity.def_mode; |
877 | !list_empty(&info->modelist) ? | 877 | found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate, |
878 | list_entry(info->modelist.next, | 878 | parent_rate); |
879 | struct fb_modelist, list) : | ||
880 | NULL; | ||
881 | |||
882 | if (modelist) { | ||
883 | found = &modelist->mode; | ||
884 | found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate, parent_rate); | ||
885 | } | ||
886 | } | 879 | } |
887 | 880 | ||
888 | /* No cookie today */ | 881 | /* No cookie today */ |
@@ -906,10 +899,11 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, | |||
906 | else | 899 | else |
907 | hdmi->preprogrammed_vic = 0; | 900 | hdmi->preprogrammed_vic = 0; |
908 | 901 | ||
909 | dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n", | 902 | dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), " |
910 | modelist ? "default" : "EDID", hdmi->preprogrammed_vic ? "VIC" : "external", | 903 | "clock error %luHz\n", use_edid_mode ? "EDID" : "default", |
911 | found->xres, found->yres, found->refresh, | 904 | hdmi->preprogrammed_vic ? "VIC" : "external", found->xres, |
912 | PICOS2KHZ(found->pixclock) * 1000, found_rate_error); | 905 | found->yres, found->refresh, PICOS2KHZ(found->pixclock) * 1000, |
906 | found_rate_error); | ||
913 | 907 | ||
914 | hdmi->mode = *found; | 908 | hdmi->mode = *found; |
915 | sh_hdmi_external_video_param(hdmi); | 909 | sh_hdmi_external_video_param(hdmi); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index d3299ff543b1..986346dbe05d 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -1691,17 +1691,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, | |||
1691 | info->pseudo_palette = &ch->pseudo_palette; | 1691 | info->pseudo_palette = &ch->pseudo_palette; |
1692 | info->flags = FBINFO_FLAG_DEFAULT; | 1692 | info->flags = FBINFO_FLAG_DEFAULT; |
1693 | 1693 | ||
1694 | if (cfg->tx_dev) { | ||
1695 | if (!cfg->tx_dev->dev.driver || | ||
1696 | !try_module_get(cfg->tx_dev->dev.driver->owner)) { | ||
1697 | dev_warn(priv->dev, | ||
1698 | "unable to get transmitter device\n"); | ||
1699 | return -EINVAL; | ||
1700 | } | ||
1701 | ch->tx_dev = platform_get_drvdata(cfg->tx_dev); | ||
1702 | ch->tx_dev->lcdc = ch; | ||
1703 | } | ||
1704 | |||
1705 | /* Iterate through the modes to validate them and find the highest | 1694 | /* Iterate through the modes to validate them and find the highest |
1706 | * resolution. | 1695 | * resolution. |
1707 | */ | 1696 | */ |
@@ -1742,6 +1731,19 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, | |||
1742 | 1731 | ||
1743 | fb_videomode_to_modelist(mode, num_cfg, &info->modelist); | 1732 | fb_videomode_to_modelist(mode, num_cfg, &info->modelist); |
1744 | 1733 | ||
1734 | /* Initialize the transmitter device if present. */ | ||
1735 | if (cfg->tx_dev) { | ||
1736 | if (!cfg->tx_dev->dev.driver || | ||
1737 | !try_module_get(cfg->tx_dev->dev.driver->owner)) { | ||
1738 | dev_warn(priv->dev, | ||
1739 | "unable to get transmitter device\n"); | ||
1740 | return -EINVAL; | ||
1741 | } | ||
1742 | ch->tx_dev = platform_get_drvdata(cfg->tx_dev); | ||
1743 | ch->tx_dev->lcdc = ch; | ||
1744 | ch->tx_dev->def_mode = *mode; | ||
1745 | } | ||
1746 | |||
1745 | /* Initialize variable screen information using the first mode as | 1747 | /* Initialize variable screen information using the first mode as |
1746 | * default. The default Y virtual resolution is twice the panel size to | 1748 | * default. The default Y virtual resolution is twice the panel size to |
1747 | * allow for double-buffering. | 1749 | * allow for double-buffering. |
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h index 10086ae2c5ea..9c91fae1ea45 100644 --- a/drivers/video/sh_mobile_lcdcfb.h +++ b/drivers/video/sh_mobile_lcdcfb.h | |||
@@ -40,6 +40,7 @@ struct sh_mobile_lcdc_entity { | |||
40 | struct module *owner; | 40 | struct module *owner; |
41 | const struct sh_mobile_lcdc_entity_ops *ops; | 41 | const struct sh_mobile_lcdc_entity_ops *ops; |
42 | struct sh_mobile_lcdc_chan *lcdc; | 42 | struct sh_mobile_lcdc_chan *lcdc; |
43 | struct fb_videomode def_mode; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | /* | 46 | /* |