Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b244b5d authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge branch 'tda998x-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into drm-next

These are a number of fixes from the patch set which Jean-Francois has
been working on which I think are important to be merged during -rc, and
have been tested independently here.  I've been in discussion with Rob,
who is happy that I send these directly to you.

* 'tda998x-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox:
  drm/i2c: tda998x: fix the ENABLE_SPACE register
  drm/i2c: tda998x: set the PLL division factor in range 0..3
  drm/i2c: tda998x: force the page register at startup time
  drm/i2c: tda998x: free the CEC device on encoder_destroy
  drm/i2c: tda998x: check the CEC device creation
  drm/i2c: tda998x: fix bad value in the AIF
parents da89486f 2e9a3fc3
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ struct tda998x_priv {
# define PLL_SERIAL_1_SRL_IZ(x)   (((x) & 3) << 1)
# define PLL_SERIAL_1_SRL_MAN_IZ  (1 << 6)
#define REG_PLL_SERIAL_2          REG(0x02, 0x01)     /* read/write */
# define PLL_SERIAL_2_SRL_NOSC(x) (((x) & 3) << 0)
# define PLL_SERIAL_2_SRL_NOSC(x) ((x) << 0)
# define PLL_SERIAL_2_SRL_PR(x)   (((x) & 0xf) << 4)
#define REG_PLL_SERIAL_3          REG(0x02, 0x02)     /* read/write */
# define PLL_SERIAL_3_SRL_CCIR    (1 << 0)
@@ -528,10 +528,10 @@ tda998x_write_aif(struct drm_encoder *encoder, struct tda998x_encoder_params *p)
{
	uint8_t buf[PB(5) + 1];

	memset(buf, 0, sizeof(buf));
	buf[HB(0)] = 0x84;
	buf[HB(1)] = 0x01;
	buf[HB(2)] = 10;
	buf[PB(0)] = 0;
	buf[PB(1)] = p->audio_frame[1] & 0x07; /* CC */
	buf[PB(2)] = p->audio_frame[2] & 0x1c; /* SF */
	buf[PB(4)] = p->audio_frame[4];
@@ -824,6 +824,11 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
	}

	div = 148500 / mode->clock;
	if (div != 0) {
		div--;
		if (div > 3)
			div = 3;
	}

	/* mute the audio FIFO: */
	reg_set(encoder, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
@@ -913,7 +918,7 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,

	if (priv->rev == TDA19988) {
		/* let incoming pixels fill the active space (if any) */
		reg_write(encoder, REG_ENABLE_SPACE, 0x01);
		reg_write(encoder, REG_ENABLE_SPACE, 0x00);
	}

	/* must be last register set: */
@@ -1094,6 +1099,8 @@ tda998x_encoder_destroy(struct drm_encoder *encoder)
{
	struct tda998x_priv *priv = to_tda998x_priv(encoder);
	drm_i2c_encoder_destroy(encoder);
	if (priv->cec)
		i2c_unregister_device(priv->cec);
	kfree(priv);
}

@@ -1142,8 +1149,10 @@ tda998x_encoder_init(struct i2c_client *client,
	priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
	priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5);

	priv->current_page = 0;
	priv->current_page = 0xff;
	priv->cec = i2c_new_dummy(client->adapter, 0x34);
	if (!priv->cec)
		return -ENODEV;
	priv->dpms = DRM_MODE_DPMS_OFF;

	encoder_slave->slave_priv = priv;