mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
media: mt9p031: Refactor format handling for different sensor models
Add new structure 'mt9p031_model_info' to encapsulate format codes for the mt9p031 camera sensor family. This approach enhances code clarity and maintainability. Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
df1ae2251a
commit
a80b1bbff8
|
|
@ -111,6 +111,10 @@
|
||||||
#define MT9P031_TEST_PATTERN_RED 0xa2
|
#define MT9P031_TEST_PATTERN_RED 0xa2
|
||||||
#define MT9P031_TEST_PATTERN_BLUE 0xa3
|
#define MT9P031_TEST_PATTERN_BLUE 0xa3
|
||||||
|
|
||||||
|
struct mt9p031_model_info {
|
||||||
|
u32 code;
|
||||||
|
};
|
||||||
|
|
||||||
struct mt9p031 {
|
struct mt9p031 {
|
||||||
struct v4l2_subdev subdev;
|
struct v4l2_subdev subdev;
|
||||||
struct media_pad pad;
|
struct media_pad pad;
|
||||||
|
|
@ -1204,10 +1208,18 @@ static void mt9p031_remove(struct i2c_client *client)
|
||||||
mutex_destroy(&mt9p031->power_lock);
|
mutex_destroy(&mt9p031->power_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct mt9p031_model_info mt9p031_models_bayer = {
|
||||||
|
.code = MEDIA_BUS_FMT_SGRBG12_1X12
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct mt9p031_model_info mt9p031_models_mono = {
|
||||||
|
.code = MEDIA_BUS_FMT_Y12_1X12
|
||||||
|
};
|
||||||
|
|
||||||
static const struct of_device_id mt9p031_of_match[] = {
|
static const struct of_device_id mt9p031_of_match[] = {
|
||||||
{ .compatible = "aptina,mt9p006", .data = (void *)MEDIA_BUS_FMT_SGRBG12_1X12 },
|
{ .compatible = "aptina,mt9p006", .data = &mt9p031_models_bayer },
|
||||||
{ .compatible = "aptina,mt9p031", .data = (void *)MEDIA_BUS_FMT_SGRBG12_1X12 },
|
{ .compatible = "aptina,mt9p031", .data = &mt9p031_models_bayer },
|
||||||
{ .compatible = "aptina,mt9p031m", .data = (void *)MEDIA_BUS_FMT_Y12_1X12 },
|
{ .compatible = "aptina,mt9p031m", .data = &mt9p031_models_mono },
|
||||||
{ /* sentinel */ }
|
{ /* sentinel */ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, mt9p031_of_match);
|
MODULE_DEVICE_TABLE(of, mt9p031_of_match);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user