mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
media: irs1125: Refactoring and debug messages
Changed some variable names to comply with checkpatch --strict mode. Debug messages added. Signed-off-by: Markus Proeller <markus.proeller@pieye.org>
This commit is contained in:
committed by
Dom Cobley
parent
737c10c244
commit
b7c11cfabe
@@ -15,6 +15,7 @@
|
|||||||
#include "irs1125.h"
|
#include "irs1125.h"
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/firmware.h>
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
@@ -22,13 +23,13 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of_graph.h>
|
#include <linux/of_graph.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/types.h>
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#include <linux/firmware.h>
|
#include <media/v4l2-ctrls.h>
|
||||||
#include <media/v4l2-device.h>
|
#include <media/v4l2-device.h>
|
||||||
#include <media/v4l2-fwnode.h>
|
#include <media/v4l2-fwnode.h>
|
||||||
#include <media/v4l2-image-sizes.h>
|
#include <media/v4l2-image-sizes.h>
|
||||||
#include <media/v4l2-mediabus.h>
|
#include <media/v4l2-mediabus.h>
|
||||||
#include <media/v4l2-ctrls.h>
|
|
||||||
|
|
||||||
#define CHECK_BIT(val, pos) ((val) & BIT(pos))
|
#define CHECK_BIT(val, pos) ((val) & BIT(pos))
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
|
|
||||||
#define IRS1125_ALTERNATE_FW "irs1125_af.bin"
|
#define IRS1125_ALTERNATE_FW "irs1125_af.bin"
|
||||||
|
|
||||||
|
#define IRS1125_REG_SAFE_RECONFIG 0xA850
|
||||||
#define IRS1125_REG_CSICFG 0xA882
|
#define IRS1125_REG_CSICFG 0xA882
|
||||||
#define IRS1125_REG_DESIGN_STEP 0xB0AD
|
#define IRS1125_REG_DESIGN_STEP 0xB0AD
|
||||||
#define IRS1125_REG_EFUSEVAL2 0xB09F
|
#define IRS1125_REG_EFUSEVAL2 0xB09F
|
||||||
@@ -87,7 +89,7 @@ static inline struct irs1125 *to_state(struct v4l2_subdev *sd)
|
|||||||
return container_of(sd, struct irs1125, sd);
|
return container_of(sd, struct irs1125, sd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct regval_list irs1125_26MHz[] = {
|
static struct regval_list irs1125_26mhz[] = {
|
||||||
{0xB017, 0x0413},
|
{0xB017, 0x0413},
|
||||||
{0xB086, 0x3535},
|
{0xB086, 0x3535},
|
||||||
{0xB0AE, 0xEF02},
|
{0xB0AE, 0xEF02},
|
||||||
@@ -153,7 +155,7 @@ static struct regval_list irs1125_26MHz[] = {
|
|||||||
{0xFFFF, 100}
|
{0xFFFF, 100}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct regval_list irs1125_seq_cfg[] = {
|
static struct regval_list irs1125_seq_cfg_init[] = {
|
||||||
{0xC3A0, 0x823D},
|
{0xC3A0, 0x823D},
|
||||||
{0xC3A1, 0xB13B},
|
{0xC3A1, 0xB13B},
|
||||||
{0xC3A2, 0x0313},
|
{0xC3A2, 0x0313},
|
||||||
@@ -243,6 +245,7 @@ static int irs1125_write(struct v4l2_subdev *sd, u16 reg, u16 val)
|
|||||||
dev_err(&client->dev, "%s: i2c write error, reg: %x\n",
|
dev_err(&client->dev, "%s: i2c write error, reg: %x\n",
|
||||||
__func__, reg);
|
__func__, reg);
|
||||||
|
|
||||||
|
dev_dbg(&client->dev, "write addr 0x%04x, val 0x%04x\n", reg, val);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,8 +367,8 @@ static int __sensor_init(struct v4l2_subdev *sd)
|
|||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = irs1125_write_array(sd, irs1125_26MHz,
|
ret = irs1125_write_array(sd, irs1125_26mhz,
|
||||||
ARRAY_SIZE(irs1125_26MHz));
|
ARRAY_SIZE(irs1125_26mhz));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&client->dev, "write sensor default regs error\n");
|
dev_err(&client->dev, "write sensor default regs error\n");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -415,8 +418,8 @@ static int __sensor_init(struct v4l2_subdev *sd)
|
|||||||
}
|
}
|
||||||
release_firmware(fw);
|
release_firmware(fw);
|
||||||
|
|
||||||
ret = irs1125_write_array(sd, irs1125_seq_cfg,
|
ret = irs1125_write_array(sd, irs1125_seq_cfg_init,
|
||||||
ARRAY_SIZE(irs1125_seq_cfg));
|
ARRAY_SIZE(irs1125_seq_cfg_init));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&client->dev, "write default sequence failed\n");
|
dev_err(&client->dev, "write default sequence failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1037,6 +1040,7 @@ static int irs1125_probe(struct i2c_client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gpio_num = desc_to_gpio(sensor->reset);
|
gpio_num = desc_to_gpio(sensor->reset);
|
||||||
|
dev_dbg(&client->dev, "reset on GPIO num %d\n", gpio_num);
|
||||||
|
|
||||||
mutex_init(&sensor->lock);
|
mutex_init(&sensor->lock);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user