mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
drm/i2c: tda998x: move tda998x_set_config() into tda998x_create()
Move the non-DT configuration of the TDA998x into tda998x_create() so that we do all setup in one place. Tested-by: Peter Rosin <peda@axentia.se> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
parent
2c6e758332
commit
6c1187aaa2
1 changed files with 35 additions and 38 deletions
|
@ -1630,6 +1630,25 @@ static int tda998x_get_audio_ports(struct tda998x_priv *priv,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tda998x_set_config(struct tda998x_priv *priv,
|
||||||
|
const struct tda998x_encoder_params *p)
|
||||||
|
{
|
||||||
|
priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(p->swap_a) |
|
||||||
|
(p->mirr_a ? VIP_CNTRL_0_MIRR_A : 0) |
|
||||||
|
VIP_CNTRL_0_SWAP_B(p->swap_b) |
|
||||||
|
(p->mirr_b ? VIP_CNTRL_0_MIRR_B : 0);
|
||||||
|
priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(p->swap_c) |
|
||||||
|
(p->mirr_c ? VIP_CNTRL_1_MIRR_C : 0) |
|
||||||
|
VIP_CNTRL_1_SWAP_D(p->swap_d) |
|
||||||
|
(p->mirr_d ? VIP_CNTRL_1_MIRR_D : 0);
|
||||||
|
priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(p->swap_e) |
|
||||||
|
(p->mirr_e ? VIP_CNTRL_2_MIRR_E : 0) |
|
||||||
|
VIP_CNTRL_2_SWAP_F(p->swap_f) |
|
||||||
|
(p->mirr_f ? VIP_CNTRL_2_MIRR_F : 0);
|
||||||
|
|
||||||
|
priv->audio_params = p->audio_params;
|
||||||
|
}
|
||||||
|
|
||||||
static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
|
static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
|
||||||
{
|
{
|
||||||
struct device_node *np = client->dev.of_node;
|
struct device_node *np = client->dev.of_node;
|
||||||
|
@ -1781,9 +1800,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
|
||||||
/* enable EDID read irq: */
|
/* enable EDID read irq: */
|
||||||
reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
|
reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
|
||||||
|
|
||||||
if (!np)
|
if (np) {
|
||||||
return 0; /* non-DT */
|
|
||||||
|
|
||||||
/* get the device tree parameters */
|
/* get the device tree parameters */
|
||||||
ret = of_property_read_u32(np, "video-ports", &video);
|
ret = of_property_read_u32(np, "video-ports", &video);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
|
@ -1798,6 +1815,9 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
|
||||||
|
|
||||||
if (priv->audio_port[0].format != AFMT_UNUSED)
|
if (priv->audio_port[0].format != AFMT_UNUSED)
|
||||||
tda998x_audio_codec_init(priv, &client->dev);
|
tda998x_audio_codec_init(priv, &client->dev);
|
||||||
|
} else if (client->dev.platform_data) {
|
||||||
|
tda998x_set_config(priv, client->dev.platform_data);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1843,28 +1863,8 @@ static const struct drm_encoder_funcs tda998x_encoder_funcs = {
|
||||||
.destroy = tda998x_encoder_destroy,
|
.destroy = tda998x_encoder_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void tda998x_set_config(struct tda998x_priv *priv,
|
|
||||||
const struct tda998x_encoder_params *p)
|
|
||||||
{
|
|
||||||
priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(p->swap_a) |
|
|
||||||
(p->mirr_a ? VIP_CNTRL_0_MIRR_A : 0) |
|
|
||||||
VIP_CNTRL_0_SWAP_B(p->swap_b) |
|
|
||||||
(p->mirr_b ? VIP_CNTRL_0_MIRR_B : 0);
|
|
||||||
priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(p->swap_c) |
|
|
||||||
(p->mirr_c ? VIP_CNTRL_1_MIRR_C : 0) |
|
|
||||||
VIP_CNTRL_1_SWAP_D(p->swap_d) |
|
|
||||||
(p->mirr_d ? VIP_CNTRL_1_MIRR_D : 0);
|
|
||||||
priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(p->swap_e) |
|
|
||||||
(p->mirr_e ? VIP_CNTRL_2_MIRR_E : 0) |
|
|
||||||
VIP_CNTRL_2_SWAP_F(p->swap_f) |
|
|
||||||
(p->mirr_f ? VIP_CNTRL_2_MIRR_F : 0);
|
|
||||||
|
|
||||||
priv->audio_params = p->audio_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tda998x_bind(struct device *dev, struct device *master, void *data)
|
static int tda998x_bind(struct device *dev, struct device *master, void *data)
|
||||||
{
|
{
|
||||||
struct tda998x_encoder_params *params = dev->platform_data;
|
|
||||||
struct i2c_client *client = to_i2c_client(dev);
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
struct drm_device *drm = data;
|
struct drm_device *drm = data;
|
||||||
struct tda998x_priv *priv;
|
struct tda998x_priv *priv;
|
||||||
|
@ -1892,9 +1892,6 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!dev->of_node && params)
|
|
||||||
tda998x_set_config(priv, params);
|
|
||||||
|
|
||||||
drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs);
|
drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs);
|
||||||
ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs,
|
ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs,
|
||||||
DRM_MODE_ENCODER_TMDS, NULL);
|
DRM_MODE_ENCODER_TMDS, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue