* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#undef DEBUG
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
MODULE_DESCRIPTION("TPS6501x Power Management Driver");
MODULE_LICENSE("GPL");
-/* only two addresses possible */
-#define TPS_BASE 0x48
-static unsigned short normal_i2c[] = {
- TPS_BASE,
- I2C_CLIENT_END };
+static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
struct i2c_client client;
struct mutex lock;
int irq;
- int irq_type;
struct work_struct work;
struct dentry *file;
unsigned charging:1;
u8 chgstatus, regstatus, chgconf;
u8 nmask1, nmask2;
- /* plus four GPIOs, probably used to switch power */
+ /* not currently tracking GPIO state */
};
-#define POWER_POLL_DELAY msecs_to_jiffies(800)
+#define POWER_POLL_DELAY msecs_to_jiffies(5000)
/*-------------------------------------------------------------------------*/
(regstatus & TPS_REG_COVER) ? " uncover" : "",
(regstatus & TPS_REG_UVLO) ? " UVLO" : "",
(regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "",
- (regstatus & TPS_REG_PG_LD02) ? " ld01_bad" : "",
+ (regstatus & TPS_REG_PG_LD02) ? " ld02_bad" : "",
(regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "",
(regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "",
(regstatus & TPS_REG_PG_CORE) ? " core_bad" : "");
static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
{
- char *hibit;
+ const char *hibit;
if (por)
hibit = (chgconfig & TPS_CHARGE_POR)
seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2);
for (i = 0; i < 4; i++) {
- if (value & (1 << (4 +i)))
+ if (value & (1 << (4 + i)))
seq_printf(s, " gpio%d-out %s\n", i + 1,
(value & (1 << i)) ? "low" : "hi ");
else
debugfs_remove(tps->file);
if (i2c_detach_client(client) == 0)
kfree(tps);
- the_tps = 0;
+ the_tps = NULL;
return 0;
}
{
struct tps65010 *tps;
int status;
+ unsigned long irqflags;
if (the_tps) {
dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME);
INIT_WORK(&tps->work, tps65010_work, tps);
tps->irq = -1;
tps->client.addr = address;
- i2c_set_clientdata(&tps->client, tps);
tps->client.adapter = bus;
tps->client.driver = &tps65010_driver;
strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE);
if (status < 0) {
dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
DRIVER_NAME, address, status);
-fail1:
- kfree(tps);
- return 0;
+ goto fail1;
}
- tps->irq_type = 0;
-
+ /* the IRQ is active low, but many gpio lines can't support that
+ * so this driver can use falling-edge triggers instead.
+ */
+ irqflags = IRQF_SAMPLE_RANDOM;
#ifdef CONFIG_ARM
if (machine_is_omap_h2()) {
tps->model = TPS65010;
tps->irq = OMAP_GPIO_IRQ(58);
omap_request_gpio(58);
omap_set_gpio_direction(58, 1);
- tps->irq_type = SA_TRIGGER_FALLING;
+ irqflags |= IRQF_TRIGGER_FALLING;
}
if (machine_is_omap_osk()) {
tps->model = TPS65010;
tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
omap_request_gpio(OMAP_MPUIO(1));
omap_set_gpio_direction(OMAP_MPUIO(1), 1);
- tps->irq_type = SA_TRIGGER_FALLING;
+ irqflags |= IRQF_TRIGGER_FALLING;
}
if (machine_is_omap_h3()) {
tps->model = TPS65013;
if (tps->irq > 0) {
status = request_irq(tps->irq, tps65010_irq,
- tps->irq_type, DRIVER_NAME, tps);
+ irqflags, DRIVER_NAME, tps);
if (status < 0) {
dev_dbg(&tps->client.dev, "can't get IRQ %d, err %d\n",
tps->irq, status);
tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
tps, DEBUG_FOPS);
return 0;
+fail1:
+ kfree(tps);
+ return 0;
}
static int __init tps65010_scan_bus(struct i2c_adapter *bus)
static struct i2c_driver tps65010_driver = {
.driver = {
- .name = "tps65010",
+ .name = "tps65010",
},
- .id = 888, /* FIXME assign "official" value */
.attach_adapter = tps65010_scan_bus,
.detach_client = __exit_p(tps65010_detach_client),
};
return -ENODEV;
if ((gpio < GPIO1) || (gpio > GPIO4))
return -EINVAL;
-
+
mutex_lock(&the_tps->lock);
defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO);
/* Configure GPIO for output */
defgpio |= 1 << (gpio + 3);
-
+
/* Writing 1 forces a logic 0 on that GPIO and vice versa */
switch (value) {
case LOW:
defgpio &= ~(1 << (gpio - 1)); /* set GPIO high by writing 0 */
break;
}
-
+
status = i2c_smbus_write_byte_data(&the_tps->client,
TPS_DEFGPIO, defgpio);
pr_debug("%s: gpio%dout = %s, defgpio 0x%02x\n", DRIVER_NAME,
gpio, value ? "high" : "low",
i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO));
-
+
mutex_unlock(&the_tps->lock);
return status;
}
if (!the_tps)
return -ENODEV;
- if(led == LED1)
+ if (led == LED1)
offs = 0;
else {
offs = 2;
mutex_lock(&the_tps->lock);
- dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led,
- i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
+ pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
+ i2c_smbus_read_byte_data(&the_tps->client,
+ TPS_LED1_ON + offs));
+
+ pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led,
+ i2c_smbus_read_byte_data(&the_tps->client,
+ TPS_LED1_PER + offs));
- dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led,
- i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
-
switch (mode) {
case OFF:
led_on = 1 << 7;
led_per = 0x08 | (1 << 7);
break;
default:
- printk(KERN_ERR "%s: Wrong mode parameter for tps65010_set_led()\n",
+ printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n",
DRIVER_NAME);
mutex_unlock(&the_tps->lock);
return -EINVAL;
TPS_LED1_ON + offs, led_on);
if (status != 0) {
- printk(KERN_ERR "%s: Failed to write led%i_on register\n",
+ printk(KERN_ERR "%s: Failed to write led%i_on register\n",
DRIVER_NAME, led);
mutex_unlock(&the_tps->lock);
return status;
- }
+ }
- dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led,
+ pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led,
i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
status = i2c_smbus_write_byte_data(&the_tps->client,
TPS_LED1_PER + offs, led_per);
if (status != 0) {
- printk(KERN_ERR "%s: Failed to write led%i_per register\n",
+ printk(KERN_ERR "%s: Failed to write led%i_per register\n",
DRIVER_NAME, led);
mutex_unlock(&the_tps->lock);
return status;
}
- dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led,
- i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
+ pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led,
+ i2c_smbus_read_byte_data(&the_tps->client,
+ TPS_LED1_PER + offs));
mutex_unlock(&the_tps->lock);
i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
vdcdc1 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1);
-
+
switch (mode) {
case OFF:
vdcdc1 &= ~TPS_ENABLE_LP; /* disable ENABLE_LP bit */
TPS_VDCDC1, vdcdc1);
if (status != 0)
- printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
- DRIVER_NAME);
+ printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
+ DRIVER_NAME);
else
pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
mutex_lock(&the_tps->lock);
- pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
- i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+ pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
+ i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
status = i2c_smbus_write_byte_data(&the_tps->client,
TPS_VREGS1, value);
if (status != 0)
- printk(KERN_ERR "%s: Failed to write vregs1 register\n",
- DRIVER_NAME);
+ printk(KERN_ERR "%s: Failed to write vregs1 register\n",
+ DRIVER_NAME);
else
pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
msleep(10);
}
-#if defined(CONFIG_ARM)
+#ifdef CONFIG_ARM
if (machine_is_omap_osk()) {
// FIXME: More should be placed in the initialization code
} else if (machine_is_omap_h3()) {
/* gpio4 for SD, gpio3 for VDD_DSP */
#ifdef CONFIG_PM
- /* FIXME: Enable LOW_PWR hangs H3 */
- //tps65013_set_low_pwr(ON);
+ /* Enable LOW_PWR */
+ tps65013_set_low_pwr(ON);
#endif
}
#endif
#
# Prompt user for primary drivers.
-config SOUND_OMAP
- tristate "OMAP Sound Driver"
- depends on SOUND_PRIME!=n && SOUND && ARCH_OMAP
- ---help---
- OMAP Audio driver
+config OSS_OBSOLETE_DRIVER
+ bool "Obsolete OSS drivers"
+ depends on SOUND_PRIME
+ help
+ This option enables support for obsolete OSS drivers that
+ are scheduled for removal in the near future since there
+ are ALSA drivers for the same hardware.
-config SOUND_OMAP_TSC2101
- tristate "TSC2101 Stereo Codec"
- depends on SOUND_OMAP && ( MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4 || MACH_OMAP_APOLLON)
- select OMAP_TSC2101 if ( MACH_OMAP_H2 || MACH_OMAP_H3 )
- select OMAP_UWIRE if ARCH_OMAP1
- ---help---
- Tsc2101 Audio Codec Driver for OMAP will be enabled.
- Will also Enable the following:
- case OMAP1:
- 1. uWire Driver based on Platform
- 2. TSC2101 Glue driver
- case OMAP2:
- 1. McSPI Driver based on Platform
- 2. TSC2101 Glue driver
-
-config SOUND_OMAP_AIC23
- tristate "AIC23 Stereo Codec"
- depends on SOUND_OMAP && ( MACH_OMAP_INNOVATOR || MACH_OMAP_OSK )
- select I2C
- select I2C_OMAP if ARCH_OMAP
- select SENSORS_TLV320AIC23 if ARCH_OMAP
- ---help---
- AIC23 Audio Codec Driver for OMAP will be enabled.
- Additionally, AIC23 I2C support is enabled.
+ Please contact Adrian Bunk <bunk@stusta.de> if you had to
+ say Y here because your soundcard is not properly supported
+ by ALSA.
+
+ If unsure, say N.
config SOUND_BT878
tristate "BT878 audio dma"
config SOUND_EMU10K1
tristate "Creative SBLive! (EMU10K1)"
- depends on SOUND_PRIME && PCI
+ depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER
---help---
Say Y or M if you have a PCI sound card using the EMU10K1 chipset,
such as the Creative SBLive!, SB PCI512 or Emu-APS.
For more information on this driver and the degree of support for
the different card models please check:
- <http://sourceforge.net/projects/emu10k1/>
+ <http://sourceforge.net/projects/emu10k1/>
It is now possible to load dsp microcode patches into the EMU10K1
chip. These patches are used to implement real time sound
config SOUND_FUSION
tristate "Crystal SoundFusion (CS4280/461x)"
- depends on SOUND_PRIME && PCI
+ depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER
help
This module drives the Crystal SoundFusion devices (CS4280/46xx
series) when wired as native sound drivers with AC97 codecs. If
system support" and "Sysctl support", and after the /proc file
system has been mounted, executing the command
- command what is enabled
+ command what is enabled
echo 0>/proc/ALi5451 pcm out is also set to S/PDIF out. (Default).
config SOUND_AD1816
tristate "AD1816(A) based cards (EXPERIMENTAL)"
- depends on EXPERIMENTAL && SOUND_OSS
+ depends on EXPERIMENTAL && SOUND_OSS && OSS_OBSOLETE_DRIVER
help
Say M here if you have a sound card based on the Analog Devices
AD1816(A) chip.
config SOUND_AD1889
tristate "AD1889 based cards (AD1819 codec) (EXPERIMENTAL)"
- depends on EXPERIMENTAL && SOUND_OSS && PCI
+ depends on EXPERIMENTAL && SOUND_OSS && PCI && OSS_OBSOLETE_DRIVER
help
Say M here if you have a sound card based on the Analog Devices
AD1889 chip.
config SOUND_ADLIB
tristate "Adlib Cards"
- depends on SOUND_OSS
+ depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
help
Includes ASB 64 4D. Information on programming AdLib cards is
available at <http://www.itsnet.com/home/ldragon/Specs/adlib.html>.
config SOUND_ACI_MIXER
tristate "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20)"
- depends on SOUND_OSS
+ depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
---help---
ACI (Audio Command Interface) is a protocol used to communicate with
the microcontroller on some sound cards produced by miro and
config SOUND_NM256
tristate "NM256AV/NM256ZX audio support"
- depends on SOUND_OSS
+ depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
help
Say M here to include audio support for the NeoMagic 256AV/256ZX
chipsets. These are the audio chipsets found in the Sony
config SOUND_OPL3SA2
tristate "Yamaha OPL3-SA2 and SA3 based PnP cards"
- depends on SOUND_OSS
+ depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
help
Say Y or M if you have a card based on one of these Yamaha sound
chipsets or the "SAx", which is actually a SA3. Read
config SOUND_TVMIXER
tristate "TV card (bt848) mixer support"
- depends on SOUND_PRIME && I2C
+ depends on SOUND_PRIME && I2C && VIDEO_V4L1
help
Support for audio mixer facilities on the BT848 TV frame-grabber
card.