Lines Matching refs:client

131 #define reg_read(reg) mt9m111_reg_read(client, MT9M111_##reg)
132 #define reg_write(reg, val) mt9m111_reg_write(client, MT9M111_##reg, (val))
133 #define reg_set(reg, val) mt9m111_reg_set(client, MT9M111_##reg, (val))
134 #define reg_clear(reg, val) mt9m111_reg_clear(client, MT9M111_##reg, (val))
135 #define reg_mask(reg, val, mask) mt9m111_reg_mask(client, MT9M111_##reg, \
231 static struct mt9m111 *to_mt9m111(const struct i2c_client *client) in to_mt9m111() argument
233 return container_of(i2c_get_clientdata(client), struct mt9m111, subdev); in to_mt9m111()
236 static int reg_page_map_set(struct i2c_client *client, const u16 reg) in reg_page_map_set() argument
240 struct mt9m111 *mt9m111 = to_mt9m111(client); in reg_page_map_set()
248 ret = i2c_smbus_write_word_swapped(client, MT9M111_PAGE_MAP, page); in reg_page_map_set()
254 static int mt9m111_reg_read(struct i2c_client *client, const u16 reg) in mt9m111_reg_read() argument
258 ret = reg_page_map_set(client, reg); in mt9m111_reg_read()
260 ret = i2c_smbus_read_word_swapped(client, reg & 0xff); in mt9m111_reg_read()
262 dev_dbg(&client->dev, "read reg.%03x -> %04x\n", reg, ret); in mt9m111_reg_read()
266 static int mt9m111_reg_write(struct i2c_client *client, const u16 reg, in mt9m111_reg_write() argument
271 ret = reg_page_map_set(client, reg); in mt9m111_reg_write()
273 ret = i2c_smbus_write_word_swapped(client, reg & 0xff, data); in mt9m111_reg_write()
274 dev_dbg(&client->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret); in mt9m111_reg_write()
278 static int mt9m111_reg_set(struct i2c_client *client, const u16 reg, in mt9m111_reg_set() argument
283 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_set()
285 ret = mt9m111_reg_write(client, reg, ret | data); in mt9m111_reg_set()
289 static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg, in mt9m111_reg_clear() argument
294 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_clear()
296 ret = mt9m111_reg_write(client, reg, ret & ~data); in mt9m111_reg_clear()
300 static int mt9m111_reg_mask(struct i2c_client *client, const u16 reg, in mt9m111_reg_mask() argument
305 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_mask()
307 ret = mt9m111_reg_write(client, reg, (ret & ~mask) | data); in mt9m111_reg_mask()
314 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_context() local
322 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_rect_ctx() local
323 int ret = mt9m111_reg_write(client, ctx->reducer_xzoom, rect->width); in mt9m111_setup_rect_ctx()
325 ret = mt9m111_reg_write(client, ctx->reducer_yzoom, rect->height); in mt9m111_setup_rect_ctx()
327 ret = mt9m111_reg_write(client, ctx->reducer_xsize, width); in mt9m111_setup_rect_ctx()
329 ret = mt9m111_reg_write(client, ctx->reducer_ysize, height); in mt9m111_setup_rect_ctx()
336 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_geometry() local
358 dev_dbg(&client->dev, "%s(%x): %ux%u@%u:%u -> %ux%u = %d\n", in mt9m111_setup_geometry()
367 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_enable() local
373 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_reset() local
472 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_pixfmt() local
526 dev_err(&client->dev, "Pixel format not handled: %x\n", code); in mt9m111_set_pixfmt()
530 ret = mt9m111_reg_mask(client, context_a.output_fmt_ctrl2, in mt9m111_set_pixfmt()
533 ret = mt9m111_reg_mask(client, context_b.output_fmt_ctrl2, in mt9m111_set_pixfmt()
544 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_set_fmt() local
580 dev_dbg(&client->dev, "%s(): %ux%u, code=%x\n", __func__, in mt9m111_set_fmt()
607 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_g_register() local
613 val = mt9m111_reg_read(client, reg->reg); in mt9m111_g_register()
626 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_s_register() local
631 if (mt9m111_reg_write(client, reg->reg, reg->val) < 0) in mt9m111_s_register()
640 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_flip() local
644 ret = mt9m111_reg_set(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
646 ret = mt9m111_reg_clear(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
653 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_get_global_gain() local
665 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_global_gain() local
683 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autoexposure() local
692 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autowhitebalance() local
724 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_suspend() local
762 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_init() local
771 dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); in mt9m111_init()
777 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_on() local
778 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_power_on()
781 ret = soc_camera_power_on(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_on()
787 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); in mt9m111_power_on()
788 soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_on()
796 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_off() local
797 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_power_off()
800 soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_off()
857 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_g_mbus_config() local
858 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_g_mbus_config()
892 static int mt9m111_video_probe(struct i2c_client *client) in mt9m111_video_probe() argument
894 struct mt9m111 *mt9m111 = to_mt9m111(client); in mt9m111_video_probe()
906 dev_info(&client->dev, in mt9m111_video_probe()
910 dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); in mt9m111_video_probe()
913 dev_err(&client->dev, in mt9m111_video_probe()
931 static int mt9m111_probe(struct i2c_client *client, in mt9m111_probe() argument
935 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); in mt9m111_probe()
936 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_probe()
939 if (client->dev.of_node) { in mt9m111_probe()
940 ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL); in mt9m111_probe()
943 client->dev.platform_data = ssdd; in mt9m111_probe()
946 dev_err(&client->dev, "mt9m111: driver needs platform data\n"); in mt9m111_probe()
956 mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); in mt9m111_probe()
960 mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9m111_probe()
967 v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops); in mt9m111_probe()
995 ret = soc_camera_power_init(&client->dev, ssdd); in mt9m111_probe()
999 ret = mt9m111_video_probe(client); in mt9m111_probe()
1003 mt9m111->subdev.dev = &client->dev; in mt9m111_probe()
1018 static int mt9m111_remove(struct i2c_client *client) in mt9m111_remove() argument
1020 struct mt9m111 *mt9m111 = to_mt9m111(client); in mt9m111_remove()