devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Peter Griffin <peter.griffin@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com,
	maxime.coquelin@st.com, patrice.chotard@st.com,
	lee.jones@linaro.org, hugues.fruchet@st.com,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 02/12] [media] dvb-pll: Add support for THOMSON DTT7546X tuner.
Date: Wed, 22 Jul 2015 14:10:40 -0300	[thread overview]
Message-ID: <20150722141040.2be3ca98@recife.lan> (raw)
In-Reply-To: <1435158670-7195-3-git-send-email-peter.griffin@linaro.org>

Em Wed, 24 Jun 2015 16:11:00 +0100
Peter Griffin <peter.griffin@linaro.org> escreveu:

> This is used in conjunction with the STV0367 demodulator on
> the STV0367-NIM-V1.0 NIM card which can be used with the STi
> STB SoC's.
> 
> This tuner has a fifth register, so some changes have been made
> to accommodate this.
> 
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
>  drivers/media/dvb-frontends/dvb-pll.c | 74 +++++++++++++++++++++++++++++------
>  drivers/media/dvb-frontends/dvb-pll.h |  1 +
>  2 files changed, 64 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c
> index 6d8fe88..f7381c7 100644
> --- a/drivers/media/dvb-frontends/dvb-pll.c
> +++ b/drivers/media/dvb-frontends/dvb-pll.c
> @@ -141,6 +141,35 @@ static struct dvb_pll_desc dvb_pll_thomson_dtt7520x = {
>  	},
>  };
>  
> +static void thomson_dtt7546x_bw(struct dvb_frontend *fe, u8 *buf)
> +{
> +	/* set CB2 reg - set ATC, XTO */
> +	buf[4] = 0xc3;
> +}
> +
> +static struct dvb_pll_desc dvb_pll_thomson_dtt7546x = {
> +	.name  = "Thomson dtt7546x",
> +	.min   = 44250000,
> +	.max   = 863250000,
> +	.set   = thomson_dtt7546x_bw,
> +	.iffreq= 36166667,

Whitespace is missing. Please check the patchs with scripts/checkpatch.pl.

> +	.count = 12,
> +	.entries = {
> +		{  121000000, 166667, 0x88, 0x01 },
> +		{  141000000, 166667, 0x88, 0x41 },
> +		{  166000000, 166667, 0x88, 0x81 },
> +		{  182000000, 166667, 0x88, 0xc1 },
> +		{  286000000, 166667, 0x88, 0x02 },
> +		{  386000000, 166667, 0x88, 0x42 },
> +		{  446000000, 166667, 0x88, 0x82 },
> +		{  466000000, 166667, 0x88, 0xc2 },
> +		{  506000000, 166667, 0x88, 0x08 },
> +		{  761000000, 166667, 0x88, 0x48 },
> +		{  846000000, 166667, 0x88, 0x88 },
> +		{  905000000, 166667, 0x88, 0xc8 },
> +	},
> +};
> +
>  static struct dvb_pll_desc dvb_pll_lg_z201 = {
>  	.name  = "LG z201",
>  	.min   = 174000000,
> @@ -537,6 +566,7 @@ static struct dvb_pll_desc dvb_pll_alps_tdee4 = {
>  static struct dvb_pll_desc *pll_list[] = {
>  	[DVB_PLL_UNDEFINED]              = NULL,
>  	[DVB_PLL_THOMSON_DTT7579]        = &dvb_pll_thomson_dtt7579,
> +	[DVB_PLL_THOMSON_DTT7546X]       = &dvb_pll_thomson_dtt7546x,
>  	[DVB_PLL_THOMSON_DTT759X]        = &dvb_pll_thomson_dtt759x,
>  	[DVB_PLL_THOMSON_DTT7520X]       = &dvb_pll_thomson_dtt7520x,
>  	[DVB_PLL_LG_Z201]                = &dvb_pll_lg_z201,
> @@ -561,7 +591,7 @@ static struct dvb_pll_desc *pll_list[] = {
>  /* code                                                        */
>  
>  static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
> -			     const u32 frequency)
> +			const u32 frequency, const u32 len)
>  {
>  	struct dvb_pll_priv *priv = fe->tuner_priv;
>  	struct dvb_pll_desc *desc = priv->pll_desc;
> @@ -593,11 +623,15 @@ static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
>  	if (desc->set)
>  		desc->set(fe, buf);
>  
> -	if (debug)
> -		printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
> -		       desc->name, div, buf[0], buf[1], buf[2], buf[3]);
> +	if (debug) {
> +		printk(KERN_DEBUG "pll: %s: div=%d | buf=", desc->name, div);
> +		for (i = 0; i < len; i++)
> +			printk(KERN_DEBUG "0x%02x,", buf[i]);
>  
> -	// calculate the frequency we set it to
> +		printk(KERN_DEBUG "\n");
> +	}

Please use, instead, the Documentation/printk-formats.txt macros to
print an hex buffer:

	"Raw buffer as a hex string:
		%*ph	00 01 02  ...  3f
		%*phC	00:01:02: ... :3f
		%*phD	00-01-02- ... -3f
		%*phN	000102 ... 3f"


> +
> +	/* calculate the frequency we set it to */
>  	return (div * desc->entries[i].stepsize) - desc->iffreq;
>  }
>  
> @@ -634,21 +668,39 @@ static int dvb_pll_sleep(struct dvb_frontend *fe)
>  	return -EINVAL;
>  }
>  
> +static int dvb_pll_get_num_regs(struct dvb_pll_priv *priv)
> +{
> +	int num_regs = 4;
> +
> +	if (strncmp(priv->pll_desc->name, "Thomson dtt7546x", 16) == 0)
> +		num_regs = 5;
> +
> +	return num_regs;
> +}
> +
>  static int dvb_pll_set_params(struct dvb_frontend *fe)
>  {
>  	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
>  	struct dvb_pll_priv *priv = fe->tuner_priv;
> -	u8 buf[4];
> -	struct i2c_msg msg =
> -		{ .addr = priv->pll_i2c_address, .flags = 0,
> -		  .buf = buf, .len = sizeof(buf) };
> +	struct i2c_msg msg;
> +	u8 *bufp;
>  	int result;
>  	u32 frequency = 0;
>  
> +	bufp = kzalloc(dvb_pll_get_num_regs(priv), GFP_KERNEL);
> +
> +	if (!bufp)
> +		return -ENOMEM;
> +
> +	msg.addr = priv->pll_i2c_address;
> +	msg.flags = 0;
> +	msg.buf = bufp;
> +	msg.len = dvb_pll_get_num_regs(priv);
> +
>  	if (priv->i2c == NULL)
>  		return -EINVAL;
>  
> -	result = dvb_pll_configure(fe, buf, c->frequency);
> +	result = dvb_pll_configure(fe, bufp, c->frequency, msg.len);
>  	if (result < 0)
>  		return result;
>  	else
> @@ -677,7 +729,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe,
>  	if (buf_len < 5)
>  		return -EINVAL;
>  
> -	result = dvb_pll_configure(fe, buf + 1, c->frequency);
> +	result = dvb_pll_configure(fe, buf + 1, c->frequency, buf_len - 1);
>  	if (result < 0)
>  		return result;
>  	else
> diff --git a/drivers/media/dvb-frontends/dvb-pll.h b/drivers/media/dvb-frontends/dvb-pll.h
> index bf9602a..f523f42 100644
> --- a/drivers/media/dvb-frontends/dvb-pll.h
> +++ b/drivers/media/dvb-frontends/dvb-pll.h
> @@ -28,6 +28,7 @@
>  #define DVB_PLL_SAMSUNG_TBMU24112      17
>  #define DVB_PLL_TDEE4		       18
>  #define DVB_PLL_THOMSON_DTT7520X       19
> +#define DVB_PLL_THOMSON_DTT7546X       20
>  
>  /**
>   * Attach a dvb-pll to the supplied frontend structure.

  parent reply	other threads:[~2015-07-22 17:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 15:10 [PATCH 00/12] Add c8sectpfe LinuxDVB demux driver Peter Griffin
2015-06-24 15:10 ` [PATCH 01/12] ARM: DT: STi: stihxxx-b2120: Add pulse-width properties to ssc2 & ssc3 Peter Griffin
     [not found] ` <1435158670-7195-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-06-24 15:11   ` [PATCH 02/12] [media] dvb-pll: Add support for THOMSON DTT7546X tuner Peter Griffin
     [not found]     ` <1435158670-7195-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-06-25  1:17       ` Joe Perches
2015-07-22 21:58         ` Mauro Carvalho Chehab
     [not found]           ` <20150722185811.2d718baa-+RedX5hVuTR+urZeOPWqwQ@public.gmane.org>
2015-07-30  9:47             ` Peter Griffin
2015-07-30 10:08               ` Joe Perches
     [not found]                 ` <1438250928.2677.10.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2015-07-30 11:14                   ` Michael Ira Krufky
     [not found]                     ` <CAOcJUbw5hSmPdrz6rPPYU6iMBHnvOZc1p3f+4WhEYq2-XmAPVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-30 11:17                       ` Michael Ira Krufky
2015-07-30 14:33                         ` Peter Griffin
2015-07-30 11:37                     ` Michael Ira Krufky
2015-07-30 14:34                       ` Peter Griffin
2015-07-22 17:10     ` Mauro Carvalho Chehab [this message]
2015-07-30  9:46       ` Peter Griffin
2015-06-24 15:11   ` [PATCH 09/12] [media] tsin: c8sectpfe: Add support for various ST NIM cards Peter Griffin
2015-07-22 21:53     ` Mauro Carvalho Chehab
2015-07-30  9:43       ` Peter Griffin
2015-06-24 15:11   ` [PATCH 10/12] [media] tsin: c8sectpfe: Add c8sectpfe debugfs support Peter Griffin
2015-06-24 15:11   ` [PATCH 11/12] [media] tsin: c8sectpfe: Add Kconfig and Makefile for the driver Peter Griffin
2015-06-25  7:23     ` Paul Bolle
2015-07-22  7:38       ` Peter Griffin
2015-07-22 21:56     ` Mauro Carvalho Chehab
2015-07-30  9:39       ` Peter Griffin
2015-06-24 15:11   ` [PATCH 12/12] MAINTAINERS: Add c8sectpfe driver directory to STi section Peter Griffin
2015-06-24 15:11 ` [PATCH 03/12] [media] stv0367: Refine i2c error trace to include i2c address Peter Griffin
2015-06-24 15:11 ` [PATCH 04/12] [media] stv0367: Add support for 16Mhz reference clock Peter Griffin
2015-06-24 15:11 ` [PATCH 05/12] [media] tsin: c8sectpfe: Add DT bindings documentation for c8sectpfe driver Peter Griffin
2015-06-24 15:11 ` [PATCH 06/12] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node Peter Griffin
2015-06-24 15:11 ` [PATCH 07/12] [media] tsin: c8sectpfe: STiH407/10 Linux DVB demux support Peter Griffin
     [not found]   ` <1435158670-7195-8-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-07-22 21:46     ` Mauro Carvalho Chehab
2015-07-30 11:08       ` Peter Griffin
2015-06-24 15:11 ` [PATCH 08/12] [media] tsin: c8sectpfe: Add LDVB helper functions Peter Griffin

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=20150722141040.2be3ca98@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hugues.fruchet@st.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=patrice.chotard@st.com \
    --cc=peter.griffin@linaro.org \
    --cc=srinivas.kandagatla@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).