Commit 9afec493 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB: tm6000: Replace all magic values by a register alias

Instead of using magic pairs of req/reg, replace them by the defined
values.

This patch were generated by the following script:

cat tm6000-regs.h |perl -ne 'if (m/(TM6010_REQ[^\s]+)\s+0x([a-f0-9]+)\,
0x([a-f0-9]+)/) { $name="$1"; $req=$2; $val=$3; printf
"s/REQ_${req}_SET_GET_AVREG[_BIT]*, 0x[0]*$3,/$1,/\n" }'  >a; for i in
tm*.c; do sed -f a $i >b && mv b $i; done
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 77012fb9
......@@ -100,11 +100,11 @@ static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip)
int val;
/* Enables audio */
val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0);
val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0);
val |= 0x20;
tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val);
tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val);
tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0x80);
tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0x80);
return 0;
}
......@@ -119,11 +119,11 @@ static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip)
dprintk(1, "Stopping audio DMA\n");
/* Enables audio */
val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0);
val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0);
val &= ~0x20;
tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val);
tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val);
tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0);
tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0);
return 0;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -1186,16 +1186,16 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
/* FIXME: Probably, those won't work! Maybe we need shadow regs */
switch (ctrl->id) {
case V4L2_CID_CONTRAST:
val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x08, 0);
val = tm6000_get_reg(dev, TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, 0);
break;
case V4L2_CID_BRIGHTNESS:
val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x09, 0);
val = tm6000_get_reg(dev, TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, 0);
return 0;
case V4L2_CID_SATURATION:
val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, 0);
val = tm6000_get_reg(dev, TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, 0);
return 0;
case V4L2_CID_HUE:
val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, 0);
val = tm6000_get_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, 0);
return 0;
default:
return -EINVAL;
......@@ -1217,16 +1217,16 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
switch (ctrl->id) {
case V4L2_CID_CONTRAST:
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x08, val);
tm6000_set_reg(dev, TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, val);
return 0;
case V4L2_CID_BRIGHTNESS:
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x09, val);
tm6000_set_reg(dev, TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, val);
return 0;
case V4L2_CID_SATURATION:
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, val);
tm6000_set_reg(dev, TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, val);
return 0;
case V4L2_CID_HUE:
tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, val);
tm6000_set_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, val);
return 0;
}
return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment