[PATCH 2/3] hwmon: tmp108: Use devm variants of registration interfaces.
From: John MuirUse the devm hwmon and thermal zone registration functions to clean up the code and remove the need for an i2c_driver.remove callback. Signed-off-by: John Muir --- drivers/hwmon/tmp108.c | 28 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c index da64517..b13d652 100644 --- a/drivers/hwmon/tmp108.c +++ b/drivers/hwmon/tmp108.c @@ -83,8 +83,6 @@ struct tmp108 { struct regmap *regmap; - struct device *hwmon_dev; - struct thermal_zone_device *tz; u16 config; unsigned long ready_time; }; @@ -245,6 +243,7 @@ static int tmp108_probe(struct i2c_client *client, { struct device *dev = >dev; struct device *hwmon_dev; + struct thermal_zone_device *tz; struct tmp108 *tmp108; unsigned int regval; int err; @@ -353,18 +352,18 @@ static int tmp108_probe(struct i2c_client *client, if (err) return err; - hwmon_dev = hwmon_device_register_with_groups(dev, client->name, - tmp108, tmp108_groups); + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, + tmp108, + tmp108_groups); if (IS_ERR(hwmon_dev)) { dev_dbg(dev, "unable to register hwmon device\n"); return PTR_ERR(hwmon_dev); } - tmp108->hwmon_dev = hwmon_dev; - tmp108->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, -_of_thermal_ops); - if (IS_ERR(tmp108->tz)) - return PTR_ERR(tmp108->tz); + tz = devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev, + _of_thermal_ops); + if (IS_ERR(tz)) + return PTR_ERR(tz); dev_info(dev, "%s, alert: active %s, hyst: %uC, conv: %ucHz\n", (tmp108->config & TMP108_CONF_TM) != 0 ? @@ -374,16 +373,6 @@ static int tmp108_probe(struct i2c_client *client, return 0; } -static int tmp108_remove(struct i2c_client *client) -{ - struct tmp108 *tmp108 = i2c_get_clientdata(client); - - thermal_zone_of_sensor_unregister(tmp108->hwmon_dev, tmp108->tz); - hwmon_device_unregister(tmp108->hwmon_dev); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int tmp108_suspend(struct device *dev) { @@ -418,7 +407,6 @@ static struct i2c_driver tmp108_driver = { .driver.name= DRIVER_NAME, .driver.pm = _dev_pm_ops, .probe = tmp108_probe, - .remove = tmp108_remove, .id_table = tmp108_id, }; -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] hwmon: Add Texas Instruments TMP108 temperature sensor driver.
Add support for the TI TMP108 temperature sensor with some device configuration parameters. Signed-off-by: John Muir--- Documentation/devicetree/bindings/hwmon/tmp108.txt | 27 ++ Documentation/hwmon/tmp108 | 38 ++ drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tmp108.c | 429 + 5 files changed, 506 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/tmp108.txt create mode 100644 Documentation/hwmon/tmp108 create mode 100644 drivers/hwmon/tmp108.c diff --git a/Documentation/devicetree/bindings/hwmon/tmp108.txt b/Documentation/devicetree/bindings/hwmon/tmp108.txt new file mode 100644 index 000..210af63 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/tmp108.txt @@ -0,0 +1,27 @@ +TMP108 temperature sensor +- + +This device supports I2C only. + +Requires node properties: +- compatible : "ti,tmp108" +- reg : the I2C address of the device. This is 0x48, 0x49, 0x4a, or 0x4b. + +Optional node properties: +- ti,thermostat-mode-comparitor : (boolean) select the comparitor mode for the + thermostat rather than the default interrupt-mode. +- ti,alert-active-high : (boolean) make the alert pin active-high instead of + the default active-low. +- ti,conversion-rate-cHz : (integer, cHz) select the conversion frequency for + continuous mode, in centi-Hz: 25, 100 (default), 400, or 1600. +- ti,hysteresis : (integer, C) select the hysteresis value: 0, 1, 2, or 4 + (celcius). + +Example: + tmp108@48 { + compatible = "ti,tmp108"; + reg = <0x48>; + ti,alert-active-high; + ti,hysteresis = <2>; + ti,conversion-rate-cHz = <25>; + }; diff --git a/Documentation/hwmon/tmp108 b/Documentation/hwmon/tmp108 new file mode 100644 index 000..ef2e9a3 --- /dev/null +++ b/Documentation/hwmon/tmp108 @@ -0,0 +1,38 @@ +Kernel driver tmp108 + + +Supported chips: + * Texas Instruments TMP108 +Prefix: 'tmp108' +Addresses scanned: none +Datasheet: http://www.ti.com/product/tmp108 + +Author: + John Muir + +Description +--- + +The Texas Instruments TMP108 implements one temperature sensor. An alert pin +can be set when temperatures exceed minimum or maximum values plus or minus a +hysteresis value. + +The sensor is accurate to 0.75C over the range of -25 to +85 C, and to 1.0 +degree from -40 to +125 C. Resolution of the sensor is 0.0625 degree. The +operating temperature has a minimum of -55 C and a maximum of +150 C. +Hysteresis values can be set to 0, 1, 2, or 4C. + +The TMP108 has a programmable update rate that can select between 8, 4, 1, and +0.5 Hz. + +By default the TMP108 reads the temperature continuously. To conserve power, +the TMP108 has a one-shot mode where the device is normally shut-down. When a +one shot is requested the temperature is read, the result can be retrieved, +and then the device is shut down automatically. (This driver only supports +continuous mode.) + +The driver provides the common sysfs-interface for temperatures (see +Documentation/hwmon/sysfs-interface under Temperatures). + +See Documentation/devicetree/bindings/hwmon/tmp108.txt for configuration +properties. diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 45cef3d..4c173de 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1591,6 +1591,17 @@ config SENSORS_TMP103 This driver can also be built as a module. If so, the module will be called tmp103. +config SENSORS_TMP108 + tristate "Texas Instruments TMP108" + depends on I2C + select REGMAP_I2C + help + If you say yes here you get support for Texas Instruments TMP108 + sensor chips. + + This driver can also be built as a module. If so, the module + will be called tmp108. + config SENSORS_TMP401 tristate "Texas Instruments TMP401 and compatibles" depends on I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index aecf4ba..51e5256 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -152,6 +152,7 @@ obj-$(CONFIG_SENSORS_TC74) += tc74.o obj-$(CONFIG_SENSORS_THMC50) += thmc50.o obj-$(CONFIG_SENSORS_TMP102) += tmp102.o obj-$(CONFIG_SENSORS_TMP103) += tmp103.o +obj-$(CONFIG_SENSORS_TMP108) += tmp108.o obj-$(CONFIG_SENSORS_TMP401) += tmp401.o obj-$(CONFIG_SENSORS_TMP421) += tmp421.o obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c new file mode 100644 index 000..da64517 --- /dev/null +++ b/drivers/hwmon/tmp108.c @@ -0,0 +1,429 @@ +/* Texas Instruments TMP108 SMBus temperature sensor driver + * + * Copyright (C) 2016 John Muir + * + * This program is
Re: [PATCH 0/3] Texas Instruments TMP108 temperature sensor driver.
On 11/26/2016 05:26 PM, John Muir wrote: This driver is split into three patches as it is being ported forward from a Linux 4.4 implementation where it was tested. The final driver code uses interfaces that are not available in 4.4. John Muir (3): hwmon: Add Texas Instruments TMP108 temperature sensor driver. hwmon: tmp108: Use devm variants of registration interfaces. hwmon: tmp108: Update driver to use hwmon_chip_info. Documentation/devicetree/bindings/hwmon/tmp108.txt | 27 ++ Documentation/hwmon/tmp108 | 38 ++ drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tmp108.c | 421 + 5 files changed, 498 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/tmp108.txt create mode 100644 Documentation/hwmon/tmp108 create mode 100644 drivers/hwmon/tmp108.c Hi John, maybe the rest of the patches are delayed, but so far I only see this introduction. Just an early note, in case the other patches still show up. Can you send me a register dump for this chip ? Thanks, Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] Texas Instruments TMP108 temperature sensor driver.
This driver is split into three patches as it is being ported forward from a Linux 4.4 implementation where it was tested. The final driver code uses interfaces that are not available in 4.4. John Muir (3): hwmon: Add Texas Instruments TMP108 temperature sensor driver. hwmon: tmp108: Use devm variants of registration interfaces. hwmon: tmp108: Update driver to use hwmon_chip_info. Documentation/devicetree/bindings/hwmon/tmp108.txt | 27 ++ Documentation/hwmon/tmp108 | 38 ++ drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tmp108.c | 421 + 5 files changed, 498 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/tmp108.txt create mode 100644 Documentation/hwmon/tmp108 create mode 100644 drivers/hwmon/tmp108.c -- 2.8.0.rc3.226.g39d4020 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH v3 20/20] x86: Add support to make use of Secure Memory Encryption
On Wed, Nov 09, 2016 at 06:38:38PM -0600, Tom Lendacky wrote: > This patch adds the support to check if SME has been enabled and if the > mem_encrypt=on command line option is set. If both of these conditions > are true, then the encryption mask is set and the kernel is encrypted > "in place." > > Signed-off-by: Tom Lendacky> --- > arch/x86/kernel/head_64.S |1 + > arch/x86/kernel/mem_encrypt_init.c | 60 > +++- > arch/x86/mm/mem_encrypt.c |2 + > 3 files changed, 62 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S > index e8a7272..c225433 100644 > --- a/arch/x86/kernel/head_64.S > +++ b/arch/x86/kernel/head_64.S > @@ -100,6 +100,7 @@ startup_64: >* to include it in the page table fixups. >*/ > push%rsi > + movq%rsi, %rdi > callsme_enable > pop %rsi > movq%rax, %r12 > diff --git a/arch/x86/kernel/mem_encrypt_init.c > b/arch/x86/kernel/mem_encrypt_init.c > index 7bdd159..c94ceb8 100644 > --- a/arch/x86/kernel/mem_encrypt_init.c > +++ b/arch/x86/kernel/mem_encrypt_init.c > @@ -16,9 +16,14 @@ > #include > > #include > +#include > +#include > +#include > > #ifdef CONFIG_AMD_MEM_ENCRYPT > > +static char sme_cmdline_arg[] __initdata = "mem_encrypt=on"; One more thing: just like we're adding an =on switch, we'd need an =off switch in case something's wrong with the SME code. IOW, if a user supplies "mem_encrypt=off", we do not encrypt. Thanks. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 0/7] mux controller abstraction and iio/i2c muxes
On 2016-11-24 16:18, Peter Rosin wrote: > v3 -> v4 changes > - added support for having the mux-controller in a child node of a > mux-consumer if it is a sole consumer, to hopefully even further satisfy > the complaint from Rob (and later Lars-Peter) about dt complexity. > - the above came at the cost of some rather horrible refcounting code, > please review and suggest how it should be done... > > v2 -> v3 changes > - have the mux-controller in the parent node of any mux-controller consumer, > to hopefully satisfy complaint from Rob about dt complexity. I did some further tests and both of these attempts to support fancier devicetree bindings have severe problems. I will remove them for v5 and go back to having a phandle reference to the mux-controller from the consumer (unless I get some revelation of course and just get it). I'm simply not yet understanding the driver model well enough to pull this off at the moment... Cheers, Peter -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html