Lines Matching refs:ctx
30 void (*update)(struct img_ascii_lcd_ctx *ctx);
67 static void boston_update(struct img_ascii_lcd_ctx *ctx)
72 val = *((u64 *)&ctx->curr[0]);
73 __raw_writeq(val, ctx->base);
75 val = *((u32 *)&ctx->curr[0]);
76 __raw_writel(val, ctx->base);
77 val = *((u32 *)&ctx->curr[4]);
78 __raw_writel(val, ctx->base + 4);
93 static void malta_update(struct img_ascii_lcd_ctx *ctx)
98 for (i = 0; i < ctx->cfg->num_chars; i++) {
99 err = regmap_write(ctx->regmap,
100 ctx->offset + (i * 8), ctx->curr[i]);
129 static int sead3_wait_sm_idle(struct img_ascii_lcd_ctx *ctx)
135 err = regmap_read(ctx->regmap,
136 ctx->offset + SEAD3_REG_CPLD_STATUS,
146 static int sead3_wait_lcd_idle(struct img_ascii_lcd_ctx *ctx)
151 err = sead3_wait_sm_idle(ctx);
156 err = regmap_read(ctx->regmap,
157 ctx->offset + SEAD3_REG_LCD_CTRL,
162 err = sead3_wait_sm_idle(ctx);
166 err = regmap_read(ctx->regmap,
167 ctx->offset + SEAD3_REG_CPLD_DATA,
176 static void sead3_update(struct img_ascii_lcd_ctx *ctx)
181 for (i = 0; i < ctx->cfg->num_chars; i++) {
182 err = sead3_wait_lcd_idle(ctx);
186 err = regmap_write(ctx->regmap,
187 ctx->offset + SEAD3_REG_LCD_CTRL,
192 err = sead3_wait_lcd_idle(ctx);
196 err = regmap_write(ctx->regmap,
197 ctx->offset + SEAD3_REG_LCD_DATA,
198 ctx->curr[i]);
230 struct img_ascii_lcd_ctx *ctx = from_timer(ctx, t, timer);
231 unsigned int i, ch = ctx->scroll_pos;
232 unsigned int num_chars = ctx->cfg->num_chars;
237 for (; i < num_chars && ch < ctx->message_len; i++, ch++)
238 ctx->curr[i] = ctx->message[ch];
245 ctx->cfg->update(ctx);
248 ctx->scroll_pos++;
249 ctx->scroll_pos %= ctx->message_len;
252 if (ctx->message_len > ctx->cfg->num_chars)
253 mod_timer(&ctx->timer, jiffies + ctx->scroll_rate);
258 * @ctx: pointer to the private data structure
268 static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,
274 del_timer_sync(&ctx->timer);
285 devm_kfree(&ctx->pdev->dev, ctx->message);
286 ctx->message = NULL;
287 ctx->message_len = 0;
288 memset(ctx->curr, ' ', ctx->cfg->num_chars);
289 ctx->cfg->update(ctx);
293 new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL);
300 if (ctx->message)
301 devm_kfree(&ctx->pdev->dev, ctx->message);
303 ctx->message = new_msg;
304 ctx->message_len = count;
305 ctx->scroll_pos = 0;
308 img_ascii_lcd_scroll(&ctx->timer);
327 struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
329 return sprintf(buf, "%s\n", ctx->message);
346 struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
349 err = img_ascii_lcd_display(ctx, buf, count);
368 struct img_ascii_lcd_ctx *ctx;
376 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx) + cfg->num_chars,
378 if (!ctx)
382 ctx->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node);
383 if (IS_ERR(ctx->regmap))
384 return PTR_ERR(ctx->regmap);
387 &ctx->offset))
390 ctx->base = devm_platform_ioremap_resource(pdev, 0);
391 if (IS_ERR(ctx->base))
392 return PTR_ERR(ctx->base);
395 ctx->pdev = pdev;
396 ctx->cfg = cfg;
397 ctx->message = NULL;
398 ctx->scroll_pos = 0;
399 ctx->scroll_rate = HZ / 2;
402 timer_setup(&ctx->timer, img_ascii_lcd_scroll, 0);
404 platform_set_drvdata(pdev, ctx);
407 err = img_ascii_lcd_display(ctx, "Linux " UTS_RELEASE " ", -1);
417 del_timer_sync(&ctx->timer);
432 struct img_ascii_lcd_ctx *ctx = platform_get_drvdata(pdev);
435 del_timer_sync(&ctx->timer);