support for MAX8821 led charge pump
PATCH 1/1 support for MAX8821 led charge pump
From: Rodolfo Giometti <[email protected]>
--- drivers/i2c/chips/Kconfig | 12 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/max8821.c | 707 +++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c/max8821.h | 32 ++ 4 files changed, 752 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/max8821.c create mode 100644 include/linux/i2c/max8821.h
drivers/i2c/chips/Kconfig +12 -0
@@ -152,6 +152,18 @@ config SENSORS_MAX6875 This driver can also be built as a module. If so, the module will be called max6875. +config SENSORS_MAX8821 + tristate "Maxim MAX8821 Led charge pump, mono audio amp and dual LDO" + depends on EXPERIMENTAL + help + If you say yes here you get support for the Maxim MAX8821 + white led charge pump with mono class D audio amp and dual LDO. + + This provides an interface to manage internal subsystems. + + This driver can also be built as a module. If so, the module + will be called max8821. + config SENSORS_TSL2550 tristate "Taos TSL2550 ambient light sensor" depends on EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_DS1682) += ds1682.o obj-$(CONFIG_AT24) += at24.o obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o obj-$(CONFIG_SENSORS_MAX6875) += max6875.o +obj-$(CONFIG_SENSORS_MAX8821) += max8821.o obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o obj-$(CONFIG_PCF8575) += pcf8575.o
drivers/i2c/chips/max8821.c new file +706 -0
706 lines not on this page · raw message
include/linux/i2c/max8821.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __LINUX_MAX8821_H +#define __LINUX_MAX8821_H + +#define MAX8821_LED1 0 +#define MAX8821_LED2 1 +#define MAX8821_LED3 2 +#define MAX8821_LED4 3 +#define MAX8821_LED5 4 +#define MAX8821_LED6 5 + +#define MAX8821_LDO1 0 +#define MAX8821_LDO2 1 + +struct max8821_platform_data { +struct { +char *name; +char *trigger;/* see available led triggers */ +unsigned int brightness;/* use values in [0:31] */ + } led[6 ]; +struct { +int power;/* Use 0 or 1 */ +int voltage;/* see ldo1_voltage[2][] for allowed values */ + } ldo[2 ]; +struct { +int power;/* Use 0 or 1 */ +int clock;/* see write_clock() for allowed values */ +int gain;/* see write_audio_gain() for allowed values */ + } audio; +}; + +#endif /* __LINUX_MAX8821_H */ +
Signature · 7 lines
1.5.4.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 1/1] [i2c] support for MAX8821 led charge
drivers/i2c/chips/max8821.c line 29
Quoted 8 lines · Rodolfo Giometti
drivers/i2c/chips/max8821.c new file +8
-0+ +#include <linux/module.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/i2c.h> +#include <linux/mutex.h> +#include <linux/leds.h> +
The LDOs should be exposed via the regulator framework which was merged in 2.6.27 - see include/linux/regulator and drivers/regulator. This provides an API for use by client drivers and standard sysfs interfaces for user space.
Quoted 8 lines
drivers/i2c/chips/max8821.c new file +8
-0+static ssize_t store_audio_power (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +int ret =write_audio_power (to_i2c_client (dev), +strict_strtol (buf,NULL ,10 )); +return ret ? ret : count; +}
...
drivers/i2c/chips/max8821.c line 465
Quoted 2 lines
drivers/i2c/chips/max8821.c new file +2
-0+static DEVICE_ATTR(audio_gain, S_IWUSR | S_IRUGO, + show_audio_gain, store_audio_gain);
It'd be much nicer to expose these as an in-kernel API, allowing ASoC machine or other ALSA drivers to integrate control for the audio part. With a direct sysfs interface rather an in-kernel one user space would need to do the power management for the amplifier and it won't be possible to expose the gain via standard ALSA interfaces.
Ideally ASoC would support multiple analogue devices so this could just be an ASoC driver directly but we're not there yet. There's an example of how such chips are currently handled in the OpenMoko GTA01 driver in sound/soc/s3c24xx/neo1973_wm8753.c - essentially, all the controls for the extra chip are glued in by the machine driver.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors