All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Volokh Konstantin <volokh84@gmail.com>,
	Pete Eberlein <pete@sensoray.com>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [REVIEW PATCH 06/42] saa7115: add support for double-rate ASCLK
Date: Mon, 11 Mar 2013 12:45:44 +0100	[thread overview]
Message-ID: <6f49fd63991545d1e9aada9c8c06ae5a3fcd5bee.1363000605.git.hans.verkuil@cisco.com> (raw)
In-Reply-To: <1363002380-19825-1-git-send-email-hverkuil@xs4all.nl>
In-Reply-To: <38bc3cc42d0c021432afd29c2c1e22cf380b06e0.1363000605.git.hans.verkuil@cisco.com>

From: Hans Verkuil <hans.verkuil@cisco.com>

Some devices expect a double rate ASCLK. Add a flag to let the driver know
through the s_crystal_freq call.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/i2c/saa7115.c |   16 +++++++++++-----
 include/media/saa7115.h     |    7 ++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index d301442..9d3dbb3 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -83,9 +83,10 @@ struct saa711x_state {
 	u32 ident;
 	u32 audclk_freq;
 	u32 crystal_freq;
-	u8 ucgc;
+	bool ucgc;
 	u8 cgcdiv;
-	u8 apll;
+	bool apll;
+	bool double_asclk;
 };
 
 static inline struct saa711x_state *to_state(struct v4l2_subdev *sd)
@@ -732,8 +733,12 @@ static int saa711x_s_clock_freq(struct v4l2_subdev *sd, u32 freq)
 	if (state->apll)
 		acc |= 0x08;
 
+	if (state->double_asclk) {
+		acpf <<= 1;
+		acni <<= 1;
+	}
 	saa711x_write(sd, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03);
-	saa711x_write(sd, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10);
+	saa711x_write(sd, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10 << state->double_asclk);
 	saa711x_write(sd, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc);
 
 	saa711x_write(sd, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff);
@@ -1302,9 +1307,10 @@ static int saa711x_s_crystal_freq(struct v4l2_subdev *sd, u32 freq, u32 flags)
 	if (freq != SAA7115_FREQ_32_11_MHZ && freq != SAA7115_FREQ_24_576_MHZ)
 		return -EINVAL;
 	state->crystal_freq = freq;
