Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: staging: max96712: Move link frequency setting to device struct

Prepare for supporting MAX96724 by moving the soon device specific link
frequency setting into information structure. This struct will be
extended to carry more differences between the two devices supported.

While at it remove trailing comma in device table, no entries will be
appended after the sentinel.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Niklas Söderlund and committed by
Mauro Carvalho Chehab
2536a071 aa1e8e18

+17 -7
+17 -7
drivers/staging/media/max96712/max96712.c
··· 16 16 #include <media/v4l2-fwnode.h> 17 17 #include <media/v4l2-subdev.h> 18 18 19 - #define MAX96712_DPLL_FREQ 1000 20 - 21 19 enum max96712_pattern { 22 20 MAX96712_PATTERN_CHECKERBOARD = 0, 23 21 MAX96712_PATTERN_GRADIENT, 22 + }; 23 + 24 + struct max96712_info { 25 + unsigned int dpllfreq; 24 26 }; 25 27 26 28 struct max96712_priv { 27 29 struct i2c_client *client; 28 30 struct regmap *regmap; 29 31 struct gpio_desc *gpiod_pwdn; 32 + 33 + const struct max96712_info *info; 30 34 31 35 bool cphy; 32 36 struct v4l2_mbus_config_mipi_csi2 mipi; ··· 142 138 143 139 /* Set link frequency for PHY0 and PHY1. */ 144 140 max96712_update_bits(priv, 0x415, 0x3f, 145 - ((MAX96712_DPLL_FREQ / 100) & 0x1f) | BIT(5)); 141 + ((priv->info->dpllfreq / 100) & 0x1f) | BIT(5)); 146 142 max96712_update_bits(priv, 0x418, 0x3f, 147 - ((MAX96712_DPLL_FREQ / 100) & 0x1f) | BIT(5)); 143 + ((priv->info->dpllfreq / 100) & 0x1f) | BIT(5)); 148 144 149 145 /* Enable PHY0 and PHY1 */ 150 146 max96712_update_bits(priv, 0x8a2, 0xf0, 0x30); ··· 306 302 * TODO: Once V4L2_CID_LINK_FREQ is changed from a menu control to an 307 303 * INT64 control it should be used here instead of V4L2_CID_PIXEL_RATE. 308 304 */ 309 - pixel_rate = MAX96712_DPLL_FREQ / priv->mipi.num_data_lanes * 1000000; 305 + pixel_rate = priv->info->dpllfreq / priv->mipi.num_data_lanes * 1000000; 310 306 v4l2_ctrl_new_std(&priv->ctrl_handler, NULL, V4L2_CID_PIXEL_RATE, 311 307 pixel_rate, pixel_rate, 1, pixel_rate); 312 308 ··· 409 405 if (!priv) 410 406 return -ENOMEM; 411 407 408 + priv->info = of_device_get_match_data(&client->dev); 409 + 412 410 priv->client = client; 413 411 i2c_set_clientdata(client, priv); 414 412 ··· 449 443 gpiod_set_value_cansleep(priv->gpiod_pwdn, 0); 450 444 } 451 445 446 + static const struct max96712_info max96712_info_max96712 = { 447 + .dpllfreq = 1000, 448 + }; 449 + 452 450 static const struct of_device_id max96712_of_table[] = { 453 - { .compatible = "maxim,max96712" }, 454 - { /* sentinel */ }, 451 + { .compatible = "maxim,max96712", .data = &max96712_info_max96712 }, 452 + { /* sentinel */ } 455 453 }; 456 454 MODULE_DEVICE_TABLE(of, max96712_of_table); 457 455