linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] radio-bcm2048: Fix region selection
@ 2015-05-15 21:32 Pali Rohár
  2015-05-15 22:51 ` Greg Kroah-Hartman
  2015-06-05 11:36 ` Hans Verkuil
  0 siblings, 2 replies; 9+ messages in thread
From: Pali Rohár @ 2015-05-15 21:32 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil, Pavel Machek
  Cc: linux-media, linux-kernel, maxx, Pali Rohár

From: maxx <maxx@spaceboyz.net>

This actually fixes region selection for BCM2048 FM receiver. To select
the japanese FM-band an additional bit in FM_CTRL register needs to be
set. This might not sound so important but it enables at least me to
listen to some 'very interesting' radio transmission below normal
FM-band.

Patch writen by maxx@spaceboyz.net

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Cc: maxx@spaceboyz.net
---
 drivers/staging/media/bcm2048/radio-bcm2048.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
index aeb6c3c..1482d4b 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -739,7 +739,20 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
 		return -EINVAL;
 
 	mutex_lock(&bdev->mutex);
+
 	bdev->region_info = region_configs[region];
+
+	bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT;
+	if (region > 2) {
+		bdev->cache_fm_ctrl |= BCM2048_BAND_SELECT;
+		err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL,
+					bdev->cache_fm_ctrl);
+		if (err) {
+			mutex_unlock(&bdev->mutex);
+			goto done;
+		}
+	}
+
 	mutex_unlock(&bdev->mutex);
 
 	if (bdev->frequency < region_configs[region].bottom_frequency ||
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-05-15 21:32 [PATCH] radio-bcm2048: Fix region selection Pali Rohár
@ 2015-05-15 22:51 ` Greg Kroah-Hartman
  2015-06-05 11:36 ` Hans Verkuil
  1 sibling, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-15 22:51 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Pavel Machek, linux-media,
	linux-kernel, maxx

On Fri, May 15, 2015 at 11:32:51PM +0200, Pali Rohár wrote:
> From: maxx <maxx@spaceboyz.net>

I need a real name here, sorry.

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-05-15 21:32 [PATCH] radio-bcm2048: Fix region selection Pali Rohár
  2015-05-15 22:51 ` Greg Kroah-Hartman
@ 2015-06-05 11:36 ` Hans Verkuil
  2015-06-05 12:01   ` Pali Rohár
  2015-06-09 11:44   ` [PATCH v2] " Pali Rohár
  1 sibling, 2 replies; 9+ messages in thread
From: Hans Verkuil @ 2015-06-05 11:36 UTC (permalink / raw)
  To: Pali Rohár, Mauro Carvalho Chehab, Greg Kroah-Hartman,
	Hans Verkuil, Pavel Machek
  Cc: linux-media, linux-kernel, maxx

On 05/15/2015 11:32 PM, Pali Rohár wrote:
> From: maxx <maxx@spaceboyz.net>
> 
> This actually fixes region selection for BCM2048 FM receiver. To select
> the japanese FM-band an additional bit in FM_CTRL register needs to be
> set. This might not sound so important but it enables at least me to
> listen to some 'very interesting' radio transmission below normal
> FM-band.
> 
> Patch writen by maxx@spaceboyz.net
> 
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Cc: maxx@spaceboyz.net

Looks good to me. If someone can repost with correct names and SoBs, then I'll
apply.

Regards,

	Hans

> ---
>  drivers/staging/media/bcm2048/radio-bcm2048.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
> index aeb6c3c..1482d4b 100644
> --- a/drivers/staging/media/bcm2048/radio-bcm2048.c
> +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
> @@ -739,7 +739,20 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
>  		return -EINVAL;
>  
>  	mutex_lock(&bdev->mutex);
> +
>  	bdev->region_info = region_configs[region];
> +
> +	bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT;
> +	if (region > 2) {
> +		bdev->cache_fm_ctrl |= BCM2048_BAND_SELECT;
> +		err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL,
> +					bdev->cache_fm_ctrl);
> +		if (err) {
> +			mutex_unlock(&bdev->mutex);
> +			goto done;
> +		}
> +	}
> +
>  	mutex_unlock(&bdev->mutex);
>  
>  	if (bdev->frequency < region_configs[region].bottom_frequency ||
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-06-05 11:36 ` Hans Verkuil
@ 2015-06-05 12:01   ` Pali Rohár
  2015-06-09 11:44   ` [PATCH v2] " Pali Rohár
  1 sibling, 0 replies; 9+ messages in thread
From: Pali Rohár @ 2015-06-05 12:01 UTC (permalink / raw)
  To: Jan Roemisch
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Pavel Machek, linux-media, linux-kernel, Hans Verkuil

On Friday 05 June 2015 13:36:40 Hans Verkuil wrote:
> On 05/15/2015 11:32 PM, Pali Rohár wrote:
> > From: maxx <maxx@spaceboyz.net>
> > 
> > This actually fixes region selection for BCM2048 FM receiver. To select
> > the japanese FM-band an additional bit in FM_CTRL register needs to be
> > set. This might not sound so important but it enables at least me to
> > listen to some 'very interesting' radio transmission below normal
> > FM-band.
> > 
> > Patch writen by maxx@spaceboyz.net
> > 
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Cc: maxx@spaceboyz.net
> 
> Looks good to me. If someone can repost with correct names and SoBs, then I'll
> apply.
> 

Jan, will you resend patch in correct format with correct names?

-- 
Pali Rohár
pali.rohar@gmail.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] radio-bcm2048: Fix region selection
  2015-06-05 11:36 ` Hans Verkuil
  2015-06-05 12:01   ` Pali Rohár
@ 2015-06-09 11:44   ` Pali Rohár
  1 sibling, 0 replies; 9+ messages in thread
From: Pali Rohár @ 2015-06-09 11:44 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, Hans Verkuil,
	Pavel Machek, linux-media, linux-kernel, Pali Rohár,
	Jan Roemisch

From: Jan Roemisch <maxx@spaceboyz.net>

This patch fixes region selection for lower bottom_frequency in BCM2048 FM
receiver. It also removes "Japan wide band" region since this is impossible
to do just like that.

Signed-off-by: Jan Roemisch <maxx@spaceboyz.net>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/staging/media/bcm2048/radio-bcm2048.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
index e9d0691..134e2af 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -342,14 +342,6 @@ static struct region_info region_configs[] = {
 		.deemphasis		= 50,
 		.region			= 3,
 	},
-	/* Japan wide band */
-	{
-		.channel_spacing	= 10,
-		.bottom_frequency	= 76000,
-		.top_frequency		= 108000,
-		.deemphasis		= 50,
-		.region			= 4,
-	},
 };
 
 /*
@@ -741,6 +733,18 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
 
 	mutex_lock(&bdev->mutex);
 	bdev->region_info = region_configs[region];
+
+	if (region_configs[region].bottom_frequency < 87500)
+		bdev->cache_fm_ctrl |= BCM2048_BAND_SELECT;
+	else
+		bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT;
+
+	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL,
+					bdev->cache_fm_ctrl);
+	if (err) {
+		mutex_unlock(&bdev->mutex);
+		goto done;
+	}
 	mutex_unlock(&bdev->mutex);
 
 	if (bdev->frequency < region_configs[region].bottom_frequency ||
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-05-16 15:20   ` Jan Roemisch
@ 2015-05-18 10:52     ` Pavel Machek
  0 siblings, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2015-05-18 10:52 UTC (permalink / raw)
  To: Jan Roemisch
  Cc: Greg KH, pali.rohar, Mauro Carvalho Chehab, Hans Verkuil,
	linux-media, linux-kernel

On Sat 2015-05-16 17:20:50, Jan Roemisch wrote:
> Removed "Japan wide band" region since this is impossible to do just
> like that. Additionally it's now possible to go back to non-Japanese regions
> without having to reload the module.

Acked-by: Pavel Machek <pavel@ucw.cz>

But note that you'll probably need to do one more resend, with

Signed-off-by:

line.

Thanks and best regards,
									Pavel

> Greetings
> Jan Roemisch
> 
> On Sat, May 16, 2015 at 07:06:17AM -0700, Greg KH wrote:
> > On Sat, May 16, 2015 at 01:22:27PM +0200, Jan Roemisch wrote:
> > > Oh sorry, the real name is Jan Roemisch.
> > 
> > Ok, thanks, can someone please fix up the patches and resend them?
> > 
> > greg k-h
> > 

> diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
> index 5382506..d2e7f1e 100644
> --- a/drivers/staging/media/bcm2048/radio-bcm2048.c
> +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
> @@ -342,14 +342,6 @@ static struct region_info region_configs[] = {
>  		.deemphasis		= 50,
>  		.region			= 3,
>  	},
> -	/* Japan wide band */
> -	{
> -		.channel_spacing	= 10,
> -		.bottom_frequency	= 76000,
> -		.top_frequency		= 108000,
> -		.deemphasis		= 50,
> -		.region			= 4,
> -	},
>  };
>  
>  /*
> @@ -741,6 +733,18 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
>  
>  	mutex_lock(&bdev->mutex);
>  	bdev->region_info = region_configs[region];
> +
> +	if (region_configs[region].bottom_frequency < 87500)
> +		bdev->cache_fm_ctrl |= BCM2048_BAND_SELECT;
> +	else
> +		bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT;
> +
> +	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL,
> +					bdev->cache_fm_ctrl);
> +	if (err) {
> +		mutex_unlock(&bdev->mutex);
> +		goto done;
> +	}
>  	mutex_unlock(&bdev->mutex);
>  
>  	if (bdev->frequency < region_configs[region].bottom_frequency ||


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-05-16 14:06 ` Greg KH
@ 2015-05-16 15:20   ` Jan Roemisch
  2015-05-18 10:52     ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Roemisch @ 2015-05-16 15:20 UTC (permalink / raw)
  To: Greg KH
  Cc: Jan Roemisch, pali.rohar, Mauro Carvalho Chehab, Hans Verkuil,
	Pavel Machek, linux-media, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

Removed "Japan wide band" region since this is impossible to do just
like that. Additionally it's now possible to go back to non-Japanese regions
without having to reload the module.

Greetings
Jan Roemisch

On Sat, May 16, 2015 at 07:06:17AM -0700, Greg KH wrote:
> On Sat, May 16, 2015 at 01:22:27PM +0200, Jan Roemisch wrote:
> > Oh sorry, the real name is Jan Roemisch.
> 
> Ok, thanks, can someone please fix up the patches and resend them?
> 
> greg k-h
> 

[-- Attachment #2: radio-bcm2048-region-fix.diff --]
[-- Type: text/plain, Size: 1095 bytes --]

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 5382506..d2e7f1e 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -342,14 +342,6 @@ static struct region_info region_configs[] = {
 		.deemphasis		= 50,
 		.region			= 3,
 	},
-	/* Japan wide band */
-	{
-		.channel_spacing	= 10,
-		.bottom_frequency	= 76000,
-		.top_frequency		= 108000,
-		.deemphasis		= 50,
-		.region			= 4,
-	},
 };
 
 /*
@@ -741,6 +733,18 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region)
 
 	mutex_lock(&bdev->mutex);
 	bdev->region_info = region_configs[region];
+
+	if (region_configs[region].bottom_frequency < 87500)
+		bdev->cache_fm_ctrl |= BCM2048_BAND_SELECT;
+	else
+		bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT;
+
+	err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL,
+					bdev->cache_fm_ctrl);
+	if (err) {
+		mutex_unlock(&bdev->mutex);
+		goto done;
+	}
 	mutex_unlock(&bdev->mutex);
 
 	if (bdev->frequency < region_configs[region].bottom_frequency ||

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
  2015-05-16 11:22 [PATCH] " Jan Roemisch
@ 2015-05-16 14:06 ` Greg KH
  2015-05-16 15:20   ` Jan Roemisch
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2015-05-16 14:06 UTC (permalink / raw)
  To: Jan Roemisch
  Cc: pali.rohar, Mauro Carvalho Chehab, Hans Verkuil, Pavel Machek,
	linux-media, linux-kernel

On Sat, May 16, 2015 at 01:22:27PM +0200, Jan Roemisch wrote:
> Oh sorry, the real name is Jan Roemisch.

Ok, thanks, can someone please fix up the patches and resend them?

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] radio-bcm2048: Fix region selection
@ 2015-05-16 11:22 Jan Roemisch
  2015-05-16 14:06 ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Roemisch @ 2015-05-16 11:22 UTC (permalink / raw)
  To: gregkh
  Cc: pali.rohar, Mauro Carvalho Chehab, Hans Verkuil, Pavel Machek,
	linux-media, linux-kernel

Oh sorry, the real name is Jan Roemisch.

Greetings
Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-06-09 11:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 21:32 [PATCH] radio-bcm2048: Fix region selection Pali Rohár
2015-05-15 22:51 ` Greg Kroah-Hartman
2015-06-05 11:36 ` Hans Verkuil
2015-06-05 12:01   ` Pali Rohár
2015-06-09 11:44   ` [PATCH v2] " Pali Rohár
2015-05-16 11:22 [PATCH] " Jan Roemisch
2015-05-16 14:06 ` Greg KH
2015-05-16 15:20   ` Jan Roemisch
2015-05-18 10:52     ` Pavel Machek

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).