summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/mas.c34
-rw-r--r--firmware/drivers/mas.h1
2 files changed, 35 insertions, 0 deletions
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c
index e954bcec5e..ec4de76a84 100644
--- a/firmware/drivers/mas.c
+++ b/firmware/drivers/mas.c
@@ -409,4 +409,38 @@ int mas_codec_readreg(int reg)
409 i2c_end(); 409 i2c_end();
410 return ret; 410 return ret;
411} 411}
412
413unsigned long mas_readver(void)
414{
415 int ret = 0;
416 unsigned char buf[16];
417 unsigned long value;
418
419 i2c_begin();
420
421 buf[0] = MAS_DATA_WRITE;
422 buf[1] = MAS_CMD_READ_IC_VER;
423 buf[2] = 0;
424
425 /* send read command */
426 if (i2c_write(MAS_DEV_WRITE,buf,3))
427 {
428 ret = -1;
429 }
430 else
431 {
432 if(mas_devread(&value, 1))
433 {
434 ret = -2;
435 }
436 else
437 {
438 ret = value;
439 }
440 }
441
442 i2c_end();
443 return ret;
444}
445
412#endif 446#endif
diff --git a/firmware/drivers/mas.h b/firmware/drivers/mas.h
index 71604fb136..b2c164d9e9 100644
--- a/firmware/drivers/mas.h
+++ b/firmware/drivers/mas.h
@@ -109,5 +109,6 @@ int mas_direct_config_read(unsigned char reg);
109int mas_direct_config_write(unsigned char reg, unsigned int val); 109int mas_direct_config_write(unsigned char reg, unsigned int val);
110int mas_codec_writereg(int reg, unsigned int val); 110int mas_codec_writereg(int reg, unsigned int val);
111int mas_codec_readreg(int reg); 111int mas_codec_readreg(int reg);
112unsigned long mas_readver(void);
112 113
113#endif 114#endif