Ticket #781: lm4857_off_on_suspend_and_shutdown.patch

File lm4857_off_on_suspend_and_shutdown.patch, 1.3 KB (added by alex@…, 3 years ago)

allow LM4857 to be off'ed on suspend and shutdown

  • sound/soc/s3c24xx/neo1973_wm8753.c

    diff -urN linux-2.6.22.5-orig/sound/soc/s3c24xx/neo1973_wm8753.c linux-2.6.22.5/sound/soc/s3c24xx/neo1973_wm8753.c
    old new  
    615615        return i2c_probe(adap, &addr_data, lm4857_amp_probe); 
    616616} 
    617617 
     618static u8 lm4857_state; 
     619 
     620static int lm4857_suspend(struct device * dev, pm_message_t state) 
     621{ 
     622  //printk("Suspend Called"); 
     623  if (lm4857_state = (lm4857_regs[LM4857_CTRL] & 0xF)) { 
     624    lm4857_regs[LM4857_CTRL] &= 0xf0; 
     625    lm4857_write_regs(); 
     626  } 
     627  return 0; 
     628} 
     629 
     630static int lm4857_resume(struct device * dev) 
     631{ 
     632  //printk("Resume Called"); 
     633  if (lm4857_state) { 
     634    lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f); 
     635    lm4857_write_regs(); 
     636  } 
     637  return 0; 
     638} 
     639 
     640static void lm4857_shutdown(struct device * dev) 
     641{ 
     642  lm4857_regs[LM4857_CTRL] &= 0xf0; 
     643  lm4857_write_regs(); 
     644} 
     645 
    618646/* corgi i2c codec control layer */ 
    619647static struct i2c_driver lm4857_i2c_driver = { 
    620648        .driver = { 
    621649                .name = "LM4857 I2C Amp", 
    622650                .owner = THIS_MODULE, 
     651                .suspend = lm4857_suspend, 
     652                .resume = lm4857_resume, 
     653                .shutdown = lm4857_shutdown, 
    623654        }, 
    624655        .id =             I2C_DRIVERID_LM4857, 
    625656        .attach_adapter = lm4857_i2c_attach,