radio-bcm2048: Fix region selection

Message ID 1431725571-7417-1-git-send-email-pali.rohar@gmail.com (mailing list archive)
State Changes Requested, archived
Delegated to: Hans Verkuil
Headers

Commit Message

Pali Rohár May 15, 2015, 9:32 p.m. UTC
  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(+)
  

Comments

Greg KH May 15, 2015, 10:51 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Hans Verkuil June 5, 2015, 11:36 a.m. UTC | #2
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 ||
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Pali Rohár June 5, 2015, 12:01 p.m. UTC | #3
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?
  

Patch

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