Skip to contentSkip to conversation

radio-bcm2048: Fix region selection

PATCH Superseded Pali Rohár 3 participants 5 messages May 15, 2015 – Jun 9, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radio-bcm2048: Fix region selection

From: maxx <[email protected]>

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 [email protected]

---
 drivers/staging/media/bcm2048/radio-bcm2048.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/staging/media/bcm2048/radio-bcm2048.c +13 -0
index aeb6c3c..1482d4b 100644
@@ -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 ||
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Pali Rohár
Quoted 8 lines · Pali Rohár

From: maxx <[email protected]>

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.

Quoted 4 lines

Patch writen by [email protected]

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

Regards,

Hans

Quoted 30 lines
---
 drivers/staging/media/bcm2048/radio-bcm2048.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/staging/media/bcm2048/radio-bcm2048.c +13 -0
index aeb6c3c..1482d4b 100644
@@ -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 ||
#3 lore raw
Quoted 9 lines · On Friday 05 June 2015 13:36:40 Hans Verkuil wrote:
Quoted 8 lines · Pali Rohár

From: maxx <[email protected]>

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.

Quoted 8 lines
Quoted 4 lines

Patch writen by [email protected]

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?

Signature · 2 lines
Pali Rohár
[email protected]
#4 lore raw

PATCH v2 1/1 radio-bcm2048: Fix region selection

In reply to Hans Verkuil

From: Jan Roemisch <[email protected]>

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.

---
 drivers/staging/media/bcm2048/radio-bcm2048.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/staging/media/bcm2048/radio-bcm2048.c +12 -8
index e9d0691..134e2af 100644
@@ -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 ||
Signature · 1 line
1.7.10.4