Lines Matching +full:eeprom +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0+
3 * LCD-OLinuXino support for panel driver
42 char name[32]; member
70 struct lcd_olinuxino_eeprom eeprom; member
82 gpiod_set_value_cansleep(lcd->enable_gpio, 0); in lcd_olinuxino_unprepare()
83 regulator_disable(lcd->supply); in lcd_olinuxino_unprepare()
93 ret = regulator_enable(lcd->supply); in lcd_olinuxino_prepare()
97 gpiod_set_value_cansleep(lcd->enable_gpio, 1); in lcd_olinuxino_prepare()
106 struct lcd_olinuxino_info *lcd_info = &lcd->eeprom.info; in lcd_olinuxino_get_modes()
111 for (i = 0; i < lcd->eeprom.num_modes; i++) { in lcd_olinuxino_get_modes()
113 &lcd->eeprom.reserved[i * sizeof(*lcd_mode)]; in lcd_olinuxino_get_modes()
115 mode = drm_mode_create(connector->dev); in lcd_olinuxino_get_modes()
117 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in lcd_olinuxino_get_modes()
118 lcd_mode->hactive, in lcd_olinuxino_get_modes()
119 lcd_mode->vactive, in lcd_olinuxino_get_modes()
120 lcd_mode->refresh); in lcd_olinuxino_get_modes()
124 mode->clock = lcd_mode->pixelclock; in lcd_olinuxino_get_modes()
125 mode->hdisplay = lcd_mode->hactive; in lcd_olinuxino_get_modes()
126 mode->hsync_start = lcd_mode->hactive + lcd_mode->hfp; in lcd_olinuxino_get_modes()
127 mode->hsync_end = lcd_mode->hactive + lcd_mode->hfp + in lcd_olinuxino_get_modes()
128 lcd_mode->hpw; in lcd_olinuxino_get_modes()
129 mode->htotal = lcd_mode->hactive + lcd_mode->hfp + in lcd_olinuxino_get_modes()
130 lcd_mode->hpw + lcd_mode->hbp; in lcd_olinuxino_get_modes()
131 mode->vdisplay = lcd_mode->vactive; in lcd_olinuxino_get_modes()
132 mode->vsync_start = lcd_mode->vactive + lcd_mode->vfp; in lcd_olinuxino_get_modes()
133 mode->vsync_end = lcd_mode->vactive + lcd_mode->vfp + in lcd_olinuxino_get_modes()
134 lcd_mode->vpw; in lcd_olinuxino_get_modes()
135 mode->vtotal = lcd_mode->vactive + lcd_mode->vfp + in lcd_olinuxino_get_modes()
136 lcd_mode->vpw + lcd_mode->vbp; in lcd_olinuxino_get_modes()
140 mode->type |= DRM_MODE_TYPE_PREFERRED; in lcd_olinuxino_get_modes()
141 mode->type |= DRM_MODE_TYPE_DRIVER; in lcd_olinuxino_get_modes()
149 connector->display_info.width_mm = lcd_info->width_mm; in lcd_olinuxino_get_modes()
150 connector->display_info.height_mm = lcd_info->height_mm; in lcd_olinuxino_get_modes()
151 connector->display_info.bpc = lcd_info->bpc; in lcd_olinuxino_get_modes()
153 if (lcd_info->bus_format) in lcd_olinuxino_get_modes()
154 drm_display_info_set_bus_formats(&connector->display_info, in lcd_olinuxino_get_modes()
155 &lcd_info->bus_format, 1); in lcd_olinuxino_get_modes()
156 connector->display_info.bus_flags = lcd_info->bus_flag; in lcd_olinuxino_get_modes()
169 struct device *dev = &client->dev; in lcd_olinuxino_probe()
174 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | in lcd_olinuxino_probe()
176 return -ENODEV; in lcd_olinuxino_probe()
180 return -ENOMEM; in lcd_olinuxino_probe()
183 lcd->dev = dev; in lcd_olinuxino_probe()
184 lcd->client = client; in lcd_olinuxino_probe()
186 mutex_init(&lcd->mutex); in lcd_olinuxino_probe()
190 mutex_lock(&lcd->mutex); in lcd_olinuxino_probe()
194 (u8 *)&lcd->eeprom + i); in lcd_olinuxino_probe()
195 mutex_unlock(&lcd->mutex); in lcd_olinuxino_probe()
203 checksum = ~crc32(~0, (u8 *)&lcd->eeprom, 252); in lcd_olinuxino_probe()
204 if (checksum != lcd->eeprom.checksum) { in lcd_olinuxino_probe()
206 return -EINVAL; in lcd_olinuxino_probe()
210 if (lcd->eeprom.header != LCD_OLINUXINO_HEADER_MAGIC) { in lcd_olinuxino_probe()
212 return -EINVAL; in lcd_olinuxino_probe()
216 lcd->eeprom.info.name, in lcd_olinuxino_probe()
217 lcd->eeprom.revision, in lcd_olinuxino_probe()
218 lcd->eeprom.serial); in lcd_olinuxino_probe()
221 * The eeprom can hold up to 4 modes. in lcd_olinuxino_probe()
224 if (lcd->eeprom.num_modes > 4) { in lcd_olinuxino_probe()
226 lcd->eeprom.num_modes = 4; in lcd_olinuxino_probe()
229 lcd->supply = devm_regulator_get(dev, "power"); in lcd_olinuxino_probe()
230 if (IS_ERR(lcd->supply)) in lcd_olinuxino_probe()
231 return PTR_ERR(lcd->supply); in lcd_olinuxino_probe()
233 lcd->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); in lcd_olinuxino_probe()
234 if (IS_ERR(lcd->enable_gpio)) in lcd_olinuxino_probe()
235 return PTR_ERR(lcd->enable_gpio); in lcd_olinuxino_probe()
237 drm_panel_init(&lcd->panel, dev, &lcd_olinuxino_funcs, in lcd_olinuxino_probe()
240 ret = drm_panel_of_backlight(&lcd->panel); in lcd_olinuxino_probe()
244 drm_panel_add(&lcd->panel); in lcd_olinuxino_probe()
253 drm_panel_remove(&panel->panel); in lcd_olinuxino_remove()
257 { .compatible = "olimex,lcd-olinuxino" },
264 .name = "lcd_olinuxino",
274 MODULE_DESCRIPTION("LCD-OLinuXino driver");