rj54n1
fmt = rj54n1->fmt;
rj54n1->fmt = fmt;
rj54n1->resize = ret;
rj54n1->rect.width = input_w;
rj54n1->rect.height = input_h;
rj54n1->width = output_w;
rj54n1->height = output_h;
struct rj54n1 *rj54n1 = to_rj54n1(client);
if (rj54n1->pwup_gpio)
gpiod_set_value(rj54n1->pwup_gpio, 1);
if (rj54n1->enable_gpio)
gpiod_set_value(rj54n1->enable_gpio, 1);
return clk_prepare_enable(rj54n1->clk);
clk_disable_unprepare(rj54n1->clk);
if (rj54n1->enable_gpio)
gpiod_set_value(rj54n1->enable_gpio, 0);
if (rj54n1->pwup_gpio)
gpiod_set_value(rj54n1->pwup_gpio, 0);
struct rj54n1 *rj54n1 = container_of(ctrl->handler, struct rj54n1, hdl);
struct v4l2_subdev *sd = &rj54n1->subdev;
rj54n1->auto_wb = ctrl->val;
struct rj54n1 *rj54n1 = to_rj54n1(client);
ret = rj54n1_s_power(&rj54n1->subdev, 1);
ret = v4l2_ctrl_handler_setup(&rj54n1->hdl);
rj54n1_s_power(&rj54n1->subdev, 0);
struct rj54n1 *rj54n1;
rj54n1 = devm_kzalloc(&client->dev, sizeof(struct rj54n1), GFP_KERNEL);
if (!rj54n1)
v4l2_i2c_subdev_init(&rj54n1->subdev, client, &rj54n1_subdev_ops);
v4l2_ctrl_handler_init(&rj54n1->hdl, 4);
v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops,
v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops,
v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops,
v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops,
if (rj54n1->hdl.error) {
ret = rj54n1->hdl.error;
rj54n1->subdev.ctrl_handler = &rj54n1->hdl;
rj54n1->clk_div = clk_div;
rj54n1->rect.left = RJ54N1_COLUMN_SKIP;
rj54n1->rect.top = RJ54N1_ROW_SKIP;
rj54n1->rect.width = RJ54N1_MAX_WIDTH;
rj54n1->rect.height = RJ54N1_MAX_HEIGHT;
rj54n1->width = RJ54N1_MAX_WIDTH;
rj54n1->height = RJ54N1_MAX_HEIGHT;
rj54n1->fmt = &rj54n1_colour_fmts[0];
rj54n1->resize = 1024;
rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) /
rj54n1->clk = clk_get(&client->dev, NULL);
if (IS_ERR(rj54n1->clk)) {
ret = PTR_ERR(rj54n1->clk);
rj54n1->pwup_gpio = gpiod_get_optional(&client->dev, "powerup",
if (IS_ERR(rj54n1->pwup_gpio)) {
rj54n1->pwup_gpio);
ret = PTR_ERR(rj54n1->pwup_gpio);
rj54n1->enable_gpio = gpiod_get_optional(&client->dev, "enable",
if (IS_ERR(rj54n1->enable_gpio)) {
rj54n1->enable_gpio);
ret = PTR_ERR(rj54n1->enable_gpio);
ret = v4l2_async_register_subdev(&rj54n1->subdev);
if (rj54n1->enable_gpio)
gpiod_put(rj54n1->enable_gpio);
if (rj54n1->pwup_gpio)
gpiod_put(rj54n1->pwup_gpio);
clk_put(rj54n1->clk);
v4l2_ctrl_handler_free(&rj54n1->hdl);
struct rj54n1 *rj54n1 = to_rj54n1(client);
if (rj54n1->enable_gpio)
gpiod_put(rj54n1->enable_gpio);
if (rj54n1->pwup_gpio)
gpiod_put(rj54n1->pwup_gpio);
clk_put(rj54n1->clk);
v4l2_ctrl_handler_free(&rj54n1->hdl);
v4l2_async_unregister_subdev(&rj54n1->subdev);
static struct rj54n1 *to_rj54n1(const struct i2c_client *client)
return container_of(i2c_get_clientdata(client), struct rj54n1, subdev);
struct rj54n1 *rj54n1 = to_rj54n1(client);
if (rj54n1->bank != reg >> 8) {
rj54n1->bank = reg >> 8;
struct rj54n1 *rj54n1 = to_rj54n1(client);
if (rj54n1->bank != reg >> 8) {
rj54n1->bank = reg >> 8;
struct rj54n1 *rj54n1 = to_rj54n1(client);
output_w = (input_w * 1024 + rj54n1->resize / 2) / rj54n1->resize;
output_h = (input_h * 1024 + rj54n1->resize / 2) / rj54n1->resize;
input_w, input_h, rj54n1->resize, output_w, output_h);
rj54n1->width = output_w;
rj54n1->height = output_h;
rj54n1->resize = ret;
rj54n1->rect.width = input_w;
rj54n1->rect.height = input_h;
struct rj54n1 *rj54n1 = to_rj54n1(client);
sel->r = rj54n1->rect;
struct rj54n1 *rj54n1 = to_rj54n1(client);
mf->code = rj54n1->fmt->code;
mf->colorspace = rj54n1->fmt->colorspace;
mf->width = rj54n1->width;
mf->height = rj54n1->height;
struct rj54n1 *rj54n1 = to_rj54n1(client);
if (!rj54n1->auto_wb) {
peak = 12 * RJ54N1_MAX_WIDTH * (1 << 14) * resize / rj54n1->tgclk_mhz /
struct rj54n1 *rj54n1 = to_rj54n1(client);
rj54n1->clk_div.ratio_tg);
rj54n1->clk_div.ratio_t);
rj54n1->clk_div.ratio_r);
rj54n1->clk_div.ratio_op);
rj54n1->clk_div.ratio_o);
struct rj54n1 *rj54n1 = to_rj54n1(client);
rj54n1->auto_wb = ret & 0x80;
struct rj54n1 *rj54n1 = to_rj54n1(client);
input_w = rj54n1->rect.width, input_h = rj54n1->rect.height;