Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions sound/soc/suniv/miyoo.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#define MIYOO_FB0_PUT_OSD _IOWR(0x100, 0, unsigned long)
#define MIYOO_SND_SET_VOLUME _IOWR(0x100, 0, unsigned long)
#define MIYOO_SND_GET_VOLUME _IOWR(0x101, 0, unsigned long)
#define MIYOO_SND_JACK_STATUS _IOWR(0x102, 0, unsigned long)
#define MIYOO_TV_JACK_STATUS _IOWR(0x103, 0, unsigned long)

struct mypcm {
uint32_t dma_period;
Expand Down Expand Up @@ -84,7 +86,9 @@ static struct class *myclass = NULL;

static unsigned long MIYOO_VOLUME = 5;
static uint32_t miyoo_snd=1;
static bool miyoo_tvjack=false;
module_param(miyoo_snd,uint,0660);
module_param(miyoo_tvjack,bool,0660);

static void suniv_ioremap(void)
{
Expand Down Expand Up @@ -469,8 +473,30 @@ EXPORT_SYMBOL_GPL(MIYOO_DECREASE_VOLUME);
static long myioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
uint32_t ret;
bool jack = false;
bool tvjack = false;

switch(cmd){
case MIYOO_SND_JACK_STATUS:
ret = readl(iomm.gpio + PA_DATA);
if(ret & 4)
jack = false;
else
jack = true;
ret = copy_to_user((void*)arg, &jack, sizeof(bool));
break;
case MIYOO_TV_JACK_STATUS:
ret = readl(iomm.gpio + PA_DATA);
if(miyoo_tvjack){
// no info about separate tvjack PIN data
} else {
if(ret & 4)
tvjack = false;
else
tvjack = true;
}
ret = copy_to_user((void*)arg, &tvjack, sizeof(bool));
break;
case MIYOO_SND_SET_VOLUME:
MIYOO_SET_VOLUME(arg);
break;
Expand Down