diff options
Diffstat (limited to 'drivers/misc/lis3lv02d/lis3lv02d_i2c.c')
-rw-r--r-- | drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c index 6cdc38f6a9a8..c02fea029dcf 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c | |||
@@ -79,8 +79,7 @@ static int lis3_i2c_init(struct lis3lv02d *lis3) | |||
79 | u8 reg; | 79 | u8 reg; |
80 | int ret; | 80 | int ret; |
81 | 81 | ||
82 | if (lis3->reg_ctrl) | 82 | lis3_reg_ctrl(lis3, LIS3_REG_ON); |
83 | lis3_reg_ctrl(lis3, LIS3_REG_ON); | ||
84 | 83 | ||
85 | lis3->read(lis3, WHO_AM_I, ®); | 84 | lis3->read(lis3, WHO_AM_I, ®); |
86 | if (reg != lis3->whoami) | 85 | if (reg != lis3->whoami) |
@@ -106,10 +105,6 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, | |||
106 | struct lis3lv02d_platform_data *pdata = client->dev.platform_data; | 105 | struct lis3lv02d_platform_data *pdata = client->dev.platform_data; |
107 | 106 | ||
108 | if (pdata) { | 107 | if (pdata) { |
109 | /* Regulator control is optional */ | ||
110 | if (pdata->driver_features & LIS3_USE_REGULATOR_CTRL) | ||
111 | lis3_dev.reg_ctrl = lis3_reg_ctrl; | ||
112 | |||
113 | if ((pdata->driver_features & LIS3_USE_BLOCK_READ) && | 108 | if ((pdata->driver_features & LIS3_USE_BLOCK_READ) && |
114 | (i2c_check_functionality(client->adapter, | 109 | (i2c_check_functionality(client->adapter, |
115 | I2C_FUNC_SMBUS_I2C_BLOCK))) | 110 | I2C_FUNC_SMBUS_I2C_BLOCK))) |
@@ -131,15 +126,13 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, | |||
131 | goto fail; | 126 | goto fail; |
132 | } | 127 | } |
133 | 128 | ||
134 | if (lis3_dev.reg_ctrl) { | 129 | lis3_dev.regulators[0].supply = reg_vdd; |
135 | lis3_dev.regulators[0].supply = reg_vdd; | 130 | lis3_dev.regulators[1].supply = reg_vdd_io; |
136 | lis3_dev.regulators[1].supply = reg_vdd_io; | 131 | ret = regulator_bulk_get(&client->dev, |
137 | ret = regulator_bulk_get(&client->dev, | 132 | ARRAY_SIZE(lis3_dev.regulators), |
138 | ARRAY_SIZE(lis3_dev.regulators), | 133 | lis3_dev.regulators); |
139 | lis3_dev.regulators); | 134 | if (ret < 0) |
140 | if (ret < 0) | 135 | goto fail; |
141 | goto fail; | ||
142 | } | ||
143 | 136 | ||
144 | lis3_dev.pdata = pdata; | 137 | lis3_dev.pdata = pdata; |
145 | lis3_dev.bus_priv = client; | 138 | lis3_dev.bus_priv = client; |
@@ -153,13 +146,11 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, | |||
153 | i2c_set_clientdata(client, &lis3_dev); | 146 | i2c_set_clientdata(client, &lis3_dev); |
154 | 147 | ||
155 | /* Provide power over the init call */ | 148 | /* Provide power over the init call */ |
156 | if (lis3_dev.reg_ctrl) | 149 | lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON); |
157 | lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON); | ||
158 | 150 | ||
159 | ret = lis3lv02d_init_device(&lis3_dev); | 151 | ret = lis3lv02d_init_device(&lis3_dev); |
160 | 152 | ||
161 | if (lis3_dev.reg_ctrl) | 153 | lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF); |
162 | lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF); | ||
163 | 154 | ||
164 | if (ret) | 155 | if (ret) |
165 | goto fail2; | 156 | goto fail2; |
@@ -185,9 +176,8 @@ static int __devexit lis3lv02d_i2c_remove(struct i2c_client *client) | |||
185 | lis3lv02d_joystick_disable(lis3); | 176 | lis3lv02d_joystick_disable(lis3); |
186 | lis3lv02d_remove_fs(&lis3_dev); | 177 | lis3lv02d_remove_fs(&lis3_dev); |
187 | 178 | ||
188 | if (lis3_dev.reg_ctrl) | 179 | regulator_bulk_free(ARRAY_SIZE(lis3->regulators), |
189 | regulator_bulk_free(ARRAY_SIZE(lis3->regulators), | 180 | lis3_dev.regulators); |
190 | lis3_dev.regulators); | ||
191 | return 0; | 181 | return 0; |
192 | } | 182 | } |
193 | 183 | ||