aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/siano
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-03-07 09:40:45 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 06:52:48 -0400
commit9711a8a600a12d2895c18f31be1fc5b3c4d9b209 (patch)
tree0abbef9463713fdce8a9cd6dbb11a276c11ca50b /drivers/media/common/siano
parent5ac14b60118071631bb0e2e50527c7528675648c (diff)
[media] siano: honour per-card default mode
Instead of using a global default_mode, passed via modprobe parameter, use the one defined inside the cards struct. That will prevent the need of manually specify it for each board, except, of course, if the user wants to do something different, on boards that accept multiple types. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/siano')
-rw-r--r--drivers/media/common/siano/smscoreapi.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
index 9b2f2b42bfbb..44040a60cd77 100644
--- a/drivers/media/common/siano/smscoreapi.c
+++ b/drivers/media/common/siano/smscoreapi.c
@@ -434,7 +434,7 @@ static struct mutex g_smscore_deviceslock;
434static struct list_head g_smscore_registry; 434static struct list_head g_smscore_registry;
435static struct mutex g_smscore_registrylock; 435static struct mutex g_smscore_registrylock;
436 436
437static int default_mode = 4; 437static int default_mode = DEVICE_MODE_NONE;
438 438
439module_param(default_mode, int, 0644); 439module_param(default_mode, int, 0644);
440MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); 440MODULE_PARM_DESC(default_mode, "default firmware id (device mode)");
@@ -880,8 +880,15 @@ int smscore_configure_board(struct smscore_device_t *coredev)
880 */ 880 */
881int smscore_start_device(struct smscore_device_t *coredev) 881int smscore_start_device(struct smscore_device_t *coredev)
882{ 882{
883 int rc = smscore_set_device_mode( 883 int rc;
884 coredev, smscore_registry_getmode(coredev->devpath)); 884 int board_id = smscore_get_board_id(coredev);
885 int mode = smscore_registry_getmode(coredev->devpath);
886
887 /* Device is initialized as DEVICE_MODE_NONE */
888 if (board_id != SMS_BOARD_UNKNOWN && mode == DEVICE_MODE_NONE)
889 mode = sms_get_board(board_id)->default_mode;
890
891 rc = smscore_set_device_mode(coredev, mode);
885 if (rc < 0) { 892 if (rc < 0) {
886 sms_info("set device mode faile , rc %d", rc); 893 sms_info("set device mode faile , rc %d", rc);
887 return rc; 894 return rc;
@@ -1269,6 +1276,12 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
1269 1276
1270 type = smscore_registry_gettype(coredev->devpath); 1277 type = smscore_registry_gettype(coredev->devpath);
1271 1278
1279 /* Prevent looking outside the smscore_fw_lkup table */
1280 if (type <= SMS_UNKNOWN_TYPE || type >= SMS_NUM_OF_DEVICE_TYPES)
1281 return NULL;
1282 if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
1283 return NULL;
1284
1272 if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) { 1285 if ((board_id == SMS_BOARD_UNKNOWN) || (lookup == 1)) {
1273 sms_debug("trying to get fw name from lookup table mode %d type %d", 1286 sms_debug("trying to get fw name from lookup table mode %d type %d",
1274 mode, type); 1287 mode, type);
@@ -1338,7 +1351,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
1338 1351
1339 sms_debug("set device mode to %d", mode); 1352 sms_debug("set device mode to %d", mode);
1340 if (coredev->device_flags & SMS_DEVICE_FAMILY2) { 1353 if (coredev->device_flags & SMS_DEVICE_FAMILY2) {
1341 if (mode < DEVICE_MODE_DVBT || mode >= DEVICE_MODE_RAW_TUNER) { 1354 if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) {
1342 sms_err("invalid mode specified %d", mode); 1355 sms_err("invalid mode specified %d", mode);
1343 return -EINVAL; 1356 return -EINVAL;
1344 } 1357 }
@@ -1390,7 +1403,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
1390 sms_err("device init failed, rc %d.", rc); 1403 sms_err("device init failed, rc %d.", rc);
1391 } 1404 }
1392 } else { 1405 } else {
1393 if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_MAX) { 1406 if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) {
1394 sms_err("invalid mode specified %d", mode); 1407 sms_err("invalid mode specified %d", mode);
1395 return -EINVAL; 1408 return -EINVAL;
1396 } 1409 }