All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Longerbeam <slongerbeam@gmail.com>
To: lars@metafoo.de
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: [PATCH v2 03/10] media: adv7180: define more registers
Date: Tue, 19 Jul 2016 17:03:30 -0700	[thread overview]
Message-ID: <1468973017-17647-4-git-send-email-steve_longerbeam@mentor.com> (raw)
In-Reply-To: <1468973017-17647-1-git-send-email-steve_longerbeam@mentor.com>

Replace hard-coded addresses with new register macro defines. No
functional changes.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/media/i2c/adv7180.c | 73 ++++++++++++++++++++++++++++++---------------
 1 file changed, 49 insertions(+), 24 deletions(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 95cbc85..cb83ebb 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -56,10 +56,11 @@
 
 #define ADV7182_REG_INPUT_VIDSEL			0x0002
 
+#define ADV7180_REG_OUTPUT_CONTROL			0x0003
 #define ADV7180_REG_EXTENDED_OUTPUT_CONTROL		0x0004
 #define ADV7180_EXTENDED_OUTPUT_CONTROL_NTSCDIS		0xC5
 
-#define ADV7180_REG_AUTODETECT_ENABLE			0x07
+#define ADV7180_REG_AUTODETECT_ENABLE			0x0007
 #define ADV7180_AUTODETECT_DEFAULT			0x7f
 /* Contrast */
 #define ADV7180_REG_CON		0x0008	/*Unsigned */
@@ -100,6 +101,20 @@
 #define ADV7180_REG_IDENT 0x0011
 #define ADV7180_ID_7180 0x18
 
+#define ADV7180_REG_STATUS3		0x0013
+#define ADV7180_REG_ANALOG_CLAMP_CTL	0x0014
+#define ADV7180_REG_SHAP_FILTER_CTL_1	0x0017
+#define ADV7180_REG_CTRL_2		0x001d
+#define ADV7180_REG_VSYNC_FIELD_CTL_1	0x0031
+#define ADV7180_REG_MANUAL_WIN_CTL_1	0x003d
+#define ADV7180_REG_MANUAL_WIN_CTL_2	0x003e
+#define ADV7180_REG_MANUAL_WIN_CTL_3	0x003f
+#define ADV7180_REG_LOCK_CNT		0x0051
+#define ADV7180_REG_CVBS_TRIM		0x0052
+#define ADV7180_REG_CLAMP_ADJ		0x005a
+#define ADV7180_REG_RES_CIR		0x005f
+#define ADV7180_REG_DIFF_MODE		0x0060
+
 #define ADV7180_REG_ICONF1		0x2040
 #define ADV7180_ICONF1_ACTIVE_LOW	0x01
 #define ADV7180_ICONF1_PSYNC_ONLY	0x10
@@ -129,9 +144,15 @@
 #define ADV7180_REG_VPP_SLAVE_ADDR	0xFD
 #define ADV7180_REG_CSI_SLAVE_ADDR	0xFE
 
-#define ADV7180_REG_FLCONTROL 0x40e0
+#define ADV7180_REG_ACE_CTRL1		0x4080
+#define ADV7180_REG_ACE_CTRL5		0x4084
+#define ADV7180_REG_FLCONTROL		0x40e0
 #define ADV7180_FLCONTROL_FL_ENABLE 0x1
 
+#define ADV7180_REG_RST_CLAMP	0x809c
+#define ADV7180_REG_AGC_ADJ1	0x80b6
+#define ADV7180_REG_AGC_ADJ2	0x80c0
+
 #define ADV7180_CSI_REG_PWRDN	0x00
 #define ADV7180_CSI_PWRDN	0x80
 
@@ -886,16 +907,20 @@ static int adv7182_init(struct adv7180_state *state)
 
 	/* ADI required writes */
 	if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) {
-		adv7180_write(state, 0x0003, 0x4e);
-		adv7180_write(state, 0x0004, 0x57);
-		adv7180_write(state, 0x001d, 0xc0);
+		adv7180_write(state, ADV7180_REG_OUTPUT_CONTROL, 0x4e);
+		adv7180_write(state, ADV7180_REG_EXTENDED_OUTPUT_CONTROL, 0x57);
+		adv7180_write(state, ADV7180_REG_CTRL_2, 0xc0);
 	} else {
 		if (state->chip_info->flags & ADV7180_FLAG_V2)
-			adv7180_write(state, 0x0004, 0x17);
+			adv7180_write(state,
+				      ADV7180_REG_EXTENDED_OUTPUT_CONTROL,
+				      0x17);
 		else
-			adv7180_write(state, 0x0004, 0x07);
-		adv7180_write(state, 0x0003, 0x0c);
-		adv7180_write(state, 0x001d, 0x40);
+			adv7180_write(state,
+				      ADV7180_REG_EXTENDED_OUTPUT_CONTROL,
+				      0x07);
+		adv7180_write(state, ADV7180_REG_OUTPUT_CONTROL, 0x0c);
+		adv7180_write(state, ADV7180_REG_CTRL_2, 0x40);
 	}
 
 	adv7180_write(state, 0x0013, 0x00);
@@ -972,8 +997,8 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
 		return ret;
 
 	/* Reset clamp circuitry - ADI recommended writes */
-	adv7180_write(state, 0x809c, 0x00);
-	adv7180_write(state, 0x809c, 0xff);
+	adv7180_write(state, ADV7180_REG_RST_CLAMP, 0x00);
+	adv7180_write(state, ADV7180_REG_RST_CLAMP, 0xff);
 
 	input_type = adv7182_get_input_type(input);
 
@@ -981,10 +1006,10 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
 	case ADV7182_INPUT_TYPE_CVBS:
 	case ADV7182_INPUT_TYPE_DIFF_CVBS:
 		/* ADI recommends to use the SH1 filter */
-		adv7180_write(state, 0x0017, 0x41);
+		adv7180_write(state, ADV7180_REG_SHAP_FILTER_CTL_1, 0x41);
 		break;
 	default:
-		adv7180_write(state, 0x0017, 0x01);
+		adv7180_write(state, ADV7180_REG_SHAP_FILTER_CTL_1, 0x01);
 		break;
 	}
 
@@ -994,21 +1019,21 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input)
 		lbias = adv7182_lbias_settings[input_type];
 
 	for (i = 0; i < ARRAY_SIZE(adv7182_lbias_settings[0]); i++)
-		adv7180_write(state, 0x0052 + i, lbias[i]);
+		adv7180_write(state, ADV7180_REG_CVBS_TRIM + i, lbias[i]);
 
 	if (input_type == ADV7182_INPUT_TYPE_DIFF_CVBS) {
 		/* ADI required writes to make differential CVBS work */
-		adv7180_write(state, 0x005f, 0xa8);
-		adv7180_write(state, 0x005a, 0x90);
-		adv7180_write(state, 0x0060, 0xb0);
-		adv7180_write(state, 0x80b6, 0x08);
-		adv7180_write(state, 0x80c0, 0xa0);
+		adv7180_write(state, ADV7180_REG_RES_CIR, 0xa8);
+		adv7180_write(state, ADV7180_REG_CLAMP_ADJ, 0x90);
+		adv7180_write(state, ADV7180_REG_DIFF_MODE, 0xb0);
+		adv7180_write(state, ADV7180_REG_AGC_ADJ1, 0x08);
+		adv7180_write(state, ADV7180_REG_AGC_ADJ2, 0xa0);
 	} else {
-		adv7180_write(state, 0x005f, 0xf0);
-		adv7180_write(state, 0x005a, 0xd0);
-		adv7180_write(state, 0x0060, 0x10);
-		adv7180_write(state, 0x80b6, 0x9c);
-		adv7180_write(state, 0x80c0, 0x00);
+		adv7180_write(state, ADV7180_REG_RES_CIR, 0xf0);
+		adv7180_write(state, ADV7180_REG_CLAMP_ADJ, 0xd0);
+		adv7180_write(state, ADV7180_REG_DIFF_MODE, 0x10);
+		adv7180_write(state, ADV7180_REG_AGC_ADJ1, 0x9c);
+		adv7180_write(state, ADV7180_REG_AGC_ADJ2, 0x00);
 	}
 
 	return 0;
