mcp3021.c (cf9ce948f47640797bd19980e1d99c6d17d0bdc3) | mcp3021.c (a8b3a3a53f9a814e9938ea9cc179086ff5c0a387) |
---|---|
1/* 2 * mcp3021.c - driver for Microchip MCP3021 and MCP3221 3 * 4 * Copyright (C) 2008-2009, 2012 Freescale Semiconductor, Inc. 5 * Author: Mingkai Hu <Mingkai.hu@freescale.com> 6 * Reworked by Sven Schuchmann <schuchmann@schleissheimer.de> 7 * 8 * This driver export the value of analog input voltage to sysfs, the --- 129 unchanged lines hidden (view full) --- 138 case mcp3221: 139 data->sar_shift = MCP3221_SAR_SHIFT; 140 data->sar_mask = MCP3221_SAR_MASK; 141 data->output_res = MCP3221_OUTPUT_RES; 142 data->output_scale = MCP3221_OUTPUT_SCALE; 143 break; 144 } 145 | 1/* 2 * mcp3021.c - driver for Microchip MCP3021 and MCP3221 3 * 4 * Copyright (C) 2008-2009, 2012 Freescale Semiconductor, Inc. 5 * Author: Mingkai Hu <Mingkai.hu@freescale.com> 6 * Reworked by Sven Schuchmann <schuchmann@schleissheimer.de> 7 * 8 * This driver export the value of analog input voltage to sysfs, the --- 129 unchanged lines hidden (view full) --- 138 case mcp3221: 139 data->sar_shift = MCP3221_SAR_SHIFT; 140 data->sar_mask = MCP3221_SAR_MASK; 141 data->output_res = MCP3221_OUTPUT_RES; 142 data->output_scale = MCP3221_OUTPUT_SCALE; 143 break; 144 } 145 |
146 if (client->dev.platform_data) { 147 data->vdd = *(u32 *)client->dev.platform_data; | 146 if (dev_get_platdata(&client->dev)) { 147 data->vdd = *(u32 *)dev_get_platdata(&client->dev); |
148 if (data->vdd > MCP3021_VDD_MAX || data->vdd < MCP3021_VDD_MIN) 149 return -EINVAL; | 148 if (data->vdd > MCP3021_VDD_MAX || data->vdd < MCP3021_VDD_MIN) 149 return -EINVAL; |
150 } else | 150 } else { |
151 data->vdd = MCP3021_VDD_REF; | 151 data->vdd = MCP3021_VDD_REF; |
152 } |
|
152 153 err = sysfs_create_file(&client->dev.kobj, &dev_attr_in0_input.attr); 154 if (err) 155 return err; 156 157 data->hwmon_dev = hwmon_device_register(&client->dev); 158 if (IS_ERR(data->hwmon_dev)) { 159 err = PTR_ERR(data->hwmon_dev); --- 41 unchanged lines hidden --- | 153 154 err = sysfs_create_file(&client->dev.kobj, &dev_attr_in0_input.attr); 155 if (err) 156 return err; 157 158 data->hwmon_dev = hwmon_device_register(&client->dev); 159 if (IS_ERR(data->hwmon_dev)) { 160 err = PTR_ERR(data->hwmon_dev); --- 41 unchanged lines hidden --- |