[kernel] r16862 - in dists/sid/linux-2.6/debian: . config/armel patches/features/all patches/features/arm patches/series

Martin Michlmayr tbm at alioth.debian.org
Sun Feb 6 13:53:18 UTC 2011


Author: tbm
Date: Sun Feb  6 13:53:09 2011
New Revision: 16862

Log:
Orion: add support for Buffalo LS-CHL (Closes: #590105).

Added:
   dists/sid/linux-2.6/debian/patches/features/all/hwmon-gpio.patch
   dists/sid/linux-2.6/debian/patches/features/arm/ls-chl-support.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/config/armel/config.orion5x
   dists/sid/linux-2.6/debian/patches/series/31

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Sun Feb  6 01:34:52 2011	(r16861)
+++ dists/sid/linux-2.6/debian/changelog	Sun Feb  6 13:53:09 2011	(r16862)
@@ -25,6 +25,9 @@
   * init: fix race between init and kthreadd, fixes a kernel panic on 
     mips/5kc-malta.
 
+  [ Martin Michlmayr ]
+  * Orion: add support for Buffalo LS-CHL (Closes: #590105).
+
  -- Ian Campbell <ijc at hellion.org.uk>  Thu, 13 Jan 2011 07:07:54 +0000
 
 linux-2.6 (2.6.32-30) unstable; urgency=high

Modified: dists/sid/linux-2.6/debian/config/armel/config.orion5x
==============================================================================
--- dists/sid/linux-2.6/debian/config/armel/config.orion5x	Sun Feb  6 01:34:52 2011	(r16861)
+++ dists/sid/linux-2.6/debian/config/armel/config.orion5x	Sun Feb  6 13:53:09 2011	(r16862)
@@ -55,6 +55,7 @@
 ##
 CONFIG_MACH_TERASTATION_PRO2=y
 CONFIG_MACH_KUROBOX_PRO=y
+CONFIG_MACH_LINKSTATION_LSCHL=y
 CONFIG_MACH_LINKSTATION_MINI=y
 CONFIG_MACH_DNS323=y
 CONFIG_MACH_TS209=y
@@ -178,6 +179,7 @@
 ## file: drivers/hwmon/Kconfig
 ##
 CONFIG_SENSORS_G760A=m
+CONFIG_SENSORS_GPIO_FAN=m
 CONFIG_SENSORS_LM75=m
 
 ##

Added: dists/sid/linux-2.6/debian/patches/features/all/hwmon-gpio.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/hwmon-gpio.patch	Sun Feb  6 13:53:09 2011	(r16862)
@@ -0,0 +1,655 @@
+From: Simon Guinot <sguinot at lacie.com>
+Date: Thu, 21 Oct 2010 22:44:19 +0000 (+0200)
+Subject: hwmon: add generic GPIO fan driver
+X-Git-Tag: v2.6.37-rc1~118^2~13
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=d6fe1360f42e86262153927986dea6502daff703
+
+hwmon: add generic GPIO fan driver
+
+This patch adds hwmon support for fans connected to GPIO lines.
+
+Platform specific information such as GPIO pinout and speed conversion array
+(rpm from/to GPIO value) are passed to the driver via platform_data.
+
+Signed-off-by: Simon Guinot <sguinot at lacie.com>
+Signed-off-by: Guenter Roeck <guenter.roeck at ericsson.com>
+---
+
+diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
+index ec4295f..c357c83 100644
+--- a/drivers/hwmon/Kconfig
++++ b/drivers/hwmon/Kconfig
+@@ -372,6 +372,15 @@
+ 	  This driver can also be built as a module.  If so, the module
+ 	  will be called gl520sm.
+ 
++config SENSORS_GPIO_FAN
++	tristate "GPIO fan"
++	depends on GENERIC_GPIO
++	help
++	  If you say yes here you get support for fans connected to GPIO lines.
++
++	  This driver can also be built as a module.  If so, the module
++	  will be called gpio-fan.
++
+ config SENSORS_CORETEMP
+ 	tristate "Intel Core/Core2/Atom temperature sensor"
+ 	depends on X86 && EXPERIMENTAL
+diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
+index fc38e7c..d30f0f6 100644
+--- a/drivers/hwmon/Makefile
++++ b/drivers/hwmon/Makefile
+@@ -46,6 +46,7 @@
+ obj-$(CONFIG_SENSORS_G760A)	+= g760a.o
+ obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
+ obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
++obj-$(CONFIG_SENSORS_GPIO_FAN)	+= gpio-fan.o
+ obj-$(CONFIG_SENSORS_ULTRA45)	+= ultra45_env.o
+ obj-$(CONFIG_SENSORS_HDAPS)	+= hdaps.o
+ obj-$(CONFIG_SENSORS_I5K_AMB)	+= i5k_amb.o
+diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
+new file mode 100644
+index 0000000..aa701a1
+--- /dev/null
++++ b/drivers/hwmon/gpio-fan.c
+@@ -0,0 +1,558 @@
++/*
++ * gpio-fan.c - Hwmon driver for fans connected to GPIO lines.
++ *
++ * Copyright (C) 2010 LaCie
++ *
++ * Author: Simon Guinot <sguinot at lacie.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ */
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/interrupt.h>
++#include <linux/irq.h>
++#include <linux/platform_device.h>
++#include <linux/err.h>
++#include <linux/mutex.h>
++#include <linux/hwmon.h>
++#include <linux/gpio.h>
++#include <linux/gpio-fan.h>
++
++struct gpio_fan_data {
++	struct platform_device	*pdev;
++	struct device		*hwmon_dev;
++	struct mutex		lock; /* lock GPIOs operations. */
++	int			num_ctrl;
++	unsigned		*ctrl;
++	int			num_speed;
++	struct gpio_fan_speed	*speed;
++	int			speed_index;
++#ifdef CONFIG_PM
++	int			resume_speed;
++#endif
++	bool			pwm_enable;
++	struct gpio_fan_alarm	*alarm;
++	struct work_struct	alarm_work;
++};
++
++/*
++ * Alarm GPIO.
++ */
++
++static void fan_alarm_notify(struct work_struct *ws)
++{
++	struct gpio_fan_data *fan_data =
++		container_of(ws, struct gpio_fan_data, alarm_work);
++
++	sysfs_notify(&fan_data->pdev->dev.kobj, NULL, "fan1_alarm");
++	kobject_uevent(&fan_data->pdev->dev.kobj, KOBJ_CHANGE);
++}
++
++static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id)
++{
++	struct gpio_fan_data *fan_data = dev_id;
++
++	schedule_work(&fan_data->alarm_work);
++
++	return IRQ_NONE;
++}
++
++static ssize_t show_fan_alarm(struct device *dev,
++			      struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++	struct gpio_fan_alarm *alarm = fan_data->alarm;
++	int value = gpio_get_value(alarm->gpio);
++
++	if (alarm->active_low)
++		value = !value;
++
++	return sprintf(buf, "%d\n", value);
++}
++
++static DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL);
++
++static int fan_alarm_init(struct gpio_fan_data *fan_data,
++			  struct gpio_fan_alarm *alarm)
++{
++	int err;
++	int alarm_irq;
++	struct platform_device *pdev = fan_data->pdev;
++
++	fan_data->alarm = alarm;
++
++	err = gpio_request(alarm->gpio, "GPIO fan alarm");
++	if (err)
++		return err;
++
++	err = gpio_direction_input(alarm->gpio);
++	if (err)
++		goto err_free_gpio;
++
++	err = device_create_file(&pdev->dev, &dev_attr_fan1_alarm);
++	if (err)
++		goto err_free_gpio;
++
++	/*
++	 * If the alarm GPIO don't support interrupts, just leave
++	 * without initializing the fail notification support.
++	 */
++	alarm_irq = gpio_to_irq(alarm->gpio);
++	if (alarm_irq < 0)
++		return 0;
++
++	INIT_WORK(&fan_data->alarm_work, fan_alarm_notify);
++	set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH);
++	err = request_irq(alarm_irq, fan_alarm_irq_handler, IRQF_SHARED,
++			  "GPIO fan alarm", fan_data);
++	if (err)
++		goto err_free_sysfs;
++
++	return 0;
++
++err_free_sysfs:
++	device_remove_file(&pdev->dev, &dev_attr_fan1_alarm);
++err_free_gpio:
++	gpio_free(alarm->gpio);
++
++	return err;
++}
++
++static void fan_alarm_free(struct gpio_fan_data *fan_data)
++{
++	struct platform_device *pdev = fan_data->pdev;
++	int alarm_irq = gpio_to_irq(fan_data->alarm->gpio);
++
++	if (alarm_irq >= 0)
++		free_irq(alarm_irq, fan_data);
++	device_remove_file(&pdev->dev, &dev_attr_fan1_alarm);
++	gpio_free(fan_data->alarm->gpio);
++}
++
++/*
++ * Control GPIOs.
++ */
++
++/* Must be called with fan_data->lock held, except during initialization. */
++static void __set_fan_ctrl(struct gpio_fan_data *fan_data, int ctrl_val)
++{
++	int i;
++
++	for (i = 0; i < fan_data->num_ctrl; i++)
++		gpio_set_value(fan_data->ctrl[i], (ctrl_val >> i) & 1);
++}
++
++static int __get_fan_ctrl(struct gpio_fan_data *fan_data)
++{
++	int i;
++	int ctrl_val = 0;
++
++	for (i = 0; i < fan_data->num_ctrl; i++) {
++		int value;
++
++		value = gpio_get_value(fan_data->ctrl[i]);
++		ctrl_val |= (value << i);
++	}
++	return ctrl_val;
++}
++
++/* Must be called with fan_data->lock held, except during initialization. */
++static void set_fan_speed(struct gpio_fan_data *fan_data, int speed_index)
++{
++	if (fan_data->speed_index == speed_index)
++		return;
++
++	__set_fan_ctrl(fan_data, fan_data->speed[speed_index].ctrl_val);
++	fan_data->speed_index = speed_index;
++}
++
++static int get_fan_speed_index(struct gpio_fan_data *fan_data)
++{
++	int ctrl_val = __get_fan_ctrl(fan_data);
++	int i;
++
++	for (i = 0; i < fan_data->num_speed; i++)
++		if (fan_data->speed[i].ctrl_val == ctrl_val)
++			return i;
++
++	dev_warn(&fan_data->pdev->dev,
++		 "missing speed array entry for GPIO value 0x%x\n", ctrl_val);
++
++	return -EINVAL;
++}
++
++static int rpm_to_speed_index(struct gpio_fan_data *fan_data, int rpm)
++{
++	struct gpio_fan_speed *speed = fan_data->speed;
++	int i;
++
++	for (i = 0; i < fan_data->num_speed; i++)
++		if (speed[i].rpm >= rpm)
++			return i;
++
++	return fan_data->num_speed - 1;
++}
++
++static ssize_t show_pwm(struct device *dev,
++			struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++	u8 pwm = fan_data->speed_index * 255 / (fan_data->num_speed - 1);
++
++	return sprintf(buf, "%d\n", pwm);
++}
++
++static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
++		       const char *buf, size_t count)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++	unsigned long pwm;
++	int speed_index;
++	int ret = count;
++
++	if (strict_strtoul(buf, 10, &pwm) || pwm > 255)
++		return -EINVAL;
++
++	mutex_lock(&fan_data->lock);
++
++	if (!fan_data->pwm_enable) {
++		ret = -EPERM;
++		goto exit_unlock;
++	}
++
++	speed_index = DIV_ROUND_UP(pwm * (fan_data->num_speed - 1), 255);
++	set_fan_speed(fan_data, speed_index);
++
++exit_unlock:
++	mutex_unlock(&fan_data->lock);
++
++	return ret;
++}
++
++static ssize_t show_pwm_enable(struct device *dev,
++			       struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++
++	return sprintf(buf, "%d\n", fan_data->pwm_enable);
++}
++
++static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
++			      const char *buf, size_t count)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++	unsigned long val;
++
++	if (strict_strtoul(buf, 10, &val) || val > 1)
++		return -EINVAL;
++
++	if (fan_data->pwm_enable == val)
++		return count;
++
++	mutex_lock(&fan_data->lock);
++
++	fan_data->pwm_enable = val;
++
++	/* Disable manual control mode: set fan at full speed. */
++	if (val == 0)
++		set_fan_speed(fan_data, fan_data->num_speed - 1);
++
++	mutex_unlock(&fan_data->lock);
++
++	return count;
++}
++
++static ssize_t show_pwm_mode(struct device *dev,
++			     struct device_attribute *attr, char *buf)
++{
++	return sprintf(buf, "0\n");
++}
++
++static ssize_t show_rpm_min(struct device *dev,
++			    struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++
++	return sprintf(buf, "%d\n", fan_data->speed[0].rpm);
++}
++
++static ssize_t show_rpm_max(struct device *dev,
++			    struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++
++	return sprintf(buf, "%d\n",
++		       fan_data->speed[fan_data->num_speed - 1].rpm);
++}
++
++static ssize_t show_rpm(struct device *dev,
++			struct device_attribute *attr, char *buf)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++
++	return sprintf(buf, "%d\n", fan_data->speed[fan_data->speed_index].rpm);
++}
++
++static ssize_t set_rpm(struct device *dev, struct device_attribute *attr,
++		       const char *buf, size_t count)
++{
++	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
++	unsigned long rpm;
++	int ret = count;
++
++	if (strict_strtoul(buf, 10, &rpm))
++		return -EINVAL;
++
++	mutex_lock(&fan_data->lock);
++
++	if (!fan_data->pwm_enable) {
++		ret = -EPERM;
++		goto exit_unlock;
++	}
++
++	set_fan_speed(fan_data, rpm_to_speed_index(fan_data, rpm));
++
++exit_unlock:
++	mutex_unlock(&fan_data->lock);
++
++	return ret;
++}
++
++static DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm);
++static DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
++		   show_pwm_enable, set_pwm_enable);
++static DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL);
++static DEVICE_ATTR(fan1_min, S_IRUGO, show_rpm_min, NULL);
++static DEVICE_ATTR(fan1_max, S_IRUGO, show_rpm_max, NULL);
++static DEVICE_ATTR(fan1_input, S_IRUGO, show_rpm, NULL);
++static DEVICE_ATTR(fan1_target, S_IRUGO | S_IWUSR, show_rpm, set_rpm);
++
++static struct attribute *gpio_fan_ctrl_attributes[] = {
++	&dev_attr_pwm1.attr,
++	&dev_attr_pwm1_enable.attr,
++	&dev_attr_pwm1_mode.attr,
++	&dev_attr_fan1_input.attr,
++	&dev_attr_fan1_target.attr,
++	&dev_attr_fan1_min.attr,
++	&dev_attr_fan1_max.attr,
++	NULL
++};
++
++static const struct attribute_group gpio_fan_ctrl_group = {
++	.attrs = gpio_fan_ctrl_attributes,
++};
++
++static int fan_ctrl_init(struct gpio_fan_data *fan_data,
++			 struct gpio_fan_platform_data *pdata)
++{
++	struct platform_device *pdev = fan_data->pdev;
++	int num_ctrl = pdata->num_ctrl;
++	unsigned *ctrl = pdata->ctrl;
++	int i, err;
++
++	for (i = 0; i < num_ctrl; i++) {
++		err = gpio_request(ctrl[i], "GPIO fan control");
++		if (err)
++			goto err_free_gpio;
++
++		err = gpio_direction_output(ctrl[i], gpio_get_value(ctrl[i]));
++		if (err) {
++			gpio_free(ctrl[i]);
++			goto err_free_gpio;
++		}
++	}
++
++	err = sysfs_create_group(&pdev->dev.kobj, &gpio_fan_ctrl_group);
++	if (err)
++		goto err_free_gpio;
++
++	fan_data->num_ctrl = num_ctrl;
++	fan_data->ctrl = ctrl;
++	fan_data->num_speed = pdata->num_speed;
++	fan_data->speed = pdata->speed;
++	fan_data->pwm_enable = true; /* Enable manual fan speed control. */
++	fan_data->speed_index = get_fan_speed_index(fan_data);
++	if (fan_data->speed_index < 0) {
++		err = -ENODEV;
++		goto err_free_gpio;
++	}
++
++	return 0;
++
++err_free_gpio:
++	for (i = i - 1; i >= 0; i--)
++		gpio_free(ctrl[i]);
++
++	return err;
++}
++
++static void fan_ctrl_free(struct gpio_fan_data *fan_data)
++{
++	struct platform_device *pdev = fan_data->pdev;
++	int i;
++
++	sysfs_remove_group(&pdev->dev.kobj, &gpio_fan_ctrl_group);
++	for (i = 0; i < fan_data->num_ctrl; i++)
++		gpio_free(fan_data->ctrl[i]);
++}
++
++/*
++ * Platform driver.
++ */
++
++static ssize_t show_name(struct device *dev,
++			 struct device_attribute *attr, char *buf)
++{
++	return sprintf(buf, "gpio-fan\n");
++}
++
++static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
++
++static int __devinit gpio_fan_probe(struct platform_device *pdev)
++{
++	int err;
++	struct gpio_fan_data *fan_data;
++	struct gpio_fan_platform_data *pdata = pdev->dev.platform_data;
++
++	if (!pdata)
++		return -EINVAL;
++
++	fan_data = kzalloc(sizeof(struct gpio_fan_data), GFP_KERNEL);
++	if (!fan_data)
++		return -ENOMEM;
++
++	fan_data->pdev = pdev;
++	platform_set_drvdata(pdev, fan_data);
++	mutex_init(&fan_data->lock);
++
++	/* Configure alarm GPIO if available. */
++	if (pdata->alarm) {
++		err = fan_alarm_init(fan_data, pdata->alarm);
++		if (err)
++			goto err_free_data;
++	}
++
++	/* Configure control GPIOs if available. */
++	if (pdata->ctrl && pdata->num_ctrl > 0) {
++		if (!pdata->speed || pdata->num_speed <= 1) {
++			err = -EINVAL;
++			goto err_free_alarm;
++		}
++		err = fan_ctrl_init(fan_data, pdata);
++		if (err)
++			goto err_free_alarm;
++	}
++
++	err = device_create_file(&pdev->dev, &dev_attr_name);
++	if (err)
++		goto err_free_ctrl;
++
++	/* Make this driver part of hwmon class. */
++	fan_data->hwmon_dev = hwmon_device_register(&pdev->dev);
++	if (IS_ERR(fan_data->hwmon_dev)) {
++		err = PTR_ERR(fan_data->hwmon_dev);
++		goto err_remove_name;
++	}
++
++	dev_info(&pdev->dev, "GPIO fan initialized\n");
++
++	return 0;
++
++err_remove_name:
++	device_remove_file(&pdev->dev, &dev_attr_name);
++err_free_ctrl:
++	if (fan_data->ctrl)
++		fan_ctrl_free(fan_data);
++err_free_alarm:
++	if (fan_data->alarm)
++		fan_alarm_free(fan_data);
++err_free_data:
++	platform_set_drvdata(pdev, NULL);
++	kfree(fan_data);
++
++	return err;
++}
++
++static int __devexit gpio_fan_remove(struct platform_device *pdev)
++{
++	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
++
++	hwmon_device_unregister(fan_data->hwmon_dev);
++	device_remove_file(&pdev->dev, &dev_attr_name);
++	if (fan_data->alarm)
++		fan_alarm_free(fan_data);
++	if (fan_data->ctrl)
++		fan_ctrl_free(fan_data);
++	kfree(fan_data);
++
++	return 0;
++}
++
++#ifdef CONFIG_PM
++static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
++{
++	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
++
++	if (fan_data->ctrl) {
++		fan_data->resume_speed = fan_data->speed_index;
++		set_fan_speed(fan_data, 0);
++	}
++
++	return 0;
++}
++
++static int gpio_fan_resume(struct platform_device *pdev)
++{
++	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
++
++	if (fan_data->ctrl)
++		set_fan_speed(fan_data, fan_data->resume_speed);
++
++	return 0;
++}
++#else
++#define gpio_fan_suspend NULL
++#define gpio_fan_resume NULL
++#endif
++
++static struct platform_driver gpio_fan_driver = {
++	.probe		= gpio_fan_probe,
++	.remove		= __devexit_p(gpio_fan_remove),
++	.suspend	= gpio_fan_suspend,
++	.resume		= gpio_fan_resume,
++	.driver	= {
++		.name	= "gpio-fan",
++	},
++};
++
++static int __init gpio_fan_init(void)
++{
++	return platform_driver_register(&gpio_fan_driver);
++}
++
++static void __exit gpio_fan_exit(void)
++{
++	platform_driver_unregister(&gpio_fan_driver);
++}
++
++module_init(gpio_fan_init);
++module_exit(gpio_fan_exit);
++
++MODULE_AUTHOR("Simon Guinot <sguinot at lacie.com>");
++MODULE_DESCRIPTION("GPIO FAN driver");
++MODULE_LICENSE("GPL");
++MODULE_ALIAS("platform:gpio-fan");
+diff --git a/include/linux/gpio-fan.h b/include/linux/gpio-fan.h
+new file mode 100644
+index 0000000..0966591
+--- /dev/null
++++ b/include/linux/gpio-fan.h
+@@ -0,0 +1,36 @@
++/*
++ * include/linux/gpio-fan.h
++ *
++ * Platform data structure for GPIO fan driver
++ *
++ * This file is licensed under the terms of the GNU General Public
++ * License version 2.  This program is licensed "as is" without any
++ * warranty of any kind, whether express or implied.
++ */
++
++#ifndef __LINUX_GPIO_FAN_H
++#define __LINUX_GPIO_FAN_H
++
++struct gpio_fan_alarm {
++	unsigned	gpio;
++	unsigned	active_low;
++};
++
++struct gpio_fan_speed {
++	int rpm;
++	int ctrl_val;
++};
++
++struct gpio_fan_platform_data {
++	int			num_ctrl;
++	unsigned		*ctrl;	/* fan control GPIOs. */
++	struct gpio_fan_alarm	*alarm;	/* fan alarm GPIO. */
++	/*
++	 * Speed conversion array: rpm from/to GPIO bit field.
++	 * This array _must_ be sorted in ascending rpm order.
++	 */
++	int			num_speed;
++	struct gpio_fan_speed	*speed;
++};
++
++#endif /* __LINUX_GPIO_FAN_H */