-- 
1.9.1

  parent reply	other threads:[~2016-07-20  0:04 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 22:59 [PATCH 00/11] adv7180 subdev fixes Steve Longerbeam
2016-07-06 22:59 ` [PATCH 01/11] media: adv7180: Fix broken interrupt register access Steve Longerbeam
2016-07-07 14:44   ` Tim Harvey
2016-07-07 15:37   ` Lars-Peter Clausen
2016-07-06 22:59 ` [PATCH 02/11] Revert "[media] adv7180: fix broken standards handling" Steve Longerbeam
2016-07-07 14:48   ` Tim Harvey
2016-07-07 15:45   ` Lars-Peter Clausen
2016-07-09 18:56     ` Steve Longerbeam
2016-07-06 22:59 ` [PATCH 03/11] media: adv7180: add power pin control Steve Longerbeam
2016-07-07 15:04   ` Tim Harvey
2016-07-07 15:35   ` Lars-Peter Clausen
2016-07-06 22:59 ` [PATCH 04/11] media: adv7180: implement g_parm Steve Longerbeam
2016-07-07 15:04   ` Tim Harvey
2016-07-06 22:59 ` [PATCH 05/11] media: adv7180: init chip with AD recommended register settings Steve Longerbeam
2016-07-07 15:23   ` Tim Harvey
2016-07-07 15:29   ` Lars-Peter Clausen
2016-07-06 22:59 ` [PATCH 06/11] media: adv7180: add bt.656-4 OF property Steve Longerbeam
2016-07-07 14:52   ` Lars-Peter Clausen
2016-07-09 18:59     ` Steve Longerbeam
2016-07-09 21:10       ` Steve Longerbeam
2016-07-09 21:36         ` Steve Longerbeam
2016-07-10 12:10           ` Lars-Peter Clausen
2016-07-10 12:55             ` Hans Verkuil
2016-07-10 14:17               ` Ian Arkver
2016-07-10 14:30                 ` Hans Verkuil
2016-07-10 22:34                   ` Steve Longerbeam
2016-07-11  7:06                     ` Ian Arkver
2016-07-11 22:03                       ` Steve Longerbeam
2016-07-12 10:25                         ` Ian Arkver
2016-07-12 17:26                           ` Steve Longerbeam
2016-07-06 23:00 ` [PATCH 07/11] media: adv7180: change mbus format to UYVY Steve Longerbeam
2016-07-07 15:18   ` Lars-Peter Clausen
2016-07-08 10:52     ` Niklas Söderlund
2016-07-07 15:25   ` Tim Harvey
2016-07-06 23:00 ` [PATCH 08/11] adv7180: send V4L2_EVENT_SOURCE_CHANGE on std change Steve Longerbeam
2016-07-07 15:27   ` Tim Harvey
2016-07-06 23:00 ` [PATCH 09/11] v4l: Add signal lock status to source change events Steve Longerbeam
2016-07-06 23:00 ` [PATCH 10/11] media: adv7180: enable lock/unlock interrupts Steve Longerbeam
2016-07-06 23:00 ` [PATCH 11/11] media: adv7180: fix field type Steve Longerbeam
2016-07-07 14:37 ` [PATCH 00/11] adv7180 subdev fixes Tim Harvey
2016-07-20  0:03 ` [PATCH v2 00/10] adv7180 subdev fixes, v2 Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 01/10] v4l: of: add "newavmode" property for Analog Devices codecs Steve Longerbeam
2016-07-20  7:37     ` Hans Verkuil
2016-07-20 17:14       ` Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 02/10] media: adv7180: Fix broken interrupt register access Steve Longerbeam
2016-07-20  0:03   ` Steve Longerbeam [this message]
2016-07-20  8:54     ` [PATCH v2 03/10] media: adv7180: define more registers Lars-Peter Clausen
2016-07-20  0:03   ` [PATCH v2 04/10] media: adv7180: add support for NEWAVMODE Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 05/10] media: adv7180: add power pin control Steve Longerbeam
2016-07-20  8:53     ` Lars-Peter Clausen
2016-07-20  0:03   ` [PATCH v2 06/10] media: adv7180: implement g_parm Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 07/10] media: adv7180: change mbus format to UYVY Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 08/10] v4l: Add signal lock status to source change events Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 09/10] media: adv7180: enable lock/unlock interrupts Steve Longerbeam
2016-07-20  0:03   ` [PATCH v2 10/10] media: adv7180: fix field type Steve Longerbeam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468973017-17647-4-git-send-email-steve_longerbeam@mentor.com \
    --to=slongerbeam@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=steve_longerbeam@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.