#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/i2c.h>
/* Private data for the CS4349 */
struct cs4349_private {
struct regmap *regmap;
- struct cs4349_platform_data pdata;
struct gpio_desc *reset_gpio;
unsigned int mode;
int rate;
const struct i2c_device_id *id)
{
struct cs4349_private *cs4349;
- struct cs4349_platform_data *pdata = dev_get_platdata(&client->dev);
- int ret = 0;
+ int ret;
cs4349 = devm_kzalloc(&client->dev, sizeof(*cs4349), GFP_KERNEL);
if (!cs4349)
return ret;
}
- if (pdata)
- cs4349->pdata = *pdata;
-
/* Reset the Device */
cs4349->reset_gpio = devm_gpiod_get_optional(&client->dev,
"reset", GPIOD_OUT_LOW);
if (IS_ERR(cs4349->reset_gpio))
return PTR_ERR(cs4349->reset_gpio);
- if (cs4349->reset_gpio)
- gpiod_set_value_cansleep(cs4349->reset_gpio, 1);
+ gpiod_set_value_cansleep(cs4349->reset_gpio, 1);
i2c_set_clientdata(client, cs4349);
snd_soc_unregister_codec(&client->dev);
/* Hold down reset */
- if (cs4349->reset_gpio)
- gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
+ gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
return 0;
}
struct cs4349_private *cs4349 = dev_get_drvdata(dev);
int ret;
- ret = regmap_update_bits(cs4349->regmap, CS4349_MISC, PWR_DWN, 1);
+ ret = regmap_update_bits(cs4349->regmap, CS4349_MISC, PWR_DWN, PWR_DWN);
if (ret < 0)
return ret;
regcache_cache_only(cs4349->regmap, true);
/* Hold down reset */
- if (cs4349->reset_gpio)
- gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
+ gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
return 0;
}
if (ret < 0)
return ret;
- if (cs4349->reset_gpio)
- gpiod_set_value_cansleep(cs4349->reset_gpio, 1);
+ gpiod_set_value_cansleep(cs4349->reset_gpio, 1);
regcache_cache_only(cs4349->regmap, false);
regcache_sync(cs4349->regmap);
static struct i2c_driver cs4349_i2c_driver = {
.driver = {
.name = "cs4349",
- .owner = THIS_MODULE,
.of_match_table = cs4349_of_match,
},
.id_table = cs4349_i2c_id,