Lines Matching +full:data +full:- +full:sheet
1 // SPDX-License-Identifier: GPL-2.0-or-later
28 #define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */
29 #define HHI_VDAC_CNTL0_G12A 0x2EC /* 0xbd offset in data sheet */
30 #define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */
31 #define HHI_VDAC_CNTL1_G12A 0x2F0 /* 0xbe offset in data sheet */
74 if (drm_mode_match(req_mode, &meson_mode->mode, in meson_cvbs_get_mode()
91 return drm_bridge_attach(bridge->encoder, meson_encoder_cvbs->next_bridge, in meson_encoder_cvbs_attach()
92 &meson_encoder_cvbs->bridge, flags); in meson_encoder_cvbs_attach()
100 struct meson_drm *priv = meson_encoder_cvbs->priv; in meson_encoder_cvbs_get_modes()
107 mode = drm_mode_duplicate(priv->drm, &meson_mode->mode); in meson_encoder_cvbs_get_modes()
109 dev_err(priv->dev, "Failed to create a new display mode\n"); in meson_encoder_cvbs_get_modes()
135 if (meson_cvbs_get_mode(&crtc_state->mode)) in meson_encoder_cvbs_atomic_check()
138 return -EINVAL; in meson_encoder_cvbs_atomic_check()
145 struct drm_atomic_state *state = bridge_state->base.state; in meson_encoder_cvbs_atomic_enable()
146 struct meson_drm *priv = encoder_cvbs->priv; in meson_encoder_cvbs_atomic_enable()
152 connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); in meson_encoder_cvbs_atomic_enable()
160 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in meson_encoder_cvbs_atomic_enable()
164 meson_mode = meson_cvbs_get_mode(&crtc_state->adjusted_mode); in meson_encoder_cvbs_atomic_enable()
168 meson_venci_cvbs_mode_set(priv, meson_mode->enci); in meson_encoder_cvbs_atomic_enable()
178 priv->io_base + _REG(VENC_VDAC_DACSEL0)); in meson_encoder_cvbs_atomic_enable()
181 regmap_write(priv->hhi, HHI_VDAC_CNTL0, 1); in meson_encoder_cvbs_atomic_enable()
182 regmap_write(priv->hhi, HHI_VDAC_CNTL1, 0); in meson_encoder_cvbs_atomic_enable()
185 regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0xf0001); in meson_encoder_cvbs_atomic_enable()
186 regmap_write(priv->hhi, HHI_VDAC_CNTL1, 0); in meson_encoder_cvbs_atomic_enable()
188 regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0x906001); in meson_encoder_cvbs_atomic_enable()
189 regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 0); in meson_encoder_cvbs_atomic_enable()
198 struct meson_drm *priv = meson_encoder_cvbs->priv; in meson_encoder_cvbs_atomic_disable()
202 regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0); in meson_encoder_cvbs_atomic_disable()
203 regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 0); in meson_encoder_cvbs_atomic_disable()
205 regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0); in meson_encoder_cvbs_atomic_disable()
206 regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8); in meson_encoder_cvbs_atomic_disable()
224 struct drm_device *drm = priv->drm; in meson_encoder_cvbs_init()
230 meson_encoder_cvbs = devm_kzalloc(priv->dev, sizeof(*meson_encoder_cvbs), GFP_KERNEL); in meson_encoder_cvbs_init()
232 return -ENOMEM; in meson_encoder_cvbs_init()
235 remote = of_graph_get_remote_node(priv->dev->of_node, 0, 0); in meson_encoder_cvbs_init()
237 dev_info(drm->dev, "CVBS Output connector not available\n"); in meson_encoder_cvbs_init()
241 meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote); in meson_encoder_cvbs_init()
243 if (!meson_encoder_cvbs->next_bridge) { in meson_encoder_cvbs_init()
244 dev_err(priv->dev, "Failed to find CVBS Connector bridge\n"); in meson_encoder_cvbs_init()
245 return -EPROBE_DEFER; in meson_encoder_cvbs_init()
249 meson_encoder_cvbs->bridge.funcs = &meson_encoder_cvbs_bridge_funcs; in meson_encoder_cvbs_init()
250 meson_encoder_cvbs->bridge.of_node = priv->dev->of_node; in meson_encoder_cvbs_init()
251 meson_encoder_cvbs->bridge.type = DRM_MODE_CONNECTOR_Composite; in meson_encoder_cvbs_init()
252 meson_encoder_cvbs->bridge.ops = DRM_BRIDGE_OP_MODES; in meson_encoder_cvbs_init()
253 meson_encoder_cvbs->bridge.interlace_allowed = true; in meson_encoder_cvbs_init()
255 drm_bridge_add(&meson_encoder_cvbs->bridge); in meson_encoder_cvbs_init()
257 meson_encoder_cvbs->priv = priv; in meson_encoder_cvbs_init()
260 ret = drm_simple_encoder_init(priv->drm, &meson_encoder_cvbs->encoder, in meson_encoder_cvbs_init()
263 dev_err(priv->dev, "Failed to init CVBS encoder: %d\n", ret); in meson_encoder_cvbs_init()
267 meson_encoder_cvbs->encoder.possible_crtcs = BIT(0); in meson_encoder_cvbs_init()
270 ret = drm_bridge_attach(&meson_encoder_cvbs->encoder, &meson_encoder_cvbs->bridge, NULL, in meson_encoder_cvbs_init()
273 dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); in meson_encoder_cvbs_init()
278 connector = drm_bridge_connector_init(priv->drm, &meson_encoder_cvbs->encoder); in meson_encoder_cvbs_init()
280 dev_err(priv->dev, "Unable to create CVBS bridge connector\n"); in meson_encoder_cvbs_init()
283 drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); in meson_encoder_cvbs_init()
285 priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; in meson_encoder_cvbs_init()
294 if (priv->encoders[MESON_ENC_CVBS]) { in meson_encoder_cvbs_remove()
295 meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; in meson_encoder_cvbs_remove()
296 drm_bridge_remove(&meson_encoder_cvbs->bridge); in meson_encoder_cvbs_remove()