Commit 8efb34b2 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] it913x: add chip device ids for binding

Driver supports 2 different device versions, AX and BX. Use device
IDs to pass chip version information to driver.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 35ef193b
...@@ -390,6 +390,7 @@ static int it913x_probe(struct platform_device *pdev) ...@@ -390,6 +390,7 @@ static int it913x_probe(struct platform_device *pdev)
struct it913x_platform_data *pdata = pdev->dev.platform_data; struct it913x_platform_data *pdata = pdev->dev.platform_data;
struct dvb_frontend *fe = pdata->fe; struct dvb_frontend *fe = pdata->fe;
struct it913x_dev *dev; struct it913x_dev *dev;
const struct platform_device_id *id = platform_get_device_id(pdev);
int ret; int ret;
char *chip_ver_str; char *chip_ver_str;
...@@ -403,7 +404,7 @@ static int it913x_probe(struct platform_device *pdev) ...@@ -403,7 +404,7 @@ static int it913x_probe(struct platform_device *pdev)
dev->pdev = pdev; dev->pdev = pdev;
dev->regmap = pdata->regmap; dev->regmap = pdata->regmap;
dev->fe = pdata->fe; dev->fe = pdata->fe;
dev->chip_ver = pdata->chip_ver; dev->chip_ver = id->driver_data;
dev->role = pdata->role; dev->role = pdata->role;
fe->tuner_priv = dev; fe->tuner_priv = dev;
...@@ -441,6 +442,13 @@ static int it913x_remove(struct platform_device *pdev) ...@@ -441,6 +442,13 @@ static int it913x_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct platform_device_id it913x_id_table[] = {
{"it9133ax-tuner", 1},
{"it9133bx-tuner", 2},
{},
};
MODULE_DEVICE_TABLE(platform, it913x_id_table);
static struct platform_driver it913x_driver = { static struct platform_driver it913x_driver = {
.driver = { .driver = {
.name = "it913x", .name = "it913x",
...@@ -448,6 +456,7 @@ static struct platform_driver it913x_driver = { ...@@ -448,6 +456,7 @@ static struct platform_driver it913x_driver = {
}, },
.probe = it913x_probe, .probe = it913x_probe,
.remove = it913x_remove, .remove = it913x_remove,
.id_table = it913x_id_table,
}; };
module_platform_driver(it913x_driver); module_platform_driver(it913x_driver);
......
...@@ -25,21 +25,16 @@ ...@@ -25,21 +25,16 @@
* struct it913x_platform_data - Platform data for the it913x driver * struct it913x_platform_data - Platform data for the it913x driver
* @regmap: af9033 demod driver regmap. * @regmap: af9033 demod driver regmap.
* @dvb_frontend: af9033 demod driver DVB frontend. * @dvb_frontend: af9033 demod driver DVB frontend.
* @chip_ver: Used chip version. 1=IT9133 AX, 2=IT9133 BX.
* @role: Chip role, single or dual configuration. * @role: Chip role, single or dual configuration.
*/ */
struct it913x_platform_data { struct it913x_platform_data {
struct regmap *regmap; struct regmap *regmap;
struct dvb_frontend *fe; struct dvb_frontend *fe;
unsigned int chip_ver:2;
#define IT913X_ROLE_SINGLE 0 #define IT913X_ROLE_SINGLE 0
#define IT913X_ROLE_DUAL_MASTER 1 #define IT913X_ROLE_DUAL_MASTER 1
#define IT913X_ROLE_DUAL_SLAVE 2 #define IT913X_ROLE_DUAL_SLAVE 2
unsigned int role:2; unsigned int role:2;
}; };
/* Backwards compatibility */
#define it913x_config it913x_platform_data
#endif #endif
...@@ -1495,6 +1495,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1495,6 +1495,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
case AF9033_TUNER_IT9135_62: case AF9033_TUNER_IT9135_62:
{ {
struct platform_device *pdev; struct platform_device *pdev;
const char *name;
struct it913x_platform_data it913x_pdata = { struct it913x_platform_data it913x_pdata = {
.regmap = state->af9033_config[adap->id].regmap, .regmap = state->af9033_config[adap->id].regmap,
.fe = adap->fe[0], .fe = adap->fe[0],
...@@ -1504,12 +1505,12 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1504,12 +1505,12 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
case AF9033_TUNER_IT9135_38: case AF9033_TUNER_IT9135_38:
case AF9033_TUNER_IT9135_51: case AF9033_TUNER_IT9135_51:
case AF9033_TUNER_IT9135_52: case AF9033_TUNER_IT9135_52:
it913x_pdata.chip_ver = 1; name = "it9133ax-tuner";
break; break;
case AF9033_TUNER_IT9135_60: case AF9033_TUNER_IT9135_60:
case AF9033_TUNER_IT9135_61: case AF9033_TUNER_IT9135_61:
case AF9033_TUNER_IT9135_62: case AF9033_TUNER_IT9135_62:
it913x_pdata.chip_ver = 2; name = "it9133bx-tuner";
break; break;
default: default:
ret = -ENODEV; ret = -ENODEV;
...@@ -1526,8 +1527,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1526,8 +1527,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
} }
request_module("%s", "it913x"); request_module("%s", "it913x");
pdev = platform_device_register_data(&d->intf->dev, pdev = platform_device_register_data(&d->intf->dev, name,
"it913x",
PLATFORM_DEVID_AUTO, PLATFORM_DEVID_AUTO,
&it913x_pdata, &it913x_pdata,
sizeof(it913x_pdata)); sizeof(it913x_pdata));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment