summaryrefslogtreecommitdiff
path: root/drivers/hwmon/mcp3021.c
AgeCommit message (Collapse)Author
2017-01-02hwmon: (mcp3021) use permission-specific DEVICE_ATTR variantsJulia Lawall
Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The conversion was done automatically using coccinelle. It was validated by compiling both the old and the new source code and comparing its text, data, and bss size. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-12-02hwmon: (mcp3021) add devicetree supportClemens Gruber
Support setting the reference voltage from the device tree. Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-12-02hwmon: (mcp3021) replace S_IRUGO with 0444Clemens Gruber
Replace S_IRUGO with the better readable 0444. This fixes a checkpatch warning. Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-07-01hwmon: (mcp3021) Fix broken output scalingStevens, Nick
The mcp3021 scaling code is dividing the VDD (full-scale) value in millivolts by the A2D resolution to obtain the scaling factor. When VDD is 3300mV (the standard value) and the resolution is 12-bit (4096 divisions), the result is a scale factor of 3300/4096, which is always one. Effectively, the raw A2D reading is always being returned because no scaling is applied. This patch fixes the issue and simplifies the register-to-volts calculation, removing the unneeded "output_scale" struct member. Signed-off-by: Nick Stevens <Nick.Stevens@digi.com> Cc: stable@vger.kernel.org # v3.10+ [Guenter Roeck: Dropped unnecessary value check] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11hwmon: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-09-23hwmon: (mcp3021) Add MCP3221 supportSven Schuchmann
This Patch adds support for mcp3221 chip to the mcp3021 driver. Signed-off-by: Sven Schuchmann <schuchmann@schleissheimer.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-09-23hwmon: (mcp3021) Prepare MCP3021 driver to support other chipsSven Schuchmann
This Patch is to prepare the MCP3021 driver to support other chips like the MCP3221. The hard defined chip data is now stored within the data struct of each chip. Signed-off-by: Sven Schuchmann <schuchmann@schleissheimer.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-09-23hwmon: (mcp3021) Convert to use devm_ functionsGuenter Roeck
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Mingkai Hu <Mingkai.hu@freescale.com> Cc: Xie Xiaobo <X.Xie@freescale.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-03-23hwmon: Add MCP3021 ADC driverXie Xiaobo
Add I2C driver for MCP3021 that is an ADC chip from Microchip. The MCP3021 is a successive approximation A/D converter (ADC) with 10-bit resolution. The driver export the value of Vin to sysfs, the voltage unit is mV. Through the sysfs interface, lm-sensors tool can also display Vin voltage. Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com> Signed-off-by: Xie Xiaobo <X.Xie@freescale.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>