Added: dists/sid/linux-2.6/debian/patches/features/arm/ls-chl-support.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/arm/ls-chl-support.patch	Sun Feb  6 13:53:09 2011	(r16862)
@@ -0,0 +1,375 @@
+From: Ash Hughes <ashley.hughes at blueyonder.co.uk>
+Date: Tue, 30 Nov 2010 21:53:09 +0000 (+0000)
+Subject: [ARM] Orion: added Buffalo LS-CHL support
+X-Git-Tag: v2.6.38-rc1~471^2^2~5^2~3
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=4bba1c34e0a70d0db2506e1b68f69d7edc8afd78
+
+[ARM] Orion: added Buffalo LS-CHL support
+
+Adds support for Buffalo Linkstation Live v3 (LS-CHL) NAS drives.
+
+Signed-off-by: Ash Hughes <ashley.hughes at blueyonder.co.uk>
+Acked-by: Lennert Buytenhek <buytenh at wantstofly.org>
+Signed-off-by: Nicolas Pitre <nico at fluxnic.net>
+---
+
+diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
+index c897e03..6604fc6 100644
+--- a/arch/arm/mach-orion5x/Kconfig
++++ b/arch/arm/mach-orion5x/Kconfig
+@@ -51,6 +51,13 @@ config MACH_LINKSTATION_PRO
+ 	  Buffalo Linkstation Pro/Live platform. Both v1 and
+ 	  v2 devices are supported.
+ 
++config MACH_LINKSTATION_LSCHL
++	bool "Buffalo Linkstation Live v3 (LS-CHL)"
++	select I2C_BOARDINFO
++	help
++	  Say 'Y' here if you want your kernel to support the
++	  Buffalo Linkstation Live v3 (LS-CHL) platform.
++
+ config MACH_LINKSTATION_MINI
+ 	bool "Buffalo Linkstation Mini"
+ 	select I2C_BOARDINFO
+diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
+index eb6eabc..7f18cda 100644
+--- a/arch/arm/mach-orion5x/Makefile
++++ b/arch/arm/mach-orion5x/Makefile
+@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_WNR854T)	+= wnr854t-setup.o
+ obj-$(CONFIG_MACH_RD88F5181L_GE)	+= rd88f5181l-ge-setup.o
+ obj-$(CONFIG_MACH_RD88F5181L_FXO)	+= rd88f5181l-fxo-setup.o
+ obj-$(CONFIG_MACH_RD88F6183AP_GE)	+= rd88f6183ap-ge-setup.o
++obj-$(CONFIG_MACH_LINKSTATION_LSCHL)	+= ls-chl-setup.o
+diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c
+new file mode 100644
+index 0000000..20a9b66
+--- /dev/null
++++ b/arch/arm/mach-orion5x/ls-chl-setup.c
+@@ -0,0 +1,327 @@
++/*
++ * arch/arm/mach-orion5x/ls-chl-setup.c
++ *
++ * Maintainer: Ash Hughes <ashley.hughes at blueyonder.co.uk>
++ *
++ * This file is licensed under the terms of the GNU General Public
++ * License version 2.  This program is licensed "as is" without any
++ * warranty of any kind, whether express or implied.
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/mtd/physmap.h>
++#include <linux/mv643xx_eth.h>
++#include <linux/leds.h>
++#include <linux/gpio_keys.h>
++#include <linux/gpio-fan.h>
++#include <linux/input.h>
++#include <linux/i2c.h>
++#include <linux/ata_platform.h>
++#include <linux/gpio.h>
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/system.h>
++#include <mach/orion5x.h>
++#include "common.h"
++#include "mpp.h"
++
++/*****************************************************************************
++ * Linkstation LS-CHL Info
++ ****************************************************************************/
++
++/*
++ * 256K NOR flash Device bus boot chip select
++ */
++
++#define LSCHL_NOR_BOOT_BASE	0xf4000000
++#define LSCHL_NOR_BOOT_SIZE	SZ_256K
++
++/*****************************************************************************
++ * 256KB NOR Flash on BOOT Device
++ ****************************************************************************/
++
++static struct physmap_flash_data lschl_nor_flash_data = {
++	.width = 1,
++};
++
++static struct resource lschl_nor_flash_resource = {
++	.flags	= IORESOURCE_MEM,
++	.start	= LSCHL_NOR_BOOT_BASE,
++	.end	= LSCHL_NOR_BOOT_BASE + LSCHL_NOR_BOOT_SIZE - 1,
++};
++
++static struct platform_device lschl_nor_flash = {
++	.name = "physmap-flash",
++	.id = 0,
++	.dev = {
++		.platform_data	= &lschl_nor_flash_data,
++	},
++	.num_resources = 1,
++	.resource = &lschl_nor_flash_resource,
++};
++
++/*****************************************************************************
++ * Ethernet
++ ****************************************************************************/
++
++static struct mv643xx_eth_platform_data lschl_eth_data = {
++	.phy_addr = MV643XX_ETH_PHY_ADDR(8),
++};
++
++/*****************************************************************************
++ * RTC 5C372a on I2C bus
++ ****************************************************************************/
++
++static struct i2c_board_info __initdata lschl_i2c_rtc = {
++	I2C_BOARD_INFO("rs5c372a", 0x32),
++};
++
++/*****************************************************************************
++ * LEDs attached to GPIO
++ ****************************************************************************/
++
++#define LSCHL_GPIO_LED_ALARM	2
++#define LSCHL_GPIO_LED_INFO	3
++#define LSCHL_GPIO_LED_FUNC	17
++#define LSCHL_GPIO_LED_PWR	0
++
++static struct gpio_led lschl_led_pins[] = {
++	{
++		.name = "alarm:red",
++		.gpio = LSCHL_GPIO_LED_ALARM,
++		.active_low = 1,
++	}, {
++		.name = "info:amber",
++		.gpio = LSCHL_GPIO_LED_INFO,
++		.active_low = 1,
++	}, {
++		.name = "func:blue:top",
++		.gpio = LSCHL_GPIO_LED_FUNC,
++		.active_low = 1,
++	}, {
++		.name = "power:blue:bottom",
++		.gpio = LSCHL_GPIO_LED_PWR,
++	},
++};
++
++static struct gpio_led_platform_data lschl_led_data = {
++	.leds = lschl_led_pins,
++	.num_leds = ARRAY_SIZE(lschl_led_pins),
++};
++
++static struct platform_device lschl_leds = {
++	.name = "leds-gpio",
++	.id = -1,
++	.dev = {
++		.platform_data = &lschl_led_data,
++	},
++};
++
++/*****************************************************************************
++ * SATA
++ ****************************************************************************/
++static struct mv_sata_platform_data lschl_sata_data = {
++	.n_ports = 2,
++};
++
++/*****************************************************************************
++ * LS-CHL specific power off method: reboot
++ ****************************************************************************/
++/*
++ * On the LS-CHL, the shutdown process is following:
++ * - Userland monitors key events until the power switch goes to off position
++ * - The board reboots
++ * - U-boot starts and goes into an idle mode waiting for the user
++ *   to move the switch to ON position
++ *
++ */
++
++static void lschl_power_off(void)
++{
++	arm_machine_restart('h', NULL);
++}
++
++/*****************************************************************************
++ * General Setup
++ ****************************************************************************/
++#define LSCHL_GPIO_USB_POWER	9
++#define LSCHL_GPIO_AUTO_POWER	17
++#define LSCHL_GPIO_POWER	18
++
++/****************************************************************************
++ * GPIO Attached Keys
++ ****************************************************************************/
++#define LSCHL_GPIO_KEY_FUNC		15
++#define LSCHL_GPIO_KEY_POWER		8
++#define LSCHL_GPIO_KEY_AUTOPOWER	10
++#define LSCHL_SW_POWER		0x00
++#define LSCHL_SW_AUTOPOWER	0x01
++#define LSCHL_SW_FUNC		0x02
++
++static struct gpio_keys_button lschl_buttons[] = {
++	{
++		.type = EV_SW,
++		.code = LSCHL_SW_POWER,
++		.gpio = LSCHL_GPIO_KEY_POWER,
++		.desc = "Power-on Switch",
++		.active_low = 1,
++	}, {
++		.type = EV_SW,
++		.code = LSCHL_SW_AUTOPOWER,
++		.gpio = LSCHL_GPIO_KEY_AUTOPOWER,
++		.desc = "Power-auto Switch",
++		.active_low = 1,
++	}, {
++		.type = EV_SW,
++		.code = LSCHL_SW_FUNC,
++		.gpio = LSCHL_GPIO_KEY_FUNC,
++		.desc = "Function Switch",
++		.active_low = 1,
++	},
++};
++
++static struct gpio_keys_platform_data lschl_button_data = {
++	.buttons = lschl_buttons,
++	.nbuttons = ARRAY_SIZE(lschl_buttons),
++};
++
++static struct platform_device lschl_button_device = {
++	.name = "gpio-keys",
++	.id = -1,
++	.num_resources = 0,
++	.dev = {
++		.platform_data = &lschl_button_data,
++	},
++};
++
++#define LSCHL_GPIO_HDD_POWER	1
++
++/****************************************************************************
++ * GPIO Fan
++ ****************************************************************************/
++
++#define LSCHL_GPIO_FAN_LOW	16
++#define LSCHL_GPIO_FAN_HIGH	14
++#define LSCHL_GPIO_FAN_LOCK	6
++
++static struct gpio_fan_alarm lschl_alarm = {
++	.gpio = LSCHL_GPIO_FAN_LOCK,
++};
++
++static struct gpio_fan_speed lschl_speeds[] = {
++	{
++		.rpm = 0,
++		.ctrl_val = 3,
++	}, {
++		.rpm = 1500,
++		.ctrl_val = 2,
++	}, {
++		.rpm = 3250,
++		.ctrl_val = 1,
++	}, {
++		.rpm = 5000,
++		.ctrl_val = 0,
++	},
++};
++
++static int lschl_gpio_list[] = {
++	LSCHL_GPIO_FAN_HIGH, LSCHL_GPIO_FAN_LOW,
++};
++
++static struct gpio_fan_platform_data lschl_fan_data = {
++	.num_ctrl = ARRAY_SIZE(lschl_gpio_list),
++	.ctrl = lschl_gpio_list,
++	.alarm = &lschl_alarm,
++	.num_speed = ARRAY_SIZE(lschl_speeds),
++	.speed = lschl_speeds,
++};
++
++static struct platform_device lschl_fan_device = {
++	.name = "gpio-fan",
++	.id = -1,
++	.num_resources = 0,
++	.dev = {
++		.platform_data = &lschl_fan_data,
++	},
++};
++
++/****************************************************************************
++ * GPIO Data
++ ****************************************************************************/
++
++static struct orion5x_mpp_mode lschl_mpp_modes[] __initdata = {
++	{  0, MPP_GPIO }, /* LED POWER */
++	{  1, MPP_GPIO }, /* HDD POWER */
++	{  2, MPP_GPIO }, /* LED ALARM */
++	{  3, MPP_GPIO }, /* LED INFO */
++	{  4, MPP_UNUSED },
++	{  5, MPP_UNUSED },
++	{  6, MPP_GPIO }, /* FAN LOCK */
++	{  7, MPP_GPIO }, /* SW INIT */
++	{  8, MPP_GPIO }, /* SW POWER */
++	{  9, MPP_GPIO }, /* USB POWER */
++	{ 10, MPP_GPIO }, /* SW AUTO POWER */
++	{ 11, MPP_UNUSED },
++	{ 12, MPP_UNUSED },
++	{ 13, MPP_UNUSED },
++	{ 14, MPP_GPIO }, /* FAN HIGH */
++	{ 15, MPP_GPIO }, /* SW FUNC */
++	{ 16, MPP_GPIO }, /* FAN LOW */
++	{ 17, MPP_GPIO }, /* LED FUNC */
++	{ 18, MPP_UNUSED },
++	{ 19, MPP_UNUSED },
++	{ -1 },
++};
++
++static void __init lschl_init(void)
++{
++	/*
++	 * Setup basic Orion functions. Needs to be called early.
++	 */
++	orion5x_init();
++
++	orion5x_mpp_conf(lschl_mpp_modes);
++
++	/*
++	 * Configure peripherals.
++	 */
++	orion5x_ehci0_init();
++	orion5x_ehci1_init();
++	orion5x_eth_init(&lschl_eth_data);
++	orion5x_i2c_init();
++	orion5x_sata_init(&lschl_sata_data);
++	orion5x_uart0_init();
++	orion5x_xor_init();
++
++	orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE,
++				   LSCHL_NOR_BOOT_SIZE);
++	platform_device_register(&lschl_nor_flash);
++
++	platform_device_register(&lschl_leds);
++
++	platform_device_register(&lschl_button_device);
++
++	platform_device_register(&lschl_fan_device);
++
++	i2c_register_board_info(0, &lschl_i2c_rtc, 1);
++
++	/* usb power on */
++	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
++
++	/* register power-off method */
++	pm_power_off = lschl_power_off;
++
++	pr_info("%s: finished\n", __func__);
++}
++
++MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")
++	/* Maintainer: Ash Hughes <ashley.hughes at blueyonder.co.uk> */
++	.boot_params	= 0x00000100,
++	.init_machine	= lschl_init,
++	.map_io		= orion5x_map_io,
++	.init_irq	= orion5x_init_irq,
++	.timer		= &orion5x_timer,
++	.fixup		= tag_fixup_mem32,
++MACHINE_END

Modified: dists/sid/linux-2.6/debian/patches/series/31
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/31	Sun Feb  6 01:34:52 2011	(r16861)
+++ dists/sid/linux-2.6/debian/patches/series/31	Sun Feb  6 13:53:09 2011	(r16862)
@@ -12,3 +12,5 @@
 + bugfix/all/r8169-keep-firmware-in-memory.patch
 + bugfix/all/av7110-check-for-negative-array-offset.patch
 + bugfix/all/init-sched-Fix-race-between-init-and-kthreadd.patch
++ features/all/hwmon-gpio.patch
++ features/arm/ls-chl-support.patch



More information about the Kernel-svn-changes mailing list