mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
media: i2c: maxim: remote: record the status of the serializer
Signed-off-by: Cai Wenzhong <cwz@rock-chips.com> Change-Id: Iee78aff7e99950313e5134bd9b0dd73422f0bec1
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
|
||||
#define MAX9295_NAME "max9295"
|
||||
#define MAX9295_NAME "maxim-max9295"
|
||||
|
||||
#define MAX9295_I2C_ADDR_DEF 0x40
|
||||
|
||||
@@ -456,6 +456,8 @@ static int max9295_module_init(maxim_remote_ser_t *max9295)
|
||||
return ret;
|
||||
}
|
||||
|
||||
max9295->ser_state = MAXIM_REMOTE_SER_INIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -468,6 +470,8 @@ static int max9295_module_deinit(maxim_remote_ser_t *max9295)
|
||||
#endif
|
||||
ret |= max9295_soft_power_down(max9295);
|
||||
|
||||
max9295->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -515,6 +519,7 @@ static int max9295_probe(struct i2c_client *client,
|
||||
max9295->client = client;
|
||||
max9295->ser_i2c_addr_map = client->addr;
|
||||
max9295->ser_ops = &max9295_ser_ops;
|
||||
max9295->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
i2c_set_clientdata(client, max9295);
|
||||
|
||||
@@ -537,6 +542,8 @@ static void max9295_remove(struct i2c_client *client)
|
||||
|
||||
mutex_destroy(&max9295->mutex);
|
||||
|
||||
max9295->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
|
||||
#define MAX96715_NAME "max96715"
|
||||
#define MAX96715_NAME "maxim-max96715"
|
||||
|
||||
#define MAX96715_I2C_ADDR_DEF 0x40
|
||||
|
||||
@@ -457,6 +457,8 @@ static int max96715_module_init(maxim_remote_ser_t *max96715)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
max96715->ser_state = MAXIM_REMOTE_SER_INIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -469,6 +471,8 @@ static int max96715_module_deinit(maxim_remote_ser_t *max96715)
|
||||
#endif
|
||||
ret |= max96715_soft_power_down(max96715);
|
||||
|
||||
max96715->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -516,6 +520,7 @@ static int max96715_probe(struct i2c_client *client,
|
||||
max96715->client = client;
|
||||
max96715->ser_i2c_addr_map = client->addr;
|
||||
max96715->ser_ops = &max96715_ser_ops;
|
||||
max96715->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
i2c_set_clientdata(client, max96715);
|
||||
|
||||
@@ -538,6 +543,8 @@ static void max96715_remove(struct i2c_client *client)
|
||||
|
||||
mutex_destroy(&max96715->mutex);
|
||||
|
||||
max96715->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -409,6 +409,8 @@ static int max96717_module_init(maxim_remote_ser_t *max96717)
|
||||
return ret;
|
||||
}
|
||||
|
||||
max96717->ser_state = MAXIM_REMOTE_SER_INIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -418,6 +420,8 @@ static int max96717_module_deinit(maxim_remote_ser_t *max96717)
|
||||
|
||||
ret |= max96717_i2c_addr_def(max96717);
|
||||
|
||||
max96717->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -465,6 +469,7 @@ static int max96717_probe(struct i2c_client *client,
|
||||
max96717->client = client;
|
||||
max96717->ser_i2c_addr_map = client->addr;
|
||||
max96717->ser_ops = &max96717_ser_ops;
|
||||
max96717->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
i2c_set_clientdata(client, max96717);
|
||||
|
||||
@@ -487,6 +492,8 @@ static void max96717_remove(struct i2c_client *client)
|
||||
|
||||
mutex_destroy(&max96717->mutex);
|
||||
|
||||
max96717->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
|
||||
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,10 @@ enum rkmodule_pad_type {
|
||||
#endif
|
||||
#endif /* LINUX_VERSION_CODE */
|
||||
|
||||
/* Serializer State */
|
||||
#define MAXIM_REMOTE_SER_DEINIT 0
|
||||
#define MAXIM_REMOTE_SER_INIT 1
|
||||
|
||||
/* I2C Device ID */
|
||||
enum {
|
||||
MAXIM_REMOTE_I2C_SER_DEF, /* Serializer I2C address: Default */
|
||||
@@ -76,6 +80,7 @@ typedef struct maxim_remote_ser {
|
||||
u8 cam_i2c_addr_def;
|
||||
u8 cam_i2c_addr_map;
|
||||
|
||||
u32 ser_state;
|
||||
struct maxim_remote_init_seq ser_init_seq;
|
||||
const struct maxim_remote_ser_ops *ser_ops;
|
||||
} maxim_remote_ser_t;
|
||||
@@ -325,4 +330,11 @@ static inline struct maxim_remote_ser *maxim_remote_cam_bind_ser(struct device *
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool maxim_remote_ser_is_inited(maxim_remote_ser_t *remote_ser)
|
||||
{
|
||||
if (remote_ser && (remote_ser->ser_state == MAXIM_REMOTE_SER_INIT))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif /* __MAXIM_REMOTE_H__ */
|
||||
|
||||
Reference in New Issue
Block a user