leds: lp5523: make separate API for loading engine
[deliverable/linux.git] / drivers / leds / leds-lp5523.c
CommitLineData
0efba16c
SO
1/*
2 * lp5523.c - LP5523 LED Driver
3 *
4 * Copyright (C) 2010 Nokia Corporation
a2387cb9 5 * Copyright (C) 2012 Texas Instruments
0efba16c
SO
6 *
7 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
a2387cb9 8 * Milo(Woogyom) Kim <milo.kim@ti.com>
0efba16c
SO
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
0efba16c 25#include <linux/delay.h>
79bcc10b
MWK
26#include <linux/firmware.h>
27#include <linux/i2c.h>
28#include <linux/init.h>
0efba16c 29#include <linux/leds.h>
79bcc10b
MWK
30#include <linux/module.h>
31#include <linux/mutex.h>
6a0c9a47 32#include <linux/platform_data/leds-lp55xx.h>
79bcc10b 33#include <linux/slab.h>
6a0c9a47
MWK
34
35#include "leds-lp55xx-common.h"
0efba16c 36
12f022d2
MWK
37#define LP5523_PROGRAM_LENGTH 32
38#define LP5523_MAX_LEDS 9
39
40/* Registers */
0efba16c
SO
41#define LP5523_REG_ENABLE 0x00
42#define LP5523_REG_OP_MODE 0x01
0efba16c
SO
43#define LP5523_REG_ENABLE_LEDS_MSB 0x04
44#define LP5523_REG_ENABLE_LEDS_LSB 0x05
0efba16c
SO
45#define LP5523_REG_LED_PWM_BASE 0x16
46#define LP5523_REG_LED_CURRENT_BASE 0x26
47#define LP5523_REG_CONFIG 0x36
12f022d2
MWK
48#define LP5523_REG_STATUS 0x3A
49#define LP5523_REG_RESET 0x3D
0efba16c
SO
50#define LP5523_REG_LED_TEST_CTRL 0x41
51#define LP5523_REG_LED_TEST_ADC 0x42
12f022d2 52#define LP5523_REG_PROG_PAGE_SEL 0x4F
0efba16c
SO
53#define LP5523_REG_PROG_MEM 0x50
54
12f022d2 55/* Bit description in registers */
0efba16c
SO
56#define LP5523_ENABLE 0x40
57#define LP5523_AUTO_INC 0x40
58#define LP5523_PWR_SAVE 0x20
59#define LP5523_PWM_PWR_SAVE 0x04
0efba16c 60#define LP5523_CP_AUTO 0x18
0efba16c 61#define LP5523_AUTO_CLK 0x02
12f022d2 62
0efba16c
SO
63#define LP5523_EN_LEDTEST 0x80
64#define LP5523_LEDTEST_DONE 0x80
48068d5d 65#define LP5523_RESET 0xFF
0efba16c 66#define LP5523_ADC_SHORTCIRC_LIM 80
0efba16c
SO
67#define LP5523_EXT_CLK_USED 0x08
68
db6eaf83
MWK
69/* Memory Page Selection */
70#define LP5523_PAGE_ENG1 0
71#define LP5523_PAGE_ENG2 1
72#define LP5523_PAGE_ENG3 2
73
74/* Program Memory Operations */
75#define LP5523_MODE_ENG1_M 0x30 /* Operation Mode Register */
76#define LP5523_MODE_ENG2_M 0x0C
77#define LP5523_MODE_ENG3_M 0x03
78#define LP5523_LOAD_ENG1 0x10
79#define LP5523_LOAD_ENG2 0x04
80#define LP5523_LOAD_ENG3 0x01
81
82#define LP5523_ENG1_IS_LOADING(mode) \
83 ((mode & LP5523_MODE_ENG1_M) == LP5523_LOAD_ENG1)
84#define LP5523_ENG2_IS_LOADING(mode) \
85 ((mode & LP5523_MODE_ENG2_M) == LP5523_LOAD_ENG2)
86#define LP5523_ENG3_IS_LOADING(mode) \
87 ((mode & LP5523_MODE_ENG3_M) == LP5523_LOAD_ENG3)
88
89#define LP5523_EXEC_ENG1_M 0x30 /* Enable Register */
90#define LP5523_EXEC_ENG2_M 0x0C
91#define LP5523_EXEC_ENG3_M 0x03
92#define LP5523_EXEC_M 0x3F
93#define LP5523_RUN_ENG1 0x20
94#define LP5523_RUN_ENG2 0x08
95#define LP5523_RUN_ENG3 0x02
96
27d7704e
KM
97enum lp5523_chip_id {
98 LP5523,
99 LP55231,
100};
101
db6eaf83
MWK
102static inline void lp5523_wait_opmode_done(void)
103{
104 usleep_range(1000, 2000);
105}
106
a96bfa13
MWK
107static void lp5523_set_led_current(struct lp55xx_led *led, u8 led_current)
108{
109 led->led_current = led_current;
110 lp55xx_write(led->chip, LP5523_REG_LED_CURRENT_BASE + led->chan_nr,
111 led_current);
112}
113
ffbdccdb 114static int lp5523_post_init_device(struct lp55xx_chip *chip)
0efba16c 115{
ffbdccdb 116 int ret;
0efba16c 117
ffbdccdb 118 ret = lp55xx_write(chip, LP5523_REG_ENABLE, LP5523_ENABLE);
632418bf
MWK
119 if (ret)
120 return ret;
0efba16c 121
2e4840ed
SO
122 /* Chip startup time is 500 us, 1 - 2 ms gives some margin */
123 usleep_range(1000, 2000);
0efba16c 124
ffbdccdb 125 ret = lp55xx_write(chip, LP5523_REG_CONFIG,
0efba16c
SO
126 LP5523_AUTO_INC | LP5523_PWR_SAVE |
127 LP5523_CP_AUTO | LP5523_AUTO_CLK |
128 LP5523_PWM_PWR_SAVE);
632418bf
MWK
129 if (ret)
130 return ret;
0efba16c
SO
131
132 /* turn on all leds */
ffbdccdb 133 ret = lp55xx_write(chip, LP5523_REG_ENABLE_LEDS_MSB, 0x01);
632418bf 134 if (ret)
1b21ec5a
JH
135 return ret;
136
ffbdccdb 137 return lp55xx_write(chip, LP5523_REG_ENABLE_LEDS_LSB, 0xff);
0efba16c
SO
138}
139
db6eaf83 140static void lp5523_load_engine(struct lp55xx_chip *chip)
0efba16c 141{
db6eaf83
MWK
142 enum lp55xx_engine_index idx = chip->engine_idx;
143 u8 mask[] = {
144 [LP55XX_ENGINE_1] = LP5523_MODE_ENG1_M,
145 [LP55XX_ENGINE_2] = LP5523_MODE_ENG2_M,
146 [LP55XX_ENGINE_3] = LP5523_MODE_ENG3_M,
147 };
148
149 u8 val[] = {
150 [LP55XX_ENGINE_1] = LP5523_LOAD_ENG1,
151 [LP55XX_ENGINE_2] = LP5523_LOAD_ENG2,
152 [LP55XX_ENGINE_3] = LP5523_LOAD_ENG3,
153 };
154
b9e1730b
MK
155 lp55xx_update_bits(chip, LP5523_REG_OP_MODE, mask[idx], val[idx]);
156
157 lp5523_wait_opmode_done();
158}
159
160static void lp5523_load_engine_and_select_page(struct lp55xx_chip *chip)
161{
162 enum lp55xx_engine_index idx = chip->engine_idx;
db6eaf83
MWK
163 u8 page_sel[] = {
164 [LP55XX_ENGINE_1] = LP5523_PAGE_ENG1,
165 [LP55XX_ENGINE_2] = LP5523_PAGE_ENG2,
166 [LP55XX_ENGINE_3] = LP5523_PAGE_ENG3,
167 };
168
b9e1730b 169 lp5523_load_engine(chip);
db6eaf83
MWK
170
171 lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]);
0efba16c
SO
172}
173
db6eaf83 174static void lp5523_stop_engine(struct lp55xx_chip *chip)
0efba16c 175{
db6eaf83
MWK
176 lp55xx_write(chip, LP5523_REG_OP_MODE, 0);
177 lp5523_wait_opmode_done();
178}
0efba16c 179
db6eaf83
MWK
180static void lp5523_turn_off_channels(struct lp55xx_chip *chip)
181{
182 int i;
0efba16c 183
db6eaf83
MWK
184 for (i = 0; i < LP5523_MAX_LEDS; i++)
185 lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + i, 0);
0efba16c
SO
186}
187
db6eaf83 188static void lp5523_run_engine(struct lp55xx_chip *chip, bool start)
0efba16c 189{
db6eaf83
MWK
190 int ret;
191 u8 mode;
192 u8 exec;
0efba16c 193
db6eaf83
MWK
194 /* stop engine */
195 if (!start) {
196 lp5523_stop_engine(chip);
197 lp5523_turn_off_channels(chip);
198 return;
199 }
0efba16c 200
db6eaf83
MWK
201 /*
202 * To run the engine,
203 * operation mode and enable register should updated at the same time
204 */
0efba16c 205
db6eaf83
MWK
206 ret = lp55xx_read(chip, LP5523_REG_OP_MODE, &mode);
207 if (ret)
208 return;
0efba16c 209
db6eaf83
MWK
210 ret = lp55xx_read(chip, LP5523_REG_ENABLE, &exec);
211 if (ret)
212 return;
0efba16c 213
db6eaf83
MWK
214 /* change operation mode to RUN only when each engine is loading */
215 if (LP5523_ENG1_IS_LOADING(mode)) {
216 mode = (mode & ~LP5523_MODE_ENG1_M) | LP5523_RUN_ENG1;
217 exec = (exec & ~LP5523_EXEC_ENG1_M) | LP5523_RUN_ENG1;
218 }
0efba16c 219
db6eaf83
MWK
220 if (LP5523_ENG2_IS_LOADING(mode)) {
221 mode = (mode & ~LP5523_MODE_ENG2_M) | LP5523_RUN_ENG2;
222 exec = (exec & ~LP5523_EXEC_ENG2_M) | LP5523_RUN_ENG2;
223 }
0efba16c 224
db6eaf83
MWK
225 if (LP5523_ENG3_IS_LOADING(mode)) {
226 mode = (mode & ~LP5523_MODE_ENG3_M) | LP5523_RUN_ENG3;
227 exec = (exec & ~LP5523_EXEC_ENG3_M) | LP5523_RUN_ENG3;
228 }
229
230 lp55xx_write(chip, LP5523_REG_OP_MODE, mode);
231 lp5523_wait_opmode_done();
232
233 lp55xx_update_bits(chip, LP5523_REG_ENABLE, LP5523_EXEC_M, exec);
0efba16c
SO
234}
235
db6eaf83
MWK
236static int lp5523_update_program_memory(struct lp55xx_chip *chip,
237 const u8 *data, size_t size)
0efba16c 238{
db6eaf83
MWK
239 u8 pattern[LP5523_PROGRAM_LENGTH] = {0};
240 unsigned cmd;
241 char c[3];
242 int update_size;
243 int nrchars;
244 int offset = 0;
245 int ret;
0efba16c 246 int i;
0efba16c 247
db6eaf83
MWK
248 /* clear program memory before updating */
249 for (i = 0; i < LP5523_PROGRAM_LENGTH; i++)
250 lp55xx_write(chip, LP5523_REG_PROG_MEM + i, 0);
0efba16c 251
db6eaf83
MWK
252 i = 0;
253 while ((offset < size - 1) && (i < LP5523_PROGRAM_LENGTH)) {
254 /* separate sscanfs because length is working only for %s */
255 ret = sscanf(data + offset, "%2s%n ", c, &nrchars);
256 if (ret != 1)
257 goto err;
0efba16c 258
db6eaf83
MWK
259 ret = sscanf(c, "%2x", &cmd);
260 if (ret != 1)
261 goto err;
0efba16c 262
db6eaf83
MWK
263 pattern[i] = (u8)cmd;
264 offset += nrchars;
265 i++;
266 }
0efba16c 267
db6eaf83
MWK
268 /* Each instruction is 16bit long. Check that length is even */
269 if (i % 2)
270 goto err;
0efba16c 271
db6eaf83
MWK
272 update_size = i;
273 for (i = 0; i < update_size; i++)
274 lp55xx_write(chip, LP5523_REG_PROG_MEM + i, pattern[i]);
0efba16c 275
db6eaf83 276 return 0;
0efba16c 277
db6eaf83
MWK
278err:
279 dev_err(&chip->cl->dev, "wrong pattern format\n");
280 return -EINVAL;
0efba16c 281}
0efba16c 282
db6eaf83 283static void lp5523_firmware_loaded(struct lp55xx_chip *chip)
0efba16c 284{
db6eaf83 285 const struct firmware *fw = chip->fw;
fbac0812 286
db6eaf83
MWK
287 if (fw->size > LP5523_PROGRAM_LENGTH) {
288 dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
289 fw->size);
290 return;
291 }
0efba16c 292
db6eaf83
MWK
293 /*
294 * Program momery sequence
295 * 1) set engine mode to "LOAD"
296 * 2) write firmware data into program memory
297 */
0efba16c 298
b9e1730b 299 lp5523_load_engine_and_select_page(chip);
db6eaf83 300 lp5523_update_program_memory(chip, fw->data, fw->size);
0efba16c 301}
0efba16c
SO
302
303static ssize_t lp5523_selftest(struct device *dev,
304 struct device_attribute *attr,
305 char *buf)
306{
9ca3bd80
MWK
307 struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
308 struct lp55xx_chip *chip = led->chip;
309 struct lp55xx_platform_data *pdata = chip->pdata;
0efba16c 310 int i, ret, pos = 0;
0efba16c
SO
311 u8 status, adc, vdd;
312
313 mutex_lock(&chip->lock);
314
9ca3bd80 315 ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
0efba16c
SO
316 if (ret < 0)
317 goto fail;
318
319 /* Check that ext clock is really in use if requested */
9ca3bd80 320 if (pdata->clock_mode == LP55XX_CLOCK_EXT) {
0efba16c
SO
321 if ((status & LP5523_EXT_CLK_USED) == 0)
322 goto fail;
9ca3bd80 323 }
0efba16c
SO
324
325 /* Measure VDD (i.e. VBAT) first (channel 16 corresponds to VDD) */
9ca3bd80 326 lp55xx_write(chip, LP5523_REG_LED_TEST_CTRL, LP5523_EN_LEDTEST | 16);
2e4840ed 327 usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */
9ca3bd80 328 ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
1b21ec5a
JH
329 if (ret < 0)
330 goto fail;
331
0efba16c 332 if (!(status & LP5523_LEDTEST_DONE))
2e4840ed 333 usleep_range(3000, 6000); /* Was not ready. Wait little bit */
0efba16c 334
9ca3bd80 335 ret = lp55xx_read(chip, LP5523_REG_LED_TEST_ADC, &vdd);
1b21ec5a
JH
336 if (ret < 0)
337 goto fail;
338
0efba16c
SO
339 vdd--; /* There may be some fluctuation in measurement */
340
0e202346 341 for (i = 0; i < LP5523_MAX_LEDS; i++) {
0efba16c 342 /* Skip non-existing channels */
9ca3bd80 343 if (pdata->led_config[i].led_current == 0)
0efba16c
SO
344 continue;
345
346 /* Set default current */
9ca3bd80
MWK
347 lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + i,
348 pdata->led_config[i].led_current);
0efba16c 349
9ca3bd80 350 lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + i, 0xff);
2e4840ed
SO
351 /* let current stabilize 2 - 4ms before measurements start */
352 usleep_range(2000, 4000);
9ca3bd80 353 lp55xx_write(chip, LP5523_REG_LED_TEST_CTRL,
0efba16c 354 LP5523_EN_LEDTEST | i);
2e4840ed
SO
355 /* ADC conversion time is 2.7 ms typically */
356 usleep_range(3000, 6000);
9ca3bd80 357 ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
1b21ec5a
JH
358 if (ret < 0)
359 goto fail;
360
0efba16c 361 if (!(status & LP5523_LEDTEST_DONE))
2e4840ed 362 usleep_range(3000, 6000);/* Was not ready. Wait. */
9ca3bd80
MWK
363
364 ret = lp55xx_read(chip, LP5523_REG_LED_TEST_ADC, &adc);
1b21ec5a
JH
365 if (ret < 0)
366 goto fail;
0efba16c
SO
367
368 if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM)
369 pos += sprintf(buf + pos, "LED %d FAIL\n", i);
370
9ca3bd80 371 lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + i, 0x00);
0efba16c
SO
372
373 /* Restore current */
9ca3bd80
MWK
374 lp55xx_write(chip, LP5523_REG_LED_CURRENT_BASE + i,
375 led->led_current);
0efba16c
SO
376 led++;
377 }
378 if (pos == 0)
379 pos = sprintf(buf, "OK\n");
380 goto release_lock;
381fail:
382 pos = sprintf(buf, "FAIL\n");
383
384release_lock:
385 mutex_unlock(&chip->lock);
386
387 return pos;
388}
389
0efba16c
SO
390static void lp5523_led_brightness_work(struct work_struct *work)
391{
a6e4679a 392 struct lp55xx_led *led = container_of(work, struct lp55xx_led,
0efba16c 393 brightness_work);
a6e4679a 394 struct lp55xx_chip *chip = led->chip;
0efba16c
SO
395
396 mutex_lock(&chip->lock);
a6e4679a 397 lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr,
0efba16c 398 led->brightness);
0efba16c
SO
399 mutex_unlock(&chip->lock);
400}
401
0efba16c
SO
402static DEVICE_ATTR(selftest, S_IRUGO, lp5523_selftest, NULL);
403
404static struct attribute *lp5523_attributes[] = {
0efba16c 405 &dev_attr_selftest.attr,
f1625842 406 NULL,
0efba16c
SO
407};
408
409static const struct attribute_group lp5523_group = {
410 .attrs = lp5523_attributes,
411};
412
48068d5d
MWK
413/* Chip specific configurations */
414static struct lp55xx_device_config lp5523_cfg = {
415 .reset = {
416 .addr = LP5523_REG_RESET,
417 .val = LP5523_RESET,
418 },
e3a700d8
MWK
419 .enable = {
420 .addr = LP5523_REG_ENABLE,
421 .val = LP5523_ENABLE,
422 },
0e202346 423 .max_channel = LP5523_MAX_LEDS,
ffbdccdb 424 .post_init_device = lp5523_post_init_device,
a6e4679a 425 .brightness_work_fn = lp5523_led_brightness_work,
a96bfa13 426 .set_led_current = lp5523_set_led_current,
db6eaf83
MWK
427 .firmware_cb = lp5523_firmware_loaded,
428 .run_engine = lp5523_run_engine,
e73c0ce6 429 .dev_attr_group = &lp5523_group,
48068d5d
MWK
430};
431
98ea1ea2 432static int lp5523_probe(struct i2c_client *client,
0efba16c
SO
433 const struct i2c_device_id *id)
434{
22ebeb48 435 int ret;
6a0c9a47
MWK
436 struct lp55xx_chip *chip;
437 struct lp55xx_led *led;
7542a04b
LW
438 struct lp55xx_platform_data *pdata;
439 struct device_node *np = client->dev.of_node;
440
87aae1ea 441 if (!dev_get_platdata(&client->dev)) {
7542a04b
LW
442 if (np) {
443 ret = lp55xx_of_populate_pdata(&client->dev, np);
444 if (ret < 0)
445 return ret;
446 } else {
447 dev_err(&client->dev, "no platform data\n");
448 return -EINVAL;
449 }
0efba16c 450 }
87aae1ea 451 pdata = dev_get_platdata(&client->dev);
0efba16c 452
6a0c9a47
MWK
453 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
454 if (!chip)
455 return -ENOMEM;
456
457 led = devm_kzalloc(&client->dev,
458 sizeof(*led) * pdata->num_channels, GFP_KERNEL);
459 if (!led)
460 return -ENOMEM;
461
462 chip->cl = client;
463 chip->pdata = pdata;
48068d5d 464 chip->cfg = &lp5523_cfg;
6a0c9a47
MWK
465
466 mutex_init(&chip->lock);
0efba16c 467
6a0c9a47 468 i2c_set_clientdata(client, led);
0efba16c 469
22ebeb48 470 ret = lp55xx_init_device(chip);
0efba16c 471 if (ret)
f6c64c6f 472 goto err_init;
0efba16c 473
56a1e9ad 474 dev_info(&client->dev, "%s Programmable led chip found\n", id->name);
0efba16c 475
9e9b3db1 476 ret = lp55xx_register_leds(led, chip);
f6524808 477 if (ret)
9e9b3db1 478 goto err_register_leds;
0efba16c 479
e73c0ce6 480 ret = lp55xx_register_sysfs(chip);
0efba16c
SO
481 if (ret) {
482 dev_err(&client->dev, "registering sysfs failed\n");
e73c0ce6 483 goto err_register_sysfs;
0efba16c 484 }
e73c0ce6
MWK
485
486 return 0;
487
488err_register_sysfs:
c3a68ebf 489 lp55xx_unregister_leds(led, chip);
9e9b3db1 490err_register_leds:
6ce61762 491 lp55xx_deinit_device(chip);
f6c64c6f 492err_init:
0efba16c
SO
493 return ret;
494}
495
496static int lp5523_remove(struct i2c_client *client)
497{
6ce61762
MWK
498 struct lp55xx_led *led = i2c_get_clientdata(client);
499 struct lp55xx_chip *chip = led->chip;
0efba16c 500
87cc4bde
MWK
501 lp5523_stop_engine(chip);
502 lp55xx_unregister_sysfs(chip);
c3a68ebf 503 lp55xx_unregister_leds(led, chip);
6ce61762 504 lp55xx_deinit_device(chip);
0efba16c 505
0efba16c
SO
506 return 0;
507}
508
509static const struct i2c_device_id lp5523_id[] = {
27d7704e
KM
510 { "lp5523", LP5523 },
511 { "lp55231", LP55231 },
0efba16c
SO
512 { }
513};
514
515MODULE_DEVICE_TABLE(i2c, lp5523_id);
516
33c88b67
AL
517#ifdef CONFIG_OF
518static const struct of_device_id of_lp5523_leds_match[] = {
519 { .compatible = "national,lp5523", },
520 {},
521};
522
523MODULE_DEVICE_TABLE(of, of_lp5523_leds_match);
524#endif
525
0efba16c
SO
526static struct i2c_driver lp5523_driver = {
527 .driver = {
27d7704e 528 .name = "lp5523x",
33c88b67 529 .of_match_table = of_match_ptr(of_lp5523_leds_match),
0efba16c
SO
530 },
531 .probe = lp5523_probe,
532 .remove = lp5523_remove,
533 .id_table = lp5523_id,
534};
535
09a0d183 536module_i2c_driver(lp5523_driver);
0efba16c
SO
537
538MODULE_AUTHOR("Mathias Nyman <mathias.nyman@nokia.com>");
a2387cb9 539MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
0efba16c
SO
540MODULE_DESCRIPTION("LP5523 LED engine");
541MODULE_LICENSE("GPL");
This page took 0.224749 seconds and 5 git commands to generate.