|
|
@@ -1350,7 +1350,7 @@ static int bcm2048_checkrev(struct bcm2048_device *bdev)
|
|
|
static int bcm2048_get_rds_rt(struct bcm2048_device *bdev, char *data)
|
|
|
{
|
|
|
int err = 0, i, j = 0, ce = 0, cr = 0;
|
|
|
- char data_buffer[BCM2048_MAX_RDS_RT+1];
|
|
|
+ char data_buffer[BCM2048_MAX_RDS_RT + 1];
|
|
|
|
|
|
mutex_lock(&bdev->mutex);
|
|
|
|
|
|
@@ -1400,7 +1400,7 @@ static int bcm2048_get_rds_rt(struct bcm2048_device *bdev, char *data)
|
|
|
static int bcm2048_get_rds_ps(struct bcm2048_device *bdev, char *data)
|
|
|
{
|
|
|
int err = 0, i, j = 0;
|
|
|
- char data_buffer[BCM2048_MAX_RDS_PS+1];
|
|
|
+ char data_buffer[BCM2048_MAX_RDS_PS + 1];
|
|
|
|
|
|
mutex_lock(&bdev->mutex);
|
|
|
|
|
|
@@ -1440,8 +1440,8 @@ static void bcm2048_parse_rds_pi(struct bcm2048_device *bdev)
|
|
|
/* Block A match, only data without crc errors taken */
|
|
|
if (bdev->rds_info.radio_text[i] == BCM2048_RDS_BLOCK_A) {
|
|
|
|
|
|
- pi = (bdev->rds_info.radio_text[i+1] << 8) +
|
|
|
- bdev->rds_info.radio_text[i+2];
|
|
|
+ pi = (bdev->rds_info.radio_text[i + 1] << 8) +
|
|
|
+ bdev->rds_info.radio_text[i + 2];
|
|
|
|
|
|
if (!bdev->rds_info.rds_pi) {
|
|
|
bdev->rds_info.rds_pi = pi;
|
|
|
@@ -1472,14 +1472,15 @@ static void bcm2048_parse_rds_rt_block(struct bcm2048_device *bdev, int i,
|
|
|
if (crc) {
|
|
|
if (!bdev->rds_info.rds_rt[index])
|
|
|
bdev->rds_info.rds_rt[index] =
|
|
|
- bdev->rds_info.radio_text[i+1];
|
|
|
- if (!bdev->rds_info.rds_rt[index+1])
|
|
|
- bdev->rds_info.rds_rt[index+1] =
|
|
|
- bdev->rds_info.radio_text[i+2];
|
|
|
+ bdev->rds_info.radio_text[i + 1];
|
|
|
+ if (!bdev->rds_info.rds_rt[index + 1])
|
|
|
+ bdev->rds_info.rds_rt[index + 1] =
|
|
|
+ bdev->rds_info.radio_text[i + 2];
|
|
|
} else {
|
|
|
- bdev->rds_info.rds_rt[index] = bdev->rds_info.radio_text[i+1];
|
|
|
- bdev->rds_info.rds_rt[index+1] =
|
|
|
- bdev->rds_info.radio_text[i+2];
|
|
|
+ bdev->rds_info.rds_rt[index] =
|
|
|
+ bdev->rds_info.radio_text[i + 1];
|
|
|
+ bdev->rds_info.rds_rt[index + 1] =
|
|
|
+ bdev->rds_info.radio_text[i + 2];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1495,11 +1496,11 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i)
|
|
|
if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) ==
|
|
|
BCM2048_RDS_BLOCK_B) {
|
|
|
|
|
|
- rt_id = bdev->rds_info.radio_text[i+1] &
|
|
|
+ rt_id = bdev->rds_info.radio_text[i + 1] &
|
|
|
BCM2048_RDS_BLOCK_MASK;
|
|
|
- rt_group_b = bdev->rds_info.radio_text[i+1] &
|
|
|
+ rt_group_b = bdev->rds_info.radio_text[i + 1] &
|
|
|
BCM2048_RDS_GROUP_AB_MASK;
|
|
|
- rt_ab = bdev->rds_info.radio_text[i+2] &
|
|
|
+ rt_ab = bdev->rds_info.radio_text[i + 2] &
|
|
|
BCM2048_RDS_RT_AB_MASK;
|
|
|
|
|
|
if (rt_group_b != bdev->rds_info.rds_rt_group_b) {
|
|
|
@@ -1516,7 +1517,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i)
|
|
|
bdev->rds_info.rds_rt_ab = rt_ab;
|
|
|
}
|
|
|
|
|
|
- index = bdev->rds_info.radio_text[i+2] &
|
|
|
+ index = bdev->rds_info.radio_text[i + 2] &
|
|
|
BCM2048_RDS_RT_INDEX;
|
|
|
|
|
|
if (bdev->rds_info.rds_rt_group_b)
|
|
|
@@ -1568,7 +1569,7 @@ static void bcm2048_parse_rt_match_d(struct bcm2048_device *bdev, int i,
|
|
|
|
|
|
if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) ==
|
|
|
BCM2048_RDS_BLOCK_D)
|
|
|
- bcm2048_parse_rds_rt_block(bdev, i, index+2, crc);
|
|
|
+ bcm2048_parse_rds_rt_block(bdev, i, index + 2, crc);
|
|
|
}
|
|
|
|
|
|
static void bcm2048_parse_rds_rt(struct bcm2048_device *bdev)
|
|
|
@@ -1616,14 +1617,15 @@ static void bcm2048_parse_rds_ps_block(struct bcm2048_device *bdev, int i,
|
|
|
if (crc) {
|
|
|
if (!bdev->rds_info.rds_ps[index])
|
|
|
bdev->rds_info.rds_ps[index] =
|
|
|
- bdev->rds_info.radio_text[i+1];
|
|
|
- if (!bdev->rds_info.rds_ps[index+1])
|
|
|
- bdev->rds_info.rds_ps[index+1] =
|
|
|
- bdev->rds_info.radio_text[i+2];
|
|
|
+ bdev->rds_info.radio_text[i + 1];
|
|
|
+ if (!bdev->rds_info.rds_ps[index + 1])
|
|
|
+ bdev->rds_info.rds_ps[index + 1] =
|
|
|
+ bdev->rds_info.radio_text[i + 2];
|
|
|
} else {
|
|
|
- bdev->rds_info.rds_ps[index] = bdev->rds_info.radio_text[i+1];
|
|
|
- bdev->rds_info.rds_ps[index+1] =
|
|
|
- bdev->rds_info.radio_text[i+2];
|
|
|
+ bdev->rds_info.rds_ps[index] =
|
|
|
+ bdev->rds_info.radio_text[i + 1];
|
|
|
+ bdev->rds_info.rds_ps[index + 1] =
|
|
|
+ bdev->rds_info.radio_text[i + 2];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1671,9 +1673,9 @@ static int bcm2048_parse_ps_match_b(struct bcm2048_device *bdev, int i)
|
|
|
/* Block B Radio PS match */
|
|
|
if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) ==
|
|
|
BCM2048_RDS_BLOCK_B) {
|
|
|
- ps_id = bdev->rds_info.radio_text[i+1] &
|
|
|
+ ps_id = bdev->rds_info.radio_text[i + 1] &
|
|
|
BCM2048_RDS_BLOCK_MASK;
|
|
|
- ps_group = bdev->rds_info.radio_text[i+1] &
|
|
|
+ ps_group = bdev->rds_info.radio_text[i + 1] &
|
|
|
BCM2048_RDS_GROUP_AB_MASK;
|
|
|
|
|
|
/*
|
|
|
@@ -1697,7 +1699,7 @@ static int bcm2048_parse_ps_match_b(struct bcm2048_device *bdev, int i)
|
|
|
}
|
|
|
|
|
|
if (ps_id == BCM2048_RDS_PS) {
|
|
|
- index = bdev->rds_info.radio_text[i+2] &
|
|
|
+ index = bdev->rds_info.radio_text[i + 2] &
|
|
|
BCM2048_RDS_PS_INDEX;
|
|
|
index <<= 1;
|
|
|
return index;
|
|
|
@@ -1789,7 +1791,7 @@ static int bcm2048_get_rds_data(struct bcm2048_device *bdev, char *data)
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < bdev->rds_info.text_len; i++) {
|
|
|
- p += sprintf(data_buffer+p, "%x ",
|
|
|
+ p += sprintf(data_buffer + p, "%x ",
|
|
|
bdev->rds_info.radio_text[i]);
|
|
|
}
|
|
|
|
|
|
@@ -2062,7 +2064,7 @@ property_str_read(rds_rt, (BCM2048_MAX_RDS_RT + 1))
|
|
|
property_str_read(rds_ps, (BCM2048_MAX_RDS_PS + 1))
|
|
|
|
|
|
property_read(fm_rds_flags, unsigned int, "%u")
|
|
|
-property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT*5)
|
|
|
+property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT * 5)
|
|
|
|
|
|
property_read(region_bottom_frequency, unsigned int, "%u")
|
|
|
property_read(region_top_frequency, unsigned int, "%u")
|
|
|
@@ -2233,13 +2235,16 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf,
|
|
|
while (i < count) {
|
|
|
unsigned char tmpbuf[3];
|
|
|
|
|
|
- tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2];
|
|
|
- tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1];
|
|
|
- tmpbuf[i+2] = (bdev->rds_info.radio_text[bdev->rd_index + i] & 0xf0) >> 4;
|
|
|
- if ((bdev->rds_info.radio_text[bdev->rd_index+i] &
|
|
|
+ tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index + i + 2];
|
|
|
+ tmpbuf[i + 1] =
|
|
|
+ bdev->rds_info.radio_text[bdev->rd_index + i + 1];
|
|
|
+ tmpbuf[i + 2] =
|
|
|
+ (bdev->rds_info.radio_text[bdev->rd_index + i] &
|
|
|
+ 0xf0) >> 4;
|
|
|
+ if ((bdev->rds_info.radio_text[bdev->rd_index + i] &
|
|
|
BCM2048_RDS_CRC_MASK) == BCM2048_RDS_CRC_UNRECOVARABLE)
|
|
|
- tmpbuf[i+2] |= 0x80;
|
|
|
- if (copy_to_user(buf+i, tmpbuf, 3)) {
|
|
|
+ tmpbuf[i + 2] |= 0x80;
|
|
|
+ if (copy_to_user(buf + i, tmpbuf, 3)) {
|
|
|
retval = -EFAULT;
|
|
|
break;
|
|
|
}
|