boards: cxd56: drivers: sensors: nxstyle fix

Nxstyle fix for the sensors drivers

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2020-04-17 09:59:16 +02:00 committed by patacongo
parent b4cab7eb9e
commit f2a6d88c9d
9 changed files with 179 additions and 73 deletions

View File

@ -185,12 +185,12 @@ static const struct file_operations g_ak09912fops =
ak09912_close, /* close */
ak09912_read, /* read */
ak09912_write, /* write */
0, /* seek */
ak09912_ioctl, /* ioctl */
0, /* seek */
ak09912_ioctl, /* ioctl */
#ifndef CONFIG_DISABLE_POLL
0, /* poll */
0, /* poll */
#endif
0 /* unlink */
0 /* unlink */
};
/* Take XYZ data, temperature and Status 2 register.
@ -456,7 +456,8 @@ static int ak09912_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case SNIOC_GETADJ:
{
struct ak09912_sensadj_s *user = (struct ak09912_sensadj_s *)(uintptr_t)arg;
struct ak09912_sensadj_s *user = (struct ak09912_sensadj_s *)
(uintptr_t)arg;
user->x = g_asa.x;
user->y = g_asa.y;
@ -554,7 +555,8 @@ int ak09912_register(FAR const char *devpath, int minor,
/* Initialize the AK09912 device structure */
priv = (FAR struct ak09912_dev_s *)kmm_malloc(sizeof(struct ak09912_dev_s));
priv = (FAR struct ak09912_dev_s *)
kmm_malloc(sizeof(struct ak09912_dev_s));
if (!priv)
{
snerr("Failed to allocate instance\n");

View File

@ -328,7 +328,12 @@ static uint16_t apds9930_getreg16(FAR struct apds9930_dev_s *priv,
inst[0] = SCU_INST_SEND(APDS9930_CMD_TYPE_AUTOINC | regaddr);
inst[1] = SCU_INST_RECV(2) | SCU_INST_LAST;
scu_i2ctransfer(priv->port, priv->addr, inst, 2, (FAR uint8_t *)&regval, 2);
scu_i2ctransfer(priv->port,
priv->addr,
inst,
2,
(FAR uint8_t *)&regval,
2);
return regval;
}
@ -503,8 +508,13 @@ static int apds9930als_seqinit(FAR struct apds9930_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_apds9930alsinst, itemsof(g_apds9930alsinst));
seq_setsample(priv->seq, APDS9930_ALS_BYTESPERSAMPLE, 0, APDS9930_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_apds9930alsinst,
itemsof(g_apds9930alsinst));
seq_setsample(priv->seq,
APDS9930_ALS_BYTESPERSAMPLE,
0,
APDS9930_ELEMENTSIZE,
false);
return OK;
@ -537,8 +547,13 @@ static int apds9930ps_seqinit(FAR struct apds9930_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_apds9930psinst, itemsof(g_apds9930psinst));
seq_setsample(priv->seq, APDS9930_PS_BYTESPERSAMPLE, 0, APDS9930_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_apds9930psinst,
itemsof(g_apds9930psinst));
seq_setsample(priv->seq,
APDS9930_PS_BYTESPERSAMPLE,
0,
APDS9930_ELEMENTSIZE,
false);
return OK;

View File

@ -97,11 +97,15 @@ struct bh1721fvc_dev_s
static int bh1721fvc_open(FAR struct file *filep);
static int bh1721fvc_close(FAR struct file *filep);
static ssize_t bh1721fvc_read(FAR struct file *filep, FAR char *buffer,
static ssize_t bh1721fvc_read(FAR struct file *filep,
FAR char *buffer,
size_t buflen);
static ssize_t bh1721fvc_write(FAR struct file *filep, FAR const char *buffer,
static ssize_t bh1721fvc_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen);
static int bh1721fvc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int bh1721fvc_ioctl(FAR struct file *filep,
int cmd,
unsigned long arg);
/****************************************************************************
* Private Data
@ -184,8 +188,13 @@ static int bh1721fvc_seqinit(FAR struct bh1721fvc_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_bh1721fvcinst, itemsof(g_bh1721fvcinst));
seq_setsample(priv->seq, BH1721FVC_BYTESPERSAMPLE, 0, BH1721FVC_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_bh1721fvcinst,
itemsof(g_bh1721fvcinst));
seq_setsample(priv->seq,
BH1721FVC_BYTESPERSAMPLE,
0,
BH1721FVC_ELEMENTSIZE,
false);
return OK;
@ -275,7 +284,8 @@ static ssize_t bh1721fvc_read(FAR struct file *filep, FAR char *buffer,
* Name: bh1721fvc_write
****************************************************************************/
static ssize_t bh1721fvc_write(FAR struct file *filep, FAR const char *buffer,
static ssize_t bh1721fvc_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen)
{
return -ENOSYS;
@ -343,7 +353,8 @@ int bh1721fvc_init(FAR struct i2c_master_s *i2c, int port)
* Name: bh1721fvc_register
*
* Description:
* Register the BH1721FVC ambient light sensor character device as 'devpath'
* Register the BH1721FVC ambient light sensor character device as
* 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/light0"

View File

@ -121,9 +121,11 @@ struct bh1745nuc_dev_s
static int bh1745nuc_open(FAR struct file *filep);
static int bh1745nuc_close(FAR struct file *filep);
static ssize_t bh1745nuc_read(FAR struct file *filep, FAR char *buffer,
static ssize_t bh1745nuc_read(FAR struct file *filep,
FAR char *buffer,
size_t buflen);
static ssize_t bh1745nuc_write(FAR struct file *filep, FAR const char *buffer,
static ssize_t bh1745nuc_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen);
static int bh1745nuc_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
@ -276,8 +278,12 @@ static int bh1745nuc_seqinit(FAR struct bh1745nuc_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_bh1745nucinst, itemsof(g_bh1745nucinst));
seq_setsample(priv->seq, BH1745NUC_BYTESPERSAMPLE, 0, BH1745NUC_ELEMENTSIZE,
seq_setinstruction(priv->seq, g_bh1745nucinst,
itemsof(g_bh1745nucinst));
seq_setsample(priv->seq,
BH1745NUC_BYTESPERSAMPLE,
0,
BH1745NUC_ELEMENTSIZE,
false);
return OK;
@ -392,7 +398,8 @@ static ssize_t bh1745nuc_read(FAR struct file *filep, FAR char *buffer,
* Name: bh1745nuc_write
****************************************************************************/
static ssize_t bh1745nuc_write(FAR struct file *filep, FAR const char *buffer,
static ssize_t bh1745nuc_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen)
{
return -ENOSYS;
@ -402,7 +409,9 @@ static ssize_t bh1745nuc_write(FAR struct file *filep, FAR const char *buffer,
* Name: bh1745nuc_ioctl
****************************************************************************/
static int bh1745nuc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
static int bh1745nuc_ioctl(FAR struct file *filep,
int cmd,
unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
FAR struct bh1745nuc_dev_s *priv = inode->i_private;

View File

@ -267,7 +267,8 @@ struct bmi160_dev_s
* Private Functions
****************************************************************************/
static uint8_t bmi160_getreg8(FAR struct bmi160_dev_s *priv, uint8_t regaddr);
static uint8_t bmi160_getreg8(FAR struct bmi160_dev_s *priv,
uint8_t regaddr);
static void bmi160_putreg8(FAR struct bmi160_dev_s *priv,
uint8_t regaddr, uint8_t regval);
@ -286,15 +287,15 @@ static int bmi160_checkid(FAR struct bmi160_dev_s *priv);
#ifdef CONFIG_SENSORS_BMI160_I2C
static int bmi160_devregister(FAR const char *devpath,
FAR struct i2c_master_s *dev,
FAR struct i2c_master_s *dev,
int minor,
const struct file_operations *fops,
int port);
const struct file_operations *fops,
int port);
#else /* CONFIG_SENSORS_BMI160_SPI */
static int bmi160_devregister(FAR const char *devpath,
FAR struct spi_dev_s *dev,
FAR struct spi_dev_s *dev,
int minor,
const struct file_operations *fops);
const struct file_operations *fops);
#endif
static int bmi160_set_accel_pm(FAR struct bmi160_dev_s *priv, int pm);
@ -310,20 +311,20 @@ static const struct file_operations g_bmi160gyrofops =
{
bmi160_open_gyro, /* open */
bmi160_close_gyro, /* close */
bmi160_read, /* read */
bmi160_read, /* read */
0, /* write */
0, /* seek */
bmi160_ioctl, /* ioctl */
bmi160_ioctl, /* ioctl */
};
static const struct file_operations g_bmi160accelfops =
{
bmi160_open_accel, /* open */
bmi160_close_accel, /* close */
bmi160_read, /* read */
bmi160_read, /* read */
0, /* write */
0, /* seek */
bmi160_ioctl, /* ioctl */
bmi160_ioctl, /* ioctl */
};
/* SCU instructions for pick gyro sensing data. */
@ -491,8 +492,14 @@ static int bmi160_seqinit_gyro(FAR struct bmi160_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_bmi160gyroinst, itemsof(g_bmi160gyroinst));
seq_setsample(priv->seq, BMI160_BYTESPERSAMPLE, 0, BMI160_ELEMENTSIZE, false);
seq_setinstruction(priv->seq,
g_bmi160gyroinst,
itemsof(g_bmi160gyroinst));
seq_setsample(priv->seq,
BMI160_BYTESPERSAMPLE,
0,
BMI160_ELEMENTSIZE,
false);
return OK;
}
@ -524,8 +531,14 @@ static int bmi160_seqinit_accel(FAR struct bmi160_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_bmi160accelinst, itemsof(g_bmi160accelinst));
seq_setsample(priv->seq, BMI160_BYTESPERSAMPLE, 0, BMI160_ELEMENTSIZE, false);
seq_setinstruction(priv->seq,
g_bmi160accelinst,
itemsof(g_bmi160accelinst));
seq_setsample(priv->seq,
BMI160_BYTESPERSAMPLE,
0,
BMI160_ELEMENTSIZE,
false);
return OK;
}
@ -686,7 +699,9 @@ static int bmi160_close_accel(FAR struct file *filep)
*
****************************************************************************/
static ssize_t bmi160_read(FAR struct file *filep, FAR char *buffer, size_t len)
static ssize_t bmi160_read(FAR struct file *filep,
FAR char *buffer,
size_t len)
{
FAR struct inode *inode = filep->f_inode;
FAR struct bmi160_dev_s *priv = inode->i_private;
@ -791,11 +806,16 @@ static int bmi160_checkid(FAR struct bmi160_dev_s *priv)
****************************************************************************/
#ifdef CONFIG_SENSORS_BMI160_I2C
static int bmi160_devregister(FAR const char *devpath, FAR struct i2c_master_s *dev,
int minor, const struct file_operations *fops, int port)
static int bmi160_devregister(FAR const char *devpath,
FAR struct i2c_master_s *dev,
int minor,
const struct file_operations *fops,
int port)
#else /* CONFIG_SENSORS_BMI160_SPI */
static int bmi160_devregister(FAR const char *devpath, FAR struct spi_dev_s *dev,
int minor, const struct file_operations *fops)
static int bmi160_devregister(FAR const char *devpath,
FAR struct spi_dev_s *dev,
int minor,
const struct file_operations *fops)
#endif
{
FAR struct bmi160_dev_s *priv;
@ -1021,7 +1041,7 @@ int bmi160_init(FAR struct spi_dev_s *dev)
return ret;
}
/* To avoid gyro wakeup it is required to write 0x00 to 0x6C*/
/* To avoid gyro wakeup it is required to write 0x00 to 0x6C */
bmi160_putreg8(priv, BMI160_PMU_TRIGGER, 0);
up_mdelay(1);

View File

@ -154,8 +154,10 @@ struct bmp280_dev_s
* Private Function Prototypes
****************************************************************************/
static uint8_t bmp280_getreg8(FAR struct bmp280_dev_s *priv, uint8_t regaddr);
static void bmp280_putreg8(FAR struct bmp280_dev_s *priv, uint8_t regaddr,
static uint8_t bmp280_getreg8(FAR struct bmp280_dev_s *priv,
uint8_t regaddr);
static void bmp280_putreg8(FAR struct bmp280_dev_s *priv,
uint8_t regaddr,
uint8_t regval);
/* Character driver methods */
@ -386,7 +388,8 @@ static int bmp280_get_calib_param_temp(FAR struct bmp280_dev_s *priv)
*
****************************************************************************/
static void bmp280_set_power_mode(FAR struct bmp280_dev_s *priv, uint8_t value)
static void bmp280_set_power_mode(FAR struct bmp280_dev_s *priv,
uint8_t value)
{
uint8_t v_data_u8 = 0;
@ -403,7 +406,8 @@ static void bmp280_set_power_mode(FAR struct bmp280_dev_s *priv, uint8_t value)
*
****************************************************************************/
static void bmp280_set_oversamp_press(FAR struct bmp280_dev_s *priv, uint8_t value)
static void bmp280_set_oversamp_press(FAR struct bmp280_dev_s *priv,
uint8_t value)
{
uint8_t v_data_u8 = 0;
@ -827,7 +831,8 @@ static int bmp280_ioctl_temp(FAR struct file *filep, int cmd,
case SNIOC_GETADJ:
{
struct bmp280_temp_adj_s *user = (struct bmp280_temp_adj_s *)(uintptr_t)arg;
struct bmp280_temp_adj_s *user = (struct bmp280_temp_adj_s *)
(uintptr_t)arg;
user->dig_t1 = g_temp_adj.dig_t1;
user->dig_t2 = g_temp_adj.dig_t2;

View File

@ -284,8 +284,14 @@ static int kx022_seqinit(FAR struct kx022_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_kx022inst, itemsof(g_kx022inst));
seq_setsample(priv->seq, KX022_BYTESPERSAMPLE, 0, KX022_ELEMENTSIZE, false);
seq_setinstruction(priv->seq,
g_kx022inst,
itemsof(g_kx022inst));
seq_setsample(priv->seq,
KX022_BYTESPERSAMPLE,
0,
KX022_ELEMENTSIZE,
false);
return OK;
}

View File

@ -356,8 +356,13 @@ static int lt1pa01als_seqinit(FAR struct lt1pa01_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_lt1pa01alsinst, itemsof(g_lt1pa01alsinst));
seq_setsample(priv->seq, LT1PA01_ALS_BYTESPERSAMPLE, 0, LT1PA01_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_lt1pa01alsinst,
itemsof(g_lt1pa01alsinst));
seq_setsample(priv->seq,
LT1PA01_ALS_BYTESPERSAMPLE,
0,
LT1PA01_ELEMENTSIZE,
false);
return OK;
@ -390,8 +395,13 @@ static int lt1pa01prox_seqinit(FAR struct lt1pa01_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_lt1pa01proxinst, itemsof(g_lt1pa01proxinst));
seq_setsample(priv->seq, LT1PA01_PROX_BYTESPERSAMPLE, 0, LT1PA01_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_lt1pa01proxinst,
itemsof(g_lt1pa01proxinst));
seq_setsample(priv->seq,
LT1PA01_PROX_BYTESPERSAMPLE,
0,
LT1PA01_ELEMENTSIZE,
false);
return OK;

View File

@ -150,15 +150,20 @@ static int rpr0521rs_open_als(FAR struct file *filep);
static int rpr0521rs_open_ps(FAR struct file *filep);
static int rpr0521rs_close_als(FAR struct file *filep);
static int rpr0521rs_close_ps(FAR struct file *filep);
static ssize_t rpr0521rs_read_als(FAR struct file *filep, FAR char *buffer,
static ssize_t rpr0521rs_read_als(FAR struct file *filep,
FAR char *buffer,
size_t buflen);
static ssize_t rpr0521rs_read_ps(FAR struct file *filep, FAR char *buffer,
static ssize_t rpr0521rs_read_ps(FAR struct file *filep,
FAR char *buffer,
size_t buflen);
static ssize_t rpr0521rs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
static int rpr0521rs_ioctl_als(FAR struct file *filep, int cmd,
static ssize_t rpr0521rs_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen);
static int rpr0521rs_ioctl_als(FAR struct file *filep,
int cmd,
unsigned long arg);
static int rpr0521rs_ioctl_ps(FAR struct file *filep, int cmd,
static int rpr0521rs_ioctl_ps(FAR struct file *filep,
int cmd,
unsigned long arg);
/****************************************************************************
@ -303,7 +308,12 @@ static uint16_t rpr0521rs_getreg16(FAR struct rpr0521rs_dev_s *priv,
inst[0] = SCU_INST_SEND(regaddr);
inst[1] = SCU_INST_RECV(2) | SCU_INST_LAST;
scu_i2ctransfer(priv->port, priv->addr, inst, 2, (FAR uint8_t *)&regval, 2);
scu_i2ctransfer(priv->port,
priv->addr,
inst,
2,
(FAR uint8_t *)&regval,
2);
return regval;
}
@ -405,7 +415,9 @@ static void rpr0521rs_setmodecontrol(FAR struct rpr0521rs_dev_s *priv,
{
if (enable)
{
val = setbit | checkbit | RPR0521RS_MODE_CONTROL_MEASTIME_100_100MS;
val = setbit |
checkbit |
RPR0521RS_MODE_CONTROL_MEASTIME_100_100MS;
}
else
{
@ -455,8 +467,13 @@ static int rpr0521rsals_seqinit(FAR struct rpr0521rs_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_rpr0521rsalsinst, itemsof(g_rpr0521rsalsinst));
seq_setsample(priv->seq, RPR0521RS_ALS_BYTESPERSAMPLE, 0, RPR0521RS_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_rpr0521rsalsinst,
itemsof(g_rpr0521rsalsinst));
seq_setsample(priv->seq,
RPR0521RS_ALS_BYTESPERSAMPLE,
0,
RPR0521RS_ELEMENTSIZE,
false);
return OK;
@ -489,8 +506,13 @@ static int rpr0521rsps_seqinit(FAR struct rpr0521rs_dev_s *priv)
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_rpr0521rspsinst, itemsof(g_rpr0521rspsinst));
seq_setsample(priv->seq, RPR0521RS_PS_BYTESPERSAMPLE, 0, RPR0521RS_ELEMENTSIZE,
seq_setinstruction(priv->seq,
g_rpr0521rspsinst,
itemsof(g_rpr0521rspsinst));
seq_setsample(priv->seq,
RPR0521RS_PS_BYTESPERSAMPLE,
0,
RPR0521RS_ELEMENTSIZE,
false);
return OK;
@ -674,7 +696,8 @@ static ssize_t rpr0521rs_read_ps(FAR struct file *filep, FAR char *buffer,
if (len)
{
len = RPR0521RS_PS_BYTESPERSAMPLE;
*(FAR uint16_t *)buffer = rpr0521rs_getreg16(priv, RPR0521RS_PS_DATA_LSB);
*(FAR uint16_t *)buffer = rpr0521rs_getreg16(priv,
RPR0521RS_PS_DATA_LSB);
}
#else
len = seq_read(priv->seq, priv->minor, buffer, len);
@ -687,7 +710,8 @@ static ssize_t rpr0521rs_read_ps(FAR struct file *filep, FAR char *buffer,
* Name: rpr0521rs_write
****************************************************************************/
static ssize_t rpr0521rs_write(FAR struct file *filep, FAR const char *buffer,
static ssize_t rpr0521rs_write(FAR struct file *filep,
FAR const char *buffer,
size_t buflen)
{
return -ENOSYS;
@ -697,7 +721,8 @@ static ssize_t rpr0521rs_write(FAR struct file *filep, FAR const char *buffer,
* Name: rpr0521rs_ioctl_als
****************************************************************************/
static int rpr0521rs_ioctl_als(FAR struct file *filep, int cmd,
static int rpr0521rs_ioctl_als(FAR struct file *filep,
int cmd,
unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
@ -730,7 +755,8 @@ static int rpr0521rs_ioctl_als(FAR struct file *filep, int cmd,
* Name: rpr0521rs_ioctl_ps
****************************************************************************/
static int rpr0521rs_ioctl_ps(FAR struct file *filep, int cmd,
static int rpr0521rs_ioctl_ps(FAR struct file *filep,
int cmd,
unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
@ -790,7 +816,8 @@ static int rpr0521rs_ioctl_ps(FAR struct file *filep, int cmd,
case SNIOC_GETINTSTATUS:
{
FAR uint8_t intstatus = rpr0521rs_getreg8(priv, RPR0521RS_INTERRUPT);
FAR uint8_t intstatus = rpr0521rs_getreg8(priv,
RPR0521RS_INTERRUPT);
*(FAR uint8_t *)(uintptr_t)arg = intstatus;
sninfo("Get proximity IntStatus 0x%02x\n", intstatus);
}
@ -885,7 +912,8 @@ int rpr0521rs_init(FAR struct i2c_master_s *i2c, int port)
* Name: rpr0521rsals_register
*
* Description:
* Register the RPR0521RS ambient light sensor character device as 'devpath'
* Register the RPR0521RS ambient light sensor character device as
* 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/light0"