Skip to content

Commit 1f1bafa

Browse files
authored
miyoo: add iocl MIYOO_SND(/TV)_JACK_STATUS in snd module (#98)
* miyoo: add iocl MIYOO_SND_JACK_STATUS for headphone/tvout connection detect * miyoo: add separate MIYOO_TV_JACK_STATUS the same as snd jack for every console without separate tvout jack
1 parent 8ee8856 commit 1f1bafa

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

sound/soc/suniv/miyoo.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
#define MIYOO_FB0_PUT_OSD _IOWR(0x100, 0, unsigned long)
5656
#define MIYOO_SND_SET_VOLUME _IOWR(0x100, 0, unsigned long)
5757
#define MIYOO_SND_GET_VOLUME _IOWR(0x101, 0, unsigned long)
58+
#define MIYOO_SND_JACK_STATUS _IOWR(0x102, 0, unsigned long)
59+
#define MIYOO_TV_JACK_STATUS _IOWR(0x103, 0, unsigned long)
5860

5961
struct mypcm {
6062
uint32_t dma_period;
@@ -84,7 +86,9 @@ static struct class *myclass = NULL;
8486

8587
static unsigned long MIYOO_VOLUME = 5;
8688
static uint32_t miyoo_snd=1;
89+
static bool miyoo_tvjack=false;
8790
module_param(miyoo_snd,uint,0660);
91+
module_param(miyoo_tvjack,bool,0660);
8892

8993
static void suniv_ioremap(void)
9094
{
@@ -469,8 +473,30 @@ EXPORT_SYMBOL_GPL(MIYOO_DECREASE_VOLUME);
469473
static long myioctl(struct file *filp, unsigned int cmd, unsigned long arg)
470474
{
471475
uint32_t ret;
476+
bool jack = false;
477+
bool tvjack = false;
472478

473479
switch(cmd){
480+
case MIYOO_SND_JACK_STATUS:
481+
ret = readl(iomm.gpio + PA_DATA);
482+
if(ret & 4)
483+
jack = false;
484+
else
485+
jack = true;
486+
ret = copy_to_user((void*)arg, &jack, sizeof(bool));
487+
break;
488+
case MIYOO_TV_JACK_STATUS:
489+
ret = readl(iomm.gpio + PA_DATA);
490+
if(miyoo_tvjack){
491+
// no info about separate tvjack PIN data
492+
} else {
493+
if(ret & 4)
494+
tvjack = false;
495+
else
496+
tvjack = true;
497+
}
498+
ret = copy_to_user((void*)arg, &tvjack, sizeof(bool));
499+
break;
474500
case MIYOO_SND_SET_VOLUME:
475501
MIYOO_SET_VOLUME(arg);
476502
break;

0 commit comments

Comments
 (0)