aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-11-16 16:01:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:40 -0500
commit76052bc8688c84628865740e2f82ab41d71a977b (patch)
tree4c9add782206671fea5999f6bcfb65bd1c8a93a1 /drivers/media/dvb
parentc9455fbb159711ca7a2ee5a67f0e7ca43287bbd7 (diff)
V4L/DVB (9734): sms1xxx: add functions to configure and set gpio
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c70
-rw-r--r--drivers/media/dvb/siano/smscoreapi.h32
2 files changed, 102 insertions, 0 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index 6576fbb40fc6..b0e8bcb1238d 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -1187,6 +1187,76 @@ int smsclient_sendrequest(struct smscore_client_t *client,
1187} 1187}
1188 1188
1189 1189
1190int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
1191 struct smscore_gpio_config *pinconfig)
1192{
1193 struct {
1194 struct SmsMsgHdr_ST hdr;
1195 u32 data[6];
1196 } msg;
1197
1198 if (coredev->device_flags & SMS_DEVICE_FAMILY2) {
1199 msg.hdr.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
1200 msg.hdr.msgDstId = HIF_TASK;
1201 msg.hdr.msgFlags = 0;
1202 msg.hdr.msgType = MSG_SMS_GPIO_CONFIG_EX_REQ;
1203 msg.hdr.msgLength = sizeof(msg);
1204
1205 msg.data[0] = pin;
1206 msg.data[1] = pinconfig->pullupdown;
1207
1208 /* Convert slew rate for Nova: Fast(0) = 3 / Slow(1) = 0; */
1209 msg.data[2] = pinconfig->outputslewrate == 0 ? 3 : 0;
1210
1211 switch (pinconfig->outputdriving) {
1212 case SMS_GPIO_OUTPUTDRIVING_16mA:
1213 msg.data[3] = 7; /* Nova - 16mA */
1214 break;
1215 case SMS_GPIO_OUTPUTDRIVING_12mA:
1216 msg.data[3] = 5; /* Nova - 11mA */
1217 break;
1218 case SMS_GPIO_OUTPUTDRIVING_8mA:
1219 msg.data[3] = 3; /* Nova - 7mA */
1220 break;
1221 case SMS_GPIO_OUTPUTDRIVING_4mA:
1222 default:
1223 msg.data[3] = 2; /* Nova - 4mA */
1224 break;
1225 }
1226
1227 msg.data[4] = pinconfig->direction;
1228 msg.data[5] = 0;
1229 } else /* TODO: SMS_DEVICE_FAMILY1 */
1230 return -EINVAL;
1231
1232 return coredev->sendrequest_handler(coredev->context,
1233 &msg, sizeof(msg));
1234}
1235
1236int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level)
1237{
1238 struct {
1239 struct SmsMsgHdr_ST hdr;
1240 u32 data[3];
1241 } msg;
1242
1243 if (pin > MAX_GPIO_PIN_NUMBER)
1244 return -EINVAL;
1245
1246 msg.hdr.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
1247 msg.hdr.msgDstId = HIF_TASK;
1248 msg.hdr.msgFlags = 0;
1249 msg.hdr.msgType = MSG_SMS_GPIO_SET_LEVEL_REQ;
1250 msg.hdr.msgLength = sizeof(msg);
1251
1252 msg.data[0] = pin;
1253 msg.data[1] = level ? 1 : 0;
1254 msg.data[2] = 0;
1255
1256 return coredev->sendrequest_handler(coredev->context,
1257 &msg, sizeof(msg));
1258}
1259
1190static int __init smscore_module_init(void) 1260static int __init smscore_module_init(void)
1191{ 1261{
1192 int rc = 0; 1262 int rc = 0;
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h
index 8d973f726fb8..27b0c4139dc0 100644
--- a/drivers/media/dvb/siano/smscoreapi.h
+++ b/drivers/media/dvb/siano/smscoreapi.h
@@ -186,6 +186,8 @@ struct smsclient_params_t {
186#define MSG_SW_RELOAD_EXEC_REQ 704 186#define MSG_SW_RELOAD_EXEC_REQ 704
187#define MSG_SW_RELOAD_EXEC_RES 705 187#define MSG_SW_RELOAD_EXEC_RES 705
188#define MSG_SMS_SPI_INT_LINE_SET_REQ 710 188#define MSG_SMS_SPI_INT_LINE_SET_REQ 710
189#define MSG_SMS_GPIO_CONFIG_EX_REQ 712
190#define MSG_SMS_GPIO_CONFIG_EX_RES 713
189#define MSG_SMS_ISDBT_TUNE_REQ 776 191#define MSG_SMS_ISDBT_TUNE_REQ 776
190#define MSG_SMS_ISDBT_TUNE_RES 777 192#define MSG_SMS_ISDBT_TUNE_RES 777
191 193
@@ -341,6 +343,32 @@ struct SmsMsgStatisticsInfo_ST {
341}; 343};
342 344
343 345
346struct smscore_gpio_config {
347#define SMS_GPIO_DIRECTION_INPUT 0
348#define SMS_GPIO_DIRECTION_OUTPUT 1
349 u8 direction;
350
351#define SMS_GPIO_PULLUPDOWN_NONE 0
352#define SMS_GPIO_PULLUPDOWN_PULLDOWN 1
353#define SMS_GPIO_PULLUPDOWN_PULLUP 2
354#define SMS_GPIO_PULLUPDOWN_KEEPER 3
355 u8 pullupdown;
356
357#define SMS_GPIO_INPUTCHARACTERISTICS_NORMAL 0
358#define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1
359 u8 inputcharacteristics;
360
361#define SMS_GPIO_OUTPUTSLEWRATE_FAST 0
362#define SMS_GPIO_OUTPUTSLEWRATE_SLOW 1
363 u8 outputslewrate;
364
365#define SMS_GPIO_OUTPUTDRIVING_4mA 0
366#define SMS_GPIO_OUTPUTDRIVING_8mA 1
367#define SMS_GPIO_OUTPUTDRIVING_12mA 2
368#define SMS_GPIO_OUTPUTDRIVING_16mA 3
369 u8 outputdriving;
370};
371
344struct smsdvb_client_t { 372struct smsdvb_client_t {
345 struct list_head entry; 373 struct list_head entry;
346 374
@@ -396,6 +424,10 @@ struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
396extern void smscore_putbuffer(struct smscore_device_t *coredev, 424extern void smscore_putbuffer(struct smscore_device_t *coredev,
397 struct smscore_buffer_t *cb); 425 struct smscore_buffer_t *cb);
398 426
427int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
428 struct smscore_gpio_config *pinconfig);
429int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level);
430
399void smscore_set_board_id(struct smscore_device_t *core, int id); 431void smscore_set_board_id(struct smscore_device_t *core, int id);
400int smscore_get_board_id(struct smscore_device_t *core); 432int smscore_get_board_id(struct smscore_device_t *core);
401 433