27 #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
28 #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers"
29 #define DRIVER_VERSION "1.0.2"
32 #include <linux/i2c.h>
33 #include <linux/slab.h>
56 static int radio_nr = -1;
61 static unsigned int rds_buf = 100;
66 static unsigned short max_rds_errors = 1;
81 #define WRITE_REG_NUM 8
82 #define WRITE_INDEX(i) (i + 0x02)
85 #define READ_REG_NUM RADIO_REGISTER_NUM
86 #define READ_INDEX(i) ((i + RADIO_REGISTER_NUM - 0x0a) % READ_REG_NUM)
102 .
addr = radio->client->addr,
127 .
addr = radio->client->addr,
151 static int si470x_get_all_registers(
struct si470x_device *radio)
157 .
addr = radio->client->addr,
190 if (v4l2_fh_is_singular_file(file)) {
218 if (v4l2_fh_is_singular_file(file))
259 unsigned char blocknum;
289 for (blocknum = 0; blocknum < 4; blocknum++) {
314 put_unaligned_le16(rds, &tmpbuf);
315 tmpbuf[2] = blocknum;
316 tmpbuf[2] |= blocknum << 3;
317 if (bler > max_rds_errors)
355 unsigned char version_warning = 0;
371 video_set_drvdata(&radio->
videodev, radio);
382 if (si470x_get_all_registers(radio) < 0) {
386 dev_info(&client->
dev,
"DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
390 "This driver is known to work with "
393 "but the device has firmware version %hu.\n",
399 if (version_warning == 1) {
401 "If you have some trouble using this driver,\n");
403 "please report to V4L ML at "
426 dev_err(&client->
dev,
"Failed to register interrupt\n");
434 dev_warn(&client->
dev,
"Could not register video device\n");
437 i2c_set_clientdata(client, radio);
470 static int si470x_i2c_suspend(
struct device *
dev)
487 static int si470x_i2c_resume(
struct device *dev)
508 static struct i2c_driver si470x_i2c_driver = {
513 .pm = &si470x_i2c_pm,
516 .probe = si470x_i2c_probe,
518 .id_table = si470x_i2c_id,