mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
New driver for menf21bmc.
Convert k10temp, smsc47b397, da9052, da9055 to new hwmon API. Register ntc_thermistor driver with thermal subsystem. Add support for F15h M60h to k10temp driver. Add driver for MEN14F021P00 BMC HWMON driver; this required a merge with tag mfd-hwmon-leds-watchdog-v3.18. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJUNZQwAAoJEMsfJm/On5mBxZEQAIf555P39+4fkRIrf3oYUuC2 q1tXNP0u8Z74eDFfwYYobt+NCJG5KW3H3kFaO5WCTjySfVwjUin9Fc6DkLl2m3U+ 4FfH/2rO1y1upVRQemLAhe7BAYJAzABuNFWbLqqbGbZytyf5sHzhP52vjJ5VNmvr 5zcn/sGJdB5M9tj3isvfrac0itNu+D7K3qxknk4wI5gb6YzKg+uovXscPVx4Xa7w eHKXJWITtBAZdD5bDV5YAzlTR15ASG3h+yyV7G5rKgslYyCMuRfIDm8Rl5zzHUmq DjLwwib469NMii6CjdC7kEpYOgJ2ZxK/2XQ5IAeGax8GLdIHB6lhp3GrXIzzRwiW 5mtsMdRB7y41p050rIXN7AIXGVqSvtZtKf0r8w1p5YElat/wtX9gv0lGTgOq4sSa 0SOE7E6W0cfe75dYgJP/6HIkuZZ7PweBelQYDfWrN00u/rdIcwC2nRnW/nDbctkr TmQLiS0ql2mXPWXD+Lk9v3bUALuYOPuQpX2aARj7en7jeBagP6KX0d70GaoAEzGk Gw6z4X4gI3TasuIck4LZx3kaiijEnDOgnIaEQah4b3k7ABEiuOYVBBpnWvqECaSD p9/lwFAs2POCsYSuADiclzxH6FLCMRJLE2V7dgMun9uK60o+0pGUqBL1PG/5/w+r jGdB/75PCOEn3Y/VlfZg =vI5p -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: - new driver for menf21bmc. - convert k10temp, smsc47b397, da9052, da9055 to new hwmon API. - register ntc_thermistor driver with thermal subsystem. - add support for F15h M60h to k10temp driver. - add driver for MEN14F021P00 BMC HWMON driver; this required a merge with tag mfd-hwmon-leds-watchdog-v3.18 * tag 'hwmon-for-linus-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (ab8500) Call kernel_power_off instead of pm_power_off hwmon: (menf21bmc) Introduce MEN14F021P00 BMC HWMON driver leds: leds-menf21bmc: Introduce MEN 14F021P00 BMC LED driver watchdog: menf21bmc_wdt: Introduce MEN 14F021P00 BMC Watchdog driver mfd: menf21bmc: Introduce MEN 14F021P00 BMC MFD Core driver hwmon: (ntc_thermistor) Add ntc thermistor to thermal subsystem as a sensor. hwmon: (smsc47b397) Convert to devm_hwmon_device_register_with_groups MAINTAINERS: add entry for the PWM fan driver hwmon: (k10temp) Convert to devm_hwmon_device_register_with_groups hwmon: (k10temp) Add support for F15h M60h hwmon: (da9052) Convert to devm_hwmon_device_register_with_groups hwmon: (da9055) Convert to devm_hwmon_device_register_with_groups hwmon: (ads1015) Use of_property_read_u32 at appropriate places
This commit is contained in:
commit
40c43269cf
23 changed files with 949 additions and 228 deletions
|
|
@ -468,6 +468,15 @@ config LEDS_OT200
|
|||
This option enables support for the LEDs on the Bachmann OT200.
|
||||
Say Y to enable LEDs on the Bachmann OT200.
|
||||
|
||||
config LEDS_MENF21BMC
|
||||
tristate "LED support for the MEN 14F021P00 BMC"
|
||||
depends on LEDS_CLASS && MFD_MENF21BMC
|
||||
help
|
||||
Say Y here to include support for the MEN 14F021P00 BMC LEDs.
|
||||
|
||||
This driver can also be built as a module. If so the module
|
||||
will be called leds-menf21bmc.
|
||||
|
||||
comment "LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)"
|
||||
|
||||
config LEDS_BLINKM
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o
|
|||
obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
|
||||
obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o
|
||||
obj-$(CONFIG_LEDS_VERSATILE) += leds-versatile.o
|
||||
obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o
|
||||
|
||||
# LED SPI Drivers
|
||||
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
|
||||
|
|
|
|||
131
drivers/leds/leds-menf21bmc.c
Normal file
131
drivers/leds/leds-menf21bmc.c
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* MEN 14F021P00 Board Management Controller (BMC) LEDs Driver.
|
||||
*
|
||||
* This is the core LED driver of the MEN 14F021P00 BMC.
|
||||
* There are four LEDs available which can be switched on and off.
|
||||
* STATUS LED, HOT SWAP LED, USER LED 1, USER LED 2
|
||||
*
|
||||
* Copyright (C) 2014 MEN Mikro Elektronik Nuernberg GmbH
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#define BMC_CMD_LED_GET_SET 0xA0
|
||||
#define BMC_BIT_LED_STATUS BIT(0)
|
||||
#define BMC_BIT_LED_HOTSWAP BIT(1)
|
||||
#define BMC_BIT_LED_USER1 BIT(2)
|
||||
#define BMC_BIT_LED_USER2 BIT(3)
|
||||
|
||||
struct menf21bmc_led {
|
||||
struct led_classdev cdev;
|
||||
u8 led_bit;
|
||||
const char *name;
|
||||
struct i2c_client *i2c_client;
|
||||
};
|
||||
|
||||
static struct menf21bmc_led leds[] = {
|
||||
{
|
||||
.name = "menf21bmc:led_status",
|
||||
.led_bit = BMC_BIT_LED_STATUS,
|
||||
},
|
||||
{
|
||||
.name = "menf21bmc:led_hotswap",
|
||||
.led_bit = BMC_BIT_LED_HOTSWAP,
|
||||
},
|
||||
{
|
||||
.name = "menf21bmc:led_user1",
|
||||
.led_bit = BMC_BIT_LED_USER1,
|
||||
},
|
||||
{
|
||||
.name = "menf21bmc:led_user2",
|
||||
.led_bit = BMC_BIT_LED_USER2,
|
||||
}
|
||||
};
|
||||
|
||||
static DEFINE_MUTEX(led_lock);
|
||||
|
||||
static void
|
||||
menf21bmc_led_set(struct led_classdev *led_cdev, enum led_brightness value)
|
||||
{
|
||||
int led_val;
|
||||
struct menf21bmc_led *led = container_of(led_cdev,
|
||||
struct menf21bmc_led, cdev);
|
||||
|
||||
mutex_lock(&led_lock);
|
||||
led_val = i2c_smbus_read_byte_data(led->i2c_client,
|
||||
BMC_CMD_LED_GET_SET);
|
||||
if (led_val < 0)
|
||||
goto err_out;
|
||||
|
||||
if (value == LED_OFF)
|
||||
led_val &= ~led->led_bit;
|
||||
else
|
||||
led_val |= led->led_bit;
|
||||
|
||||
i2c_smbus_write_byte_data(led->i2c_client,
|
||||
BMC_CMD_LED_GET_SET, led_val);
|
||||
err_out:
|
||||
mutex_unlock(&led_lock);
|
||||
}
|
||||
|
||||
static int menf21bmc_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
struct i2c_client *i2c_client = to_i2c_client(pdev->dev.parent);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(leds); i++) {
|
||||
leds[i].cdev.name = leds[i].name;
|
||||
leds[i].cdev.brightness_set = menf21bmc_led_set;
|
||||
leds[i].i2c_client = i2c_client;
|
||||
ret = led_classdev_register(&pdev->dev, &leds[i].cdev);
|
||||
if (ret < 0)
|
||||
goto err_free_leds;
|
||||
}
|
||||
dev_info(&pdev->dev, "MEN 140F21P00 BMC LED device enabled\n");
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_leds:
|
||||
dev_err(&pdev->dev, "failed to register LED device\n");
|
||||
|
||||
for (i = i - 1; i >= 0; i--)
|
||||
led_classdev_unregister(&leds[i].cdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int menf21bmc_led_remove(struct platform_device *pdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(leds); i++)
|
||||
led_classdev_unregister(&leds[i].cdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver menf21bmc_led = {
|
||||
.probe = menf21bmc_led_probe,
|
||||
.remove = menf21bmc_led_remove,
|
||||
.driver = {
|
||||
.name = "menf21bmc_led",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(menf21bmc_led);
|
||||
|
||||
MODULE_AUTHOR("Andreas Werner <[email protected]>");
|
||||
MODULE_DESCRIPTION("MEN 14F021P00 BMC led driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_ALIAS("platform:menf21bmc_led");
|
||||
Loading…
Reference in a new issue