+	state->double_asclk = flags & SAA7115_FREQ_FL_DOUBLE_ASCLK;
 	state->cgcdiv = (flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4;
-	state->ucgc = (flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0;
-	state->apll = (flags & SAA7115_FREQ_FL_APLL) ? 1 : 0;
+	state->ucgc = flags & SAA7115_FREQ_FL_UCGC;
+	state->apll = flags & SAA7115_FREQ_FL_APLL;
 	saa711x_s_clock_freq(sd, state->audclk_freq);
 	return 0;
 }
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index 8b2ecc6..4079186 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -59,9 +59,10 @@
 #define SAA7115_FREQ_24_576_MHZ 24576000   /* 24.576 MHz crystal */
 
 /* SAA7115 v4l2_crystal_freq audio clock control flags */
-#define SAA7115_FREQ_FL_UCGC   (1 << 0)	   /* SA 3A[7], UCGC, SAA7115 only */
-#define SAA7115_FREQ_FL_CGCDIV (1 << 1)	   /* SA 3A[6], CGCDIV, SAA7115 only */
-#define SAA7115_FREQ_FL_APLL   (1 << 2)	   /* SA 3A[3], APLL, SAA7114/5 only */
+#define SAA7115_FREQ_FL_UCGC         (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */
+#define SAA7115_FREQ_FL_CGCDIV       (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */
+#define SAA7115_FREQ_FL_APLL         (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
+#define SAA7115_FREQ_FL_DOUBLE_ASCLK (1 << 3) /* SA 39, LRDIV, SAA7114/5 only */
 
 #endif
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-03-11 11:46 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 11:45 [REVIEW PATCH 00/42] go7007: complete overhaul Hans Verkuil
2013-03-11 11:45 ` [REVIEW PATCH 01/42] v4l2-ctrls: eliminate lockdep false alarms for struct v4l2_ctrl_handler.lock Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 02/42] v4l2-core: add code to check for specific ops Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 03/42] v4l2-ioctl: check if an ioctl is valid Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 04/42] saa7115: add config flag to change the IDQ polarity Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 05/42] saa7115: improve querystd handling for the saa7115 Hans Verkuil
2013-03-11 11:45   ` Hans Verkuil [this message]
2013-03-11 11:45   ` [REVIEW PATCH 07/42] go7007: fix i2c_xfer return codes Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 08/42] tuner: add Sony BTF tuners Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 09/42] sony-btf-mpx: the MPX driver for the sony BTF PAL/SECAM tuner Hans Verkuil
2013-03-24 15:21     ` Mauro Carvalho Chehab
2013-03-25  8:52       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 10/42] ov7640: add new ov7640 driver Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 11/42] uda1342: add new uda1342 audio codec driver Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 12/42] tw9903: add new tw9903 video decoder Hans Verkuil
2013-03-24 15:29     ` Mauro Carvalho Chehab
2013-03-24 16:06       ` Mauro Carvalho Chehab
2013-03-25  8:55       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 13/42] tw2804: add support for the Techwell tw2804 Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 14/42] tw2804: modify ADC power control Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 15/42] go7007: i2c initialization changes for tw2804 Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 16/42] go7007: switch to standard tuner/i2c subdevs Hans Verkuil
2013-03-24 15:35     ` Mauro Carvalho Chehab
2013-03-11 11:45   ` [REVIEW PATCH 17/42] go7007: remove all wis* drivers Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 18/42] go7007: add audio input ioctls Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 19/42] s2250-loader: use usbv2_cypress_load_firmware Hans Verkuil
2013-03-24 15:39     ` Mauro Carvalho Chehab
2013-03-24 15:49       ` Antti Palosaari
2013-03-25  8:56       ` Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 20/42] go7007: go7007: add device_caps and bus_info support to querycap Hans Verkuil
2013-03-11 11:45   ` [REVIEW PATCH 21/42] go7007: remove current_norm Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 22/42] go7007: fix DMA related errors Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 23/42] go7007: remember boot firmware Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 24/42] go7007: fix unregister/disconnect handling Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 25/42] go7007: convert to the control framework and remove obsolete JPEGCOMP support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 26/42] s2250: convert to the control framework Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 27/42] go7007: add prio and control event support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 28/42] go7007: add log_status support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 29/42] go7007: tuner/std related fixes Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 30/42] go7007: standardize MPEG handling support Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 31/42] go7007: simplify the PX-TV402U board ID handling Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 32/42] go7007: set up the saa7115 audio clock correctly Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 33/42] go7007: drop struct go7007_file Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 34/42] go7007: convert to core locking and vb2 Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 35/42] go7007: embed struct video_device Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 36/42] go7007: remove cropping functions Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 37/42] saa7134-go7007: add support for this combination Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 38/42] s2250: add comment describing the hardware Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 39/42] go7007-loader: renamed from s2250-loader Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 40/42] go7007-loader: add support for the other devices and move fw files Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 41/42] go7007: update the README Hans Verkuil
2013-03-11 11:46   ` [REVIEW PATCH 42/42] MAINTAINERS: add the go7007 driver Hans Verkuil
2013-03-11 11:50   ` [REVIEW PATCH 01/42] v4l2-ctrls: eliminate lockdep false alarms for struct v4l2_ctrl_handler.lock Hans Verkuil
2013-03-11 22:01 ` [REVIEW PATCH 00/42] go7007: complete overhaul Hans Verkuil
2013-03-12 14:37 ` Darrick Burch
2013-03-12 15:05   ` Hans Verkuil

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=6f49fd63991545d1e9aada9c8c06ae5a3fcd5bee.1363000605.git.hans.verkuil@cisco.com \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pete@sensoray.com \
    --cc=volokh84@gmail.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.