diff options
Diffstat (limited to 'drivers/gpu/drm')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv04_tv.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 62e826a139b3..4a69ccdef9b4 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c | |||
| @@ -184,14 +184,23 @@ static const struct drm_encoder_funcs nv04_tv_funcs = { | |||
| 184 | .destroy = nv04_tv_destroy, | 184 | .destroy = nv04_tv_destroy, |
| 185 | }; | 185 | }; |
| 186 | 186 | ||
| 187 | static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = { | ||
| 188 | .dpms = nv04_tv_dpms, | ||
| 189 | .save = drm_i2c_encoder_save, | ||
| 190 | .restore = drm_i2c_encoder_restore, | ||
| 191 | .mode_fixup = drm_i2c_encoder_mode_fixup, | ||
| 192 | .prepare = nv04_tv_prepare, | ||
| 193 | .commit = nv04_tv_commit, | ||
| 194 | .mode_set = nv04_tv_mode_set, | ||
| 195 | .detect = drm_i2c_encoder_detect, | ||
| 196 | }; | ||
| 197 | |||
| 187 | int | 198 | int |
| 188 | nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) | 199 | nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) |
| 189 | { | 200 | { |
| 190 | struct nouveau_encoder *nv_encoder; | 201 | struct nouveau_encoder *nv_encoder; |
| 191 | struct drm_encoder *encoder; | 202 | struct drm_encoder *encoder; |
| 192 | struct drm_device *dev = connector->dev; | 203 | struct drm_device *dev = connector->dev; |
| 193 | struct drm_encoder_helper_funcs *hfuncs; | ||
| 194 | struct drm_encoder_slave_funcs *sfuncs; | ||
| 195 | struct nouveau_drm *drm = nouveau_drm(dev); | 204 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 196 | struct nouveau_i2c *i2c = nouveau_i2c(drm->device); | 205 | struct nouveau_i2c *i2c = nouveau_i2c(drm->device); |
| 197 | struct nouveau_i2c_port *port = i2c->find(i2c, entry->i2c_index); | 206 | struct nouveau_i2c_port *port = i2c->find(i2c, entry->i2c_index); |
| @@ -207,17 +216,11 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) | |||
| 207 | if (!nv_encoder) | 216 | if (!nv_encoder) |
| 208 | return -ENOMEM; | 217 | return -ENOMEM; |
| 209 | 218 | ||
| 210 | hfuncs = kzalloc(sizeof(*hfuncs), GFP_KERNEL); | ||
| 211 | if (!hfuncs) { | ||
| 212 | ret = -ENOMEM; | ||
| 213 | goto fail_free; | ||
| 214 | } | ||
| 215 | |||
| 216 | /* Initialize the common members */ | 219 | /* Initialize the common members */ |
| 217 | encoder = to_drm_encoder(nv_encoder); | 220 | encoder = to_drm_encoder(nv_encoder); |
| 218 | 221 | ||
| 219 | drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); | 222 | drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); |
| 220 | drm_encoder_helper_add(encoder, hfuncs); | 223 | drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); |
| 221 | 224 | ||
| 222 | encoder->possible_crtcs = entry->heads; | 225 | encoder->possible_crtcs = entry->heads; |
| 223 | encoder->possible_clones = 0; | 226 | encoder->possible_clones = 0; |
| @@ -230,30 +233,14 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) | |||
| 230 | if (ret < 0) | 233 | if (ret < 0) |
| 231 | goto fail_cleanup; | 234 | goto fail_cleanup; |
| 232 | 235 | ||
| 233 | /* Fill the function pointers */ | ||
| 234 | sfuncs = get_slave_funcs(encoder); | ||
| 235 | |||
| 236 | *hfuncs = (struct drm_encoder_helper_funcs) { | ||
| 237 | .dpms = nv04_tv_dpms, | ||
| 238 | .save = sfuncs->save, | ||
| 239 | .restore = sfuncs->restore, | ||
| 240 | .mode_fixup = sfuncs->mode_fixup, | ||
| 241 | .prepare = nv04_tv_prepare, | ||
| 242 | .commit = nv04_tv_commit, | ||
| 243 | .mode_set = nv04_tv_mode_set, | ||
| 244 | .detect = sfuncs->detect, | ||
| 245 | }; | ||
| 246 | |||
| 247 | /* Attach it to the specified connector. */ | 236 | /* Attach it to the specified connector. */ |
| 248 | sfuncs->create_resources(encoder, connector); | 237 | get_slave_funcs(encoder)->create_resources(encoder, connector); |
| 249 | drm_mode_connector_attach_encoder(connector, encoder); | 238 | drm_mode_connector_attach_encoder(connector, encoder); |
| 250 | 239 | ||
| 251 | return 0; | 240 | return 0; |
| 252 | 241 | ||
| 253 | fail_cleanup: | 242 | fail_cleanup: |
| 254 | drm_encoder_cleanup(encoder); | 243 | drm_encoder_cleanup(encoder); |
| 255 | kfree(hfuncs); | ||
| 256 | fail_free: | ||
| 257 | kfree(nv_encoder); | 244 | kfree(nv_encoder); |
| 258 | return ret; | 245 | return ret; |
| 259 | } | 246 | } |
